@fleetbase/fleetops-engine 0.4.4 → 0.4.6

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 (103) hide show
  1. package/README.md +1 -1
  2. package/addon/components/contact-form-panel.hbs +1 -0
  3. package/addon/components/driver-panel.hbs +1 -0
  4. package/addon/components/edit-order-route-panel.hbs +1 -0
  5. package/addon/components/fleet-form-panel.hbs +1 -0
  6. package/addon/components/fleet-panel.hbs +1 -0
  7. package/addon/components/fuel-report-form-panel.hbs +1 -0
  8. package/addon/components/fuel-report-panel.hbs +1 -0
  9. package/addon/components/issue-form-panel.hbs +1 -0
  10. package/addon/components/issue-panel.hbs +1 -0
  11. package/addon/components/place-form-panel.hbs +1 -0
  12. package/addon/components/place-panel.hbs +1 -0
  13. package/addon/components/vehicle-form-panel.hbs +1 -0
  14. package/addon/components/vehicle-panel.hbs +1 -0
  15. package/addon/components/vendor-form-panel.hbs +1 -0
  16. package/addon/components/vendor-panel.hbs +1 -0
  17. package/addon/components/widget/fleet-ops-key-metrics.hbs +19 -0
  18. package/addon/components/widget/fleet-ops-key-metrics.js +92 -0
  19. package/addon/controllers/management/contacts/index.js +3 -3
  20. package/addon/controllers/operations/orders/index.js +1 -1
  21. package/addon/engine.js +18 -12
  22. package/addon/styles/fleetops-engine.css +2 -2
  23. package/app/components/widget/{issues.js → fleet-ops-key-metrics.js} +1 -1
  24. package/composer.json +6 -6
  25. package/extension.json +1 -1
  26. package/package.json +3 -4
  27. package/server/src/Casts/MultiPolygon.php +3 -3
  28. package/server/src/Casts/Point.php +8 -4
  29. package/server/src/Casts/Polygon.php +3 -3
  30. package/server/src/Console/Commands/DispatchAdhocOrders.php +1 -1
  31. package/server/src/Events/DriverSimulatedLocationChanged.php +1 -1
  32. package/server/src/Flow/Activity.php +12 -0
  33. package/server/src/Flow/Config.php +7 -0
  34. package/server/src/Flow/Logic.php +7 -0
  35. package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -1
  36. package/server/src/Http/Controllers/Api/v1/OrderController.php +3 -3
  37. package/server/src/Http/Controllers/Api/v1/PlaceController.php +1 -1
  38. package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +1 -1
  39. package/server/src/Http/Controllers/Api/v1/TrackingStatusController.php +1 -1
  40. package/server/src/Http/Controllers/Api/v1/ZoneController.php +1 -1
  41. package/server/src/Http/Controllers/Internal/v1/DriverController.php +1 -1
  42. package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +2 -2
  43. package/server/src/Http/Controllers/Internal/v1/MetricsController.php +6 -50
  44. package/server/src/Http/Controllers/Internal/v1/OrderController.php +2 -2
  45. package/server/src/Http/Controllers/Internal/v1/PlaceController.php +1 -1
  46. package/server/src/Http/Filter/PlaceFilter.php +1 -1
  47. package/server/src/Http/Resources/v1/Driver.php +1 -1
  48. package/server/src/Http/Resources/v1/FuelReport.php +1 -1
  49. package/server/src/Http/Resources/v1/Issue.php +1 -1
  50. package/server/src/Http/Resources/v1/Payload.php +1 -0
  51. package/server/src/Http/Resources/v1/Place.php +1 -1
  52. package/server/src/Http/Resources/v1/TrackingStatus.php +1 -1
  53. package/server/src/Http/Resources/v1/Vehicle.php +1 -1
  54. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +1 -1
  55. package/server/src/Http/Resources/v1/Waypoint.php +2 -4
  56. package/server/src/Integrations/Lalamove/LalamoveDeliveryStop.php +2 -2
  57. package/server/src/Jobs/SimulateWaypointReached.php +2 -2
  58. package/server/src/Models/Contact.php +6 -18
  59. package/server/src/Models/Driver.php +7 -19
  60. package/server/src/Models/Fleet.php +6 -25
  61. package/server/src/Models/FuelReport.php +1 -1
  62. package/server/src/Models/Issue.php +1 -1
  63. package/server/src/Models/Order.php +15 -19
  64. package/server/src/Models/Payload.php +7 -7
  65. package/server/src/Models/Place.php +14 -14
  66. package/server/src/Models/Position.php +1 -1
  67. package/server/src/Models/ServiceArea.php +14 -14
  68. package/server/src/Models/TrackingNumber.php +1 -1
  69. package/server/src/Models/TrackingStatus.php +1 -1
  70. package/server/src/Models/Vehicle.php +7 -19
  71. package/server/src/Models/VehicleDeviceEvent.php +1 -1
  72. package/server/src/Models/Vendor.php +8 -25
  73. package/server/src/Models/Waypoint.php +6 -6
  74. package/server/src/Models/Zone.php +8 -8
  75. package/server/src/Observers/DriverObserver.php +1 -1
  76. package/server/src/Observers/TrackingNumberObserver.php +1 -1
  77. package/server/src/Rules/ResolvablePoint.php +1 -1
  78. package/server/src/Support/Encoding/Polyline.php +1 -1
  79. package/server/src/Support/OSRM.php +1 -1
  80. package/server/src/Support/Utils.php +60 -60
  81. package/server/src/Traits/HasTrackingNumber.php +3 -3
  82. package/server/src/routes.php +1 -4
  83. package/translations/en-us.yaml +1 -0
  84. package/addon/components/widget/fleet-ops-quickstart.hbs +0 -40
  85. package/addon/components/widget/fleet-ops-quickstart.js +0 -59
  86. package/addon/components/widget/issues.hbs +0 -1
  87. package/addon/components/widget/key-metrics.hbs +0 -121
  88. package/addon/components/widget/key-metrics.js +0 -46
  89. package/addon/components/widget/live-order-map.hbs +0 -59
  90. package/addon/components/widget/live-order-map.js +0 -11
  91. package/addon/components/widget/recent-orders.hbs +0 -35
  92. package/addon/components/widget/recent-orders.js +0 -24
  93. package/addon/components/widget/transaction-earnings.hbs +0 -1
  94. package/addon/components/widget/transactions.hbs +0 -36
  95. package/addon/components/widget/transactions.js +0 -29
  96. package/addon/components/widget/weekly-orders.hbs +0 -1
  97. package/addon/components/widget/weekly-orders.js +0 -3
  98. package/app/components/widget/key-metrics.js +0 -1
  99. package/app/components/widget/live-order-map.js +0 -1
  100. package/app/components/widget/recent-orders.js +0 -1
  101. package/app/components/widget/transaction-earnings.js +0 -1
  102. package/app/components/widget/transactions.js +0 -1
  103. package/app/components/widget/weekly-orders.js +0 -1
@@ -4,22 +4,22 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\MultiPolygon as MultiPolygonCast;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
+ use Fleetbase\LaravelMysqlSpatial\Types\LineString;
9
+ use Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon;
10
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
11
+ use Fleetbase\LaravelMysqlSpatial\Types\Polygon;
7
12
  use Fleetbase\Models\Model;
8
13
  use Fleetbase\Traits\HasApiModelBehavior;
9
14
  use Fleetbase\Traits\HasPublicId;
10
15
  use Fleetbase\Traits\HasUuid;
11
16
  use Fleetbase\Traits\SendsWebhooks;
12
17
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
- use Grimzy\LaravelMysqlSpatial\Types\LineString;
15
- use Grimzy\LaravelMysqlSpatial\Types\MultiPolygon;
16
- use Grimzy\LaravelMysqlSpatial\Types\Point;
17
- use Grimzy\LaravelMysqlSpatial\Types\Polygon;
18
18
  use Illuminate\Support\Arr;
19
19
 
20
20
  /**
21
- * @var \Grimzy\LaravelMysqlSpatial\Types\Point $location
22
- * @var \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon $border
21
+ * @var \Fleetbase\LaravelMysqlSpatial\Types\Point $location
22
+ * @var \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon $border
23
23
  */
24
24
  class ServiceArea extends Model
25
25
  {
@@ -130,10 +130,10 @@ class ServiceArea extends Model
130
130
  /**
131
131
  * Creates a polygon from a given point and radius.
132
132
  *
133
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
134
- * @param int $meters The radius in meters for the polygon. Default is 500 meters.
133
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
134
+ * @param int $meters The radius in meters for the polygon. Default is 500 meters.
135
135
  *
136
- * @return \Grimzy\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
136
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
137
137
  */
138
138
  public static function createPolygonFromPoint(Point $point, int $meters = 500): Polygon
139
139
  {
@@ -150,10 +150,10 @@ class ServiceArea extends Model
150
150
  /**
151
151
  * Creates a multi-polygon from a given point and radius.
152
152
  *
153
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the multi-polygon
154
- * @param int $meters The radius in meters for the multi-polygon. Default is 500 meters.
153
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the multi-polygon
154
+ * @param int $meters The radius in meters for the multi-polygon. Default is 500 meters.
155
155
  *
156
- * @return \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon returns a MultiPolygon object
156
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon returns a MultiPolygon object
157
157
  */
158
158
  public static function createMultiPolygonFromPoint(Point $point, int $meters = 500): MultiPolygon
159
159
  {
@@ -180,7 +180,7 @@ class ServiceArea extends Model
180
180
  /**
181
181
  * Retrieves the location attribute as a point.
182
182
  *
183
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
183
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
184
184
  */
185
185
  public function getLocationAttribute(): Point
186
186
  {
@@ -4,13 +4,13 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\Point;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasPublicId;
10
11
  use Fleetbase\Traits\HasUuid;
11
12
  use Fleetbase\Traits\SendsWebhooks;
12
13
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
14
  use Illuminate\Support\Carbon;
15
15
  use Illuminate\Support\Facades\DB;
16
16
  use Illuminate\Support\Str;
@@ -4,6 +4,7 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasMetaAttributes;
@@ -11,7 +12,6 @@ use Fleetbase\Traits\HasPublicId;
11
12
  use Fleetbase\Traits\HasUuid;
12
13
  use Fleetbase\Traits\SendsWebhooks;
13
14
  use Fleetbase\Traits\TracksApiCredential;
14
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
15
15
  use Illuminate\Support\Carbon;
16
16
  use Illuminate\Support\Str;
17
17
 
@@ -5,6 +5,7 @@ namespace Fleetbase\FleetOps\Models;
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
7
  use Fleetbase\FleetOps\Support\Utils;
8
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
9
  use Fleetbase\Models\Model;
9
10
  use Fleetbase\Traits\HasApiModelBehavior;
10
11
  use Fleetbase\Traits\HasMetaAttributes;
@@ -12,8 +13,8 @@ use Fleetbase\Traits\HasPublicId;
12
13
  use Fleetbase\Traits\HasUuid;
13
14
  use Fleetbase\Traits\Searchable;
14
15
  use Fleetbase\Traits\TracksApiCredential;
15
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
16
16
  use Illuminate\Support\Str;
17
+ use Spatie\Activitylog\LogOptions;
17
18
  use Spatie\Activitylog\Traits\LogsActivity;
18
19
  use Spatie\Sluggable\HasSlug;
19
20
  use Spatie\Sluggable\SlugOptions;
@@ -66,25 +67,12 @@ class Vehicle extends Model
66
67
  protected $with = [];
67
68
 
68
69
  /**
69
- * Properties which activity needs to be logged.
70
- *
71
- * @var array
70
+ * Get the activity log options for the model.
72
71
  */
73
- protected static $logAttributes = '*';
74
-
75
- /**
76
- * Do not log empty changed.
77
- *
78
- * @var bool
79
- */
80
- protected static $submitEmptyLogs = false;
81
-
82
- /**
83
- * The name of the subject to log.
84
- *
85
- * @var string
86
- */
87
- protected static $logName = 'vehicle';
72
+ public function getActivitylogOptions(): LogOptions
73
+ {
74
+ return LogOptions::defaults()->logOnly(['*'])->logOnlyDirty();
75
+ }
88
76
 
89
77
  /**
90
78
  * Get the options for generating the slug.
@@ -4,12 +4,12 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasUuid;
10
11
  use Fleetbase\Traits\Searchable;
11
12
  use Fleetbase\Traits\TracksApiCredential;
12
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
13
13
 
14
14
  class VehicleDeviceEvent extends Model
15
15
  {
@@ -11,6 +11,7 @@ use Fleetbase\Traits\HasUuid;
11
11
  use Fleetbase\Traits\Searchable;
12
12
  use Fleetbase\Traits\TracksApiCredential;
13
13
  use Illuminate\Notifications\Notifiable;
14
+ use Spatie\Activitylog\LogOptions;
14
15
  use Spatie\Activitylog\Traits\LogsActivity;
15
16
  use Spatie\Sluggable\HasSlug;
16
17
  use Spatie\Sluggable\SlugOptions;
@@ -106,32 +107,14 @@ class Vendor extends Model
106
107
  protected $with = ['place'];
107
108
 
108
109
  /**
109
- * Properties which activity needs to be logged.
110
- *
111
- * @var array
110
+ * Get the activity log options for the model.
112
111
  */
113
- protected static $logAttributes = ['name', 'email', 'website_url', 'phone', 'country', 'status', 'type', 'logo_uuid', 'company_uuid'];
114
-
115
- /**
116
- * Do not log empty changed.
117
- *
118
- * @var bool
119
- */
120
- protected static $submitEmptyLogs = false;
121
-
122
- /**
123
- * We only want to log changed attributes.
124
- *
125
- * @var bool
126
- */
127
- protected static $logOnlyDirty = true;
128
-
129
- /**
130
- * The name of the subject to log.
131
- *
132
- * @var string
133
- */
134
- protected static $logName = 'vendor';
112
+ public function getActivitylogOptions(): LogOptions
113
+ {
114
+ return LogOptions::defaults()
115
+ ->logOnly(['name', 'email', 'website_url', 'phone', 'country', 'status', 'type', 'logo_uuid', 'company_uuid'])
116
+ ->logOnlyDirty();
117
+ }
135
118
 
136
119
  /**
137
120
  * Get the options for generating the slug.
@@ -86,7 +86,7 @@ class Waypoint extends Model
86
86
  /**
87
87
  * @return \Illuminate\Database\Eloquent\Relations\HasMany
88
88
  */
89
- public function entities()
89
+ public function entities()
90
90
  {
91
91
  return $this->hasMany(Entity::class, 'destination_uuid', 'place_uuid')->where('payload_uuid', $this->payload_uuid);
92
92
  }
@@ -97,16 +97,16 @@ class Waypoint extends Model
97
97
  public function label()
98
98
  {
99
99
  $this->load(['trackingNumber', 'company', 'place', 'entities']);
100
-
100
+
101
101
  // $entities = Entity::where(['payload_uuid' => $this->payload_uuid, 'destination_uuid' => $this->place_uuid])->get();
102
102
  // dd($entities, );
103
103
 
104
104
  return view('fleetops::labels/waypoint-label', [
105
105
  'waypoint' => $this,
106
- 'dropoff' => $this->place,
107
- 'entities' => $this->entities()->get(),
108
- 'trackingNumber' => $this->trackingNumber,
109
- 'company' => $this->company,
106
+ 'dropoff' => $this->place,
107
+ 'entities' => $this->entities()->get(),
108
+ 'trackingNumber' => $this->trackingNumber,
109
+ 'company' => $this->company,
110
110
  ])->render();
111
111
  }
112
112
 
@@ -4,16 +4,16 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\Polygon as PolygonCast;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
+ use Fleetbase\LaravelMysqlSpatial\Types\LineString;
9
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
10
+ use Fleetbase\LaravelMysqlSpatial\Types\Polygon;
7
11
  use Fleetbase\Models\Model;
8
12
  use Fleetbase\Traits\HasApiModelBehavior;
9
13
  use Fleetbase\Traits\HasPublicId;
10
14
  use Fleetbase\Traits\HasUuid;
11
15
  use Fleetbase\Traits\SendsWebhooks;
12
16
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
- use Grimzy\LaravelMysqlSpatial\Types\LineString;
15
- use Grimzy\LaravelMysqlSpatial\Types\Point;
16
- use Grimzy\LaravelMysqlSpatial\Types\Polygon;
17
17
  use Illuminate\Support\Arr;
18
18
 
19
19
  class Zone extends Model
@@ -104,7 +104,7 @@ class Zone extends Model
104
104
  /**
105
105
  * Retrieves the location attribute as a point.
106
106
  *
107
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
107
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
108
108
  */
109
109
  public function getLocationAttribute(): Point
110
110
  {
@@ -195,10 +195,10 @@ class Zone extends Model
195
195
  /**
196
196
  * Creates a polygon from a given point and radius.
197
197
  *
198
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
199
- * @param int $meters The radius in meters for the polygon. Default is 500 meters.
198
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
199
+ * @param int $meters The radius in meters for the polygon. Default is 500 meters.
200
200
  *
201
- * @return \Grimzy\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
201
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
202
202
  */
203
203
  public static function createPolygonFromPoint(Point $point, int $meters = 500): Polygon
204
204
  {
@@ -4,9 +4,9 @@ namespace Fleetbase\FleetOps\Observers;
4
4
 
5
5
  use Fleetbase\FleetOps\Models\Driver;
6
6
  use Fleetbase\FleetOps\Models\Order;
7
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
7
8
  use Fleetbase\Models\CompanyUser;
8
9
  use Fleetbase\Models\User;
9
- use Grimzy\LaravelMysqlSpatial\Types\Point;
10
10
 
11
11
  class DriverObserver
12
12
  {
@@ -4,7 +4,7 @@ namespace Fleetbase\FleetOps\Observers;
4
4
 
5
5
  use Fleetbase\FleetOps\Models\TrackingNumber;
6
6
  use Fleetbase\FleetOps\Models\TrackingStatus;
7
- use Grimzy\LaravelMysqlSpatial\Types\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
8
8
  use Illuminate\Support\Str;
9
9
  use Milon\Barcode\Facades\DNS2DFacade as DNS2D;
10
10
 
@@ -19,7 +19,7 @@ class ResolvablePoint implements Rule
19
19
  try {
20
20
  $point = Utils::getPointFromMixed($value);
21
21
 
22
- return $point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point;
22
+ return $point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point;
23
23
  } catch (\Exception $e) {
24
24
  return false;
25
25
  }
@@ -125,7 +125,7 @@ class Polyline
125
125
  $lng = $number * 1 / (10 ** static::$precision); // Using ** operator for pow
126
126
  } else {
127
127
  $lat = $number * 1 / (10 ** static::$precision);
128
- $points[] = new \Grimzy\LaravelMysqlSpatial\Types\Point($lat, $lng); // Create Point object and add to the array
128
+ $points[] = new \Fleetbase\LaravelMysqlSpatial\Types\Point($lat, $lng); // Create Point object and add to the array
129
129
  }
130
130
 
131
131
  $index++;
@@ -3,7 +3,7 @@
3
3
  namespace Fleetbase\FleetOps\Support;
4
4
 
5
5
  use Fleetbase\FleetOps\Support\Encoding\Polyline;
6
- use Grimzy\LaravelMysqlSpatial\Types\Point;
6
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
7
7
  use Illuminate\Support\Facades\Cache;
8
8
  use Illuminate\Support\Facades\Http;
9
9