@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.
Files changed (45) hide show
  1. package/addon/components/storefront-order-summary.hbs +69 -68
  2. package/addon/components/storefront-order-summary.js +10 -1
  3. package/addon/controllers/base-controller.js +2 -22
  4. package/addon/controllers/networks/index/network.js +25 -0
  5. package/addon/controllers/promotions/push-notifications.js +64 -0
  6. package/addon/controllers/promotions.js +16 -0
  7. package/addon/engine.js +1 -31
  8. package/addon/extension.js +35 -0
  9. package/addon/routes/customers/index.js +0 -9
  10. package/addon/routes/networks/index/network/customers.js +0 -9
  11. package/addon/routes/networks/index.js +0 -9
  12. package/addon/routes/orders/index.js +0 -9
  13. package/addon/routes/products/index.js +2 -8
  14. package/addon/routes/promotions/push-notifications.js +19 -0
  15. package/addon/routes/promotions.js +16 -0
  16. package/addon/routes.js +3 -1
  17. package/addon/styles/storefront-engine.css +4 -0
  18. package/addon/templates/application.hbs +7 -0
  19. package/addon/templates/networks/index/network/index.hbs +30 -8
  20. package/addon/templates/networks/index/network.hbs +5 -26
  21. package/addon/templates/promotions/push-notifications.hbs +85 -0
  22. package/addon/templates/promotions.hbs +8 -0
  23. package/addon/templates/settings/index.hbs +19 -0
  24. package/app/controllers/promotions/push-notifications.js +1 -0
  25. package/app/controllers/promotions.js +1 -0
  26. package/app/routes/promotions/push-notifications.js +1 -0
  27. package/app/routes/promotions.js +1 -0
  28. package/app/templates/promotions/push-notifications.hbs +1 -0
  29. package/app/templates/promotions.hbs +1 -0
  30. package/composer.json +1 -1
  31. package/config/environment.js +1 -1
  32. package/extension.json +1 -1
  33. package/package.json +4 -4
  34. package/server/config/storefront.php +1 -1
  35. package/server/src/Http/Controllers/ActionController.php +61 -0
  36. package/server/src/Http/Controllers/v1/CheckoutController.php +26 -10
  37. package/server/src/Http/Controllers/v1/CustomerController.php +22 -16
  38. package/server/src/Models/Cart.php +2 -1
  39. package/server/src/Models/Network.php +25 -0
  40. package/server/src/Models/Store.php +25 -0
  41. package/server/src/Notifications/PromotionalPushNotification.php +166 -0
  42. package/server/src/Support/QPay.php +550 -2
  43. package/server/src/Support/Storefront.php +14 -0
  44. package/server/src/routes.php +1 -0
  45. package/translations/en-us.yaml +28 -0
@@ -21,6 +21,7 @@ use Illuminate\Support\Facades\DB;
21
21
  use Illuminate\Support\Facades\Log;
22
22
  use Illuminate\Support\Facades\Notification;
23
23
  use Illuminate\Support\Facades\Redis;
24
+ use Illuminate\Support\Facades\Schema;
24
25
  use Illuminate\Support\Str;
25
26
  use Laravel\Sanctum\PersonalAccessToken;
26
27
 
@@ -729,4 +730,17 @@ class Storefront
729
730
 
730
731
  return null;
731
732
  }
733
+
734
+ public static function calculateTipAmount($tip, $subtotal)
735
+ {
736
+ $tipAmount = 0;
737
+
738
+ if (is_string($tip) && Str::endsWith($tip, '%')) {
739
+ $tipAmount = Utils::calculatePercentage(Utils::numbersOnly($tip), $subtotal);
740
+ } else {
741
+ $tipAmount = Utils::numbersOnly($tip);
742
+ }
743
+
744
+ return $tipAmount;
745
+ }
732
746
  }
@@ -155,6 +155,7 @@ Route::prefix(config('storefront.api.routing.prefix', 'storefront'))->namespace(
155
155
  function ($router) {
156
156
  $router->get('store-count', 'ActionController@getStoreCount');
157
157
  $router->get('metrics', 'ActionController@getMetrics');
158
+ $router->post('send-push-notification', 'ActionController@sendPushNotification');
158
159
  }
159
160
  );
160
161
  $router->fleetbaseRoutes(
@@ -82,6 +82,7 @@ storefront:
82
82
  customers: Customers
83
83
  orders: Orders
84
84
  networks: Networks
85
+ promotions: Promotions
85
86
  settings: Settings
86
87
  launch-app: Launch App
87
88
  component:
@@ -369,6 +370,9 @@ storefront:
369
370
  enable-tax: Enable tax
370
371
  tax-percentage-input-label: Tax Percentage
371
372
  tax-percentage-input-help-text: The sales tax percentage to apply to orders.
373
+ enable-minimum-order-amount: Enable minimum order amount
374
+ minimum-order-amount-input-label: Minimum Order Amount
375
+ minimum-order-amount-input-help-text: The minimum order amount required for checkout.
372
376
  auto-accept-incoming-orders: Auto accept incoming orders
373
377
  auto-dispatch-orders: Auto dispatch orders
374
378
  require-proof-of-delivery: Require proof of delivery
@@ -610,6 +614,9 @@ storefront:
610
614
  enable-tax: Enable tax
611
615
  tax-percentage: Tax Percentage
612
616
  tax-percentage-help-text: The sales tax percentage to apply to orders.
617
+ enable-minimum-order-amount: Enable minimum order amount
618
+ minimum-order-amount: Minimum Order Amount
619
+ minimum-order-amount-help-text: The minimum order amount required for checkout.
613
620
  auto-accept-incoming-order: Auto accept incoming orders
614
621
  auto-dispatch-order: Auto dispatch orders
615
622
  require-proof-of-delivery: Require proof of delivery
@@ -658,3 +665,24 @@ storefront:
658
665
  storefront-create-success: Your new storefront has been created!
659
666
  application:
660
667
  launch-app: Launch App
668
+ promotions:
669
+ title: Promotions
670
+ push-notifications:
671
+ tab-title: Push Notifications
672
+ header: Send Push Notifications
673
+ description: Send promotional push notifications to your customers
674
+ title-label: Notification Title
675
+ title-placeholder: Enter notification title
676
+ title-help-text: The title that will appear in the push notification
677
+ body-label: Notification Body
678
+ body-placeholder: Enter notification message
679
+ body-help-text: The message content that will be sent to customers
680
+ select-all-customers: Select All Customers
681
+ select-all-customers-help-text: Send notification to all customers of this store
682
+ customers-label: Select Customers
683
+ customers-placeholder: Select customers to send notification to
684
+ send-button: Send Notification
685
+ validation-title-body-required: Please enter both title and body for the notification
686
+ validation-customers-required: Please select at least one customer to send the notification to
687
+ notification-sent-success: Push notification sent successfully to selected customers
688
+ notification-sent-error: Failed to send push notification. Please try again.