@fleetbase/storefront-engine 0.0.1
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/LICENSE.md +9 -0
- package/README.md +32 -0
- package/addon/adapters/addon-category.js +1 -0
- package/addon/adapters/customer.js +1 -0
- package/addon/adapters/gateway.js +1 -0
- package/addon/adapters/network.js +1 -0
- package/addon/adapters/notification-channel.js +1 -0
- package/addon/adapters/product-addon-category.js +1 -0
- package/addon/adapters/product-addon.js +1 -0
- package/addon/adapters/product-hour.js +1 -0
- package/addon/adapters/product-store-location.js +1 -0
- package/addon/adapters/product-variant-option.js +1 -0
- package/addon/adapters/product-variant.js +1 -0
- package/addon/adapters/product.js +1 -0
- package/addon/adapters/store-hour.js +1 -0
- package/addon/adapters/store-location.js +1 -0
- package/addon/adapters/store.js +1 -0
- package/addon/adapters/storefront.js +5 -0
- package/addon/components/file-record.hbs +22 -0
- package/addon/components/file-record.js +43 -0
- package/addon/components/modals/add-store-hours.hbs +8 -0
- package/addon/components/modals/add-stores-to-network.hbs +5 -0
- package/addon/components/modals/assign-driver.hbs +25 -0
- package/addon/components/modals/create-first-store.hbs +21 -0
- package/addon/components/modals/create-gateway.hbs +35 -0
- package/addon/components/modals/create-network-category.hbs +50 -0
- package/addon/components/modals/create-network.hbs +20 -0
- package/addon/components/modals/create-new-variant.hbs +15 -0
- package/addon/components/modals/create-notification-channel.hbs +45 -0
- package/addon/components/modals/create-product-category.hbs +30 -0
- package/addon/components/modals/create-store.hbs +9 -0
- package/addon/components/modals/edit-network.hbs +1 -0
- package/addon/components/modals/import-products.hbs +97 -0
- package/addon/components/modals/incoming-order.hbs +242 -0
- package/addon/components/modals/manage-addons.hbs +50 -0
- package/addon/components/modals/manage-addons.js +86 -0
- package/addon/components/modals/order-ready-assign-driver.hbs +36 -0
- package/addon/components/modals/select-addon-category.hbs +5 -0
- package/addon/components/modals/share-network.hbs +35 -0
- package/addon/components/modals/store-location-form.hbs +30 -0
- package/addon/components/order-card.hbs +1 -0
- package/addon/components/order-card.js +3 -0
- package/addon/components/schedule-manager.hbs +22 -0
- package/addon/components/schedule-manager.js +73 -0
- package/addon/components/settings-container.hbs +7 -0
- package/addon/components/store-selector.hbs +21 -0
- package/addon/components/store-selector.js +20 -0
- package/addon/components/widget/customers.hbs +44 -0
- package/addon/components/widget/customers.js +53 -0
- package/addon/components/widget/orders.hbs +111 -0
- package/addon/components/widget/orders.js +248 -0
- package/addon/components/widget/storefront-metrics.hbs +54 -0
- package/addon/components/widget/storefront-metrics.js +61 -0
- package/addon/controllers/application.js +33 -0
- package/addon/controllers/customers/index.js +267 -0
- package/addon/controllers/home.js +3 -0
- package/addon/controllers/networks/index/network/customers.js +3 -0
- package/addon/controllers/networks/index/network/index.js +147 -0
- package/addon/controllers/networks/index/network/orders.js +3 -0
- package/addon/controllers/networks/index/network/stores.js +370 -0
- package/addon/controllers/networks/index/network.js +29 -0
- package/addon/controllers/networks/index.js +138 -0
- package/addon/controllers/orders/index.js +331 -0
- package/addon/controllers/products/index/category/edit.js +62 -0
- package/addon/controllers/products/index/category/new.js +287 -0
- package/addon/controllers/products/index/category.js +163 -0
- package/addon/controllers/products/index/index/edit.js +1 -0
- package/addon/controllers/products/index/index.js +136 -0
- package/addon/controllers/products/index.js +203 -0
- package/addon/controllers/settings/api.js +3 -0
- package/addon/controllers/settings/gateways.js +110 -0
- package/addon/controllers/settings/index.js +102 -0
- package/addon/controllers/settings/locations.js +186 -0
- package/addon/controllers/settings/notifications.js +102 -0
- package/addon/engine.js +19 -0
- package/addon/helpers/get-tip-amount.js +5 -0
- package/addon/models/addon-category.js +6 -0
- package/addon/models/gateway.js +46 -0
- package/addon/models/network.js +166 -0
- package/addon/models/notification-channel.js +47 -0
- package/addon/models/product-addon-category.js +41 -0
- package/addon/models/product-addon.js +41 -0
- package/addon/models/product-hour.js +72 -0
- package/addon/models/product-store-location.js +41 -0
- package/addon/models/product-variant-option.js +39 -0
- package/addon/models/product-variant.js +44 -0
- package/addon/models/product.js +208 -0
- package/addon/models/store-hour.js +72 -0
- package/addon/models/store-location.js +93 -0
- package/addon/models/store.js +100 -0
- package/addon/routes/application.js +47 -0
- package/addon/routes/customers/index/edit.js +3 -0
- package/addon/routes/customers/index.js +25 -0
- package/addon/routes/home.js +3 -0
- package/addon/routes/networks/index/network/customers.js +3 -0
- package/addon/routes/networks/index/network/index.js +15 -0
- package/addon/routes/networks/index/network/orders.js +3 -0
- package/addon/routes/networks/index/network/stores.js +28 -0
- package/addon/routes/networks/index/network.js +10 -0
- package/addon/routes/networks/index.js +19 -0
- package/addon/routes/orders/index/edit.js +3 -0
- package/addon/routes/orders/index/new.js +3 -0
- package/addon/routes/orders/index/view.js +3 -0
- package/addon/routes/orders/index.js +29 -0
- package/addon/routes/products/index/category/edit.js +15 -0
- package/addon/routes/products/index/category/new.js +7 -0
- package/addon/routes/products/index/category.js +54 -0
- package/addon/routes/products/index/index/edit.js +1 -0
- package/addon/routes/products/index/index.js +22 -0
- package/addon/routes/products/index.js +21 -0
- package/addon/routes/settings/api.js +10 -0
- package/addon/routes/settings/gateways.js +11 -0
- package/addon/routes/settings/index.js +16 -0
- package/addon/routes/settings/locations.js +14 -0
- package/addon/routes/settings/notifications.js +11 -0
- package/addon/routes.js +48 -0
- package/addon/serializers/addon-category.js +15 -0
- package/addon/serializers/network.js +19 -0
- package/addon/serializers/notification-channel.js +15 -0
- package/addon/serializers/product-addon-category.js +15 -0
- package/addon/serializers/product-variant.js +15 -0
- package/addon/serializers/product.js +20 -0
- package/addon/serializers/store-location.js +17 -0
- package/addon/serializers/store.js +19 -0
- package/addon/services/storefront.js +208 -0
- package/addon/templates/application.hbs +16 -0
- package/addon/templates/customers/index/edit.hbs +2 -0
- package/addon/templates/customers/index.hbs +22 -0
- package/addon/templates/home.hbs +7 -0
- package/addon/templates/networks/index/network/customers.hbs +2 -0
- package/addon/templates/networks/index/network/index.hbs +254 -0
- package/addon/templates/networks/index/network/orders.hbs +2 -0
- package/addon/templates/networks/index/network/stores.hbs +164 -0
- package/addon/templates/networks/index/network.hbs +38 -0
- package/addon/templates/networks/index.hbs +60 -0
- package/addon/templates/orders/index/edit.hbs +2 -0
- package/addon/templates/orders/index/new.hbs +2 -0
- package/addon/templates/orders/index/view.hbs +2 -0
- package/addon/templates/orders/index.hbs +22 -0
- package/addon/templates/products/index/category/edit.hbs +1 -0
- package/addon/templates/products/index/category/new.hbs +248 -0
- package/addon/templates/products/index/category.hbs +41 -0
- package/addon/templates/products/index/index/edit.hbs +1 -0
- package/addon/templates/products/index/index.hbs +40 -0
- package/addon/templates/products/index.hbs +22 -0
- package/addon/templates/settings/api.hbs +18 -0
- package/addon/templates/settings/gateways.hbs +48 -0
- package/addon/templates/settings/index.hbs +229 -0
- package/addon/templates/settings/locations.hbs +39 -0
- package/addon/templates/settings/notifications.hbs +35 -0
- package/addon/templates/settings.hbs +30 -0
- package/addon/utils/get-gateway-schemas.js +34 -0
- package/addon/utils/get-notification-schemas.js +18 -0
- package/app/adapters/addon-category.js +1 -0
- package/app/adapters/gateway.js +1 -0
- package/app/adapters/network.js +1 -0
- package/app/adapters/notification-channel.js +1 -0
- package/app/adapters/product-addon-category.js +1 -0
- package/app/adapters/product-addon.js +1 -0
- package/app/adapters/product-hour.js +1 -0
- package/app/adapters/product-store-location.js +1 -0
- package/app/adapters/product-variant-option.js +1 -0
- package/app/adapters/product-variant.js +1 -0
- package/app/adapters/product.js +1 -0
- package/app/adapters/store-hour.js +1 -0
- package/app/adapters/store-location.js +1 -0
- package/app/adapters/store.js +1 -0
- package/app/adapters/storefront.js +1 -0
- package/app/components/file-record.js +1 -0
- package/app/components/modals/add-store-hours.js +1 -0
- package/app/components/modals/add-stores-to-network.js +1 -0
- package/app/components/modals/assign-driver.js +1 -0
- package/app/components/modals/create-first-store.js +1 -0
- package/app/components/modals/create-gateway.js +1 -0
- package/app/components/modals/create-network-category.js +1 -0
- package/app/components/modals/create-network.js +1 -0
- package/app/components/modals/create-new-variant.js +1 -0
- package/app/components/modals/create-notification-channel.js +1 -0
- package/app/components/modals/create-product-category.js +1 -0
- package/app/components/modals/create-store.js +1 -0
- package/app/components/modals/edit-network.js +1 -0
- package/app/components/modals/import-products.js +1 -0
- package/app/components/modals/incoming-order.js +1 -0
- package/app/components/modals/manage-addons.js +1 -0
- package/app/components/modals/order-ready-assign-driver.js +1 -0
- package/app/components/modals/select-addon-category.js +1 -0
- package/app/components/modals/share-network.js +1 -0
- package/app/components/modals/store-location-form.js +1 -0
- package/app/components/order-card.js +1 -0
- package/app/components/schedule-manager.js +1 -0
- package/app/components/settings-container.js +1 -0
- package/app/components/store-selector.js +1 -0
- package/app/components/widget/customers.js +1 -0
- package/app/components/widget/orders.js +1 -0
- package/app/components/widget/storefront-metrics.js +1 -0
- package/app/controllers/application.js +1 -0
- package/app/controllers/customers/index.js +1 -0
- package/app/controllers/home.js +1 -0
- package/app/controllers/networks/index/network/customers.js +1 -0
- package/app/controllers/networks/index/network/index.js +1 -0
- package/app/controllers/networks/index/network/orders.js +1 -0
- package/app/controllers/networks/index/network/stores.js +1 -0
- package/app/controllers/networks/index/network.js +1 -0
- package/app/controllers/networks/index.js +1 -0
- package/app/controllers/orders/index.js +1 -0
- package/app/controllers/products/index/category/edit.js +1 -0
- package/app/controllers/products/index/category/new.js +1 -0
- package/app/controllers/products/index/category.js +1 -0
- package/app/controllers/products/index/index/edit.js +1 -0
- package/app/controllers/products/index/index.js +1 -0
- package/app/controllers/products/index.js +1 -0
- package/app/controllers/settings/api.js +1 -0
- package/app/controllers/settings/gateways.js +1 -0
- package/app/controllers/settings/index.js +1 -0
- package/app/controllers/settings/locations.js +1 -0
- package/app/controllers/settings/notifications.js +1 -0
- package/app/helpers/get-tip-amount.js +1 -0
- package/app/models/addon-category.js +1 -0
- package/app/models/gateway.js +1 -0
- package/app/models/network.js +1 -0
- package/app/models/notification-channel.js +1 -0
- package/app/models/product-addon-category.js +1 -0
- package/app/models/product-addon.js +1 -0
- package/app/models/product-hour.js +1 -0
- package/app/models/product-store-location.js +1 -0
- package/app/models/product-variant-option.js +1 -0
- package/app/models/product-variant.js +1 -0
- package/app/models/product.js +1 -0
- package/app/models/store-hour.js +1 -0
- package/app/models/store-location.js +1 -0
- package/app/models/store.js +1 -0
- package/app/routes/application.js +1 -0
- package/app/routes/customers/index/edit.js +1 -0
- package/app/routes/customers/index.js +1 -0
- package/app/routes/home.js +1 -0
- package/app/routes/networks/index/network/customers.js +1 -0
- package/app/routes/networks/index/network/index.js +1 -0
- package/app/routes/networks/index/network/orders.js +1 -0
- package/app/routes/networks/index/network/stores.js +1 -0
- package/app/routes/networks/index/network.js +1 -0
- package/app/routes/networks/index.js +1 -0
- package/app/routes/orders/index/edit.js +1 -0
- package/app/routes/orders/index/new.js +1 -0
- package/app/routes/orders/index/view.js +1 -0
- package/app/routes/orders/index.js +1 -0
- package/app/routes/products/index/category/edit.js +1 -0
- package/app/routes/products/index/category/new.js +1 -0
- package/app/routes/products/index/category.js +1 -0
- package/app/routes/products/index/index/edit.js +1 -0
- package/app/routes/products/index/index.js +1 -0
- package/app/routes/products/index.js +1 -0
- package/app/routes/settings/api.js +1 -0
- package/app/routes/settings/gateways.js +1 -0
- package/app/routes/settings/index.js +1 -0
- package/app/routes/settings/locations.js +1 -0
- package/app/routes/settings/notifications.js +1 -0
- package/app/serializers/addon-category.js +1 -0
- package/app/serializers/network.js +1 -0
- package/app/serializers/notification-channel.js +1 -0
- package/app/serializers/product-addon-category.js +1 -0
- package/app/serializers/product-variant.js +1 -0
- package/app/serializers/product.js +1 -0
- package/app/serializers/store-location.js +1 -0
- package/app/serializers/store.js +1 -0
- package/app/services/storefront.js +1 -0
- package/app/templates/customers/index/edit.js +1 -0
- package/app/templates/customers/index.js +1 -0
- package/app/templates/home.js +1 -0
- package/app/templates/networks/index/network/customers.js +1 -0
- package/app/templates/networks/index/network/index.js +1 -0
- package/app/templates/networks/index/network/orders.js +1 -0
- package/app/templates/networks/index/network/stores.js +1 -0
- package/app/templates/networks/index/network.js +1 -0
- package/app/templates/networks/index.js +1 -0
- package/app/templates/orders/index/edit.js +1 -0
- package/app/templates/orders/index/new.js +1 -0
- package/app/templates/orders/index/view.js +1 -0
- package/app/templates/orders/index.js +1 -0
- package/app/templates/products/index/category/edit.js +1 -0
- package/app/templates/products/index/category/new.js +1 -0
- package/app/templates/products/index/category.js +1 -0
- package/app/templates/products/index/index/edit.js +1 -0
- package/app/templates/products/index/index.js +1 -0
- package/app/templates/products/index.js +1 -0
- package/app/templates/settings/api.js +1 -0
- package/app/templates/settings/gateways.js +1 -0
- package/app/templates/settings/index.js +1 -0
- package/app/templates/settings/locations.js +1 -0
- package/app/templates/settings/notifications.js +1 -0
- package/app/templates/settings.js +1 -0
- package/app/utils/get-gateway-schemas.js +1 -0
- package/app/utils/get-notification-schemas.js +1 -0
- package/config/environment.js +21 -0
- package/index.js +22 -0
- package/package.json +123 -0
- package/pnpm-lock.yaml +12509 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
|
|
4
|
+
export default class StoreSelectorComponent extends Component {
|
|
5
|
+
@action onSwitchStore(store) {
|
|
6
|
+
const { onSwitchStore } = this.args;
|
|
7
|
+
|
|
8
|
+
if (typeof onSwitchStore === 'function') {
|
|
9
|
+
onSwitchStore(store);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@action onCreateStore() {
|
|
14
|
+
const { onCreateStore } = this.args;
|
|
15
|
+
|
|
16
|
+
if (typeof onCreateStore === 'function') {
|
|
17
|
+
onCreateStore();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<ContentPanel @title={{this.title}} @titleStatusRight={{this.customers.length}} @titleStatuRightClass="info-status-badge" @hideStatusDot={{true}} @open={{this.customers.length}} @pad={{false}} @wrapperClass={{@wrapperClass}} @onInsert={{this.getCustomers}}>
|
|
2
|
+
{{#if this.isLoading}}
|
|
3
|
+
<div class="px-3 py-2">
|
|
4
|
+
<Spinner class="text-sky-400" />
|
|
5
|
+
</div>
|
|
6
|
+
{{/if}}
|
|
7
|
+
<div class="hidden md:flex table-wrapper table-fluid">
|
|
8
|
+
<table>
|
|
9
|
+
<thead>
|
|
10
|
+
<tr class="h-12 text-left py-1">
|
|
11
|
+
<th>ID</th>
|
|
12
|
+
<th>Phone</th>
|
|
13
|
+
<th>Email</th>
|
|
14
|
+
<th>Orders</th>
|
|
15
|
+
<th></th>
|
|
16
|
+
</tr>
|
|
17
|
+
</thead>
|
|
18
|
+
<tbody>
|
|
19
|
+
{{#each this.customers as |customer|}}
|
|
20
|
+
<tr class="h-12">
|
|
21
|
+
<td>{{customer.customerId}}</td>
|
|
22
|
+
<td>{{n-a customer.phone}}</td>
|
|
23
|
+
<td>{{n-a customer.email}}</td>
|
|
24
|
+
<td></td>
|
|
25
|
+
<td></td>
|
|
26
|
+
</tr>
|
|
27
|
+
{{/each}}
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="flex flex-col md:hidden p-3 space-y-3">
|
|
32
|
+
{{#each this.customers as |customer|}}
|
|
33
|
+
<div class="py-2 px-3 rounded-md border border-gray-400 dark:border-gray-700">
|
|
34
|
+
<div class="flex flex-row">
|
|
35
|
+
<div class="flex-1 font-semibold">{{customer.name}}</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="flex flex-col">
|
|
38
|
+
<div class="text-xs">Phone:{{n-a customer.phone}}</div>
|
|
39
|
+
<div class="text-xs">Email: {{n-a customer.email}}</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
{{/each}}
|
|
43
|
+
</div>
|
|
44
|
+
</ContentPanel>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { action, computed } from '@ember/object';
|
|
5
|
+
|
|
6
|
+
export default class WidgetCustomersComponent extends Component {
|
|
7
|
+
@service store;
|
|
8
|
+
@service storefront;
|
|
9
|
+
@tracked isLoading = true;
|
|
10
|
+
@tracked customers = [];
|
|
11
|
+
|
|
12
|
+
@computed('args.title') get title() {
|
|
13
|
+
return this.args.title || 'Recent Customers';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@action async getCustomers() {
|
|
17
|
+
this.customers = await this.fetchCustomers();
|
|
18
|
+
|
|
19
|
+
this.storefront.on('order.broadcasted', this.reloadCustomers);
|
|
20
|
+
this.storefront.on('storefront.changed', this.reloadCustomers);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@action async reloadCustomers() {
|
|
24
|
+
this.customers = await this.fetchCustomers();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@action fetchCustomers() {
|
|
28
|
+
this.isLoading = true;
|
|
29
|
+
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
const storefront = this.storefront?.activeStore?.public_id;
|
|
32
|
+
|
|
33
|
+
if (!storefront) {
|
|
34
|
+
this.isLoading = false;
|
|
35
|
+
return resolve([]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.store
|
|
39
|
+
.query('customer', {
|
|
40
|
+
storefront,
|
|
41
|
+
limit: 14,
|
|
42
|
+
})
|
|
43
|
+
.then((customers) => {
|
|
44
|
+
this.isLoading = false;
|
|
45
|
+
resolve(customers);
|
|
46
|
+
})
|
|
47
|
+
.catch(() => {
|
|
48
|
+
this.isLoading = false;
|
|
49
|
+
resolve(this.customers);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<ContentPanel @title={{this.title}} @titleStatusRight={{this.orders.length}} @titleStatuRightClass="info-status-badge" @hideStatusDot={{true}} @open={{this.orders.length}} @pad={{false}} @wrapperClass={{@wrapperClass}} @onInsert={{this.setupWidget}}>
|
|
2
|
+
{{#if this.isLoading}}
|
|
3
|
+
<div class="px-3 py-2">
|
|
4
|
+
<Spinner class="text-sky-400" />
|
|
5
|
+
</div>
|
|
6
|
+
{{/if}}
|
|
7
|
+
<div class="hidden md:flex table-wrapper table-fluid">
|
|
8
|
+
<table>
|
|
9
|
+
<thead>
|
|
10
|
+
<tr class="h-12 text-left py-1">
|
|
11
|
+
<th>ID</th>
|
|
12
|
+
<th>Amount</th>
|
|
13
|
+
<th>Customer</th>
|
|
14
|
+
<th>Driver</th>
|
|
15
|
+
<th>Created</th>
|
|
16
|
+
<th>Status</th>
|
|
17
|
+
<th></th>
|
|
18
|
+
</tr>
|
|
19
|
+
</thead>
|
|
20
|
+
<tbody>
|
|
21
|
+
{{#each this.orders as |order|}}
|
|
22
|
+
<tr class="h-12">
|
|
23
|
+
<td><a href="javascript:;" {{on "click" (fn this.viewOrder order)}}>{{order.public_id}}</a></td>
|
|
24
|
+
<td>{{format-currency order.meta.total order.meta.currency}}</td>
|
|
25
|
+
<td>{{n-a order.customer_name}}</td>
|
|
26
|
+
<td>{{n-a order.driver_name}}</td>
|
|
27
|
+
<td>{{order.createdAgo}}</td>
|
|
28
|
+
<td>
|
|
29
|
+
<Badge @status={{order.status}} />
|
|
30
|
+
</td>
|
|
31
|
+
<td>
|
|
32
|
+
{{#if order.isFresh}}
|
|
33
|
+
<Button @size="xs" @type="success" @iconPrefix="fas" @icon="check" @text="Accept Order!" @onClick={{fn this.acceptOrder order}} />
|
|
34
|
+
{{/if}}
|
|
35
|
+
{{#if order.isPreparing}}
|
|
36
|
+
<Button @size="xs" @type="success" @icon="bells" @text="Mark as Ready!" @onClick={{fn this.markAsReady order}} />
|
|
37
|
+
{{/if}}
|
|
38
|
+
{{#if order.isPickupReady}}
|
|
39
|
+
<Button @size="xs" @type="success" @icon="check" @text="Mark as Completed" @onClick={{fn this.markAsCompleted order}} />
|
|
40
|
+
{{/if}}
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
{{/each}}
|
|
44
|
+
</tbody>
|
|
45
|
+
</table>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="flex flex-col md:hidden p-3 space-y-3">
|
|
48
|
+
{{#each this.orders as |order|}}
|
|
49
|
+
<div class="py-2 px-3 rounded-md border border-gray-400 dark:border-gray-700">
|
|
50
|
+
<div class="flex flex-row mb-3">
|
|
51
|
+
<div class="flex-1">
|
|
52
|
+
<a href="javascript:;" {{on "click" (fn this.viewOrder order)}} class="font-semibold">{{order.public_id}}</a>
|
|
53
|
+
<div>{{order.createdAt}}</div>
|
|
54
|
+
<div>{{order.createdAgo}}</div>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="flex-shrink-0 flex flex-col text-right">
|
|
57
|
+
<Badge class="mb-1" @status={{order.status}} />
|
|
58
|
+
<div>{{format-currency order.meta.total order.meta.currency}}</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="flex flex-row space-x-2 flex-wrap">
|
|
62
|
+
<Button @size="xs" @type="primary" @icon="eye" @text="View" @onClick={{fn this.viewOrder order}} />
|
|
63
|
+
<Button @size="xs" @type="default" @icon="steering-wheel" @text={{if order.has_driver_assigned "Change Driver" "Assign Driver"}} @onClick={{fn this.assignDriver order}} />
|
|
64
|
+
{{#if order.isFresh}}
|
|
65
|
+
<Button @size="xs" @type="success" @iconPrefix="fas" @icon="check" @text="Accept Order!" @onClick={{fn this.acceptOrder order}} />
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{#if order.isPreparing}}
|
|
68
|
+
<Button @size="xs" @type="success" @icon="bells" @text="Mark as Ready!" @onClick={{fn this.markAsReady order}} />
|
|
69
|
+
{{/if}}
|
|
70
|
+
{{#if order.isPickupReady}}
|
|
71
|
+
<Button @size="xs" @type="success" @icon="check" @text="Mark as Completed" @onClick={{fn this.markAsCompleted order}} />
|
|
72
|
+
{{/if}}
|
|
73
|
+
</div>
|
|
74
|
+
<ContentPanel @title="More Details" class="mt-2">
|
|
75
|
+
<div class="flex flex-col py-2 border-t dark:border-gray-800">
|
|
76
|
+
<div>Customer: {{n-a order.customer_name}}</div>
|
|
77
|
+
<div>Driver: {{n-a order.driver_name}}</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="py-2 space-y-2 border-t dark:border-gray-800">
|
|
80
|
+
<div class="flex items-center justify-between">
|
|
81
|
+
<span class="dark:text-gray-50">Subtotal</span>
|
|
82
|
+
<span class="dark:text-gray-50">{{format-currency order.meta.subtotal order.meta.currency}}</span>
|
|
83
|
+
</div>
|
|
84
|
+
{{#unless order.meta.is_pickup}}
|
|
85
|
+
<div class="flex items-center justify-between">
|
|
86
|
+
<span class="dark:text-gray-50">Delivery fee</span>
|
|
87
|
+
<span class="dark:text-gray-50">{{format-currency order.meta.delivery_fee order.meta.currency}}</span>
|
|
88
|
+
</div>
|
|
89
|
+
{{/unless}}
|
|
90
|
+
{{#if order.meta.tip}}
|
|
91
|
+
<div class="flex items-center justify-between">
|
|
92
|
+
<span class="dark:text-gray-50">Tip</span>
|
|
93
|
+
<span class="dark:text-gray-50">{{get-tip-amount order.meta.tip order.meta.subtotal order.meta.currency}}</span>
|
|
94
|
+
</div>
|
|
95
|
+
{{/if}}
|
|
96
|
+
{{#if order.meta.delivery_tip}}
|
|
97
|
+
<div class="flex items-center justify-between">
|
|
98
|
+
<span class="dark:text-gray-50">Delivery Tip</span>
|
|
99
|
+
<span class="dark:text-gray-50">{{get-tip-amount order.meta.delivery_tip order.meta.subtotal order.meta.currency}}</span>
|
|
100
|
+
</div>
|
|
101
|
+
{{/if}}
|
|
102
|
+
<div class="flex items-center justify-between">
|
|
103
|
+
<span class="dark:text-gray-50 font-bold">Total</span>
|
|
104
|
+
<span class="dark:text-gray-50 font-bold">{{format-currency order.meta.total order.meta.currency}}</span>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</ContentPanel>
|
|
108
|
+
</div>
|
|
109
|
+
{{/each}}
|
|
110
|
+
</div>
|
|
111
|
+
</ContentPanel>
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { action, computed } from '@ember/object';
|
|
5
|
+
import { later } from '@ember/runloop';
|
|
6
|
+
|
|
7
|
+
export default class WidgetOrdersComponent extends Component {
|
|
8
|
+
@service store;
|
|
9
|
+
@service storefront;
|
|
10
|
+
@service fetch;
|
|
11
|
+
@service appCache;
|
|
12
|
+
@service modalsManager;
|
|
13
|
+
@tracked isLoading = true;
|
|
14
|
+
@tracked orders = [];
|
|
15
|
+
|
|
16
|
+
@computed('args.title') get title() {
|
|
17
|
+
return this.args.title ?? 'Recent Orders';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@action async setupWidget() {
|
|
21
|
+
later(
|
|
22
|
+
this,
|
|
23
|
+
() => {
|
|
24
|
+
this.reloadOrders();
|
|
25
|
+
},
|
|
26
|
+
100
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
this.storefront.on('order.broadcasted', this.reloadOrders);
|
|
30
|
+
this.storefront.on('storefront.changed', this.reloadOrders);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action async reloadOrders(params = {}) {
|
|
34
|
+
this.orders = await this.fetchOrders(params);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@action fetchOrders(params = {}) {
|
|
38
|
+
let cachedOrders;
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
if (this.appCache.has('storefront_recent_orders')) {
|
|
42
|
+
cachedOrders = this.appCache.getEmberData('storefront_recent_orders', 'order');
|
|
43
|
+
}
|
|
44
|
+
} catch (exception) {
|
|
45
|
+
// silent exception just load orders from
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (cachedOrders) {
|
|
49
|
+
this.orders = cachedOrders;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.isLoading = true;
|
|
53
|
+
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
const storefront = this.storefront?.activeStore?.public_id;
|
|
56
|
+
|
|
57
|
+
if (!storefront) {
|
|
58
|
+
this.isLoading = false;
|
|
59
|
+
return resolve([]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.store
|
|
63
|
+
.query('order', {
|
|
64
|
+
storefront,
|
|
65
|
+
limit: 14,
|
|
66
|
+
sort: '-created_at',
|
|
67
|
+
...params,
|
|
68
|
+
})
|
|
69
|
+
.then((orders) => {
|
|
70
|
+
this.isLoading = false;
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
this.appCache.setEmberData('storefront_recent_orders', orders, ['tracking_statuses', 'tracking_number']);
|
|
74
|
+
} catch (exception) {
|
|
75
|
+
// silent exception just clear from cache if not able to set
|
|
76
|
+
this.appCache.set('storefront_recent_orders', undefined);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
resolve(orders);
|
|
80
|
+
})
|
|
81
|
+
.catch(() => {
|
|
82
|
+
this.isLoading = false;
|
|
83
|
+
|
|
84
|
+
resolve(this.orders);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@action async viewOrder(order) {
|
|
90
|
+
const store = this.storefront.activeStore;
|
|
91
|
+
|
|
92
|
+
if (order.isFresh) {
|
|
93
|
+
return this.acceptOrder(order);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (order.isPreparing) {
|
|
97
|
+
return this.markAsReady(order);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (order.isPickupReady) {
|
|
101
|
+
return this.markAsCompleted(order);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.modalsManager.show('modals/incoming-order', {
|
|
105
|
+
title: `${order.public_id}`,
|
|
106
|
+
hideAcceptButton: true,
|
|
107
|
+
declineButtonText: 'Done',
|
|
108
|
+
declineButtonScheme: 'primary',
|
|
109
|
+
declineButtonIcon: 'check',
|
|
110
|
+
assignDriver: async () => {
|
|
111
|
+
await this.modalsManager.done();
|
|
112
|
+
this.assignDriver(order);
|
|
113
|
+
},
|
|
114
|
+
order,
|
|
115
|
+
store,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@action async acceptOrder(order) {
|
|
120
|
+
const store = this.storefront.activeStore;
|
|
121
|
+
|
|
122
|
+
await order.loadPayload();
|
|
123
|
+
await order.loadCustomer();
|
|
124
|
+
|
|
125
|
+
this.modalsManager.show('modals/incoming-order', {
|
|
126
|
+
title: 'Accept Order',
|
|
127
|
+
acceptButtonText: 'Accept Order',
|
|
128
|
+
acceptButtonScheme: 'success',
|
|
129
|
+
acceptButtonIcon: 'check',
|
|
130
|
+
order,
|
|
131
|
+
store,
|
|
132
|
+
confirm: (modal) => {
|
|
133
|
+
modal.startLoading();
|
|
134
|
+
|
|
135
|
+
return this.fetch.post('orders/accept', { order: order.id }, { namespace: 'storefront/int/v1' }).then(() => {
|
|
136
|
+
return this.fetchOrders().then((orders) => {
|
|
137
|
+
this.orders = orders;
|
|
138
|
+
modal.stopLoading();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@action markAsReady(order) {
|
|
146
|
+
// for pickup orders
|
|
147
|
+
if (order.meta?.is_pickup === true) {
|
|
148
|
+
this.modalsManager.confirm({
|
|
149
|
+
title: 'Mark order ready for pickup?',
|
|
150
|
+
body: 'Marking the order as ready will notify the customer their order is ready for pickup!',
|
|
151
|
+
acceptButtonText: 'Ready for Pickup!',
|
|
152
|
+
acceptButtonIcon: 'check',
|
|
153
|
+
acceptButtonScheme: 'success',
|
|
154
|
+
confirm: (modal) => {
|
|
155
|
+
modal.startLoading();
|
|
156
|
+
|
|
157
|
+
return this.fetch.post('orders/ready', { order: order.id }, { namespace: 'storefront/int/v1' }).then(() => {
|
|
158
|
+
return this.fetchOrders().then((orders) => {
|
|
159
|
+
this.orders = orders;
|
|
160
|
+
modal.stopLoading();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (!order.adhoc) {
|
|
168
|
+
// prompt to assign driver then dispatch
|
|
169
|
+
return this.modalsManager.show('modals/order-ready-assign-driver', {
|
|
170
|
+
title: 'Assign driver and dispatch orders',
|
|
171
|
+
acceptButtonText: 'Assign & Dispatch!',
|
|
172
|
+
acceptButtonScheme: 'success',
|
|
173
|
+
acceptButtonIcon: 'check',
|
|
174
|
+
adhoc: false,
|
|
175
|
+
driver: null,
|
|
176
|
+
order,
|
|
177
|
+
confirm: (modal) => {
|
|
178
|
+
modal.startLoading();
|
|
179
|
+
|
|
180
|
+
return this.fetch
|
|
181
|
+
.post('orders/ready', { order: order.id, driver: modal.getOption('driver.id'), adhoc: modal.getOption('adhoc') }, { namespace: 'storefront/int/v1' })
|
|
182
|
+
.then(() => {
|
|
183
|
+
return this.fetchOrders().then((orders) => {
|
|
184
|
+
this.orders = orders;
|
|
185
|
+
modal.stopLoading();
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
this.modalsManager.confirm({
|
|
193
|
+
title: 'Are you want to mark order as ready?',
|
|
194
|
+
body: 'Marking the order as ready will dispatch the order to nearby drivers, only mark the order as ready when it can be picked up.',
|
|
195
|
+
acceptButtonText: 'Dispatch!',
|
|
196
|
+
acceptButtonIcon: 'check',
|
|
197
|
+
acceptButtonScheme: 'success',
|
|
198
|
+
confirm: (modal) => {
|
|
199
|
+
modal.startLoading();
|
|
200
|
+
|
|
201
|
+
return this.fetch.post('orders/ready', { order: order.id }, { namespace: 'storefront/int/v1' }).then(() => {
|
|
202
|
+
return this.fetchOrders().then((orders) => {
|
|
203
|
+
this.orders = orders;
|
|
204
|
+
modal.stopLoading();
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@action markAsCompleted(order) {
|
|
212
|
+
this.modalsManager.confirm({
|
|
213
|
+
title: 'Are you sure you want to mark order as completed?',
|
|
214
|
+
body: 'Marking the order as completed is a confirmation that the customer has picked up the order and the order is completed.',
|
|
215
|
+
acceptButtonText: 'Order Completed!',
|
|
216
|
+
acceptButtonIcon: 'check',
|
|
217
|
+
acceptButtonScheme: 'success',
|
|
218
|
+
confirm: (modal) => {
|
|
219
|
+
modal.startLoading();
|
|
220
|
+
|
|
221
|
+
return this.fetch.post('orders/completed', { order: order.id }, { namespace: 'storefront/int/v1' }).then(() => {
|
|
222
|
+
return this.fetchOrders().then((orders) => {
|
|
223
|
+
this.orders = orders;
|
|
224
|
+
modal.stopLoading();
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@action async assignDriver(order) {
|
|
232
|
+
await order.loadDriver();
|
|
233
|
+
|
|
234
|
+
this.modalsManager.show('modals/assign-driver', {
|
|
235
|
+
title: 'Assign driver',
|
|
236
|
+
acceptButtonText: 'Assign Driver',
|
|
237
|
+
acceptButtonScheme: 'success',
|
|
238
|
+
acceptButtonIcon: 'check',
|
|
239
|
+
driver: order.driver_assigned,
|
|
240
|
+
order,
|
|
241
|
+
confirm: (modal) => {
|
|
242
|
+
modal.startLoading();
|
|
243
|
+
|
|
244
|
+
return order.save();
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<div class="storefront-metrics-widget" {{did-insert this.setupWidget}} ...attributes>
|
|
2
|
+
<div class="flex items-center justify-between">
|
|
3
|
+
<div class="flex items-center">
|
|
4
|
+
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100 mr-2">
|
|
5
|
+
Last 30 days
|
|
6
|
+
</h3>
|
|
7
|
+
{{#if this.isLoading}}
|
|
8
|
+
<div>
|
|
9
|
+
<Spinner class="text-sky-400" />
|
|
10
|
+
</div>
|
|
11
|
+
{{/if}}
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<dl class="mt-4 grid grid-cols-2 gap-5 sm:grid-cols-4">
|
|
18
|
+
<div class="px-4 py-5 border border-gray-200 dark:border-gray-900 bg-gray-50 dark:bg-gray-700 shadow-sm dark:shadow rounded-lg overflow-hidden sm:p-6">
|
|
19
|
+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-100 truncate">
|
|
20
|
+
Orders
|
|
21
|
+
</dt>
|
|
22
|
+
<dd class="mt-1 text-3xl font-semibold text-gray-800 dark:text-white">
|
|
23
|
+
{{this.metrics.orders_count}}
|
|
24
|
+
</dd>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="px-4 py-5 border border-gray-200 dark:border-gray-900 bg-gray-50 dark:bg-gray-700 shadow-sm dark:shadow rounded-lg overflow-hidden sm:p-6">
|
|
28
|
+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-100 truncate">
|
|
29
|
+
Customers
|
|
30
|
+
</dt>
|
|
31
|
+
<dd class="mt-1 text-3xl font-semibold text-gray-800 dark:text-white">
|
|
32
|
+
{{this.metrics.customers_count}}
|
|
33
|
+
</dd>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="px-4 py-5 border border-gray-200 dark:border-gray-900 bg-gray-50 dark:bg-gray-700 shadow-sm dark:shadow rounded-lg overflow-hidden sm:p-6">
|
|
37
|
+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-100 truncate">
|
|
38
|
+
Stores
|
|
39
|
+
</dt>
|
|
40
|
+
<dd class="mt-1 text-3xl font-semibold text-gray-800 dark:text-white">
|
|
41
|
+
{{this.metrics.stores_count}}
|
|
42
|
+
</dd>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="px-4 py-5 border border-gray-200 dark:border-gray-900 bg-gray-50 dark:bg-gray-700 shadow-sm dark:shadow rounded-lg overflow-hidden sm:p-6">
|
|
46
|
+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-100 truncate">
|
|
47
|
+
Earnings
|
|
48
|
+
</dt>
|
|
49
|
+
<dd class="mt-1 text-3xl font-semibold text-gray-800 dark:text-white">
|
|
50
|
+
{{format-currency this.metrics.earnings_sum this.metrics.currency}}
|
|
51
|
+
</dd>
|
|
52
|
+
</div>
|
|
53
|
+
</dl>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { action, computed } from '@ember/object';
|
|
5
|
+
import { startOfMonth, endOfMonth, format } from 'date-fns';
|
|
6
|
+
|
|
7
|
+
export default class WidgetStorefrontMetricsComponent extends Component {
|
|
8
|
+
@service fetch;
|
|
9
|
+
@service storefront;
|
|
10
|
+
|
|
11
|
+
@tracked metrics = {
|
|
12
|
+
orders_count: 0,
|
|
13
|
+
customers_count: 0,
|
|
14
|
+
stores_count: 0,
|
|
15
|
+
earnings_sum: 0,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
@tracked isLoading = true;
|
|
19
|
+
@tracked start = format(startOfMonth(new Date()), 'P');
|
|
20
|
+
@tracked end = format(endOfMonth(new Date()), 'P');
|
|
21
|
+
|
|
22
|
+
@computed('args.title') get title() {
|
|
23
|
+
return this.args.title || 'This Month';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@action async setupWidget() {
|
|
27
|
+
this.metrics = await this.fetchMetrics(this.start, this.end);
|
|
28
|
+
|
|
29
|
+
this.storefront.on('order.broadcasted', this.reloadMetrics);
|
|
30
|
+
this.storefront.on('storefront.changed', this.reloadMetrics);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action async reloadMetrics() {
|
|
34
|
+
this.metrics = await this.fetchMetrics(this.start, this.end);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@action fetchMetrics(start, end) {
|
|
38
|
+
this.isLoading = true;
|
|
39
|
+
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
const store = this.storefront?.activeStore?.id;
|
|
42
|
+
|
|
43
|
+
if (!store) {
|
|
44
|
+
this.isLoading = false;
|
|
45
|
+
return resolve(this.metrics);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.fetch
|
|
49
|
+
.get('actions/metrics', { start, end, store }, { namespace: 'storefront/int/v1' })
|
|
50
|
+
.then((metrics) => {
|
|
51
|
+
this.isLoading = false;
|
|
52
|
+
resolve(metrics);
|
|
53
|
+
})
|
|
54
|
+
.catch(() => {
|
|
55
|
+
this.isLoading = false;
|
|
56
|
+
|
|
57
|
+
resolve(this.metrics);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Controller from '@ember/controller';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { alias } from '@ember/object/computed';
|
|
5
|
+
|
|
6
|
+
export default class ApplicationController extends Controller {
|
|
7
|
+
@service storefront;
|
|
8
|
+
@service hostRouter;
|
|
9
|
+
@service loader;
|
|
10
|
+
@alias('storefront.activeStore') activeStore;
|
|
11
|
+
|
|
12
|
+
@action createNewStorefront() {
|
|
13
|
+
return this.storefront.createNewStorefront({
|
|
14
|
+
onSuccess: () => {
|
|
15
|
+
const loader = this.loader.show(`Switching to newly created store...`);
|
|
16
|
+
|
|
17
|
+
this.hostRouter.refresh().then(() => {
|
|
18
|
+
this.notifyPropertyChange('activeStore');
|
|
19
|
+
this.loader.removeLoader(loader);
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@action switchActiveStore(store) {
|
|
26
|
+
const loader = this.loader.show(`Switching Storefront to ${store.name}...`);
|
|
27
|
+
this.storefront.setActiveStorefront(store);
|
|
28
|
+
this.hostRouter.refresh().then(() => {
|
|
29
|
+
this.notifyPropertyChange('activeStore');
|
|
30
|
+
this.loader.removeLoader(loader);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|