@fleetbase/fleetops-engine 0.4.18 → 0.4.20

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 (84) hide show
  1. package/addon/components/activity-event-selector.js +1 -1
  2. package/addon/components/activity-form-panel.hbs +19 -0
  3. package/addon/components/activity-form-panel.js +20 -2
  4. package/addon/components/activity-logic-builder.js +1 -1
  5. package/addon/components/admin/navigator-app.hbs +77 -1
  6. package/addon/components/admin/navigator-app.js +65 -12
  7. package/addon/components/contact-form-panel.js +2 -2
  8. package/addon/components/contact-panel.js +2 -2
  9. package/addon/components/custom-field-form-panel.js +2 -2
  10. package/addon/components/driver-form-panel.js +2 -2
  11. package/addon/components/driver-panel.js +2 -2
  12. package/addon/components/edit-order-route-panel.js +2 -2
  13. package/addon/components/fleet-form-panel.js +2 -2
  14. package/addon/components/fleet-panel/driver-listing.js +1 -1
  15. package/addon/components/fleet-panel/vehicle-listing.js +1 -1
  16. package/addon/components/fleet-panel.js +2 -2
  17. package/addon/components/fuel-report-form-panel.js +2 -2
  18. package/addon/components/fuel-report-panel.js +2 -2
  19. package/addon/components/issue-form-panel.js +2 -2
  20. package/addon/components/issue-panel.js +2 -2
  21. package/addon/components/live-map-drawer.js +2 -2
  22. package/addon/components/live-map.js +14 -7
  23. package/addon/components/order-config-manager/activity-flow.js +1 -1
  24. package/addon/components/order-config-manager/custom-fields.js +1 -1
  25. package/addon/components/order-config-manager/entities.js +1 -1
  26. package/addon/components/order-config-manager-overlay.js +1 -1
  27. package/addon/components/order-config-manager.js +2 -2
  28. package/addon/components/place-form-panel.js +2 -2
  29. package/addon/components/place-panel.js +2 -2
  30. package/addon/components/vehicle-form-panel.js +2 -2
  31. package/addon/components/vehicle-panel.js +2 -2
  32. package/addon/components/vendor-form-panel/create-form.js +1 -1
  33. package/addon/components/vendor-form-panel.js +2 -2
  34. package/addon/components/vendor-panel.js +2 -2
  35. package/addon/controllers/operations/orders/index/new.js +5 -0
  36. package/addon/controllers/operations/service-rates/index/new.js +23 -2
  37. package/addon/routes/operations/service-rates/index/edit.js +14 -5
  38. package/addon/routes/operations/service-rates/index/new.js +2 -6
  39. package/addon/services/location.js +54 -44
  40. package/addon/templates/operations/service-rates/index/new.hbs +10 -1
  41. package/composer.json +2 -2
  42. package/extension.json +1 -1
  43. package/package.json +3 -3
  44. package/server/config/fleetops.php +127 -4
  45. package/server/migrations/2024_03_13_061249_add_order_config_uuid_column_to_service_rates_table.php +28 -0
  46. package/server/src/Console/Commands/FixLegacyOrderConfigs.php +17 -11
  47. package/server/src/Http/Controllers/Api/v1/DriverController.php +0 -1
  48. package/server/src/Http/Controllers/Api/v1/OrderController.php +49 -2
  49. package/server/src/Http/Controllers/Api/v1/ServiceQuoteController.php +10 -5
  50. package/server/src/Http/Controllers/Internal/v1/ServiceRateController.php +3 -0
  51. package/server/src/Http/Controllers/Internal/v1/SettingController.php +20 -0
  52. package/server/src/Http/Filter/ContactFilter.php +5 -0
  53. package/server/src/Http/Filter/DriverFilter.php +5 -0
  54. package/server/src/Http/Filter/EntityFilter.php +18 -0
  55. package/server/src/Http/Filter/FleetFilter.php +5 -0
  56. package/server/src/Http/Filter/FuelReportFilter.php +5 -0
  57. package/server/src/Http/Filter/IssueFilter.php +5 -0
  58. package/server/src/Http/Filter/OrderConfigFilter.php +5 -0
  59. package/server/src/Http/Filter/OrderFilter.php +5 -0
  60. package/server/src/Http/Filter/PayloadFilter.php +18 -0
  61. package/server/src/Http/Filter/PlaceFilter.php +5 -0
  62. package/server/src/Http/Filter/PurchaseRateFilter.php +18 -0
  63. package/server/src/Http/Filter/ServiceAreaFilter.php +5 -0
  64. package/server/src/Http/Filter/ServiceQuoteFilter.php +5 -0
  65. package/server/src/Http/Filter/ServiceRateFilter.php +5 -0
  66. package/server/src/Http/Filter/TrackingNumberFilter.php +18 -0
  67. package/server/src/Http/Filter/TrackingStatusFilter.php +5 -0
  68. package/server/src/Http/Filter/VehicleFilter.php +5 -0
  69. package/server/src/Http/Filter/VendorFilter.php +5 -0
  70. package/server/src/Http/Filter/ZoneFilter.php +5 -0
  71. package/server/src/Http/Requests/CreateOrderRequest.php +32 -13
  72. package/server/src/Http/Requests/Internal/CreateOrderRequest.php +41 -10
  73. package/server/src/Http/Resources/v1/Order.php +1 -0
  74. package/server/src/Http/Resources/v1/ServiceRate.php +34 -31
  75. package/server/src/Models/Driver.php +1 -1
  76. package/server/src/Models/ServiceRate.php +9 -0
  77. package/server/src/Providers/FleetOpsServiceProvider.php +3 -3
  78. package/server/src/Support/Utils.php +40 -14
  79. package/server/src/routes.php +3 -0
  80. package/translations/en-us.yaml +9 -1
  81. package/addon/utils/apply-context-component-arguments.js +0 -33
  82. package/addon/utils/context-component-callback.js +0 -16
  83. package/app/utils/apply-context-component-arguments.js +0 -1
  84. package/app/utils/context-component-callback.js +0 -1
@@ -39,6 +39,9 @@ class ServiceRateController extends FleetOpsController
39
39
  $waypoints,
40
40
  function ($query) use ($request) {
41
41
  $query->where('company_uuid', $request->session()->get('company'));
42
+ if ($request->filled('service_type')) {
43
+ $query->where('service_type', $request->input('service_type'));
44
+ }
42
45
  }
43
46
  );
44
47
 
@@ -47,4 +47,24 @@ class SettingController extends Controller
47
47
 
48
48
  return response()->json(['visibilitySettings' => $visibilitySettings]);
49
49
  }
50
+
51
+ public function saveEntityEditingSettings(Request $request)
52
+ {
53
+ $entityEditingSettings = $request->input('entityEditingSettings', []);
54
+ $isEntityFieldsEditable = $request->boolean('isEntityFieldsEditable');
55
+
56
+ // Save entity editing settings
57
+ Setting::configure('fleet-ops.entity-editing-settings', $entityEditingSettings);
58
+ Setting::configure('fleet-ops.entity-fields-editable', $isEntityFieldsEditable);
59
+
60
+ return response()->json(['entityEditingSettings' => $entityEditingSettings, 'isEntityFieldsEditable' => $isEntityFieldsEditable]);
61
+ }
62
+
63
+ public function getEntityEditingSettings()
64
+ {
65
+ $entityEditingSettings = Setting::where('key', 'fleet-ops.entity-editing-settings')->value('value');
66
+ $isEntityFieldsEditable = Setting::where('key', 'fleet-ops.entity-fields-editable')->value('value');
67
+
68
+ return response()->json(['entityEditingSettings' => $entityEditingSettings, 'isEntityFieldsEditable' => $isEntityFieldsEditable]);
69
+ }
50
70
  }
@@ -22,6 +22,11 @@ class ContactFilter extends Filter
22
22
  );
23
23
  }
24
24
 
25
+ public function queryForPublic()
26
+ {
27
+ $this->builder->where('company_uuid', $this->session->get('company'));
28
+ }
29
+
25
30
  public function query(?string $searchQuery)
26
31
  {
27
32
  $this->builder->search($searchQuery);
@@ -23,6 +23,11 @@ class DriverFilter extends Filter
23
23
  );
24
24
  }
25
25
 
26
+ public function queryForPublic()
27
+ {
28
+ $this->queryForInternal();
29
+ }
30
+
26
31
  public function query(?string $searchQuery)
27
32
  {
28
33
  $this->builder->where(function ($query) use ($searchQuery) {
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\FleetOps\Http\Filter;
4
+
5
+ use Fleetbase\Http\Filter\Filter;
6
+
7
+ class EntityFilter extends Filter
8
+ {
9
+ public function queryForInternal()
10
+ {
11
+ $this->builder->where('company_uuid', $this->session->get('company'));
12
+ }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+ }
@@ -12,6 +12,11 @@ class FleetFilter extends Filter
12
12
  $this->builder->where('company_uuid', $this->session->get('company'))->with(['serviceArea', 'zone']);
13
13
  }
14
14
 
15
+ public function queryForPublic()
16
+ {
17
+ $this->builder->where('company_uuid', $this->session->get('company'));
18
+ }
19
+
15
20
  public function query(?string $searchQuery)
16
21
  {
17
22
  $this->builder->where(function ($query) use ($searchQuery) {
@@ -13,6 +13,11 @@ class FuelReportFilter extends Filter
13
13
  $this->builder->where('company_uuid', $this->session->get('company'));
14
14
  }
15
15
 
16
+ public function queryForPublic()
17
+ {
18
+ $this->builder->where('company_uuid', $this->session->get('company'));
19
+ }
20
+
16
21
  public function query(?string $searchQuery)
17
22
  {
18
23
  $this->builder->search($searchQuery);
@@ -13,6 +13,11 @@ class IssueFilter extends Filter
13
13
  $this->builder->where('company_uuid', $this->session->get('company'));
14
14
  }
15
15
 
16
+ public function queryForPublic()
17
+ {
18
+ $this->builder->where('company_uuid', $this->session->get('company'));
19
+ }
20
+
16
21
  public function query(?string $searchQuery)
17
22
  {
18
23
  $this->builder->search($searchQuery);
@@ -10,4 +10,9 @@ class OrderConfigFilter extends Filter
10
10
  {
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
13
18
  }
@@ -36,6 +36,11 @@ class OrderFilter extends Filter
36
36
  );
37
37
  }
38
38
 
39
+ public function queryForPublic()
40
+ {
41
+ $this->builder->where('company_uuid', $this->session->get('company'))->whereHas('trackingNumber')->whereHas('payload');
42
+ }
43
+
39
44
  public function unassigned(bool $unassigned)
40
45
  {
41
46
  if ($unassigned) {
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\FleetOps\Http\Filter;
4
+
5
+ use Fleetbase\Http\Filter\Filter;
6
+
7
+ class PayloadFilter extends Filter
8
+ {
9
+ public function queryForInternal()
10
+ {
11
+ $this->builder->where('company_uuid', $this->session->get('company'));
12
+ }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+ }
@@ -15,6 +15,11 @@ class PlaceFilter extends Filter
15
15
  $this->builder->where('company_uuid', $this->session->get('company'));
16
16
  }
17
17
 
18
+ public function queryForPublic()
19
+ {
20
+ $this->builder->where('company_uuid', $this->session->get('company'));
21
+ }
22
+
18
23
  public function query(?string $searchQuery)
19
24
  {
20
25
  $this->builder->search($searchQuery);
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\FleetOps\Http\Filter;
4
+
5
+ use Fleetbase\Http\Filter\Filter;
6
+
7
+ class PurchaseRateFilter extends Filter
8
+ {
9
+ public function queryForInternal()
10
+ {
11
+ $this->builder->where('company_uuid', $this->session->get('company'));
12
+ }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+ }
@@ -10,4 +10,9 @@ class ServiceAreaFilter extends Filter
10
10
  {
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
13
18
  }
@@ -10,4 +10,9 @@ class ServiceQuoteFilter extends Filter
10
10
  {
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
13
18
  }
@@ -11,6 +11,11 @@ class ServiceRateFilter extends Filter
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
13
 
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+
14
19
  public function serviceArea(?string $serviceArea)
15
20
  {
16
21
  $this->builder->whereHas(
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\FleetOps\Http\Filter;
4
+
5
+ use Fleetbase\Http\Filter\Filter;
6
+
7
+ class TrackingNumberFilter extends Filter
8
+ {
9
+ public function queryForInternal()
10
+ {
11
+ $this->builder->where('company_uuid', $this->session->get('company'));
12
+ }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+ }
@@ -11,6 +11,11 @@ class TrackingStatusFilter extends Filter
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
13
 
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
18
+
14
19
  public function trackingNumber(string $trackingNumber)
15
20
  {
16
21
  $this->builder->whereHas('trackingNumber', function ($query) use ($trackingNumber) {
@@ -12,6 +12,11 @@ class VehicleFilter extends Filter
12
12
  $this->builder->where('company_uuid', $this->session->get('company'));
13
13
  }
14
14
 
15
+ public function queryForPublic()
16
+ {
17
+ $this->builder->where('company_uuid', $this->session->get('company'));
18
+ }
19
+
15
20
  public function query(?string $query)
16
21
  {
17
22
  $this->builder->search($query);
@@ -12,6 +12,11 @@ class VendorFilter extends Filter
12
12
  $this->builder->where('company_uuid', $this->session->get('company'));
13
13
  }
14
14
 
15
+ public function queryForPublic()
16
+ {
17
+ $this->builder->where('company_uuid', $this->session->get('company'));
18
+ }
19
+
15
20
  public function query(?string $searchQuery)
16
21
  {
17
22
  $this->builder->search($searchQuery);
@@ -10,4 +10,9 @@ class ZoneFilter extends Filter
10
10
  {
11
11
  $this->builder->where('company_uuid', $this->session->get('company'));
12
12
  }
13
+
14
+ public function queryForPublic()
15
+ {
16
+ $this->builder->where('company_uuid', $this->session->get('company'));
17
+ }
13
18
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  namespace Fleetbase\FleetOps\Http\Requests;
4
4
 
5
+ use Fleetbase\FleetOps\Support\Utils;
5
6
  use Fleetbase\Http\Requests\FleetbaseRequest;
6
7
  use Fleetbase\Rules\ExistsInAny;
7
8
 
@@ -25,21 +26,26 @@ class CreateOrderRequest extends FleetbaseRequest
25
26
  public function rules()
26
27
  {
27
28
  $validations = [
28
- 'adhoc' => 'in:true,false,1,0',
29
- 'dispatch' => ['nullable', 'boolean'],
30
- 'adhoc_distance' => 'numeric',
31
- 'pod_required' => 'in:true,false,1,0',
32
- 'pod_method' => 'in:' . config('api.pod_methods'),
33
- 'scheduled_at' => ['nullable', 'date'],
34
- 'driver' => 'nullable|exists:drivers,public_id',
35
- 'service_quote' => 'nullable|exists:service_quotes,public_id',
36
- 'purchase_rate' => 'nullable|exists:purchase_rates,public_id',
37
- 'facilitator' => ['nullable', new ExistsInAny(['vendors', 'contacts', 'integrated_vendors'], ['public_id', 'provider'])],
38
- 'customer' => ['nullable', new ExistsInAny(['vendors', 'contacts'], 'public_id')],
39
- 'status' => 'string',
40
- 'type' => 'string',
29
+ 'adhoc' => ['nullable', 'boolean'],
30
+ 'dispatch' => ['nullable', 'boolean'],
31
+ 'adhoc_distance' => ['nullable', 'numeric'],
32
+ 'pod_required' => ['nullable', 'boolean'],
33
+ 'pod_method' => ['nullable', 'in:' . config('fleetops.pod_methods')],
34
+ 'scheduled_at' => ['nullable', 'date'],
35
+ 'driver' => ['nullable', 'exists:drivers,public_id'],
36
+ 'service_quote' => ['nullable', 'exists:service_quotes,public_id'],
37
+ 'purchase_rate' => ['nullable', 'exists:purchase_rates,public_id'],
38
+ 'facilitator' => ['nullable', new ExistsInAny(['vendors', 'contacts', 'integrated_vendors'], ['public_id', 'provider'])],
39
+ 'customer' => ['nullable', new ExistsInAny(['vendors', 'contacts'], 'public_id')],
40
+ 'status' => ['nullable', 'string'],
41
+ 'type' => ['string'],
41
42
  ];
42
43
 
44
+ // Conditionally require 'pod_method' if 'pod_required' is truthy
45
+ if (Utils::isTrue($this->input('pod_required'))) {
46
+ $validations['pod_method'] = ['required', 'in:' . implode(',', config('fleetops.pod_methods'))];
47
+ }
48
+
43
49
  if ($this->has('payload')) {
44
50
  $validations['payload.entities'] = 'array';
45
51
  $validations['payload.waypoints'] = 'array';
@@ -77,4 +83,17 @@ class CreateOrderRequest extends FleetbaseRequest
77
83
 
78
84
  return $validations;
79
85
  }
86
+
87
+ /**
88
+ * Get custom attributes for validator errors.
89
+ *
90
+ * @return array<string, string>
91
+ */
92
+ public function attributes(): array
93
+ {
94
+ return [
95
+ 'pod_required' => 'proof of delivery required',
96
+ 'pod_method' => 'proof of delivery method',
97
+ ];
98
+ }
80
99
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  namespace Fleetbase\FleetOps\Http\Requests\Internal;
4
4
 
5
+ use Fleetbase\FleetOps\Support\Utils;
5
6
  use Fleetbase\Http\Requests\FleetbaseRequest;
6
7
  use Fleetbase\Rules\ExistsInAny;
7
8
 
@@ -25,22 +26,27 @@ class CreateOrderRequest extends FleetbaseRequest
25
26
  public function rules()
26
27
  {
27
28
  $validations = [
28
- 'order_config_uuid' => 'required',
29
- // 'adhoc' => 'in:true,false,1,0',
29
+ 'order_config_uuid' => ['required'],
30
+ 'adhoc' => ['nullable', 'boolean'],
30
31
  'dispatch' => ['nullable', 'boolean'],
31
- // 'adhoc_distance' => 'numeric',
32
- 'pod_required' => 'in:true,false,1,0',
33
- 'pod_method' => 'in:' . config('api.pod_methods'),
32
+ 'adhoc_distance' => ['nullable', 'numeric'],
33
+ 'pod_required' => ['nullable', 'boolean'],
34
+ 'pod_method' => ['nullable', 'in:' . config('fleetops.pod_methods')],
34
35
  'scheduled_at' => ['nullable', 'date'],
35
- 'driver' => 'nullable|exists:drivers,uuid',
36
- 'service_quote' => 'nullable|exists:service_quotes,uuid',
37
- 'purchase_rate' => 'nullable|exists:purchase_rates,uuid',
36
+ 'driver' => ['nullable', 'exists:drivers,uuid'],
37
+ 'service_quote' => ['nullable', 'exists:service_quotes,uuid'],
38
+ 'purchase_rate' => ['nullable', 'exists:purchase_rates,uuid'],
38
39
  'facilitator' => ['nullable', new ExistsInAny(['vendors', 'contacts', 'integrated_vendors'], ['uuid', 'provider'])],
39
40
  'customer' => ['nullable', new ExistsInAny(['vendors', 'contacts'], 'uuid')],
40
- 'status' => 'nullable|string',
41
- 'type' => 'string',
41
+ 'status' => ['nullable', 'string'],
42
+ 'type' => ['string'],
42
43
  ];
43
44
 
45
+ // Conditionally require 'pod_method' if 'pod_required' is truthy
46
+ if (Utils::isTrue($this->input('order.pod_required'))) {
47
+ $validations['pod_method'] = ['required', 'in:' . config('fleetops.pod_methods')];
48
+ }
49
+
44
50
  if ($this->has('payload')) {
45
51
  $validations['payload.entities'] = 'array';
46
52
  $validations['payload.waypoints'] = 'array';
@@ -63,4 +69,29 @@ class CreateOrderRequest extends FleetbaseRequest
63
69
 
64
70
  return $validations;
65
71
  }
72
+
73
+ /**
74
+ * Get the error messages for the defined validation rules.
75
+ *
76
+ * @return array<string, string>
77
+ */
78
+ public function messages(): array
79
+ {
80
+ return [
81
+ 'pod_method.required' => 'A proof of delivery method is required.',
82
+ ];
83
+ }
84
+
85
+ /**
86
+ * Get custom attributes for validator errors.
87
+ *
88
+ * @return array<string, string>
89
+ */
90
+ public function attributes(): array
91
+ {
92
+ return [
93
+ 'pod_required' => 'proof of delivery required',
94
+ 'pod_method' => 'proof of delivery method',
95
+ ];
96
+ }
66
97
  }
@@ -39,6 +39,7 @@ class Order extends FleetbaseResource
39
39
  'service_quote_uuid' => $this->when(Http::isInternalRequest(), $this->service_quote_uuid),
40
40
  'has_driver_assigned' => $this->when(Http::isInternalRequest(), $this->has_driver_assigned),
41
41
  'is_scheduled' => $this->when(Http::isInternalRequest(), $this->is_scheduled),
42
+ 'order_config_id' => $this->when(Http::isInternalRequest(), $this->order_config_id),
42
43
  'order_config' => $this->when(Http::isInternalRequest(), $this->whenLoaded('orderConfig', $this->orderConfig), data_get($this->orderConfig, 'public_id')),
43
44
  'custom_field_values' => $this->when(Http::isInternalRequest(), $this->customFieldValues),
44
45
  'customer' => $this->setCustomerType(Resolve::resourceForMorph($this->customer_type, $this->customer_uuid)),
@@ -18,37 +18,40 @@ class ServiceRate extends FleetbaseResource
18
18
  public function toArray($request)
19
19
  {
20
20
  return [
21
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
- 'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
25
- 'service_area_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceArea.name')),
26
- 'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
27
- 'zone_name' => $this->when(Http::isInternalRequest(), data_get($this, 'zone.name')),
28
- 'service_name' => $this->service_name,
29
- 'service_type' => $this->service_type,
30
- 'base_fee' => $this->base_fee,
31
- 'rate_calculation_method' => $this->rate_calculation_method,
32
- 'per_meter_flat_rate_fee' => $this->per_meter_flat_rate_fee,
33
- 'per_meter_unit' => $this->per_meter_unit,
34
- 'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
35
- 'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
36
- 'algorithm' => $this->algorithm,
37
- 'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
38
- 'cod_calculation_method' => $this->cod_calculation_method,
39
- 'cod_flat_fee' => $this->cod_flat_fee,
40
- 'cod_percent' => $this->cod_percent,
41
- 'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
42
- 'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
43
- 'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
44
- 'peak_hours_percent' => $this->peak_hours_percent,
45
- 'peak_hours_start' => $this->peak_hours_start,
46
- 'peak_hours_end' => $this->peak_hours_end,
47
- 'currency' => $this->currency,
48
- 'duration_terms' => $this->duration_terms,
49
- 'estimated_days' => $this->estimated_days,
50
- 'updated_at' => $this->updated_at,
51
- 'created_at' => $this->created_at,
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'service_area_uuid' => $this->when(Http::isInternalRequest(), $this->service_area_uuid),
24
+ 'zone_uuid' => $this->when(Http::isInternalRequest(), $this->zone_uuid),
25
+ 'order_config_uuid' => $this->when(Http::isInternalRequest(), $this->order_config_uuid),
26
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
27
+ 'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
28
+ 'service_area_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceArea.name')),
29
+ 'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
30
+ 'zone_name' => $this->when(Http::isInternalRequest(), data_get($this, 'zone.name')),
31
+ 'service_name' => $this->service_name,
32
+ 'service_type' => $this->service_type,
33
+ 'base_fee' => $this->base_fee,
34
+ 'rate_calculation_method' => $this->rate_calculation_method,
35
+ 'per_meter_flat_rate_fee' => $this->per_meter_flat_rate_fee,
36
+ 'per_meter_unit' => $this->per_meter_unit,
37
+ 'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
38
+ 'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
39
+ 'algorithm' => $this->algorithm,
40
+ 'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
41
+ 'cod_calculation_method' => $this->cod_calculation_method,
42
+ 'cod_flat_fee' => $this->cod_flat_fee,
43
+ 'cod_percent' => $this->cod_percent,
44
+ 'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
45
+ 'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
46
+ 'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
47
+ 'peak_hours_percent' => $this->peak_hours_percent,
48
+ 'peak_hours_start' => $this->peak_hours_start,
49
+ 'peak_hours_end' => $this->peak_hours_end,
50
+ 'currency' => $this->currency,
51
+ 'duration_terms' => $this->duration_terms,
52
+ 'estimated_days' => $this->estimated_days,
53
+ 'updated_at' => $this->updated_at,
54
+ 'created_at' => $this->created_at,
52
55
  ];
53
56
  }
54
57
 
@@ -157,7 +157,7 @@ class Driver extends Model
157
157
  *
158
158
  * @var array
159
159
  */
160
- protected $filterParams = ['vendor', 'facilitator', 'customer', 'fleet', 'photo_uuid', 'avatar_uuid'];
160
+ protected $filterParams = ['vendor', 'facilitator', 'customer', 'fleet', 'photo_uuid', 'avatar_uuid', 'avatar_value'];
161
161
 
162
162
  /**
163
163
  * Get the activity log options for the model.
@@ -53,6 +53,7 @@ class ServiceRate extends Model
53
53
  'company_uuid',
54
54
  'service_area_uuid',
55
55
  'zone_uuid',
56
+ 'order_config_uuid',
56
57
  'service_name',
57
58
  'service_type',
58
59
  'per_meter_flat_rate_fee',
@@ -124,6 +125,14 @@ class ServiceRate extends Model
124
125
  return $this->hasMany(ServiceRateParcelFee::class);
125
126
  }
126
127
 
128
+ /**
129
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
130
+ */
131
+ public function orderConfig()
132
+ {
133
+ return $this->belongsTo(OrderConfig::class)->withTrashed();
134
+ }
135
+
127
136
  /**
128
137
  * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
129
138
  */
@@ -80,9 +80,9 @@ class FleetOpsServiceProvider extends CoreServiceProvider
80
80
  $this->registerObservers();
81
81
  $this->registerCommands();
82
82
  $this->scheduleCommands(function ($schedule) {
83
- $schedule->command('fleetops:dispatch-orders')->everyMinute();
84
- $schedule->command('fleetops:dispatch-adhoc')->everyMinute();
85
- $schedule->command('fleetops:update-estimations')->everyFifteenMinutes();
83
+ $schedule->command('fleetops:dispatch-orders')->everyMinute()->withoutOverlapping()->storeOutputInDb();
84
+ $schedule->command('fleetops:dispatch-adhoc')->everyMinute()->withoutOverlapping()->storeOutputInDb();
85
+ $schedule->command('fleetops:update-estimations')->everyFiveMinutes()->withoutOverlapping();
86
86
  });
87
87
  $this->registerNotifications();
88
88
  $this->registerExpansionsFrom(__DIR__ . '/../Expansions');