@fleetbase/storefront-engine 0.1.6 → 0.1.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/.php-cs-fixer.php +29 -0
- package/LICENSE.md +16 -4
- package/README.md +106 -13
- package/addon/components/modals/add-store-to-category.hbs +5 -0
- package/addon/components/modals/create-network-category.hbs +28 -28
- package/addon/components/modals/share-network.hbs +3 -3
- package/addon/components/modals/store-details.hbs +22 -0
- package/addon/components/modals/store-form.hbs +22 -0
- package/addon/components/modals/store-form.js +21 -0
- package/addon/components/network-category-picker.hbs +40 -0
- package/addon/components/network-category-picker.js +83 -0
- package/addon/components/store-selector.hbs +4 -2
- package/addon/components/widget/orders.js +22 -17
- package/addon/controllers/networks/index/network/index.js +133 -9
- package/addon/controllers/networks/index/network/stores.js +422 -153
- package/addon/controllers/networks/index.js +66 -4
- package/addon/controllers/products/index/category.js +1 -1
- package/addon/controllers/settings/index.js +14 -7
- package/addon/controllers/settings/notifications.js +1 -1
- package/addon/models/store.js +44 -7
- package/addon/routes/networks/index/network/customers.js +4 -1
- package/addon/routes/networks/index/network/orders.js +4 -1
- package/addon/routes/networks/index/network/stores.js +19 -15
- package/addon/serializers/store.js +1 -0
- package/addon/templates/customers/index.hbs +0 -11
- package/addon/templates/networks/index/network/index.hbs +1 -1
- package/addon/templates/networks/index/network/stores.hbs +8 -163
- package/addon/templates/networks/index/network.hbs +2 -3
- package/addon/utils/create-shareable-link.js +21 -0
- package/app/adapters/addon-category.js +1 -1
- package/app/adapters/gateway.js +1 -1
- package/app/adapters/network.js +1 -1
- package/app/adapters/notification-channel.js +1 -1
- package/app/adapters/product-addon-category.js +1 -1
- package/app/adapters/product-addon.js +1 -1
- package/app/adapters/product-hour.js +1 -1
- package/app/adapters/product-store-location.js +1 -1
- package/app/adapters/product-variant-option.js +1 -1
- package/app/adapters/product-variant.js +1 -1
- package/app/adapters/product.js +1 -1
- package/app/adapters/store-hour.js +1 -1
- package/app/adapters/store-location.js +1 -1
- package/app/adapters/store.js +1 -1
- package/app/adapters/storefront.js +1 -1
- package/app/components/file-record.js +1 -1
- package/app/components/modals/add-store-hours.js +1 -1
- package/app/components/modals/add-store-to-category.js +1 -0
- package/app/components/modals/add-stores-to-network.js +1 -1
- package/app/components/modals/assign-driver.js +1 -1
- package/app/components/modals/create-first-store.js +1 -1
- package/app/components/modals/create-gateway.js +1 -1
- package/app/components/modals/create-network-category.js +1 -1
- package/app/components/modals/create-network.js +1 -1
- package/app/components/modals/create-new-variant.js +1 -1
- package/app/components/modals/create-notification-channel.js +1 -1
- package/app/components/modals/create-product-category.js +1 -1
- package/app/components/modals/create-store.js +1 -1
- package/app/components/modals/edit-network.js +1 -1
- package/app/components/modals/import-products.js +1 -1
- package/app/components/modals/incoming-order.js +1 -1
- package/app/components/modals/manage-addons.js +1 -1
- package/app/components/modals/order-ready-assign-driver.js +1 -1
- package/app/components/modals/select-addon-category.js +1 -1
- package/app/components/modals/share-network.js +1 -1
- package/app/components/modals/store-details.js +1 -0
- package/app/components/modals/store-form.js +1 -0
- package/app/components/modals/store-location-form.js +1 -1
- package/app/components/network-category-picker.js +1 -0
- package/app/components/order-card.js +1 -1
- package/app/components/schedule-manager.js +1 -1
- package/app/components/settings-container.js +1 -1
- package/app/components/store-selector.js +1 -1
- package/app/components/widget/customers.js +1 -1
- package/app/components/widget/orders.js +1 -1
- package/app/components/widget/storefront-metrics.js +1 -1
- package/app/controllers/application.js +1 -1
- package/app/controllers/customers/index.js +1 -1
- package/app/controllers/home.js +1 -1
- package/app/controllers/networks/index/network/customers.js +1 -1
- package/app/controllers/networks/index/network/index.js +1 -1
- package/app/controllers/networks/index/network/orders.js +1 -1
- package/app/controllers/networks/index/network/stores.js +1 -1
- package/app/controllers/networks/index/network.js +1 -1
- package/app/controllers/networks/index.js +1 -1
- package/app/controllers/orders/index.js +1 -1
- package/app/controllers/products/index/category/edit.js +1 -1
- package/app/controllers/products/index/category/new.js +1 -1
- package/app/controllers/products/index/category.js +1 -1
- package/app/controllers/products/index/index/edit.js +1 -1
- package/app/controllers/products/index/index.js +1 -1
- package/app/controllers/products/index.js +1 -1
- package/app/controllers/settings/api.js +1 -1
- package/app/controllers/settings/gateways.js +1 -1
- package/app/controllers/settings/index.js +1 -1
- package/app/controllers/settings/locations.js +1 -1
- package/app/controllers/settings/notifications.js +1 -1
- package/app/helpers/get-tip-amount.js +1 -1
- package/app/models/addon-category.js +1 -1
- package/app/models/gateway.js +1 -1
- package/app/models/network.js +1 -1
- package/app/models/notification-channel.js +1 -1
- package/app/models/product-addon-category.js +1 -1
- package/app/models/product-addon.js +1 -1
- package/app/models/product-hour.js +1 -1
- package/app/models/product-store-location.js +1 -1
- package/app/models/product-variant-option.js +1 -1
- package/app/models/product-variant.js +1 -1
- package/app/models/product.js +1 -1
- package/app/models/store-hour.js +1 -1
- package/app/models/store-location.js +1 -1
- package/app/models/store.js +1 -1
- package/app/routes/application.js +1 -1
- package/app/routes/customers/index/edit.js +1 -1
- package/app/routes/customers/index.js +1 -1
- package/app/routes/home.js +1 -1
- package/app/routes/networks/index/network/customers.js +1 -1
- package/app/routes/networks/index/network/index.js +1 -1
- package/app/routes/networks/index/network/orders.js +1 -1
- package/app/routes/networks/index/network/stores.js +1 -1
- package/app/routes/networks/index/network.js +1 -1
- package/app/routes/networks/index.js +1 -1
- package/app/routes/orders/index/edit.js +1 -1
- package/app/routes/orders/index/new.js +1 -1
- package/app/routes/orders/index/view.js +1 -1
- package/app/routes/orders/index.js +1 -1
- package/app/routes/products/index/category/edit.js +1 -1
- package/app/routes/products/index/category/new.js +1 -1
- package/app/routes/products/index/category.js +1 -1
- package/app/routes/products/index/index/edit.js +1 -1
- package/app/routes/products/index/index.js +1 -1
- package/app/routes/products/index.js +1 -1
- package/app/routes/settings/api.js +1 -1
- package/app/routes/settings/gateways.js +1 -1
- package/app/routes/settings/index.js +1 -1
- package/app/routes/settings/locations.js +1 -1
- package/app/routes/settings/notifications.js +1 -1
- package/app/serializers/addon-category.js +1 -1
- package/app/serializers/network.js +1 -1
- package/app/serializers/notification-channel.js +1 -1
- package/app/serializers/product-addon-category.js +1 -1
- package/app/serializers/product-variant.js +1 -1
- package/app/serializers/product.js +1 -1
- package/app/serializers/store-location.js +1 -1
- package/app/serializers/store.js +1 -1
- package/app/services/storefront.js +1 -1
- package/app/templates/customers/index/edit.js +1 -1
- package/app/templates/customers/index.js +1 -1
- package/app/templates/home.js +1 -1
- package/app/templates/networks/index/network/customers.js +1 -1
- package/app/templates/networks/index/network/index.js +1 -1
- package/app/templates/networks/index/network/orders.js +1 -1
- package/app/templates/networks/index/network/stores.js +1 -1
- package/app/templates/networks/index/network.js +1 -1
- package/app/templates/networks/index.js +1 -1
- package/app/templates/orders/index/edit.js +1 -1
- package/app/templates/orders/index/new.js +1 -1
- package/app/templates/orders/index/view.js +1 -1
- package/app/templates/orders/index.js +1 -1
- package/app/templates/products/index/category/edit.js +1 -1
- package/app/templates/products/index/category/new.js +1 -1
- package/app/templates/products/index/category.js +1 -1
- package/app/templates/products/index/index/edit.js +1 -1
- package/app/templates/products/index/index.js +1 -1
- package/app/templates/products/index.js +1 -1
- package/app/templates/settings/api.js +1 -1
- package/app/templates/settings/gateways.js +1 -1
- package/app/templates/settings/index.js +1 -1
- package/app/templates/settings/locations.js +1 -1
- package/app/templates/settings/notifications.js +1 -1
- package/app/templates/settings.js +1 -1
- package/app/utils/create-shareable-link.js +1 -0
- package/app/utils/get-gateway-schemas.js +1 -1
- package/app/utils/get-notification-schemas.js +1 -1
- package/composer.json +88 -0
- package/extension.json +10 -0
- package/package.json +6 -7
- package/phpstan.neon.dist +8 -0
- package/phpunit.xml.dist +16 -0
- package/server/.gitattributes +14 -0
- package/server/README.md +40 -0
- package/server/config/api.php +101 -0
- package/server/config/database.connections.php +57 -0
- package/server/config/storefront.php +19 -0
- package/server/config/twilio-notification-channel.php +36 -0
- package/server/migrations/2023_05_03_025307_create_carts_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_checkouts_table.php +51 -0
- package/server/migrations/2023_05_03_025307_create_gateways_table.php +48 -0
- package/server/migrations/2023_05_03_025307_create_network_stores_table.php +36 -0
- package/server/migrations/2023_05_03_025307_create_networks_table.php +56 -0
- package/server/migrations/2023_05_03_025307_create_notification_channels_table.php +43 -0
- package/server/migrations/2023_05_03_025307_create_payment_methods_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_product_addon_categories_table.php +38 -0
- package/server/migrations/2023_05_03_025307_create_product_addons_table.php +43 -0
- package/server/migrations/2023_05_03_025307_create_product_hours_table.php +37 -0
- package/server/migrations/2023_05_03_025307_create_product_store_locations_table.php +34 -0
- package/server/migrations/2023_05_03_025307_create_product_variant_options_table.php +40 -0
- package/server/migrations/2023_05_03_025307_create_product_variants_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_products_table.php +59 -0
- package/server/migrations/2023_05_03_025307_create_reviews_table.php +41 -0
- package/server/migrations/2023_05_03_025307_create_store_hours_table.php +37 -0
- package/server/migrations/2023_05_03_025307_create_store_locations_table.php +38 -0
- package/server/migrations/2023_05_03_025307_create_stores_table.php +57 -0
- package/server/migrations/2023_05_03_025307_create_votes_table.php +39 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_carts_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_checkouts_table.php +48 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_gateways_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_network_stores_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_networks_table.php +42 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_notification_channels_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_payment_methods_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_addon_categories_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_addons_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_hours_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_store_locations_table.php +34 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_variant_options_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_variants_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_products_table.php +44 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_reviews_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_store_hours_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_store_locations_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_stores_table.php +42 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_votes_table.php +38 -0
- package/server/src/Auth/Schemas/Storefront.php +95 -0
- package/server/src/Console/Commands/NotifyStorefrontOrderNearby.php +86 -0
- package/server/src/Expansions/EntityExpansion.php +44 -0
- package/server/src/Http/Controllers/ActionController.php +119 -0
- package/server/src/Http/Controllers/AddonCategoryController.php +13 -0
- package/server/src/Http/Controllers/CustomerController.php +13 -0
- package/server/src/Http/Controllers/GatewayController.php +13 -0
- package/server/src/Http/Controllers/MetricsController.php +71 -0
- package/server/src/Http/Controllers/NetworkController.php +170 -0
- package/server/src/Http/Controllers/NotificationChannelController.php +13 -0
- package/server/src/Http/Controllers/OrderController.php +154 -0
- package/server/src/Http/Controllers/ProductAddonCategoryController.php +14 -0
- package/server/src/Http/Controllers/ProductAddonController.php +14 -0
- package/server/src/Http/Controllers/ProductController.php +123 -0
- package/server/src/Http/Controllers/ProductHourController.php +13 -0
- package/server/src/Http/Controllers/ProductVariantController.php +13 -0
- package/server/src/Http/Controllers/ProductVariantOptionController.php +13 -0
- package/server/src/Http/Controllers/ReviewController.php +13 -0
- package/server/src/Http/Controllers/StoreController.php +26 -0
- package/server/src/Http/Controllers/StoreHourController.php +13 -0
- package/server/src/Http/Controllers/StoreLocationController.php +13 -0
- package/server/src/Http/Controllers/StorefrontController.php +15 -0
- package/server/src/Http/Controllers/VoteController.php +13 -0
- package/server/src/Http/Controllers/v1/CartController.php +161 -0
- package/server/src/Http/Controllers/v1/CategoryController.php +138 -0
- package/server/src/Http/Controllers/v1/CheckoutController.php +957 -0
- package/server/src/Http/Controllers/v1/CustomerController.php +482 -0
- package/server/src/Http/Controllers/v1/GatewayControllerController.php +11 -0
- package/server/src/Http/Controllers/v1/NetworkController.php +281 -0
- package/server/src/Http/Controllers/v1/PaymentMethodController.php +11 -0
- package/server/src/Http/Controllers/v1/ProductController.php +94 -0
- package/server/src/Http/Controllers/v1/ReviewController.php +270 -0
- package/server/src/Http/Controllers/v1/ServiceQuoteController.php +402 -0
- package/server/src/Http/Controllers/v1/StoreController.php +176 -0
- package/server/src/Http/Filter/AddonCategoryFilter.php +19 -0
- package/server/src/Http/Filter/CustomerFilter.php +18 -0
- package/server/src/Http/Filter/GatewayFilter.php +13 -0
- package/server/src/Http/Filter/NetworkFilter.php +18 -0
- package/server/src/Http/Filter/NotificationChannelFilter.php +13 -0
- package/server/src/Http/Filter/OrderFilter.php +46 -0
- package/server/src/Http/Filter/ProductFilter.php +28 -0
- package/server/src/Http/Filter/StoreFilter.php +42 -0
- package/server/src/Http/Filter/StoreLocationFilter.php +23 -0
- package/server/src/Http/Middleware/SetStorefrontSession.php +130 -0
- package/server/src/Http/Requests/AddStoreToNetworkCategory.php +45 -0
- package/server/src/Http/Requests/CaptureOrderRequest.php +30 -0
- package/server/src/Http/Requests/CreateCustomerRequest.php +44 -0
- package/server/src/Http/Requests/CreateReviewRequest.php +34 -0
- package/server/src/Http/Requests/GetServiceQuoteFromCart.php +40 -0
- package/server/src/Http/Requests/InitializeCheckoutRequest.php +38 -0
- package/server/src/Http/Requests/NetworkActionRequest.php +43 -0
- package/server/src/Http/Requests/VerifyCreateCustomerRequest.php +31 -0
- package/server/src/Http/Resources/Cart.php +31 -0
- package/server/src/Http/Resources/Category.php +48 -0
- package/server/src/Http/Resources/Customer.php +36 -0
- package/server/src/Http/Resources/Gateway.php +32 -0
- package/server/src/Http/Resources/Media.php +29 -0
- package/server/src/Http/Resources/Network.php +48 -0
- package/server/src/Http/Resources/Product.php +209 -0
- package/server/src/Http/Resources/Review.php +45 -0
- package/server/src/Http/Resources/ReviewCustomer.php +60 -0
- package/server/src/Http/Resources/Store.php +76 -0
- package/server/src/Http/Resources/StoreHour.php +29 -0
- package/server/src/Http/Resources/StoreLocation.php +33 -0
- package/server/src/Imports/ProductsImport.php +20 -0
- package/server/src/Jobs/DownloadProductImageUrl.php +60 -0
- package/server/src/Listeners/HandleOrderCompleted.php +31 -0
- package/server/src/Listeners/HandleOrderDispatched.php +34 -0
- package/server/src/Listeners/HandleOrderDriverAssigned.php +37 -0
- package/server/src/Listeners/HandleOrderStarted.php +27 -0
- package/server/src/Mail/StorefrontNetworkInvite.php +48 -0
- package/server/src/Models/AddonCategory.php +30 -0
- package/server/src/Models/Cart.php +691 -0
- package/server/src/Models/Checkout.php +166 -0
- package/server/src/Models/Customer.php +88 -0
- package/server/src/Models/Gateway.php +165 -0
- package/server/src/Models/Network.php +300 -0
- package/server/src/Models/NetworkStore.php +86 -0
- package/server/src/Models/NotificationChannel.php +147 -0
- package/server/src/Models/PaymentMethod.php +99 -0
- package/server/src/Models/Product.php +315 -0
- package/server/src/Models/ProductAddon.php +128 -0
- package/server/src/Models/ProductAddonCategory.php +90 -0
- package/server/src/Models/ProductHour.php +59 -0
- package/server/src/Models/ProductStoreLocation.php +77 -0
- package/server/src/Models/ProductVariant.php +125 -0
- package/server/src/Models/ProductVariantOption.php +86 -0
- package/server/src/Models/Review.php +127 -0
- package/server/src/Models/Store.php +478 -0
- package/server/src/Models/StoreHour.php +59 -0
- package/server/src/Models/StoreLocation.php +126 -0
- package/server/src/Models/StorefrontModel.php +22 -0
- package/server/src/Models/Vote.php +84 -0
- package/server/src/Notifications/StorefrontOrderCanceled.php +196 -0
- package/server/src/Notifications/StorefrontOrderCompleted.php +201 -0
- package/server/src/Notifications/StorefrontOrderCreated.php +157 -0
- package/server/src/Notifications/StorefrontOrderDriverAssigned.php +200 -0
- package/server/src/Notifications/StorefrontOrderEnroute.php +199 -0
- package/server/src/Notifications/StorefrontOrderNearby.php +201 -0
- package/server/src/Notifications/StorefrontOrderPreparing.php +202 -0
- package/server/src/Notifications/StorefrontOrderReadyForPickup.php +202 -0
- package/server/src/Observers/NetworkObserver.php +40 -0
- package/server/src/Observers/ProductObserver.php +118 -0
- package/server/src/Providers/EventServiceProvider.php +23 -0
- package/server/src/Providers/StorefrontServiceProvider.php +103 -0
- package/server/src/Support/Metrics.php +193 -0
- package/server/src/Support/OrderConfig.php +13 -0
- package/server/src/Support/QPay.php +208 -0
- package/server/src/Support/Storefront.php +201 -0
- package/server/src/routes.php +180 -0
- package/server/tests/Feature.php +5 -0
|
@@ -3,27 +3,103 @@ import { tracked } from '@glimmer/tracking';
|
|
|
3
3
|
import { inject as service } from '@ember/service';
|
|
4
4
|
import { alias } from '@ember/object/computed';
|
|
5
5
|
import { action } from '@ember/object';
|
|
6
|
-
import getPodMethods from '@fleetbase/
|
|
6
|
+
import getPodMethods from '@fleetbase/ember-core/utils/get-pod-methods';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* NetworksIndexNetworkIndexController
|
|
10
|
+
*
|
|
11
|
+
* This controller handles the logic for managing networks, gateways, and notification channels.
|
|
12
|
+
*
|
|
13
|
+
* @class NetworksIndexNetworkIndexController
|
|
14
|
+
* @extends Controller
|
|
15
|
+
*/
|
|
8
16
|
export default class NetworksIndexNetworkIndexController extends Controller {
|
|
17
|
+
/**
|
|
18
|
+
* Controller for managing gateways.
|
|
19
|
+
*
|
|
20
|
+
* @property {Controller} gatewaysController
|
|
21
|
+
*/
|
|
9
22
|
@controller('settings.gateways') gatewaysController;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Controller for managing notifications.
|
|
26
|
+
*
|
|
27
|
+
* @property {Controller} notificationsController
|
|
28
|
+
*/
|
|
10
29
|
@controller('settings.notifications') notificationsController;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Notifications service to handle notification logic.
|
|
33
|
+
*
|
|
34
|
+
* @property {Service} notifications
|
|
35
|
+
*/
|
|
11
36
|
@service notifications;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Fetch service to handle file uploads and other network requests.
|
|
40
|
+
*
|
|
41
|
+
* @property {Service} fetch
|
|
42
|
+
*/
|
|
12
43
|
@service fetch;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Proof of delivery methods.
|
|
47
|
+
*
|
|
48
|
+
* @property {Array} podMethods
|
|
49
|
+
*/
|
|
13
50
|
@tracked podMethods = getPodMethods();
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Loading state, indicating whether a network request is in progress.
|
|
54
|
+
*
|
|
55
|
+
* @property {Boolean} isLoading
|
|
56
|
+
*/
|
|
14
57
|
@tracked isLoading = false;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Alias for model.gateways, representing the gateways associated with the network.
|
|
61
|
+
*
|
|
62
|
+
* @property {Array} gateways
|
|
63
|
+
*/
|
|
15
64
|
@alias('model.gateways') gateways;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Alias for model.notification_channels, representing the notification channels associated with the network.
|
|
68
|
+
*
|
|
69
|
+
* @property {Array} channels
|
|
70
|
+
*/
|
|
16
71
|
@alias('model.notification_channels') channels;
|
|
17
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Save network settings.
|
|
75
|
+
*
|
|
76
|
+
* @method saveSettings
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
18
79
|
@action saveSettings() {
|
|
19
80
|
this.isLoading = true;
|
|
20
81
|
|
|
21
|
-
this.model
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
82
|
+
this.model
|
|
83
|
+
.save()
|
|
84
|
+
.then(() => {
|
|
85
|
+
this.notifications.success('Changes to network saved.');
|
|
86
|
+
})
|
|
87
|
+
.catch((error) => {
|
|
88
|
+
this.notifications.serverError(error);
|
|
89
|
+
})
|
|
90
|
+
.finally(() => {
|
|
91
|
+
this.isLoading = false;
|
|
92
|
+
});
|
|
25
93
|
}
|
|
26
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Upload a file.
|
|
97
|
+
*
|
|
98
|
+
* @method uploadFile
|
|
99
|
+
* @param {String} type - Type of the file.
|
|
100
|
+
* @param {File} file - File to upload.
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
27
103
|
@action uploadFile(type, file) {
|
|
28
104
|
const prefix = type.replace('storefront_', '');
|
|
29
105
|
|
|
@@ -32,23 +108,29 @@ export default class NetworksIndexNetworkIndexController extends Controller {
|
|
|
32
108
|
{
|
|
33
109
|
path: `uploads/storefront/${this.model.id}/${type}`,
|
|
34
110
|
key_uuid: this.model.id,
|
|
35
|
-
key_type: `network
|
|
111
|
+
key_type: `storefront:network`,
|
|
36
112
|
type,
|
|
37
113
|
},
|
|
38
114
|
(uploadedFile) => {
|
|
39
115
|
this.model.setProperties({
|
|
40
116
|
[`${prefix}_uuid`]: uploadedFile.id,
|
|
41
|
-
[`${prefix}_url`]: uploadedFile.
|
|
117
|
+
[`${prefix}_url`]: uploadedFile.url,
|
|
42
118
|
[prefix]: uploadedFile,
|
|
43
119
|
});
|
|
44
120
|
}
|
|
45
121
|
);
|
|
46
122
|
}
|
|
47
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Create a new payment gateway.
|
|
126
|
+
*
|
|
127
|
+
* @method createGateway
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
48
130
|
@action createGateway() {
|
|
49
131
|
const gateway = this.store.createRecord('gateway', {
|
|
50
132
|
owner_uuid: this.model.id,
|
|
51
|
-
owner_type: 'network
|
|
133
|
+
owner_type: 'storefront:network',
|
|
52
134
|
});
|
|
53
135
|
|
|
54
136
|
this.editGateway(gateway, {
|
|
@@ -69,6 +151,14 @@ export default class NetworksIndexNetworkIndexController extends Controller {
|
|
|
69
151
|
});
|
|
70
152
|
}
|
|
71
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Edit a payment gateway.
|
|
156
|
+
*
|
|
157
|
+
* @method editGateway
|
|
158
|
+
* @param {Object} gateway - The gateway object to edit.
|
|
159
|
+
* @param {Object} [options={}] - Optional parameters for editing the gateway.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
72
162
|
@action editGateway(gateway, options = {}) {
|
|
73
163
|
if (options === null) {
|
|
74
164
|
options = {};
|
|
@@ -87,14 +177,26 @@ export default class NetworksIndexNetworkIndexController extends Controller {
|
|
|
87
177
|
return this.gatewaysController.editGateway(gateway, options);
|
|
88
178
|
}
|
|
89
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Delete a payment gateway.
|
|
182
|
+
*
|
|
183
|
+
* @method deleteGateway
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
90
186
|
@action deleteGateway() {
|
|
91
187
|
return this.gatewaysController.deleteGateway(...arguments);
|
|
92
188
|
}
|
|
93
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Create a new notification channel.
|
|
192
|
+
*
|
|
193
|
+
* @method createChannel
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
94
196
|
@action createChannel() {
|
|
95
197
|
const channel = this.store.createRecord('notification-channel', {
|
|
96
198
|
owner_uuid: this.model.id,
|
|
97
|
-
owner_type: 'network
|
|
199
|
+
owner_type: 'storefront:network',
|
|
98
200
|
});
|
|
99
201
|
|
|
100
202
|
this.editChannel(channel, {
|
|
@@ -115,6 +217,14 @@ export default class NetworksIndexNetworkIndexController extends Controller {
|
|
|
115
217
|
});
|
|
116
218
|
}
|
|
117
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Edit a notification channel.
|
|
222
|
+
*
|
|
223
|
+
* @method editChannel
|
|
224
|
+
* @param {Object} channel - The channel object to edit.
|
|
225
|
+
* @param {Object} [options={}] - Optional parameters for editing the channel.
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
118
228
|
@action editChannel(channel, options = {}) {
|
|
119
229
|
if (options === null) {
|
|
120
230
|
options = {};
|
|
@@ -133,10 +243,24 @@ export default class NetworksIndexNetworkIndexController extends Controller {
|
|
|
133
243
|
return this.notificationsController.editChannel(channel, options);
|
|
134
244
|
}
|
|
135
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Delete a notification channel.
|
|
248
|
+
*
|
|
249
|
+
* @method deleteChannel
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
136
252
|
@action deleteChannel() {
|
|
137
253
|
return this.notificationsController.deleteChannel(...arguments);
|
|
138
254
|
}
|
|
139
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Make an alertable action.
|
|
258
|
+
*
|
|
259
|
+
* @method makeAlertable
|
|
260
|
+
* @param {String} reason - Reason for the alert.
|
|
261
|
+
* @param {Array} models - Models associated with the alert.
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
140
264
|
@action makeAlertable(reason, models) {
|
|
141
265
|
if (!this.model.alertable || !this.model.alertable?.length) {
|
|
142
266
|
this.model.set('alertable', {});
|