@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,267 @@
|
|
|
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
|
+
import { isBlank } from '@ember/utils';
|
|
6
|
+
import { timeout } from 'ember-concurrency';
|
|
7
|
+
import { task } from 'ember-concurrency-decorators';
|
|
8
|
+
|
|
9
|
+
export default class CustomersIndexController extends Controller {
|
|
10
|
+
/**
|
|
11
|
+
* Inject the `notifications` service
|
|
12
|
+
*
|
|
13
|
+
* @var {Service}
|
|
14
|
+
*/
|
|
15
|
+
@service notifications;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Inject the `modals-manager` service
|
|
19
|
+
*
|
|
20
|
+
* @var {Service}
|
|
21
|
+
*/
|
|
22
|
+
@service modalsManager;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Inject the `crud` service
|
|
26
|
+
*
|
|
27
|
+
* @var {Service}
|
|
28
|
+
*/
|
|
29
|
+
@service crud;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Inject the `fetch` service
|
|
33
|
+
*
|
|
34
|
+
* @var {Service}
|
|
35
|
+
*/
|
|
36
|
+
@service fetch;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Inject the `filters` service
|
|
40
|
+
*
|
|
41
|
+
* @var {Service}
|
|
42
|
+
*/
|
|
43
|
+
@service filters;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Queryable parameters for this controller's model
|
|
47
|
+
*
|
|
48
|
+
* @var {Array}
|
|
49
|
+
*/
|
|
50
|
+
queryParams = ['page', 'limit', 'sort', 'query', 'public_id', 'internal_id', 'phone', 'email', 'address', 'created_by', 'updated_by', 'status'];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The current page of data being viewed
|
|
54
|
+
*
|
|
55
|
+
* @var {Integer}
|
|
56
|
+
*/
|
|
57
|
+
@tracked page = 1;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The maximum number of items to show per page
|
|
61
|
+
*
|
|
62
|
+
* @var {Integer}
|
|
63
|
+
*/
|
|
64
|
+
@tracked limit;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The param to sort the data on, the param with prepended `-` is descending
|
|
68
|
+
*
|
|
69
|
+
* @var {String}
|
|
70
|
+
*/
|
|
71
|
+
@tracked sort;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The filterable param `public_id`
|
|
75
|
+
*
|
|
76
|
+
* @var {String}
|
|
77
|
+
*/
|
|
78
|
+
@tracked public_id;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The filterable param `internal_id`
|
|
82
|
+
*
|
|
83
|
+
* @var {String}
|
|
84
|
+
*/
|
|
85
|
+
@tracked internal_id;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The filterable param `email`
|
|
89
|
+
*
|
|
90
|
+
* @var {String}
|
|
91
|
+
*/
|
|
92
|
+
@tracked email;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The filterable param `phone`
|
|
96
|
+
*
|
|
97
|
+
* @var {String}
|
|
98
|
+
*/
|
|
99
|
+
@tracked phone;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The filterable param `status`
|
|
103
|
+
*
|
|
104
|
+
* @var {Array}
|
|
105
|
+
*/
|
|
106
|
+
@tracked status;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* All columns applicable for orders
|
|
110
|
+
*
|
|
111
|
+
* @var {Array}
|
|
112
|
+
*/
|
|
113
|
+
@tracked columns = [
|
|
114
|
+
{
|
|
115
|
+
label: 'Name',
|
|
116
|
+
valuePath: 'name',
|
|
117
|
+
width: '15%',
|
|
118
|
+
cellComponent: 'table/cell/media-name',
|
|
119
|
+
// action: this.viewVendor,
|
|
120
|
+
resizable: true,
|
|
121
|
+
sortable: true,
|
|
122
|
+
filterable: true,
|
|
123
|
+
filterComponent: 'filter/string',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: 'ID',
|
|
127
|
+
valuePath: 'public_id',
|
|
128
|
+
cellComponent: 'click-to-copy',
|
|
129
|
+
width: '15%',
|
|
130
|
+
resizable: true,
|
|
131
|
+
sortable: true,
|
|
132
|
+
filterable: true,
|
|
133
|
+
filterComponent: 'filter/string',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: 'Internal ID',
|
|
137
|
+
valuePath: 'internal_id',
|
|
138
|
+
cellComponent: 'click-to-copy',
|
|
139
|
+
width: '15%',
|
|
140
|
+
resizable: true,
|
|
141
|
+
sortable: true,
|
|
142
|
+
filterable: true,
|
|
143
|
+
filterComponent: 'filter/string',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
label: 'Email',
|
|
147
|
+
valuePath: 'email',
|
|
148
|
+
cellComponent: 'table/cell/base',
|
|
149
|
+
width: '15%',
|
|
150
|
+
resizable: true,
|
|
151
|
+
sortable: true,
|
|
152
|
+
filterable: true,
|
|
153
|
+
filterComponent: 'filter/string',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: 'Phone',
|
|
157
|
+
valuePath: 'phone',
|
|
158
|
+
cellComponent: 'table/cell/base',
|
|
159
|
+
width: '15%',
|
|
160
|
+
resizable: true,
|
|
161
|
+
sortable: true,
|
|
162
|
+
filterable: true,
|
|
163
|
+
filterComponent: 'filter/string',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
label: 'Address',
|
|
167
|
+
valuePath: 'address',
|
|
168
|
+
cellComponent: 'table/cell/anchor',
|
|
169
|
+
// action: this.viewVendorPlace,
|
|
170
|
+
width: '30%',
|
|
171
|
+
resizable: true,
|
|
172
|
+
sortable: true,
|
|
173
|
+
filterable: true,
|
|
174
|
+
filterParam: 'address',
|
|
175
|
+
filterComponent: 'filter/string',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'Country',
|
|
179
|
+
valuePath: 'country',
|
|
180
|
+
cellComponent: 'table/cell/base',
|
|
181
|
+
cellClassNames: 'uppercase',
|
|
182
|
+
width: '10%',
|
|
183
|
+
resizable: true,
|
|
184
|
+
sortable: true,
|
|
185
|
+
hidden: true,
|
|
186
|
+
filterable: true,
|
|
187
|
+
filterComponent: 'filter/string',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: 'Created At',
|
|
191
|
+
valuePath: 'createdAt',
|
|
192
|
+
sortParam: 'created_at',
|
|
193
|
+
width: '15%',
|
|
194
|
+
resizable: true,
|
|
195
|
+
sortable: true,
|
|
196
|
+
filterable: true,
|
|
197
|
+
filterComponent: 'filter/date',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: 'Updated At',
|
|
201
|
+
valuePath: 'updatedAt',
|
|
202
|
+
sortParam: 'updated_at',
|
|
203
|
+
width: '15%',
|
|
204
|
+
resizable: true,
|
|
205
|
+
sortable: true,
|
|
206
|
+
hidden: true,
|
|
207
|
+
filterable: true,
|
|
208
|
+
filterComponent: 'filter/date',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
label: '',
|
|
212
|
+
cellComponent: 'table/cell/dropdown',
|
|
213
|
+
ddButtonText: false,
|
|
214
|
+
ddButtonIcon: 'ellipsis-h',
|
|
215
|
+
ddButtonIconPrefix: 'fas',
|
|
216
|
+
ddMenuLabel: 'Vendor Actions',
|
|
217
|
+
cellClassNames: 'overflow-visible',
|
|
218
|
+
wrapperClass: 'flex items-center justify-end mx-2',
|
|
219
|
+
width: '10%',
|
|
220
|
+
actions: [
|
|
221
|
+
{
|
|
222
|
+
label: 'View Customer Details',
|
|
223
|
+
// fn: this.viewVendor,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
label: 'Edit Customer',
|
|
227
|
+
// fn: this.editVendor,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
separator: true,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: 'Delete Customer',
|
|
234
|
+
// fn: this.deleteVendor,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
sortable: false,
|
|
238
|
+
filterable: false,
|
|
239
|
+
resizable: false,
|
|
240
|
+
searchable: false,
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The search task.
|
|
246
|
+
*
|
|
247
|
+
* @void
|
|
248
|
+
*/
|
|
249
|
+
@task({ restartable: true }) *search({ target: { value } }) {
|
|
250
|
+
// if no query don't search
|
|
251
|
+
if (isBlank(value)) {
|
|
252
|
+
this.query = null;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// timeout for typing
|
|
257
|
+
yield timeout(250);
|
|
258
|
+
|
|
259
|
+
// reset page for results
|
|
260
|
+
if (this.page > 1) {
|
|
261
|
+
this.page = 1;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// update the query param
|
|
265
|
+
this.query = value;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import Controller, { inject as controller } from '@ember/controller';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { alias } from '@ember/object/computed';
|
|
5
|
+
import { action } from '@ember/object';
|
|
6
|
+
import getPodMethods from '@fleetbase/console/utils/get-pod-methods';
|
|
7
|
+
|
|
8
|
+
export default class NetworksIndexNetworkIndexController extends Controller {
|
|
9
|
+
@controller('settings.gateways') gatewaysController;
|
|
10
|
+
@controller('settings.notifications') notificationsController;
|
|
11
|
+
@service notifications;
|
|
12
|
+
@service fetch;
|
|
13
|
+
@tracked podMethods = getPodMethods();
|
|
14
|
+
@tracked isLoading = false;
|
|
15
|
+
@alias('model.gateways') gateways;
|
|
16
|
+
@alias('model.notification_channels') channels;
|
|
17
|
+
|
|
18
|
+
@action saveSettings() {
|
|
19
|
+
this.isLoading = true;
|
|
20
|
+
|
|
21
|
+
this.model.save().then(() => {
|
|
22
|
+
this.notifications.success('Changes saved');
|
|
23
|
+
this.isLoading = false;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@action uploadFile(type, file) {
|
|
28
|
+
const prefix = type.replace('storefront_', '');
|
|
29
|
+
|
|
30
|
+
this.fetch.uploadFile.perform(
|
|
31
|
+
file,
|
|
32
|
+
{
|
|
33
|
+
path: `uploads/storefront/${this.model.id}/${type}`,
|
|
34
|
+
key_uuid: this.model.id,
|
|
35
|
+
key_type: `network:storefront`,
|
|
36
|
+
type,
|
|
37
|
+
},
|
|
38
|
+
(uploadedFile) => {
|
|
39
|
+
this.model.setProperties({
|
|
40
|
+
[`${prefix}_uuid`]: uploadedFile.id,
|
|
41
|
+
[`${prefix}_url`]: uploadedFile.s3url,
|
|
42
|
+
[prefix]: uploadedFile,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@action createGateway() {
|
|
49
|
+
const gateway = this.store.createRecord('gateway', {
|
|
50
|
+
owner_uuid: this.model.id,
|
|
51
|
+
owner_type: 'network:storefront',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
this.editGateway(gateway, {
|
|
55
|
+
title: `Create a new payment gateway`,
|
|
56
|
+
acceptButtonText: 'Save Gateway',
|
|
57
|
+
confirm: (modal) => {
|
|
58
|
+
modal.startLoading();
|
|
59
|
+
|
|
60
|
+
return gateway.save().then((gateway) => {
|
|
61
|
+
this.notifications.success(`New gateway added to network`);
|
|
62
|
+
this.gateways.pushObject(gateway);
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
decline: (modal) => {
|
|
66
|
+
gateway.destroyRecord();
|
|
67
|
+
modal.done();
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@action editGateway(gateway, options = {}) {
|
|
73
|
+
if (options === null) {
|
|
74
|
+
options = {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!options.confirm) {
|
|
78
|
+
options.confirm = (modal) => {
|
|
79
|
+
modal.startLoading();
|
|
80
|
+
|
|
81
|
+
return gateway.save().then(() => {
|
|
82
|
+
this.notifications.success(`Payment gateway changes saved!`);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return this.gatewaysController.editGateway(gateway, options);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@action deleteGateway() {
|
|
91
|
+
return this.gatewaysController.deleteGateway(...arguments);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@action createChannel() {
|
|
95
|
+
const channel = this.store.createRecord('notification-channel', {
|
|
96
|
+
owner_uuid: this.model.id,
|
|
97
|
+
owner_type: 'network:storefront',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
this.editChannel(channel, {
|
|
101
|
+
title: `Create a new notification channel`,
|
|
102
|
+
acceptButtonText: 'Create Notification Channel',
|
|
103
|
+
confirm: (modal) => {
|
|
104
|
+
modal.startLoading();
|
|
105
|
+
|
|
106
|
+
return channel.save().then((channel) => {
|
|
107
|
+
this.notifications.success(`New notification channel added to network!`);
|
|
108
|
+
this.channels.pushObject(channel);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
decline: (modal) => {
|
|
112
|
+
channel.destroyRecord();
|
|
113
|
+
modal.done();
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@action editChannel(channel, options = {}) {
|
|
119
|
+
if (options === null) {
|
|
120
|
+
options = {};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!options.confirm) {
|
|
124
|
+
options.confirm = (modal) => {
|
|
125
|
+
modal.startLoading();
|
|
126
|
+
|
|
127
|
+
return channel.save().then(() => {
|
|
128
|
+
this.notifications.success(`Notification channel changes saved!`);
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return this.notificationsController.editChannel(channel, options);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@action deleteChannel() {
|
|
137
|
+
return this.notificationsController.deleteChannel(...arguments);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@action makeAlertable(reason, models) {
|
|
141
|
+
if (!this.model.alertable || !this.model.alertable?.length) {
|
|
142
|
+
this.model.set('alertable', {});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.model.set(`alertable.${reason}`, models);
|
|
146
|
+
}
|
|
147
|
+
}
|