@fleetbase/storefront-engine 0.4.6 → 0.4.8
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/addon/components/storefront-order-summary.hbs +69 -68
- package/addon/components/storefront-order-summary.js +10 -1
- package/addon/controllers/base-controller.js +2 -22
- package/addon/controllers/networks/index/network.js +25 -0
- package/addon/controllers/promotions/push-notifications.js +64 -0
- package/addon/controllers/promotions.js +16 -0
- package/addon/engine.js +1 -31
- package/addon/extension.js +35 -0
- package/addon/routes/customers/index.js +0 -9
- package/addon/routes/networks/index/network/customers.js +0 -9
- package/addon/routes/networks/index.js +0 -9
- package/addon/routes/orders/index.js +0 -9
- package/addon/routes/products/index.js +2 -8
- package/addon/routes/promotions/push-notifications.js +19 -0
- package/addon/routes/promotions.js +16 -0
- package/addon/routes.js +3 -1
- package/addon/styles/storefront-engine.css +4 -0
- package/addon/templates/application.hbs +7 -0
- package/addon/templates/networks/index/network/index.hbs +30 -8
- package/addon/templates/networks/index/network.hbs +5 -26
- package/addon/templates/promotions/push-notifications.hbs +85 -0
- package/addon/templates/promotions.hbs +8 -0
- package/addon/templates/settings/index.hbs +19 -0
- package/app/controllers/promotions/push-notifications.js +1 -0
- package/app/controllers/promotions.js +1 -0
- package/app/routes/promotions/push-notifications.js +1 -0
- package/app/routes/promotions.js +1 -0
- package/app/templates/promotions/push-notifications.hbs +1 -0
- package/app/templates/promotions.hbs +1 -0
- package/composer.json +1 -1
- package/config/environment.js +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/config/storefront.php +1 -1
- package/server/src/Http/Controllers/ActionController.php +61 -0
- package/server/src/Http/Controllers/v1/CheckoutController.php +26 -10
- package/server/src/Http/Controllers/v1/CustomerController.php +22 -16
- package/server/src/Models/Cart.php +2 -1
- package/server/src/Models/Network.php +25 -0
- package/server/src/Models/Store.php +25 -0
- package/server/src/Notifications/PromotionalPushNotification.php +166 -0
- package/server/src/Support/QPay.php +550 -2
- package/server/src/Support/Storefront.php +14 -0
- package/server/src/routes.php +1 -0
- package/translations/en-us.yaml +28 -0
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
{{#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="flex-1 flex">
|
|
19
|
-
<div class="mr-4">
|
|
20
|
-
<img src={{entity.photo_url}} class="w-12 h-12 rounded-md shadow-sm" alt={{entity.name}} />
|
|
21
|
-
</div>
|
|
22
|
-
<div>
|
|
23
|
-
<h4 class="font-semibold dark:text-gray-100 mb-1 text-sm">{{entity.name}}</h4>
|
|
24
|
-
<div class="flex flex-wrap truncate w-44">
|
|
25
|
-
<p class="dark:text-gray-50 text-xs truncate">{{entity.description}}</p>
|
|
1
|
+
{{#let @resource as |order|}}
|
|
2
|
+
{{#if order.meta.storefront}}
|
|
3
|
+
<ContentPanel
|
|
4
|
+
@title={{t "storefront.component.storefront-order-summary.order-summary-title"}}
|
|
5
|
+
@prefixTitleRight={{if order.payload.cod_amount "Cash" (n-a (titleize order.meta.gateway))}}
|
|
6
|
+
@prefixTitleRightClass={{if order.payload.cod_amount "text-green-400" "text-blue-400"}}
|
|
7
|
+
@open={{true}}
|
|
8
|
+
@wrapperClass="bordered-top"
|
|
9
|
+
>
|
|
10
|
+
<div class="flex flex-col space-y-4 p-2 overflow-hidden">
|
|
11
|
+
{{#each order.payload.entities as |entity|}}
|
|
12
|
+
<div class="flex flex-1">
|
|
13
|
+
<div class="mr-2">
|
|
14
|
+
<div class="flex items-center justify-center w-6 h-5 border border-gray-200 dark:border-blue-400 rounded-md">
|
|
15
|
+
<span class="text-blue-400 text-xs">{{entity.meta.quantity}}x</span>
|
|
26
16
|
</div>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</div>
|
|
32
|
-
{{/each}}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="flex-1 flex">
|
|
19
|
+
<div class="mr-4">
|
|
20
|
+
<img src={{entity.photo_url}} class="w-12 h-12 rounded-md shadow-sm" alt={{entity.name}} />
|
|
33
21
|
</div>
|
|
34
22
|
<div>
|
|
35
|
-
{{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
<h4 class="font-semibold dark:text-gray-100 mb-1 text-sm">{{entity.name}}</h4>
|
|
24
|
+
<div class="flex flex-wrap truncate w-44">
|
|
25
|
+
<p class="dark:text-gray-50 text-xs truncate">{{entity.description}}</p>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
{{#each entity.meta.variants as |variant|}}
|
|
29
|
+
<div>
|
|
30
|
+
<span class="text-xs dark:text-gray-50">{{variant.name}}</span>
|
|
31
|
+
</div>
|
|
32
|
+
{{/each}}
|
|
33
|
+
</div>
|
|
34
|
+
<div>
|
|
35
|
+
{{#each entity.meta.addons as |addon|}}
|
|
36
|
+
<div>
|
|
37
|
+
<span class="text-xs dark:text-gray-50">+ {{addon.name}}</span>
|
|
38
|
+
</div>
|
|
39
|
+
{{/each}}
|
|
40
|
+
</div>
|
|
40
41
|
</div>
|
|
41
42
|
</div>
|
|
43
|
+
<div>
|
|
44
|
+
<span class="dark:text-gray-50 text-sm">{{format-currency entity.meta.subtotal entity.currency}}</span>
|
|
45
|
+
</div>
|
|
42
46
|
</div>
|
|
43
|
-
|
|
44
|
-
<span class="dark:text-gray-50 text-sm">{{format-currency entity.meta.subtotal entity.currency}}</span>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
{{/each}}
|
|
48
|
-
</div>
|
|
49
|
-
<div class="p-2 space-y-2 border-t border-b dark:border-gray-800">
|
|
50
|
-
<div class="flex items-center justify-between">
|
|
51
|
-
<span class="dark:text-gray-50 text-sm">{{t "fleet-ops.operations.orders.index.view.subtotal"}}</span>
|
|
52
|
-
<span class="dark:text-gray-50 text-sm">{{format-currency @order.meta.subtotal @order.meta.currency}}</span>
|
|
47
|
+
{{/each}}
|
|
53
48
|
</div>
|
|
54
|
-
|
|
55
|
-
<div class="flex items-center justify-between">
|
|
56
|
-
<span class="dark:text-gray-50 text-sm">{{t "fleet-ops.operations.orders.index.view.delivery-fee"}}</span>
|
|
57
|
-
<span class="dark:text-gray-50 text-sm">{{format-currency @order.meta.delivery_fee @order.meta.currency}}</span>
|
|
58
|
-
</div>
|
|
59
|
-
{{/unless}}
|
|
60
|
-
{{#if @order.meta.tip}}
|
|
49
|
+
<div class="p-2 space-y-2 border-t border-b dark:border-gray-800">
|
|
61
50
|
<div class="flex items-center justify-between">
|
|
62
|
-
<span class="dark:text-gray-50 text-sm">{{t "
|
|
63
|
-
<span class="dark:text-gray-50 text-sm">{{
|
|
51
|
+
<span class="dark:text-gray-50 text-sm">{{t "storefront.orders.index.view.subtotal"}}</span>
|
|
52
|
+
<span class="dark:text-gray-50 text-sm">{{format-currency order.meta.subtotal order.meta.currency}}</span>
|
|
64
53
|
</div>
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
{{#unless order.meta.is_pickup}}
|
|
55
|
+
<div class="flex items-center justify-between">
|
|
56
|
+
<span class="dark:text-gray-50 text-sm">{{t "storefront.orders.index.view.delivery-fee"}}</span>
|
|
57
|
+
<span class="dark:text-gray-50 text-sm">{{format-currency order.meta.delivery_fee order.meta.currency}}</span>
|
|
58
|
+
</div>
|
|
59
|
+
{{/unless}}
|
|
60
|
+
{{#if order.meta.tip}}
|
|
61
|
+
<div class="flex items-center justify-between">
|
|
62
|
+
<span class="dark:text-gray-50 text-sm">{{t "storefront.orders.index.view.tip"}}</span>
|
|
63
|
+
<span class="dark:text-gray-50 text-sm">{{get-tip-amount order.meta.tip order.meta.subtotal order.meta.currency}}</span>
|
|
64
|
+
</div>
|
|
65
|
+
{{/if}}
|
|
66
|
+
{{#if order.meta.delivery_tip}}
|
|
67
|
+
<div class="flex items-center justify-between">
|
|
68
|
+
<span class="dark:text-gray-50 text-sm">{{t "storefront.orders.index.view.delivery-tip"}}</span>
|
|
69
|
+
<span class="dark:text-gray-50 text-sm">{{get-tip-amount order.meta.delivery_tip order.meta.subtotal order.meta.currency}}</span>
|
|
70
|
+
</div>
|
|
71
|
+
{{/if}}
|
|
72
|
+
</div>
|
|
73
|
+
<div class="p-2">
|
|
67
74
|
<div class="flex items-center justify-between">
|
|
68
|
-
<span class="dark:text-gray-50 text-sm">{{t "
|
|
69
|
-
<span class="dark:text-gray-50 text-sm">{{
|
|
75
|
+
<span class="dark:text-gray-50 font-bold text-sm">{{t "storefront.orders.index.view.total"}}</span>
|
|
76
|
+
<span class="dark:text-gray-50 font-bold text-sm">{{format-currency order.meta.total order.meta.currency}}</span>
|
|
70
77
|
</div>
|
|
71
|
-
{{/if}}
|
|
72
|
-
</div>
|
|
73
|
-
<div class="p-2">
|
|
74
|
-
<div class="flex items-center justify-between">
|
|
75
|
-
<span class="dark:text-gray-50 font-bold text-sm">{{t "fleet-ops.operations.orders.index.view.total"}}</span>
|
|
76
|
-
<span class="dark:text-gray-50 font-bold text-sm">{{format-currency @order.meta.total @order.meta.currency}}</span>
|
|
77
78
|
</div>
|
|
78
|
-
</
|
|
79
|
-
|
|
80
|
-
{{/
|
|
79
|
+
</ContentPanel>
|
|
80
|
+
{{/if}}
|
|
81
|
+
{{/let}}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
import getTipAmount from '../helpers/get-tip-amount';
|
|
2
4
|
|
|
3
|
-
export default class StorefrontOrderSummaryComponent extends Component {
|
|
5
|
+
export default class StorefrontOrderSummaryComponent extends Component {
|
|
6
|
+
@service('universe/registry-service') registryService;
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.registryService.registerHelper('get-tip-amount', getTipAmount);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -3,29 +3,9 @@ import { inject as service } from '@ember/service';
|
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
|
|
5
5
|
export default class BaseController extends Controller {
|
|
6
|
-
|
|
7
|
-
* Inject the `universe` service
|
|
8
|
-
*
|
|
9
|
-
* @var {Service}
|
|
10
|
-
*/
|
|
11
|
-
@service universe;
|
|
6
|
+
@service hostRouter;
|
|
12
7
|
|
|
13
|
-
/**
|
|
14
|
-
* Transitions to a specified route within the '@fleetbase/storefront-engine' engine.
|
|
15
|
-
*
|
|
16
|
-
* This action is a wrapper around the `transitionToEngineRoute` method of the `universe` service (or object),
|
|
17
|
-
* specifically targeting the '@fleetbase/storefront-engine'. It allows for easy transitioning to routes
|
|
18
|
-
* within this engine, abstracting away the need to repeatedly specify the engine name.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} route - The route within the '@fleetbase/storefront-engine' to transition to.
|
|
21
|
-
* @param {...any} args - Additional arguments to pass to the transitionToEngineRoute method.
|
|
22
|
-
* @returns {Promise} A Promise that resolves with the result of the transitionToEngineRoute method.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // To transition to the 'management.fleets.index.new' route within the '@fleetbase/storefront-engine'
|
|
26
|
-
* this.transitionToRoute('management.fleets.index.new');
|
|
27
|
-
*/
|
|
28
8
|
@action transitionToRoute(route, ...args) {
|
|
29
|
-
return this.
|
|
9
|
+
return this.hostRouter.transitionTo(`console.storefront.${route}`, ...args);
|
|
30
10
|
}
|
|
31
11
|
}
|
|
@@ -6,6 +6,31 @@ export default class NetworksIndexNetworkController extends BaseController {
|
|
|
6
6
|
@service modalsManager;
|
|
7
7
|
@service intl;
|
|
8
8
|
|
|
9
|
+
get tabs() {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
label: this.intl.t('storefront.networks.index.network.settings'),
|
|
13
|
+
icon: 'cog',
|
|
14
|
+
route: 'networks.index.network.index',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: this.intl.t('storefront.networks.index.network.stores.store'),
|
|
18
|
+
icon: 'store',
|
|
19
|
+
route: 'networks.index.network.stores',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: this.intl.t('storefront.networks.index.network.orders'),
|
|
23
|
+
icon: 'file-invoice-dollar',
|
|
24
|
+
route: 'networks.index.network.orders',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: this.intl.t('storefront.networks.index.network.customers'),
|
|
28
|
+
icon: 'users',
|
|
29
|
+
route: 'networks.index.network.customers',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
9
34
|
@action transitionBack({ closeOverlay }) {
|
|
10
35
|
if (this.model.hasDirtyAttributes) {
|
|
11
36
|
// warn user about unsaved changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Controller from '@ember/controller';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
|
|
6
|
+
export default class PromotionsPushNotificationsController extends Controller {
|
|
7
|
+
@service fetch;
|
|
8
|
+
@service notifications;
|
|
9
|
+
@service intl;
|
|
10
|
+
@service currentUser;
|
|
11
|
+
@service storefront;
|
|
12
|
+
|
|
13
|
+
@tracked title = '';
|
|
14
|
+
@tracked body = '';
|
|
15
|
+
@tracked selectedCustomers = [];
|
|
16
|
+
@tracked selectAllCustomers = false;
|
|
17
|
+
@tracked isLoading = false;
|
|
18
|
+
|
|
19
|
+
@action
|
|
20
|
+
async sendPushNotification(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
|
|
23
|
+
// Validate form
|
|
24
|
+
if (!this.title || !this.body) {
|
|
25
|
+
this.notifications.warning(this.intl.t('storefront.promotions.push-notifications.validation-title-body-required'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!this.selectAllCustomers && (!this.selectedCustomers || this.selectedCustomers.length === 0)) {
|
|
30
|
+
this.notifications.warning(this.intl.t('storefront.promotions.push-notifications.validation-customers-required'));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.isLoading = true;
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const payload = {
|
|
38
|
+
title: this.title,
|
|
39
|
+
body: this.body,
|
|
40
|
+
store: this.storefront.getActiveStore('public_id'),
|
|
41
|
+
select_all: this.selectAllCustomers,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Only include customer IDs if not selecting all
|
|
45
|
+
if (!this.selectAllCustomers) {
|
|
46
|
+
payload.customers = this.selectedCustomers.map((customer) => customer.id);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
await this.fetch.post('actions/send-push-notification', payload, { namespace: 'storefront/int/v1' });
|
|
50
|
+
|
|
51
|
+
this.notifications.success(this.intl.t('storefront.promotions.push-notifications.notification-sent-success'));
|
|
52
|
+
|
|
53
|
+
// Reset form
|
|
54
|
+
this.title = '';
|
|
55
|
+
this.body = '';
|
|
56
|
+
this.selectedCustomers = [];
|
|
57
|
+
this.selectAllCustomers = false;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
this.notifications.error(this.intl.t('storefront.promotions.push-notifications.notification-sent-error'));
|
|
60
|
+
} finally {
|
|
61
|
+
this.isLoading = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Controller from '@ember/controller';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
|
|
4
|
+
export default class PromotionsController extends Controller {
|
|
5
|
+
@service intl;
|
|
6
|
+
|
|
7
|
+
get tabs() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
route: 'promotions.push-notifications',
|
|
11
|
+
label: this.intl.t('storefront.promotions.push-notifications.tab-title'),
|
|
12
|
+
icon: 'bell',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
}
|
package/addon/engine.js
CHANGED
|
@@ -2,14 +2,9 @@ import Engine from '@ember/engine';
|
|
|
2
2
|
import loadInitializers from 'ember-load-initializers';
|
|
3
3
|
import Resolver from 'ember-resolver';
|
|
4
4
|
import config from './config/environment';
|
|
5
|
-
import services from '@fleetbase/ember-core/exports
|
|
6
|
-
import StorefrontKeyMetricsWidget from './components/widget/storefront-key-metrics';
|
|
7
|
-
import StorefrontOrderSummaryComponent from './components/storefront-order-summary';
|
|
8
|
-
import AddProductAsEntityButtonComponent from './components/add-product-as-entity-button';
|
|
5
|
+
import { services, externalRoutes } from '@fleetbase/ember-core/exports';
|
|
9
6
|
|
|
10
7
|
const { modulePrefix } = config;
|
|
11
|
-
const externalRoutes = ['console', 'extensions'];
|
|
12
|
-
|
|
13
8
|
export default class StorefrontEngine extends Engine {
|
|
14
9
|
modulePrefix = modulePrefix;
|
|
15
10
|
Resolver = Resolver;
|
|
@@ -17,31 +12,6 @@ export default class StorefrontEngine extends Engine {
|
|
|
17
12
|
services,
|
|
18
13
|
externalRoutes,
|
|
19
14
|
};
|
|
20
|
-
setupExtension = function (app, engine, universe) {
|
|
21
|
-
// register menu item in header
|
|
22
|
-
universe.registerHeaderMenuItem('Storefront', 'console.storefront', { icon: 'store', priority: 1 });
|
|
23
|
-
|
|
24
|
-
// widgets for registry
|
|
25
|
-
const KeyMetricsWidgetDefinition = {
|
|
26
|
-
widgetId: 'storefront-key-metrics-widget',
|
|
27
|
-
name: 'Storefront Metrics',
|
|
28
|
-
description: 'Key metrics from Storefront.',
|
|
29
|
-
icon: 'store',
|
|
30
|
-
component: StorefrontKeyMetricsWidget,
|
|
31
|
-
grid_options: { w: 12, h: 7, minW: 8, minH: 7 },
|
|
32
|
-
options: {
|
|
33
|
-
title: 'Storefront Metrics',
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// register component to views
|
|
38
|
-
universe.registerRenderableComponent('@fleetbase/fleetops-engine', 'fleet-ops:template:operations:orders:view', StorefrontOrderSummaryComponent);
|
|
39
|
-
universe.registerRenderableComponent('@fleetbase/fleetops-engine', 'fleet-ops:template:operations:orders:new:entities-input', AddProductAsEntityButtonComponent);
|
|
40
|
-
|
|
41
|
-
// register widgets
|
|
42
|
-
universe.registerDefaultDashboardWidgets([KeyMetricsWidgetDefinition]);
|
|
43
|
-
universe.registerDashboardWidgets([KeyMetricsWidgetDefinition]);
|
|
44
|
-
};
|
|
45
15
|
}
|
|
46
16
|
|
|
47
17
|
loadInitializers(StorefrontEngine, modulePrefix);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Widget, ExtensionComponent } from '@fleetbase/ember-core/contracts';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
setupExtension(app, universe) {
|
|
5
|
+
const menuService = universe.getService('menu');
|
|
6
|
+
const registryService = universe.getService('registry');
|
|
7
|
+
const widgetService = universe.getService('widget');
|
|
8
|
+
|
|
9
|
+
// Register menu item in header
|
|
10
|
+
menuService.registerHeaderMenuItem('Storefront', 'console.storefront', { icon: 'store', priority: 1 });
|
|
11
|
+
|
|
12
|
+
// widgets for registry
|
|
13
|
+
const widgets = [
|
|
14
|
+
new Widget({
|
|
15
|
+
id: 'storefront-key-metrics-widget',
|
|
16
|
+
name: 'Storefront Metrics',
|
|
17
|
+
description: 'Key metrics from Storefront.',
|
|
18
|
+
icon: 'store',
|
|
19
|
+
component: new ExtensionComponent('@fleetbase/storefront-engine', 'widget/storefront-key-metrics'),
|
|
20
|
+
grid_options: { w: 12, h: 7, minW: 8, minH: 7 },
|
|
21
|
+
options: { title: 'Storefront Metrics' },
|
|
22
|
+
default: true,
|
|
23
|
+
}),
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
widgetService.registerWidgets('dashboard', widgets);
|
|
27
|
+
|
|
28
|
+
// register component to views
|
|
29
|
+
registryService.registerRenderableComponent('fleet-ops:component:order:details', new ExtensionComponent('@fleetbase/storefront-engine', 'storefront-order-summary'));
|
|
30
|
+
registryService.registerRenderableComponent(
|
|
31
|
+
'fleet-ops:template:operations:orders:new:entities-input',
|
|
32
|
+
new ExtensionComponent('@fleetbase/storefront-engine', 'add-product-as-entity-button')
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action, set } from '@ember/object';
|
|
4
|
-
import isNestedRouteTransition from '@fleetbase/ember-core/utils/is-nested-route-transition';
|
|
5
3
|
|
|
6
4
|
export default class CustomersIndexRoute extends Route {
|
|
7
5
|
@service store;
|
|
@@ -26,13 +24,6 @@ export default class CustomersIndexRoute extends Route {
|
|
|
26
24
|
updated_at: { refreshModel: true },
|
|
27
25
|
};
|
|
28
26
|
|
|
29
|
-
@action willTransition(transition) {
|
|
30
|
-
if (isNestedRouteTransition(transition)) {
|
|
31
|
-
set(this.queryParams, 'page.refreshModel', false);
|
|
32
|
-
set(this.queryParams, 'sort.refreshModel', false);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
beforeModel() {
|
|
37
28
|
if (this.abilities.cannot('storefront list customer')) {
|
|
38
29
|
this.notifications.warning(this.intl.t('common.unauthorized-access'));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action, set } from '@ember/object';
|
|
4
|
-
import isNestedRouteTransition from '@fleetbase/ember-core/utils/is-nested-route-transition';
|
|
5
3
|
|
|
6
4
|
export default class NetworksIndexNetworkCustomersRoute extends Route {
|
|
7
5
|
@service store;
|
|
@@ -22,13 +20,6 @@ export default class NetworksIndexNetworkCustomersRoute extends Route {
|
|
|
22
20
|
updated_at: { refreshModel: true, as: 'n_updated_at' },
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
@action willTransition(transition) {
|
|
26
|
-
if (isNestedRouteTransition(transition)) {
|
|
27
|
-
set(this.queryParams, 'page.refreshModel', false);
|
|
28
|
-
set(this.queryParams, 'sort.refreshModel', false);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
23
|
model(params) {
|
|
33
24
|
return this.store.query('customer', { ...params, storefront: this.storefront.getActiveStore('public_id') });
|
|
34
25
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action, set } from '@ember/object';
|
|
4
|
-
import isNestedRouteTransition from '@fleetbase/ember-core/utils/is-nested-route-transition';
|
|
5
3
|
|
|
6
4
|
export default class NetworksIndexRoute extends Route {
|
|
7
5
|
@service store;
|
|
@@ -19,13 +17,6 @@ export default class NetworksIndexRoute extends Route {
|
|
|
19
17
|
updated_at: { refreshModel: true },
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
@action willTransition(transition) {
|
|
23
|
-
if (isNestedRouteTransition(transition)) {
|
|
24
|
-
set(this.queryParams, 'page.refreshModel', false);
|
|
25
|
-
set(this.queryParams, 'sort.refreshModel', false);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
20
|
beforeModel() {
|
|
30
21
|
if (this.abilities.cannot('storefront list network')) {
|
|
31
22
|
this.notifications.warning(this.intl.t('common.unauthorized-access'));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action, set } from '@ember/object';
|
|
4
|
-
import isNestedRouteTransition from '@fleetbase/ember-core/utils/is-nested-route-transition';
|
|
5
3
|
|
|
6
4
|
export default class OrdersIndexRoute extends Route {
|
|
7
5
|
@service store;
|
|
@@ -30,13 +28,6 @@ export default class OrdersIndexRoute extends Route {
|
|
|
30
28
|
before: { refreshModel: true },
|
|
31
29
|
};
|
|
32
30
|
|
|
33
|
-
@action willTransition(transition) {
|
|
34
|
-
if (isNestedRouteTransition(transition)) {
|
|
35
|
-
set(this.queryParams, 'page.refreshModel', false);
|
|
36
|
-
set(this.queryParams, 'sort.refreshModel', false);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
31
|
beforeModel() {
|
|
41
32
|
if (this.abilities.cannot('storefront list order')) {
|
|
42
33
|
this.notifications.warning(this.intl.t('common.unauthorized-access'));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action
|
|
4
|
-
import isNestedRouteTransition from '@fleetbase/ember-core/utils/is-nested-route-transition';
|
|
3
|
+
import { action } from '@ember/object';
|
|
5
4
|
|
|
6
5
|
export default class ProductsIndexRoute extends Route {
|
|
7
6
|
@service store;
|
|
@@ -11,13 +10,8 @@ export default class ProductsIndexRoute extends Route {
|
|
|
11
10
|
@service hostRouter;
|
|
12
11
|
@service notifications;
|
|
13
12
|
|
|
14
|
-
@action willTransition(
|
|
13
|
+
@action willTransition() {
|
|
15
14
|
this.controller.category = null;
|
|
16
|
-
|
|
17
|
-
if (isNestedRouteTransition(transition)) {
|
|
18
|
-
set(this.queryParams, 'page.refreshModel', false);
|
|
19
|
-
set(this.queryParams, 'sort.refreshModel', false);
|
|
20
|
-
}
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
beforeModel() {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Route from '@ember/routing/route';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
|
|
4
|
+
export default class PromotionsPushNotificationsRoute extends Route {
|
|
5
|
+
@service store;
|
|
6
|
+
@service currentUser;
|
|
7
|
+
@service storefront;
|
|
8
|
+
@service intl;
|
|
9
|
+
@service abilities;
|
|
10
|
+
@service hostRouter;
|
|
11
|
+
@service notifications;
|
|
12
|
+
|
|
13
|
+
beforeModel() {
|
|
14
|
+
if (this.abilities.cannot('storefront send push notifications')) {
|
|
15
|
+
this.notifications.warning(this.intl.t('common.unauthorized-access'));
|
|
16
|
+
return this.hostRouter.transitionTo('console.storefront');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Route from '@ember/routing/route';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
|
|
4
|
+
export default class PromotionsRoute extends Route {
|
|
5
|
+
@service intl;
|
|
6
|
+
@service abilities;
|
|
7
|
+
@service hostRouter;
|
|
8
|
+
@service notifications;
|
|
9
|
+
|
|
10
|
+
beforeModel() {
|
|
11
|
+
if (this.abilities.cannot('storefront view promotions')) {
|
|
12
|
+
this.notifications.warning(this.intl.t('common.unauthorized-access'));
|
|
13
|
+
return this.hostRouter.transitionTo('console');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/addon/routes.js
CHANGED
|
@@ -41,7 +41,9 @@ export default buildRoutes(function () {
|
|
|
41
41
|
this.route('food-trucks', function () {
|
|
42
42
|
this.route('index', { path: '/' }, function () {});
|
|
43
43
|
});
|
|
44
|
-
this.route('promotions')
|
|
44
|
+
this.route('promotions', function () {
|
|
45
|
+
this.route('push-notifications', { path: '/' });
|
|
46
|
+
});
|
|
45
47
|
this.route('coupons');
|
|
46
48
|
this.route('broadcast');
|
|
47
49
|
this.route('pages');
|
|
@@ -40,6 +40,13 @@
|
|
|
40
40
|
@visible="storefront see food-truck"
|
|
41
41
|
disabled={{not this.activeStore.id}}
|
|
42
42
|
>{{t "storefront.sidebar.food-trucks"}}</Layout::Sidebar::Item>
|
|
43
|
+
<Layout::Sidebar::Item
|
|
44
|
+
@route="console.storefront.promotions"
|
|
45
|
+
@icon="bullhorn"
|
|
46
|
+
@permission="storefront view promotions"
|
|
47
|
+
@visible="storefront see promotions"
|
|
48
|
+
disabled={{not this.activeStore.id}}
|
|
49
|
+
>{{t "storefront.sidebar.promotions"}}</Layout::Sidebar::Item>
|
|
43
50
|
<Layout::Sidebar::Item
|
|
44
51
|
@route="console.storefront.settings"
|
|
45
52
|
@icon="cogs"
|