@fleetbase/storefront-engine 0.3.5 → 0.3.7

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 (83) hide show
  1. package/addon/components/context-panel.hbs +5 -0
  2. package/addon/components/context-panel.js +6 -0
  3. package/addon/components/customer-panel/details.hbs +34 -0
  4. package/addon/components/customer-panel/details.js +3 -0
  5. package/addon/components/customer-panel/orders.hbs +140 -0
  6. package/addon/components/customer-panel/orders.js +78 -0
  7. package/addon/components/customer-panel.hbs +70 -0
  8. package/addon/components/customer-panel.js +171 -0
  9. package/addon/components/display-place.hbs +52 -0
  10. package/addon/components/display-place.js +11 -0
  11. package/addon/components/modals/manage-addons.hbs +15 -52
  12. package/addon/components/modals/manage-addons.js +93 -43
  13. package/addon/components/modals/select-addon-category.hbs +1 -1
  14. package/addon/components/order-panel/details.hbs +245 -0
  15. package/addon/components/order-panel/details.js +189 -0
  16. package/addon/components/order-panel.hbs +1 -0
  17. package/addon/components/order-panel.js +38 -0
  18. package/addon/components/storefront-order-summary.hbs +9 -2
  19. package/addon/components/widget/customers.hbs +3 -1
  20. package/addon/components/widget/customers.js +5 -0
  21. package/addon/components/widget/orders.js +8 -146
  22. package/addon/controllers/customers/index/view.js +43 -0
  23. package/addon/controllers/customers/index.js +10 -6
  24. package/addon/controllers/networks/index/network/customers.js +68 -2
  25. package/addon/controllers/networks/index/network/orders.js +324 -1
  26. package/addon/controllers/networks/index/network/stores.js +0 -2
  27. package/addon/controllers/orders/index/view.js +13 -0
  28. package/addon/controllers/orders/index.js +10 -7
  29. package/addon/controllers/products/index/category/edit.js +12 -16
  30. package/addon/controllers/products/index/category/new.js +40 -45
  31. package/addon/controllers/products/index.js +8 -2
  32. package/addon/helpers/avatar-url.js +9 -0
  33. package/addon/models/product-variant-option.js +8 -1
  34. package/addon/models/product-variant.js +12 -2
  35. package/addon/models/product.js +62 -0
  36. package/addon/routes/customers/index/view.js +14 -0
  37. package/addon/routes/networks/index/network/customers.js +29 -0
  38. package/addon/routes/networks/index/network/orders.js +5 -0
  39. package/addon/routes/networks/index.js +1 -1
  40. package/addon/routes/orders/index/view.js +22 -1
  41. package/addon/routes/products/index/category/edit.js +6 -0
  42. package/addon/routes/products/index/category/new.js +3 -1
  43. package/addon/routes.js +1 -0
  44. package/addon/serializers/product-variant-option.js +14 -0
  45. package/addon/serializers/product-variant.js +27 -0
  46. package/addon/serializers/product.js +26 -4
  47. package/addon/services/context-panel.js +210 -0
  48. package/addon/styles/storefront-engine.css +6 -0
  49. package/addon/templates/application.hbs +3 -1
  50. package/addon/templates/customers/index/view.hbs +1 -0
  51. package/addon/templates/networks/index/network/customers.hbs +18 -1
  52. package/addon/templates/networks/index/network/orders.hbs +18 -1
  53. package/addon/templates/networks/index/network.hbs +1 -1
  54. package/addon/templates/orders/index/view.hbs +1 -1
  55. package/addon/templates/products/index/category/new.hbs +12 -67
  56. package/app/components/context-panel.js +1 -0
  57. package/app/components/customer-panel/details.js +1 -0
  58. package/app/components/customer-panel/orders.js +1 -0
  59. package/app/components/customer-panel.js +1 -0
  60. package/app/components/display-place.js +1 -0
  61. package/app/components/order-panel/details.js +1 -0
  62. package/app/components/order-panel.js +1 -0
  63. package/app/controllers/customers/index/view.js +1 -0
  64. package/app/controllers/orders/index/view.js +1 -0
  65. package/app/helpers/avatar-url.js +1 -0
  66. package/app/routes/customers/index/view.js +1 -0
  67. package/app/serializers/product-variant-option.js +1 -0
  68. package/app/services/context-panel.js +1 -0
  69. package/app/templates/customers/index/view.js +1 -0
  70. package/composer.json +3 -3
  71. package/extension.json +1 -1
  72. package/package.json +10 -4
  73. package/server/src/Http/Controllers/AddonCategoryController.php +90 -0
  74. package/server/src/Http/Controllers/v1/ReviewController.php +43 -52
  75. package/server/src/Http/Resources/Network.php +34 -32
  76. package/server/src/Http/Resources/NotificationChannel.php +32 -0
  77. package/server/src/Http/Resources/Product.php +10 -8
  78. package/server/src/Models/AddonCategory.php +37 -0
  79. package/server/src/Models/Product.php +6 -7
  80. package/server/src/Models/ProductAddon.php +3 -0
  81. package/server/src/Models/ProductAddonCategory.php +12 -2
  82. package/server/src/Providers/StorefrontServiceProvider.php +1 -1
  83. package/translations/en-us.yaml +101 -39
@@ -3,6 +3,8 @@
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Models\Category;
6
+ use Illuminate\Support\Arr;
7
+ use Illuminate\Support\Str;
6
8
 
7
9
  class AddonCategory extends Category
8
10
  {
@@ -25,4 +27,39 @@ class AddonCategory extends Category
25
27
  {
26
28
  return $this->setConnection(config('storefront.connection.db'))->hasMany(ProductAddon::class, 'category_uuid');
27
29
  }
30
+
31
+ public function setAddons(array $addons = []): AddonCategory
32
+ {
33
+ foreach ($addons as $addon) {
34
+ // get uuid if set
35
+ $id = data_get($addon, 'uuid');
36
+
37
+ // make sure the cateogry is set to this current
38
+ data_set($addon, 'category_uuid', $this->uuid);
39
+
40
+ // make sure sale price is 0 if null
41
+ if (data_get($addon, 'sale_price') === null) {
42
+ data_set($addon, 'sale_price', 0);
43
+ }
44
+
45
+ // update product addon category
46
+ if (Str::isUuid($id)) {
47
+ ProductAddon::where('uuid', $id)->update(Arr::except($addon, ['uuid', 'created_at', 'updated_at']));
48
+ continue;
49
+ }
50
+
51
+ // create new product addon category
52
+ ProductAddon::create([
53
+ 'category_uuid' => $this->uuid,
54
+ 'name' => data_get($addon, 'name'),
55
+ 'description' => data_get($addon, 'description'),
56
+ 'translations' => data_get($addon, 'translations', []),
57
+ 'price' => data_get($addon, 'price'),
58
+ 'sale_price' => data_get($addon, 'sale_price'),
59
+ 'is_on_sale' => data_get($addon, 'is_on_sale'),
60
+ ]);
61
+ }
62
+
63
+ return $this;
64
+ }
28
65
  }
@@ -304,18 +304,17 @@ class Product extends StorefrontModel
304
304
  // get uuid if set
305
305
  $id = data_get($addonCategory, 'uuid');
306
306
 
307
+ // Make sure product is set
308
+ data_set($addonCategory, 'product_uuid', $this->uuid);
309
+
307
310
  // update product addon category
308
311
  if (Str::isUuid($id)) {
309
- ProductAddonCategory::where('uuid', $id)->update([
310
- 'excluded_addons' => data_get($addonCategory, 'excluded_addons'),
311
- 'max_selectable' => data_get($addonCategory, 'max_selectable'),
312
- 'is_required' => data_get($addonCategory, 'is_required'),
313
- ]);
312
+ ProductAddonCategory::where('uuid', $id)->update(Arr::except($addonCategory, ['uuid', 'created_at', 'updated_at', 'name', 'category']));
314
313
  continue;
315
314
  }
316
315
 
317
316
  // create new product addon category
318
- $productAddonCategory = ProductAddonCategory::create([
317
+ ProductAddonCategory::create([
319
318
  'product_uuid' => $this->uuid,
320
319
  'category_uuid' => data_get($addonCategory, 'category_uuid'),
321
320
  'excluded_addons' => data_get($addonCategory, 'excluded_addons'),
@@ -369,7 +368,7 @@ class Product extends StorefrontModel
369
368
  $option['additional_cost'] = Utils::numbersOnly($option['additional_cost']);
370
369
  }
371
370
 
372
- $productVariantOptionInput = Arr::except($option, ['uuid']);
371
+ $productVariantOptionInput = Arr::except($option, ['uuid', 'created_at', 'updated_at']);
373
372
  ProductVariantOption::where('uuid', $option['uuid'])->update($productVariantOptionInput);
374
373
  continue;
375
374
  }
@@ -3,6 +3,7 @@
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
+ use Fleetbase\Casts\Money;
6
7
  use Fleetbase\FleetOps\Support\Utils;
7
8
  use Fleetbase\Models\Category;
8
9
  use Fleetbase\Models\User;
@@ -66,6 +67,8 @@ class ProductAddon extends StorefrontModel
66
67
  protected $casts = [
67
68
  'is_on_sale' => 'boolean',
68
69
  'translations' => Json::class,
70
+ 'price' => Money::class,
71
+ 'sale_price' => Money::class,
69
72
  ];
70
73
 
71
74
  /**
@@ -84,8 +84,18 @@ class ProductAddonCategory extends StorefrontModel
84
84
  return static::attributeFromCache($this, 'category.name');
85
85
  }
86
86
 
87
- public function getExcludedAddonsAttribute($excluded)
87
+ /**
88
+ * Decode excluded addons.
89
+ *
90
+ * @param string $excluded
91
+ */
92
+ public function getExcludedAddonsAttribute($excluded): array
88
93
  {
89
- return Json::decode($excluded);
94
+ $excludedAddons = is_array($excluded) ? $excluded : Json::decode($excluded);
95
+ if (is_array($excludedAddons)) {
96
+ return $excludedAddons;
97
+ }
98
+
99
+ return [];
90
100
  }
91
101
  }
@@ -87,7 +87,7 @@ class StorefrontServiceProvider extends CoreServiceProvider
87
87
  {
88
88
  $this->registerCommands();
89
89
  $this->scheduleCommands(function ($schedule) {
90
- $schedule->command('storefront:notify-order-nearby')->everyMinute();
90
+ $schedule->command('storefront:notify-order-nearby')->everyMinute()->storeOutputInDb();
91
91
  });
92
92
  $this->registerObservers();
93
93
  $this->registerMiddleware();
@@ -21,6 +21,7 @@ storefront:
21
21
  category: Category
22
22
  delivery-tip: Delivery Tip
23
23
  delivery: Delivery
24
+ details: Details
24
25
  description: Description
25
26
  driver: Driver
26
27
  dropoff: Dropoff
@@ -28,11 +29,12 @@ storefront:
28
29
  email: Email
29
30
  export: Export
30
31
  id: ID
32
+ internal-id: Internal ID
31
33
  import: Import
32
34
  invalid: Invalid
33
35
  loading: Loading...
34
36
  logo: logo
35
- name: Name
37
+ name: Name
36
38
  neighborhood: Neighborhood
37
39
  online: Online
38
40
  orders: Orders
@@ -48,8 +50,9 @@ storefront:
48
50
  storefront: Storefront
49
51
  tag: Tags
50
52
  tip: Tip
53
+ title: Title
51
54
  total: Total
52
- type: Type
55
+ type: Type
53
56
  upload-new: Upload new
54
57
  uploading: Uploading...
55
58
  view: View
@@ -66,7 +69,7 @@ storefront:
66
69
  new: New
67
70
  facebook: Facebook
68
71
  instagram: Instagram
69
- twitter: Twitter
72
+ twitter: Twitter
70
73
  sidebar:
71
74
  storefront: Storefront
72
75
  dashboard: Dashboard
@@ -77,10 +80,10 @@ storefront:
77
80
  settings: Settings
78
81
  launch-app: Launch App
79
82
  component:
80
- storefront-order-summary:
83
+ storefront-order-summary:
81
84
  order-summary-title: Storefront Order Summary
82
85
  modals:
83
- add-store-hours:
86
+ add-store-hours:
84
87
  start-time: Start time
85
88
  operation-start: When availability/operation start
86
89
  end-time: End time
@@ -190,12 +193,12 @@ storefront:
190
193
  description: Addon Description
191
194
  delete-this-addon-category-assosiated-will-lost: Are you sure you wish to delete this addon category? All addons assosciated will be lost!
192
195
  untitled-addon-category: Untitled Addon Category
193
- order-ready-assign-driver:
196
+ order-ready-assign-driver:
194
197
  driver-dispatch: You are about to set this order as ready and dispatch, use the dropdown below to select a driver to dispatch to. <br><br>Or optionally you can opt to dispatch order as adhoc which will ping the order to all nearby drivers to be accepted.
195
198
  adhoc-dispatch-nearby-drivers: Adhoc dispatch to nearby drivers
196
199
  select-driver: Select Driver
197
200
  select-driver-to-assign: Select Driver to Assign
198
- share-network:
201
+ share-network:
199
202
  invite-member: Invite members to your network
200
203
  email-below: Grab a shareable invitiation link or send individual invites via email below.
201
204
  invite-network: Enter the emails of people or organizations you want to send an invite to your network.
@@ -243,12 +246,12 @@ storefront:
243
246
  mark-as-ready-modal-title: Are you want to mark order as ready?
244
247
  mark-as-ready-modal-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.
245
248
  mark-as-ready-modal-accept-button-text: Dispatch!
246
- mark-as-completed-modal-title : Are you sure you want to mark order as completed?
249
+ mark-as-completed-modal-title: Are you sure you want to mark order as completed?
247
250
  mark-as-completed-modal-body: Marking the order as completed is a confirmation that the customer has picked up the order and the order is completed.
248
251
  mark-as-completed-accept-button-text: Order Completed!
249
252
  assign-driver-modal-title: Assign Driver
250
253
  assign-driver-modal-accept-button-text: Assign Driver
251
- storefront-metrics:
254
+ storefront-metrics:
252
255
  last-day: Last 30 days
253
256
  file-record:
254
257
  delete-this-file: Are you sure you wish to delete this file?
@@ -265,7 +268,7 @@ storefront:
265
268
  by-removing-these-operation: By removing these operation/availability hours, your store or product may become inactive or unavailable according to the updated schedule...
266
269
  store-selector:
267
270
  no-stores: No stores to select
268
- create-storefront: Create a new
271
+ create-storefront: Create a new
269
272
  home:
270
273
  title: Storefront Dashboard
271
274
  customers:
@@ -277,7 +280,13 @@ storefront:
277
280
  view-customer-details: View Customer Details
278
281
  edit-customer: Edit Customer
279
282
  success-message: Your new storefront network has been created!
280
- delete-customer: Delete Customer
283
+ delete-customer: Delete Customer
284
+ customer-panel:
285
+ details:
286
+ web-url: Website URL
287
+ edit-button: Edit customer
288
+ cancel-edit-button: Cancel edit customer
289
+ cancel-new-button: Cancel new customer
281
290
  networks:
282
291
  index:
283
292
  network-option: Network Options
@@ -294,7 +303,7 @@ storefront:
294
303
  orders: Orders
295
304
  Network-changes-not-save: Network changes not saved!
296
305
  going-back-will-rollback-all-unsaved-changes: Going back will rollback all unsaved changes, are you sure you wish to continue?
297
- index:
306
+ index:
298
307
  change-network-saved: Changes to network saved.
299
308
  create-new-payment-gateway: Create a new payment gateway
300
309
  save-gateway: Save Gateway
@@ -404,7 +413,7 @@ storefront:
404
413
  add-stores-to-network: Add stores to network
405
414
  network-stores-update: Network stores updated.
406
415
  remove-this-store: Remove this store ({storeName}) from this network ({networkName})?
407
- done: Done
416
+ done: Done
408
417
  longer-findable-by-this-network: Are you sure you wish to remove this store from this network? It will no longer be findable by this network.
409
418
  viewing-storefront: Viewing {storeName} storefront
410
419
  editing-storefront: Editing {storeName} storefront
@@ -413,27 +422,80 @@ storefront:
413
422
  invalid-emails-provided-error: Invalid emails provided!
414
423
  orders:
415
424
  index:
416
- internal-id: Internal ID
417
- customer: Customer
418
- select-order-customer: Select order customer
419
- select-order-pickup-location: Select order pickup location
420
- select-order-dropoff-location: Select order dropoff location
421
- scheduled-at: Scheduled At
422
- transaction-total: Transaction Total
423
- tracking-number: Tracking Number
424
- driver-assigned: Driver Assigned
425
- select-driver-for-order: Select driver for order
426
- created-at: Created At
427
- updated-at: Updated At
428
- created-by: Created By
429
- updated-by: Updated By
430
- select-user: Select user
431
- view-order: View Order
432
- cancel-order: Cancel Order
433
- delete-order: Delete Order
434
- products:
425
+ internal-id: Internal ID
426
+ customer: Customer
427
+ select-order-customer: Select order customer
428
+ select-order-pickup-location: Select order pickup location
429
+ select-order-dropoff-location: Select order dropoff location
430
+ scheduled-at: Scheduled At
431
+ transaction-total: Transaction Total
432
+ tracking-number: Tracking Number
433
+ driver-assigned: Driver Assigned
434
+ select-driver-for-order: Select driver for order
435
+ created-at: Created At
436
+ updated-at: Updated At
437
+ created-by: Created By
438
+ updated-by: Updated By
439
+ select-user: Select user
440
+ view-order: View Order
441
+ cancel-order: Cancel Order
442
+ delete-order: Delete Order
443
+ view:
444
+ route-panel-title: Route
445
+ comments-title: Comments
446
+ notes-title: Notes
447
+ dispatch: Dispatch
448
+ unassign-driver: Unassign Driver
449
+ assign-driver: Assign Driver
450
+ cancel-order: Cancel Order
451
+ delete-order: Delete Order
452
+ activity: Activity
453
+ unable-load-order-activity: Unable to load order activity
454
+ ad-hoc: Ad-Hoc
455
+ customer: Customer
456
+ facilitator: Facilitator
457
+ driver-assigned: Driver Assigned
458
+ change-driver: Change Driver
459
+ tracking-number: Tracking Number
460
+ date-scheduled: Date Scheduled
461
+ date-dispatched: Date Dispatched
462
+ date-started: Date Started
463
+ order-details-title: Order Details
464
+ route: Route
465
+ pickup: Pickup
466
+ dropoff: Dropoff
467
+ return: Return
468
+ order-summary: Order Summary
469
+ subtotal: Subtotal
470
+ delivery-fee: Delivery fee
471
+ tip: Tip
472
+ delivery-tip: Delivery Tip
473
+ total: Total
474
+ payload: Payload
475
+ items-drop: Items drop at
476
+ tracking: Tracking
477
+ view-activity: View Activity
478
+ order-metadata: Order Metadata
479
+ unassign-title: Are you sure you wish to unassing the driver ({driverName}) from this order?
480
+ unassign-body: Once the driver is unassigned, the driver will no longer have access to this orders details.
481
+ unassign-success: Driver has been unassigned from this order.
482
+ route-error: Route optimization failed, check route entry and try again.
483
+ invalid-warning: Invalid custom status entry.
484
+ change-order: Change order driver
485
+ assign-order: Assign driver to order
486
+ assign-success: '{orderId} assigned driver updated.'
487
+ order-title: Order Label
488
+ waypoint-title: Waypoint Label
489
+ proof-of-delivery: Proof of Delivery
490
+ notes-placeholder: Enter order notes here....
491
+ save-order-note: Save Order Note
492
+ order-notes-updated: Order notes updated.
493
+ products:
435
494
  index:
436
495
  manage-addons: Manage Addons
496
+ manage-addons-dialog:
497
+ manage-addons-title: Manage Product Addon Categories & Options
498
+ manage-addons-accept-button: Save Changes
437
499
  done: Done
438
500
  create-new-product-category: Create a new product category
439
501
  product-category-created-success: New product category created.
@@ -443,7 +505,7 @@ storefront:
443
505
  products-success-message: Successfully imported {resultsLength} products...
444
506
  delete-product: Are you sure you wish to delete this product?
445
507
  body-warning: Warning! Once this product is deleted it will no longer be accessible.
446
- aside-scroller:
508
+ aside-scroller:
447
509
  title: Product Categories
448
510
  custom-top-item-text: All Products
449
511
  import-products-success-message: Successfully imported {resultsLength} products...
@@ -456,13 +518,13 @@ storefront:
456
518
  warning-only-select-an-image-file-to-be-primary: You can only select an image file to be primary!
457
519
  made-the-primary-success-image: >-
458
520
  {fileName} was made the primary image.
459
- title: Product is not saved!
521
+ title: Product is not saved!
460
522
  body: Going back will cancel this product creation, if you continue all input fields will be cleared!
461
523
  select-addon-categories: Select addon categories
462
524
  add-new-product-variant: Add new product variant
463
525
  edit-product-variant: Edit product variant
464
526
  untitled-field: Untitled Field
465
- category:
527
+ category:
466
528
  category: category
467
529
  title: Product is not saved!
468
530
  body: Warning! Deleting this category will also remove all products listed under this category.
@@ -471,7 +533,7 @@ storefront:
471
533
  category-changes-saved-success: Category changes saved.
472
534
  delete-product: Are you sure you wish to delete this product?
473
535
  body-warning: Warning! Once this product is deleted it will no longer be accessible.
474
- settings:
536
+ settings:
475
537
  api:
476
538
  api-settings: API Settings
477
539
  access-key-for-storefront-api-integrations: Access key for Storefront API & Integrations.
@@ -539,7 +601,7 @@ storefront:
539
601
  enable-tip: Enable tips
540
602
  enable-integrated-vendors: Enable integrated vendors
541
603
  save-changes: Save Changes
542
- locations:
604
+ locations:
543
605
  new-store-location: New store location
544
606
  add-new-location: Add new Location
545
607
  edit-store-location: Edit store location
@@ -567,7 +629,7 @@ storefront:
567
629
  notification-storefront: Configure notification channels for your storefront, each notification channel additionally can have it's own rules and options.
568
630
  new-channel: New channel
569
631
  service:
570
- storefront:
632
+ storefront:
571
633
  new-incoming-order: You have a new incoming order!
572
634
  accept-order: Accept Order
573
635
  decline-order: Decline Order
@@ -575,5 +637,5 @@ storefront:
575
637
  storefront-has-been-create-success: Your new storefront has been created!
576
638
  create-new-storefront: Create a new Storefront
577
639
  storefront-create-success: Your new storefront has been created!
578
- application:
640
+ application:
579
641
  launch-app: Launch App