@fleetbase/fleetops-engine 0.3.0 → 0.3.1

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/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/fleetops-api",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "require": {
24
24
  "php": "^7.4|^8.0",
25
- "fleetbase/core-api": "^1.3.1",
25
+ "fleetbase/core-api": "^1.3.2",
26
26
  "barryvdh/laravel-dompdf": "^2.0",
27
27
  "brick/geo": "0.7.2",
28
28
  "cknow/laravel-money": "^7.1",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Fleet-Ops",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/fleetops",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "fleet-ops",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@fleetbase/ember-core": "^0.1.6",
43
- "@fleetbase/ember-ui": "^0.2.1",
43
+ "@fleetbase/ember-ui": "^0.2.2",
44
44
  "@fleetbase/fleetops-data": "^0.1.1",
45
45
  "@fleetbase/leaflet-routing-machine": "^3.2.16",
46
46
  "@fortawesome/ember-fontawesome": "^0.4.1",
@@ -9,6 +9,7 @@ use Fleetbase\Traits\HasUuid;
9
9
  use Fleetbase\Traits\Searchable;
10
10
  use Fleetbase\Traits\SendsWebhooks;
11
11
  use Fleetbase\Traits\TracksApiCredential;
12
+ use Illuminate\Notifications\Notifiable;
12
13
  use Spatie\Activitylog\Traits\LogsActivity;
13
14
  use Spatie\Sluggable\HasSlug;
14
15
  use Spatie\Sluggable\SlugOptions;
@@ -23,6 +24,7 @@ class Fleet extends Model
23
24
  use Searchable;
24
25
  use HasSlug;
25
26
  use LogsActivity;
27
+ use Notifiable;
26
28
 
27
29
  /**
28
30
  * The database table used by the model.
@@ -30,6 +30,27 @@ class OrderAssigned extends Notification implements ShouldQueue
30
30
  */
31
31
  public $order;
32
32
 
33
+ /**
34
+ * Notification name.
35
+ *
36
+ * @var string
37
+ */
38
+ public static string $name = 'Order Assigned';
39
+
40
+ /**
41
+ * Notification description.
42
+ *
43
+ * @var string
44
+ */
45
+ public static string $description = 'Notify when an order has been assigned to a driver.';
46
+
47
+ /**
48
+ * Notification package.
49
+ *
50
+ * @var string
51
+ */
52
+ public static string $package = 'fleet-ops';
53
+
33
54
  /**
34
55
  * Create a new notification instance.
35
56
  *
@@ -30,6 +30,27 @@ class OrderCanceled extends Notification implements ShouldQueue
30
30
  */
31
31
  public $order;
32
32
 
33
+ /**
34
+ * Notification name.
35
+ *
36
+ * @var string
37
+ */
38
+ public static string $name = 'Order Canceled';
39
+
40
+ /**
41
+ * Notification description.
42
+ *
43
+ * @var string
44
+ */
45
+ public static string $description = 'Notify when an order has been canceled.';
46
+
47
+ /**
48
+ * Notification package.
49
+ *
50
+ * @var string
51
+ */
52
+ public static string $package = 'fleet-ops';
53
+
33
54
  /**
34
55
  * Create a new notification instance.
35
56
  *
@@ -29,6 +29,27 @@ class OrderDispatchFailed extends Notification implements ShouldQueue
29
29
  */
30
30
  public $reason;
31
31
 
32
+ /**
33
+ * Notification name.
34
+ *
35
+ * @var string
36
+ */
37
+ public static string $name = 'Order dispatch Failed';
38
+
39
+ /**
40
+ * Notification description.
41
+ *
42
+ * @var string
43
+ */
44
+ public static string $description = 'Notify when an order dispatch has been failed.';
45
+
46
+ /**
47
+ * Notification package.
48
+ *
49
+ * @var string
50
+ */
51
+ public static string $package = 'fleet-ops';
52
+
32
53
  /**
33
54
  * Create a new notification instance.
34
55
  *
@@ -33,6 +33,27 @@ class OrderDispatched extends Notification implements ShouldQueue
33
33
  */
34
34
  public $order;
35
35
 
36
+ /**
37
+ * Notification name.
38
+ *
39
+ * @var string
40
+ */
41
+ public static string $name = 'Order Dispatched';
42
+
43
+ /**
44
+ * Notification description.
45
+ *
46
+ * @var string
47
+ */
48
+ public static string $description = 'Notify when an order has been dispatched.';
49
+
50
+ /**
51
+ * Notification package.
52
+ *
53
+ * @var string
54
+ */
55
+ public static string $package = 'fleet-ops';
56
+
36
57
  /**
37
58
  * Create a new notification instance.
38
59
  *
@@ -37,6 +37,27 @@ class OrderPing extends Notification implements ShouldQueue
37
37
  */
38
38
  public $distance;
39
39
 
40
+ /**
41
+ * Notification name.
42
+ *
43
+ * @var string
44
+ */
45
+ public static string $name = 'Order Ping';
46
+
47
+ /**
48
+ * Notification description.
49
+ *
50
+ * @var string
51
+ */
52
+ public static string $description = 'Notify when an order has been pinged.';
53
+
54
+ /**
55
+ * Notification package.
56
+ *
57
+ * @var string
58
+ */
59
+ public static string $package = 'fleet-ops';
60
+
40
61
  /**
41
62
  * Create a new notification instance.
42
63
  *
@@ -11,6 +11,34 @@ class OrderSplit extends Notification
11
11
  {
12
12
  use Queueable;
13
13
 
14
+ /**
15
+ * The order instance this notification is for.
16
+ *
17
+ * @var \Fleetbase\Models\Order
18
+ */
19
+ public $order;
20
+
21
+ /**
22
+ * Notification name.
23
+ *
24
+ * @var string
25
+ */
26
+ public static string $name = 'Order Split';
27
+
28
+ /**
29
+ * Notification description.
30
+ *
31
+ * @var string
32
+ */
33
+ public static string $description = 'Notify when an order has been splited.';
34
+
35
+ /**
36
+ * Notification package.
37
+ *
38
+ * @var string
39
+ */
40
+ public static string $package = 'fleet-ops';
41
+
14
42
  /**
15
43
  * Create a new notification instance.
16
44
  *
@@ -38,9 +66,9 @@ class OrderSplit extends Notification
38
66
  public function toMail($notifiable)
39
67
  {
40
68
  return (new MailMessage())
41
- ->line('The introduction to the notification.')
42
- ->action('Notification Action', url('/'))
43
- ->line('Thank you for using our application!');
69
+ ->line('The introduction to the notification.')
70
+ ->action('Notification Action', url('/'))
71
+ ->line('Thank you for using our application!');
44
72
  }
45
73
 
46
74
  /**
@@ -50,7 +78,6 @@ class OrderSplit extends Notification
50
78
  */
51
79
  public function toArray($notifiable)
52
80
  {
53
- return [
54
- ];
81
+ return [];
55
82
  }
56
83
  }
@@ -5,6 +5,7 @@ namespace Fleetbase\FleetOps\Providers;
5
5
  use Brick\Geo\Engine\GeometryEngineRegistry;
6
6
  use Brick\Geo\Engine\GEOSEngine;
7
7
  use Fleetbase\Providers\CoreServiceProvider;
8
+ use Fleetbase\Support\NotificationRegistry;
8
9
 
9
10
  if (!class_exists(CoreServiceProvider::class)) {
10
11
  throw new \Exception('FleetOps cannot be loaded without `fleetbase/core-api` installed!');
@@ -78,6 +79,7 @@ class FleetOpsServiceProvider extends CoreServiceProvider
78
79
  $schedule->command('fleetops:dispatch-adhoc')->everyMinute();
79
80
  $schedule->command('fleetops:update-estimations')->everyFifteenMinutes();
80
81
  });
82
+ $this->registerNotifications();
81
83
  $this->registerExpansionsFrom(__DIR__ . '/../Expansions');
82
84
  $this->loadRoutesFrom(__DIR__ . '/../routes.php');
83
85
  $this->loadMigrationsFrom(__DIR__ . '/../../migrations');
@@ -91,4 +93,24 @@ class FleetOpsServiceProvider extends CoreServiceProvider
91
93
  // Register the GeometryEngine for GEOSEngine
92
94
  GeometryEngineRegistry::set(new GEOSEngine());
93
95
  }
96
+
97
+ public function registerNotifications()
98
+ {
99
+ // Register Notifications
100
+ NotificationRegistry::register([
101
+ \Fleetbase\FleetOps\Notifications\OrderAssigned::class,
102
+ \Fleetbase\FleetOps\Notifications\OrderCanceled::class,
103
+ \Fleetbase\FleetOps\Notifications\OrderDispatched::class,
104
+ \Fleetbase\FleetOps\Notifications\OrderDispatchFailed::class,
105
+ \Fleetbase\FleetOps\Notifications\OrderPing::class,
106
+ ]);
107
+
108
+ // Register Notifiables
109
+ NotificationRegistry::registerNotifiable([
110
+ \Fleetbase\FleetOps\Models\Contact::class,
111
+ \Fleetbase\FleetOps\Models\Driver::class,
112
+ \Fleetbase\FleetOps\Models\Vendor::class,
113
+ \Fleetbase\FleetOps\Models\Fleet::class,
114
+ ]);
115
+ }
94
116
  }
@@ -0,0 +1,43 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\FleetOps\Providers;
4
+
5
+ use Fleetbase\Support\NotificationRegistry;
6
+ use Fleetbase\Providers\CoreServiceProvider;
7
+
8
+ if (!class_exists(CoreServiceProvider::class)) {
9
+ throw new \Exception('FleetOps cannot be loaded without `fleetbase/core-api` installed!');
10
+ }
11
+
12
+ /**
13
+ * NotificationServiceProvider service provider.
14
+ */
15
+ class NotificationServiceProvider extends CoreServiceProvider
16
+ {
17
+ /**
18
+ * Bootstrap any package services.
19
+ *
20
+ * @return void
21
+ *
22
+ * @throws \Exception if the `fleetbase/core-api` package is not installed
23
+ */
24
+ public function boot()
25
+ {
26
+ // Register Notifications
27
+ NotificationRegistry::register([
28
+ \Fleetbase\FleetOps\Notifications\OrderAssigned::class,
29
+ \Fleetbase\FleetOps\Notifications\OrderCanceled::class,
30
+ \Fleetbase\FleetOps\Notifications\OrderDispatched::class,
31
+ \Fleetbase\FleetOps\Notifications\OrderDispatchFailed::class,
32
+ \Fleetbase\FleetOps\Notifications\OrderPing::class,
33
+ ]);
34
+
35
+ // Register Notifiables
36
+ NotificationRegistry::registerNotifiable([
37
+ \Fleetbase\FleetOps\Models\Contact::class,
38
+ \Fleetbase\FleetOps\Models\Driver::class,
39
+ \Fleetbase\FleetOps\Models\Vendor::class,
40
+ \Fleetbase\FleetOps\Models\Fleet::class,
41
+ ]);
42
+ }
43
+ }