@fleetbase/storefront-engine 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/addon/components/modals/import-products.hbs +1 -1
- package/addon/components/schedule-manager.hbs +2 -2
- package/addon/components/widget/customers.hbs +1 -1
- package/addon/components/widget/customers.js +7 -4
- package/addon/components/widget/orders.js +4 -0
- package/addon/controllers/base-controller.js +31 -0
- package/addon/controllers/networks/index/network.js +2 -2
- package/addon/controllers/networks/index.js +3 -2
- package/addon/controllers/products/index/category/new.js +14 -11
- package/addon/controllers/products/index/category.js +2 -2
- package/addon/controllers/products/index/index.js +2 -2
- package/addon/controllers/products/index.js +2 -3
- package/addon/models/network.js +0 -1
- package/addon/models/product-addon-category.js +10 -1
- package/addon/models/product-variant.js +0 -2
- package/addon/models/product.js +35 -2
- package/addon/routes/customers/index.js +11 -1
- package/addon/routes/networks/index.js +9 -0
- package/addon/routes/orders/index.js +11 -1
- package/addon/routes/products/index.js +8 -2
- package/addon/serializers/product.js +16 -0
- package/addon/services/storefront.js +81 -0
- package/addon/templates/networks/index/network/stores.hbs +2 -2
- package/addon/templates/networks/index/network.hbs +1 -1
- package/addon/templates/products/index/category/new.hbs +3 -3
- package/addon/templates/products/index/category.hbs +20 -3
- package/app/controllers/base-controller.js +1 -0
- package/assets/sounds/storefront_order_alert.mp3 +0 -0
- package/composer.json +3 -3
- package/config/environment.js +11 -1
- package/extension.json +1 -1
- package/index.js +15 -0
- package/package.json +132 -125
- package/server/src/Auth/Schemas/Storefront.php +31 -39
- package/server/src/Console/Commands/NotifyStorefrontOrderNearby.php +9 -11
- package/server/src/Expansions/ContactFilterExpansion.php +36 -0
- package/server/src/Expansions/EntityExpansion.php +12 -12
- package/server/src/Expansions/OrderFilterExpansion.php +31 -0
- package/server/src/Expansions/VendorFilterExpansion.php +36 -0
- package/server/src/Http/Controllers/ActionController.php +9 -11
- package/server/src/Http/Controllers/AddonCategoryController.php +1 -1
- package/server/src/Http/Controllers/CustomerController.php +1 -1
- package/server/src/Http/Controllers/GatewayController.php +1 -1
- package/server/src/Http/Controllers/MetricsController.php +17 -17
- package/server/src/Http/Controllers/NetworkController.php +16 -26
- package/server/src/Http/Controllers/NotificationChannelController.php +1 -1
- package/server/src/Http/Controllers/OrderController.php +18 -22
- package/server/src/Http/Controllers/ProductAddonCategoryController.php +1 -2
- package/server/src/Http/Controllers/ProductAddonController.php +1 -2
- package/server/src/Http/Controllers/ProductController.php +89 -44
- package/server/src/Http/Controllers/ProductHourController.php +1 -1
- package/server/src/Http/Controllers/ProductVariantController.php +1 -1
- package/server/src/Http/Controllers/ProductVariantOptionController.php +1 -1
- package/server/src/Http/Controllers/ReviewController.php +1 -1
- package/server/src/Http/Controllers/StoreController.php +1 -2
- package/server/src/Http/Controllers/StoreHourController.php +1 -1
- package/server/src/Http/Controllers/StoreLocationController.php +1 -1
- package/server/src/Http/Controllers/StorefrontController.php +0 -2
- package/server/src/Http/Controllers/VoteController.php +1 -1
- package/server/src/Http/Controllers/v1/CartController.php +16 -26
- package/server/src/Http/Controllers/v1/CategoryController.php +3 -4
- package/server/src/Http/Controllers/v1/CheckoutController.php +283 -286
- package/server/src/Http/Controllers/v1/CustomerController.php +54 -67
- package/server/src/Http/Controllers/v1/GatewayControllerController.php +0 -2
- package/server/src/Http/Controllers/v1/NetworkController.php +26 -23
- package/server/src/Http/Controllers/v1/PaymentMethodController.php +0 -2
- package/server/src/Http/Controllers/v1/ProductController.php +1 -4
- package/server/src/Http/Controllers/v1/ReviewController.php +31 -35
- package/server/src/Http/Controllers/v1/ServiceQuoteController.php +57 -53
- package/server/src/Http/Controllers/v1/StoreController.php +8 -16
- package/server/src/Http/Filter/AddonCategoryFilter.php +1 -1
- package/server/src/Http/Filter/OrderFilter.php +2 -2
- package/server/src/Http/Middleware/SetStorefrontSession.php +9 -20
- package/server/src/Http/Requests/AddStoreToNetworkCategory.php +3 -3
- package/server/src/Http/Requests/CreateCustomerRequest.php +5 -7
- package/server/src/Http/Requests/CreateReviewRequest.php +4 -5
- package/server/src/Http/Requests/GetServiceQuoteFromCart.php +2 -2
- package/server/src/Http/Requests/InitializeCheckoutRequest.php +5 -5
- package/server/src/Http/Requests/NetworkActionRequest.php +2 -2
- package/server/src/Http/Requests/VerifyCreateCustomerRequest.php +2 -2
- package/server/src/Http/Resources/Cart.php +20 -11
- package/server/src/Http/Resources/Category.php +12 -11
- package/server/src/Http/Resources/Customer.php +15 -14
- package/server/src/Http/Resources/Gateway.php +12 -11
- package/server/src/Http/Resources/Media.php +9 -8
- package/server/src/Http/Resources/Network.php +33 -28
- package/server/src/Http/Resources/Product.php +89 -81
- package/server/src/Http/Resources/Review.php +14 -13
- package/server/src/Http/Resources/ReviewCustomer.php +12 -11
- package/server/src/Http/Resources/Store.php +39 -33
- package/server/src/Http/Resources/StoreHour.php +9 -8
- package/server/src/Http/Resources/StoreLocation.php +9 -9
- package/server/src/Imports/ProductsImport.php +0 -2
- package/server/src/Jobs/DownloadProductImageUrl.php +7 -4
- package/server/src/Listeners/HandleOrderCompleted.php +2 -1
- package/server/src/Listeners/HandleOrderDispatched.php +2 -1
- package/server/src/Listeners/HandleOrderDriverAssigned.php +2 -1
- package/server/src/Listeners/HandleOrderStarted.php +4 -3
- package/server/src/Mail/StorefrontNetworkInvite.php +7 -6
- package/server/src/Models/AddonCategory.php +2 -4
- package/server/src/Models/Cart.php +117 -124
- package/server/src/Models/Checkout.php +14 -12
- package/server/src/Models/Customer.php +9 -9
- package/server/src/Models/Gateway.php +22 -22
- package/server/src/Models/Network.php +41 -52
- package/server/src/Models/NetworkStore.php +6 -5
- package/server/src/Models/NotificationChannel.php +11 -9
- package/server/src/Models/PaymentMethod.php +9 -7
- package/server/src/Models/Product.php +152 -30
- package/server/src/Models/ProductAddon.php +14 -11
- package/server/src/Models/ProductAddonCategory.php +9 -8
- package/server/src/Models/ProductHour.php +6 -5
- package/server/src/Models/ProductStoreLocation.php +7 -5
- package/server/src/Models/ProductVariant.php +15 -11
- package/server/src/Models/ProductVariantOption.php +12 -9
- package/server/src/Models/Review.php +9 -7
- package/server/src/Models/Store.php +68 -84
- package/server/src/Models/StoreHour.php +6 -5
- package/server/src/Models/StoreLocation.php +12 -8
- package/server/src/Models/StorefrontModel.php +1 -1
- package/server/src/Models/Vote.php +8 -6
- package/server/src/Notifications/StorefrontOrderCanceled.php +15 -19
- package/server/src/Notifications/StorefrontOrderCompleted.php +15 -19
- package/server/src/Notifications/StorefrontOrderCreated.php +31 -36
- package/server/src/Notifications/StorefrontOrderDriverAssigned.php +15 -20
- package/server/src/Notifications/StorefrontOrderEnroute.php +14 -19
- package/server/src/Notifications/StorefrontOrderNearby.php +16 -21
- package/server/src/Notifications/StorefrontOrderPreparing.php +15 -18
- package/server/src/Notifications/StorefrontOrderReadyForPickup.php +15 -18
- package/server/src/Observers/NetworkObserver.php +2 -3
- package/server/src/Observers/ProductObserver.php +17 -33
- package/server/src/Providers/EventServiceProvider.php +15 -4
- package/server/src/Providers/StorefrontServiceProvider.php +8 -10
- package/server/src/Support/Metrics.php +12 -12
- package/server/src/Support/OrderConfig.php +3 -2
- package/server/src/Support/QPay.php +22 -20
- package/server/src/Support/Storefront.php +18 -17
- package/server/src/routes.php +1 -1
- package/tsconfig.declarations.json +10 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @position="right" @isResizable={{true}} @noBackdrop={{true}} @width="
|
|
1
|
+
<Overlay @position="right" @isResizable={{true}} @noBackdrop={{true}} @width="570px" @minResizeWidth={{570}} @fullHeight={{true}}>
|
|
2
2
|
<Overlay::Header @title="Manage Network" @onPressCancel={{this.transitionBack}} />
|
|
3
3
|
<Overlay::Body class="p-0i" @increaseInnerBodyHeightBy="0" @wrapperClass="space-y-4 pt-4">
|
|
4
4
|
<div class="flex flex-col">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @position="right" @noBackdrop={{true}} @width="
|
|
1
|
+
<Overlay @position="right" @noBackdrop={{true}} @isResizable={{true}} @width="570px" @fullHeight={{true}} @containerClass="border-l border-transparent dark:border-gray-700">
|
|
2
2
|
<Overlay::Header @title={{this.overlayTitle}} @titleClass="truncate" @titleWrapperClass="w-3/4" @headerLeftClass="w-70pc" @headerLeftInnerClass="w-full flex-1" @onPressCancel={{this.transitionBack}}>
|
|
3
3
|
<Button @icon={{this.overlayActionButtonIcon}} @type="primary" @text={{this.overlayActionButtonTitle}} @onClick={{this.saveProduct}} @isLoading={{this.isSaving}} @isSubscriptionRequired={{true}} />
|
|
4
4
|
</Overlay::Header>
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
</ContentPanel>
|
|
118
118
|
|
|
119
119
|
<ContentPanel @title="Add-Ons" @open={{this.product.addon_categories.length}} @pad={{false}} @panelBodyWrapperClass="px-0 py-4" @panelBodyClass="bg-white dark:bg-gray-800">
|
|
120
|
-
<div class="px-4
|
|
120
|
+
<div class="px-4">
|
|
121
121
|
<div class="flex items-center justify-end mb-3">
|
|
122
122
|
<Button @text="Select Addon Categories" @icon="plus" @iconPrefix="fas" @onClick={{this.selectAddonCategory}} />
|
|
123
123
|
</div>
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
{{#each addonCategory.category.addons as |addon|}}
|
|
140
140
|
<div class="grid grid-cols-10 gap-1 px-3 py-2 rounded-md border border-gray-200 dark:border-gray-900 dark:text-gray-100 dark:bg-gray-800 bg-gray-200">
|
|
141
141
|
<div class="flex items-center">
|
|
142
|
-
<Checkbox @value={{not
|
|
142
|
+
<Checkbox @value={{not (in-array addon.id addonCategory.excluded_addons)}} @onToggle={{fn this.excludeAddon index addon}} />
|
|
143
143
|
</div>
|
|
144
144
|
<div class="col-span-3 flex items-center">
|
|
145
145
|
{{addon.name}}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
<Layout::Section::Header @title={{concat this.category.name " Products"}} @searchQuery={{this.query}} @onSearch={{perform this.search}}>
|
|
2
|
-
<Button @type="default" @text="Edit this category" @icon="edit" @onClick={{fn this.editCategory this.category}} @disabled={{not this.category}} @wrapperClass="mr-2" />
|
|
3
|
-
<Button @type="danger" @text="Delete this category" @icon="trash" @onClick={{this.deleteCategory}} @disabled={{not this.category}} />
|
|
1
|
+
<Layout::Section::Header @title={{concat this.category.name " Products"}} @titleClass="truncate" @searchQuery={{this.query}} @onSearch={{perform this.search}}>
|
|
2
|
+
{{!-- <Button @type="default" @text="Edit this category" @textClass="truncate" @icon="edit" @onClick={{fn this.editCategory this.category}} @disabled={{not this.category}} @wrapperClass="mr-2" />
|
|
3
|
+
<Button @type="danger" @text="Delete this category" @textClass="truncate" @icon="trash" @onClick={{this.deleteCategory}} @disabled={{not this.category}} /> --}}
|
|
4
|
+
|
|
5
|
+
{{#if this.category}}
|
|
6
|
+
<DropdownButton @icon="gear" @text="Category" @type="default" @size="sm" @contentClass="dropdown-menu" as |dd|>
|
|
7
|
+
<div class="next-dd-menu">
|
|
8
|
+
<div class="px-1">
|
|
9
|
+
<a href="#" class="next-dd-item" {{on "click" (dropdown-fn dd this.editCategory this.category)}}>
|
|
10
|
+
Edit this category...
|
|
11
|
+
</a>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="px-1">
|
|
14
|
+
<a href="#" class="text-red-500 next-dd-item" {{on "click" (dropdown-fn dd this.deleteCategory)}}>
|
|
15
|
+
Delete this category...
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</DropdownButton>
|
|
20
|
+
{{/if}}
|
|
4
21
|
</Layout::Section::Header>
|
|
5
22
|
|
|
6
23
|
<div class="h-screen overflow-y-scroll p-6">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/storefront-engine/controllers/base-controller';
|
|
Binary file
|
package/composer.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetbase/storefront-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fleetbase-extension",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"require": {
|
|
24
24
|
"php": "^7.4|^8.0",
|
|
25
|
-
"fleetbase/core-api": "^1.3.
|
|
26
|
-
"fleetbase/fleetops-api": "^0.3.
|
|
25
|
+
"fleetbase/core-api": "^1.3.6",
|
|
26
|
+
"fleetbase/fleetops-api": "^0.3.8",
|
|
27
27
|
"geocoder-php/google-maps-places-provider": "^1.4",
|
|
28
28
|
"laravel-notification-channels/apn": "^3.8",
|
|
29
29
|
"laravel-notification-channels/fcm": "^2.7",
|
package/config/environment.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-env node */
|
|
2
2
|
'use strict';
|
|
3
|
-
const { name } = require('../package');
|
|
3
|
+
const { name, fleetbase } = require('../package');
|
|
4
4
|
|
|
5
5
|
module.exports = function (environment) {
|
|
6
6
|
let ENV = {
|
|
7
7
|
modulePrefix: name,
|
|
8
8
|
environment,
|
|
9
|
+
mountedEngineRoutePrefix: getMountedEngineRoutePrefix(),
|
|
9
10
|
|
|
10
11
|
defaultValues: {
|
|
11
12
|
categoryImage: getenv('DEFAULT_CATEGORY_IMAGE', 'https://flb-assets.s3.ap-southeast-1.amazonaws.com/images/fallback-placeholder-1.png'),
|
|
@@ -16,6 +17,15 @@ module.exports = function (environment) {
|
|
|
16
17
|
return ENV;
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
function getMountedEngineRoutePrefix() {
|
|
21
|
+
let mountedEngineRoutePrefix = 'storefront';
|
|
22
|
+
if (fleetbase && typeof fleetbase.route === 'string') {
|
|
23
|
+
mountedEngineRoutePrefix = fleetbase.route;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return `console.${mountedEngineRoutePrefix}.`;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
function getenv(variable, defaultValue = null) {
|
|
20
30
|
return process.env[variable] !== undefined ? process.env[variable] : defaultValue;
|
|
21
31
|
}
|
package/extension.json
CHANGED
package/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
const { buildEngine } = require('ember-engines/lib/engine-addon');
|
|
3
3
|
const { name } = require('./package');
|
|
4
4
|
const Funnel = require('broccoli-funnel');
|
|
5
|
+
const MergeTrees = require('broccoli-merge-trees');
|
|
6
|
+
const path = require('path');
|
|
5
7
|
|
|
6
8
|
module.exports = buildEngine({
|
|
7
9
|
name,
|
|
@@ -23,4 +25,17 @@ module.exports = buildEngine({
|
|
|
23
25
|
isDevelopingAddon() {
|
|
24
26
|
return true;
|
|
25
27
|
},
|
|
28
|
+
|
|
29
|
+
treeForPublic: function () {
|
|
30
|
+
const publicTree = this._super.treeForPublic.apply(this, arguments);
|
|
31
|
+
|
|
32
|
+
const addonTree = [
|
|
33
|
+
new Funnel(path.join(__dirname, 'assets'), {
|
|
34
|
+
destDir: '/',
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
// Merge the addon tree with the existing tree
|
|
39
|
+
return publicTree ? new MergeTrees([publicTree, ...addonTree], { overwrite: true }) : new MergeTrees([...addonTree], { overwrite: true });
|
|
40
|
+
},
|
|
26
41
|
});
|
package/package.json
CHANGED
|
@@ -1,127 +1,134 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
2
|
+
"name": "@fleetbase/storefront-engine",
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
|
|
5
|
+
"fleetbase": {
|
|
6
|
+
"route": "storefront",
|
|
7
|
+
"dashboard": "storefront/int/v1/dashboard"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"fleetbase-extension",
|
|
11
|
+
"fleetbase-storefront",
|
|
12
|
+
"fleetbase",
|
|
13
|
+
"e-commerce",
|
|
14
|
+
"headless-commerce",
|
|
15
|
+
"headless-marketplace",
|
|
16
|
+
"ember-engine",
|
|
17
|
+
"ember-addon"
|
|
18
|
+
],
|
|
19
|
+
"repository": "https://github.com/fleetbase/storefront",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Fleetbase Pte Ltd <hello@fleetbase.io>",
|
|
22
|
+
"directories": {
|
|
23
|
+
"app": "app",
|
|
24
|
+
"addon": "addon",
|
|
25
|
+
"tests": "tests"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "ember build --environment=production",
|
|
29
|
+
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
|
|
30
|
+
"lint:css": "stylelint \"**/*.css\"",
|
|
31
|
+
"lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
|
|
32
|
+
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
|
|
33
|
+
"lint:hbs": "ember-template-lint .",
|
|
34
|
+
"lint:hbs:fix": "ember-template-lint . --fix",
|
|
35
|
+
"lint:js": "eslint . --cache",
|
|
36
|
+
"lint:js:fix": "eslint . --fix",
|
|
37
|
+
"start": "ember serve",
|
|
38
|
+
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
|
|
39
|
+
"test:ember": "ember test",
|
|
40
|
+
"test:ember-compatibility": "ember try:each",
|
|
41
|
+
"publish:npm": "npm config set registry https://registry.npmjs.org/ && npm publish",
|
|
42
|
+
"publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@fleetbase/ember-core": "^0.1.9",
|
|
46
|
+
"@fleetbase/ember-ui": "^0.2.8",
|
|
47
|
+
"@fleetbase/fleetops-data": "^0.1.6",
|
|
48
|
+
"@babel/core": "^7.23.2",
|
|
49
|
+
"@fortawesome/ember-fontawesome": "^0.4.1",
|
|
50
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
51
|
+
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
52
|
+
"ember-cli-babel": "^8.2.0",
|
|
53
|
+
"ember-cli-htmlbars": "^6.3.0",
|
|
54
|
+
"ember-intl": "6.3.2",
|
|
55
|
+
"ember-tag-input": "^3.1.0",
|
|
56
|
+
"ember-wormhole": "^0.6.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
60
|
+
"@babel/plugin-proposal-decorators": "^7.23.2",
|
|
61
|
+
"@ember/optional-features": "^2.0.0",
|
|
62
|
+
"@ember/test-helpers": "^3.2.0",
|
|
63
|
+
"@embroider/test-setup": "^3.0.2",
|
|
64
|
+
"@glimmer/component": "^1.1.2",
|
|
65
|
+
"@glimmer/tracking": "^1.1.2",
|
|
66
|
+
"broccoli-asset-rev": "^3.0.0",
|
|
67
|
+
"broccoli-funnel": "^3.0.8",
|
|
68
|
+
"broccoli-merge-trees": "^4.2.0",
|
|
69
|
+
"concurrently": "^8.2.2",
|
|
70
|
+
"ember-auto-import": "^2.6.3",
|
|
71
|
+
"ember-classic-decorator": "^3.0.0",
|
|
72
|
+
"ember-cli": "~5.4.1",
|
|
73
|
+
"ember-cli-clean-css": "^3.0.0",
|
|
74
|
+
"ember-cli-dependency-checker": "^3.3.2",
|
|
75
|
+
"ember-cli-inject-live-reload": "^2.1.0",
|
|
76
|
+
"ember-cli-sri": "^2.1.1",
|
|
77
|
+
"ember-cli-terser": "^4.0.2",
|
|
78
|
+
"ember-concurrency": "^3.1.1",
|
|
79
|
+
"ember-concurrency-decorators": "^2.0.3",
|
|
80
|
+
"ember-data": "^4.12.5",
|
|
81
|
+
"ember-engines": "^0.9.0",
|
|
82
|
+
"ember-load-initializers": "^2.1.2",
|
|
83
|
+
"ember-math-helpers": "^4.0.0",
|
|
84
|
+
"ember-page-title": "^8.0.0",
|
|
85
|
+
"ember-qunit": "^8.0.1",
|
|
86
|
+
"ember-resolver": "^11.0.1",
|
|
87
|
+
"ember-responsive": "^5.0.0",
|
|
88
|
+
"ember-source": "~5.4.0",
|
|
89
|
+
"ember-source-channel-url": "^3.0.0",
|
|
90
|
+
"ember-template-lint": "^5.11.2",
|
|
91
|
+
"ember-try": "^3.0.0",
|
|
92
|
+
"eslint": "^8.52.0",
|
|
93
|
+
"eslint-config-prettier": "^9.0.0",
|
|
94
|
+
"eslint-plugin-ember": "^11.11.1",
|
|
95
|
+
"eslint-plugin-n": "^16.2.0",
|
|
96
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
97
|
+
"eslint-plugin-qunit": "^8.0.1",
|
|
98
|
+
"loader.js": "^4.7.0",
|
|
99
|
+
"prettier": "^3.0.3",
|
|
100
|
+
"qunit": "^2.20.0",
|
|
101
|
+
"qunit-dom": "^2.0.0",
|
|
102
|
+
"stylelint": "^15.11.0",
|
|
103
|
+
"stylelint-config-standard": "^34.0.0",
|
|
104
|
+
"stylelint-prettier": "^4.0.2",
|
|
105
|
+
"webpack": "^5.89.0"
|
|
106
|
+
},
|
|
107
|
+
"peerDependencies": {
|
|
108
|
+
"ember-engines": "^0.9.0"
|
|
109
|
+
},
|
|
110
|
+
"engines": {
|
|
111
|
+
"node": ">= 18"
|
|
112
|
+
},
|
|
113
|
+
"ember": {
|
|
114
|
+
"edition": "octane"
|
|
115
|
+
},
|
|
116
|
+
"ember-addon": {
|
|
117
|
+
"configPath": "tests/dummy/config"
|
|
118
|
+
},
|
|
119
|
+
"prettier": {
|
|
120
|
+
"trailingComma": "es5",
|
|
121
|
+
"tabWidth": 4,
|
|
122
|
+
"semi": true,
|
|
123
|
+
"singleQuote": true,
|
|
124
|
+
"printWidth": 190,
|
|
125
|
+
"overrides": [
|
|
126
|
+
{
|
|
127
|
+
"files": "*.hbs",
|
|
128
|
+
"options": {
|
|
129
|
+
"singleQuote": false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
127
134
|
}
|
|
@@ -6,90 +6,82 @@ class Storefront
|
|
|
6
6
|
{
|
|
7
7
|
/**
|
|
8
8
|
* The permission schema Name.
|
|
9
|
-
*
|
|
10
|
-
* @var string
|
|
11
9
|
*/
|
|
12
10
|
public string $name = 'storefront';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* The permission schema Polict Name.
|
|
16
|
-
*
|
|
17
|
-
* @var string
|
|
18
14
|
*/
|
|
19
15
|
public string $policyName = 'Storefront';
|
|
20
16
|
|
|
21
17
|
/**
|
|
22
18
|
* Guards these permissions should apply to.
|
|
23
|
-
*
|
|
24
|
-
* @var array
|
|
25
19
|
*/
|
|
26
20
|
public array $guards = ['web', 'api'];
|
|
27
21
|
|
|
28
22
|
/**
|
|
29
23
|
* The permission schema resources.
|
|
30
|
-
*
|
|
31
|
-
* @var array
|
|
32
24
|
*/
|
|
33
25
|
public array $resources = [
|
|
34
26
|
[
|
|
35
|
-
'name'
|
|
36
|
-
'actions' => ['accept', 'mark-as-ready', 'mark-as-completed', 'reject']
|
|
27
|
+
'name' => 'order',
|
|
28
|
+
'actions' => ['accept', 'mark-as-ready', 'mark-as-completed', 'reject'],
|
|
37
29
|
],
|
|
38
30
|
[
|
|
39
|
-
'name'
|
|
40
|
-
'actions' => ['import']
|
|
31
|
+
'name' => 'product',
|
|
32
|
+
'actions' => ['import'],
|
|
41
33
|
],
|
|
42
34
|
[
|
|
43
|
-
'name'
|
|
44
|
-
'actions' => []
|
|
35
|
+
'name' => 'product-addon',
|
|
36
|
+
'actions' => [],
|
|
45
37
|
],
|
|
46
38
|
[
|
|
47
|
-
'name'
|
|
48
|
-
'actions' => []
|
|
39
|
+
'name' => 'product-addon-category',
|
|
40
|
+
'actions' => [],
|
|
49
41
|
],
|
|
50
42
|
[
|
|
51
|
-
'name'
|
|
52
|
-
'actions' => []
|
|
43
|
+
'name' => 'product-hour',
|
|
44
|
+
'actions' => [],
|
|
53
45
|
],
|
|
54
46
|
[
|
|
55
|
-
'name'
|
|
56
|
-
'actions' => []
|
|
47
|
+
'name' => 'product-store-location',
|
|
48
|
+
'actions' => [],
|
|
57
49
|
],
|
|
58
50
|
[
|
|
59
|
-
'name'
|
|
60
|
-
'actions' => []
|
|
51
|
+
'name' => 'product-variant',
|
|
52
|
+
'actions' => [],
|
|
61
53
|
],
|
|
62
54
|
[
|
|
63
|
-
'name'
|
|
64
|
-
'actions' => []
|
|
55
|
+
'name' => 'product-variant-option',
|
|
56
|
+
'actions' => [],
|
|
65
57
|
],
|
|
66
58
|
[
|
|
67
|
-
'name'
|
|
68
|
-
'actions' => []
|
|
59
|
+
'name' => 'gateway',
|
|
60
|
+
'actions' => [],
|
|
69
61
|
],
|
|
70
62
|
[
|
|
71
|
-
'name'
|
|
72
|
-
'actions' => []
|
|
63
|
+
'name' => 'notification-channel',
|
|
64
|
+
'actions' => [],
|
|
73
65
|
],
|
|
74
66
|
[
|
|
75
|
-
'name'
|
|
76
|
-
'actions' => []
|
|
67
|
+
'name' => 'network',
|
|
68
|
+
'actions' => [],
|
|
77
69
|
],
|
|
78
70
|
[
|
|
79
|
-
'name'
|
|
80
|
-
'actions' => []
|
|
71
|
+
'name' => 'network-store',
|
|
72
|
+
'actions' => [],
|
|
81
73
|
],
|
|
82
74
|
[
|
|
83
|
-
'name'
|
|
84
|
-
'actions' => []
|
|
75
|
+
'name' => 'store',
|
|
76
|
+
'actions' => [],
|
|
85
77
|
],
|
|
86
78
|
[
|
|
87
|
-
'name'
|
|
88
|
-
'actions' => []
|
|
79
|
+
'name' => 'store-location',
|
|
80
|
+
'actions' => [],
|
|
89
81
|
],
|
|
90
82
|
[
|
|
91
|
-
'name'
|
|
92
|
-
'actions' => []
|
|
93
|
-
]
|
|
83
|
+
'name' => 'store-hour',
|
|
84
|
+
'actions' => [],
|
|
85
|
+
],
|
|
94
86
|
];
|
|
95
87
|
}
|
|
@@ -33,17 +33,17 @@ class NotifyStorefrontOrderNearby extends Command
|
|
|
33
33
|
// Get storefront orders that are enroute
|
|
34
34
|
$orders = $this->getActiveStorefrontOrders();
|
|
35
35
|
|
|
36
|
-
// Notify and update
|
|
36
|
+
// Notify and update
|
|
37
37
|
$this->alert('Found (' . $orders->count() . ') Storefront Orders which are Enroute.');
|
|
38
38
|
|
|
39
39
|
// Iterate each order
|
|
40
40
|
$orders->each(
|
|
41
41
|
function ($order) {
|
|
42
|
-
$origin
|
|
42
|
+
$origin = $order->payload->getPickupOrFirstWaypoint();
|
|
43
43
|
$destination = $order->payload->getDropoffOrLastWaypoint();
|
|
44
|
-
$matrix
|
|
45
|
-
$distance
|
|
46
|
-
$time
|
|
44
|
+
$matrix = Utils::getDrivingDistanceAndTime($origin, $destination);
|
|
45
|
+
$distance = $matrix->distance;
|
|
46
|
+
$time = $matrix->time;
|
|
47
47
|
|
|
48
48
|
if (!$distance || !$time) {
|
|
49
49
|
return;
|
|
@@ -63,21 +63,19 @@ class NotifyStorefrontOrderNearby extends Command
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Fetches active storefront orders based on certain criteria.
|
|
66
|
-
*
|
|
67
|
-
* @return \Illuminate\Database\Eloquent\Collection
|
|
68
66
|
*/
|
|
69
67
|
public function getActiveStorefrontOrders(): \Illuminate\Database\Eloquent\Collection
|
|
70
68
|
{
|
|
71
69
|
return Order::where(
|
|
72
70
|
[
|
|
73
|
-
'status'
|
|
74
|
-
'type'
|
|
75
|
-
'dispatched' => true
|
|
71
|
+
'status' => 'driver_enroute',
|
|
72
|
+
'type' => 'storefront',
|
|
73
|
+
'dispatched' => true,
|
|
76
74
|
]
|
|
77
75
|
)->with(
|
|
78
76
|
[
|
|
79
77
|
'payload',
|
|
80
|
-
'customer'
|
|
78
|
+
'customer',
|
|
81
79
|
]
|
|
82
80
|
)
|
|
83
81
|
->withoutGlobalScopes()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\Storefront\Expansions;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Build\Expansion;
|
|
6
|
+
|
|
7
|
+
class ContactFilterExpansion implements Expansion
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Get the target class to expand.
|
|
11
|
+
*
|
|
12
|
+
* @return string|Class
|
|
13
|
+
*/
|
|
14
|
+
public static function target()
|
|
15
|
+
{
|
|
16
|
+
return \Fleetbase\FleetOps\Http\Filter\ContactFilter::class;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Filter contact's by their storefront order.
|
|
21
|
+
*
|
|
22
|
+
* @return \Closure
|
|
23
|
+
*/
|
|
24
|
+
public function storefront()
|
|
25
|
+
{
|
|
26
|
+
return function (?string $storefront) {
|
|
27
|
+
/* @var \Fleetbase\FleetOps\Http\Filter\ContactFilter $this */
|
|
28
|
+
$this->builder->whereHas(
|
|
29
|
+
'customerOrders',
|
|
30
|
+
function ($query) use ($storefront) {
|
|
31
|
+
$query->where('meta->storefront_id', $storefront);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|