@fleetbase/fleetops-engine 0.2.5 → 0.2.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.
- package/.gitattributes +14 -0
- package/.php-cs-fixer.cache +1 -0
- package/.php-cs-fixer.php +29 -0
- package/LICENSE.md +16 -4
- package/README.md +103 -13
- package/addon/components/admin/visibility-controls.hbs +12 -0
- package/addon/components/admin/visibility-controls.js +82 -0
- package/addon/components/fleet-panel.js +13 -4
- package/addon/components/fleet-vehicle-listing.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.hbs +26 -0
- package/addon/components/layout/fleet-ops-sidebar.js +129 -0
- package/addon/engine.js +19 -0
- package/addon/helpers/is-section-visible.js +5 -0
- package/addon/routes/application.js +6 -2
- package/addon/routes/virtual.js +10 -0
- package/addon/routes.js +1 -0
- package/addon/templates/application.hbs +1 -19
- package/addon/templates/virtual.hbs +9 -0
- package/app/components/admin/visibility-controls.js +1 -0
- package/app/components/layout/fleet-ops-sidebar.js +1 -0
- package/app/helpers/is-section-visible.js +1 -0
- package/app/routes/virtual.js +1 -0
- package/app/templates/virtual.js +1 -0
- package/composer.json +85 -0
- package/extension.json +10 -0
- package/package.json +6 -6
- package/phpstan.neon.dist +8 -0
- package/phpunit.xml.dist +16 -0
- package/server/config/api.php +765 -0
- package/server/config/cache.stores.php +18 -0
- package/server/config/dompdf.php +242 -0
- package/server/config/fleetops.php +19 -0
- package/server/config/geocoder.php +108 -0
- package/server/data/globe.json +261 -0
- package/server/migrations/2023_04_27_053456_create_contacts_table.php +49 -0
- package/server/migrations/2023_04_27_053456_create_drivers_table.php +62 -0
- package/server/migrations/2023_04_27_053456_create_entities_table.php +67 -0
- package/server/migrations/2023_04_27_053456_create_fleet_drivers_table.php +39 -0
- package/server/migrations/2023_04_27_053456_create_fleets_table.php +47 -0
- package/server/migrations/2023_04_27_053456_create_fuel_reports_table.php +50 -0
- package/server/migrations/2023_04_27_053456_create_integrated_vendors_table.php +44 -0
- package/server/migrations/2023_04_27_053456_create_issues_table.php +53 -0
- package/server/migrations/2023_04_27_053456_create_orders_table.php +70 -0
- package/server/migrations/2023_04_27_053456_create_payloads_table.php +51 -0
- package/server/migrations/2023_04_27_053456_create_places_table.php +62 -0
- package/server/migrations/2023_04_27_053456_create_positions_table.php +46 -0
- package/server/migrations/2023_04_27_053456_create_proofs_table.php +44 -0
- package/server/migrations/2023_04_27_053456_create_purchase_rates_table.php +46 -0
- package/server/migrations/2023_04_27_053456_create_routes_table.php +40 -0
- package/server/migrations/2023_04_27_053456_create_service_areas_table.php +47 -0
- package/server/migrations/2023_04_27_053456_create_service_quote_items_table.php +42 -0
- package/server/migrations/2023_04_27_053456_create_service_quotes_table.php +47 -0
- package/server/migrations/2023_04_27_053456_create_service_rate_fees_table.php +45 -0
- package/server/migrations/2023_04_27_053456_create_service_rate_parcel_fees_table.php +47 -0
- package/server/migrations/2023_04_27_053456_create_service_rates_table.php +61 -0
- package/server/migrations/2023_04_27_053456_create_tracking_numbers_table.php +46 -0
- package/server/migrations/2023_04_27_053456_create_tracking_statuses_table.php +54 -0
- package/server/migrations/2023_04_27_053456_create_vehicles_table.php +84 -0
- package/server/migrations/2023_04_27_053456_create_vendors_table.php +56 -0
- package/server/migrations/2023_04_27_053456_create_waypoints_table.php +45 -0
- package/server/migrations/2023_04_27_053456_create_zones_table.php +46 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_companies_table.php +32 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_contacts_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_drivers_table.php +40 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_entities_table.php +40 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_fleet_drivers_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_fleets_table.php +36 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_fuel_reports_table.php +36 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_integrated_vendors_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_issues_table.php +38 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_orders_table.php +48 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_payloads_table.php +40 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_places_table.php +32 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_positions_table.php +36 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_proofs_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_purchase_rates_table.php +38 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_routes_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_areas_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_quote_items_table.php +32 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_quotes_table.php +38 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_rate_fees_table.php +32 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_rate_parcel_fees_table.php +32 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_service_rates_table.php +36 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_tracking_numbers_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_tracking_statuses_table.php +34 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_vehicles_table.php +36 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_vendors_table.php +40 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_waypoints_table.php +38 -0
- package/server/migrations/2023_04_27_053459_add_foreign_keys_to_zones_table.php +34 -0
- package/server/migrations/2023_09_14_074512_update_vehicles_table.php +100 -0
- package/server/migrations/2023_09_14_074619_create_vehicle_devices_table.php +44 -0
- package/server/migrations/2023_09_26_071205_add_online_column_to_vehicles_table.php +32 -0
- package/server/migrations/2023_09_26_083957_create_fleet_vehicles_table.php +45 -0
- package/server/migrations/2023_09_27_023757_add_column_to_fleets_table.php +46 -0
- package/server/migrations/2023_10_05_074811_update_vehicle.php +42 -0
- package/server/resources/views/labels/default.php +165 -0
- package/server/src/Auth/Schemas/FleetOps.php +75 -0
- package/server/src/Casts/MultiPolygon.php +50 -0
- package/server/src/Casts/Point.php +109 -0
- package/server/src/Casts/Polygon.php +46 -0
- package/server/src/Console/Commands/DispatchAdhocOrders.php +137 -0
- package/server/src/Console/Commands/DispatchOrders.php +71 -0
- package/server/src/Console/Commands/TrackOrderDistanceAndTime.php +62 -0
- package/server/src/Events/DriverLocationChanged.php +174 -0
- package/server/src/Events/DriverSimulatedLocationChanged.php +183 -0
- package/server/src/Events/EntityDriverAssigned.php +36 -0
- package/server/src/Events/OrderCanceled.php +15 -0
- package/server/src/Events/OrderCompleted.php +15 -0
- package/server/src/Events/OrderDispatchFailed.php +42 -0
- package/server/src/Events/OrderDispatched.php +15 -0
- package/server/src/Events/OrderDriverAssigned.php +15 -0
- package/server/src/Events/OrderReady.php +15 -0
- package/server/src/Events/OrderStarted.php +15 -0
- package/server/src/Exceptions/IntegratedVendorException.php +18 -0
- package/server/src/Expansions/UserExpansion.php +63 -0
- package/server/src/Exports/ContactExport.php +56 -0
- package/server/src/Exports/DriverExport.php +61 -0
- package/server/src/Exports/FleetExport.php +53 -0
- package/server/src/Exports/PlaceExport.php +55 -0
- package/server/src/Exports/ServiceAreaExport.php +58 -0
- package/server/src/Exports/VehicleExport.php +57 -0
- package/server/src/Exports/VendorExport.php +57 -0
- package/server/src/Http/Controllers/Api/v1/ContactController.php +133 -0
- package/server/src/Http/Controllers/Api/v1/DriverController.php +691 -0
- package/server/src/Http/Controllers/Api/v1/EntityController.php +230 -0
- package/server/src/Http/Controllers/Api/v1/FleetController.php +146 -0
- package/server/src/Http/Controllers/Api/v1/LabelController.php +63 -0
- package/server/src/Http/Controllers/Api/v1/OrderController.php +1114 -0
- package/server/src/Http/Controllers/Api/v1/PayloadController.php +195 -0
- package/server/src/Http/Controllers/Api/v1/PlaceController.php +333 -0
- package/server/src/Http/Controllers/Api/v1/PurchaseRateController.php +199 -0
- package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +133 -0
- package/server/src/Http/Controllers/Api/v1/ServiceQuoteController.php +381 -0
- package/server/src/Http/Controllers/Api/v1/ServiceRateController.php +223 -0
- package/server/src/Http/Controllers/Api/v1/TrackingNumberController.php +146 -0
- package/server/src/Http/Controllers/Api/v1/TrackingStatusController.php +138 -0
- package/server/src/Http/Controllers/Api/v1/VehicleController.php +191 -0
- package/server/src/Http/Controllers/Api/v1/VendorController.php +159 -0
- package/server/src/Http/Controllers/Api/v1/ZoneController.php +146 -0
- package/server/src/Http/Controllers/FleetOpsController.php +13 -0
- package/server/src/Http/Controllers/Internal/v1/ContactController.php +69 -0
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +261 -0
- package/server/src/Http/Controllers/Internal/v1/EntityController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/FleetController.php +152 -0
- package/server/src/Http/Controllers/Internal/v1/FleetOpsLookupController.php +80 -0
- package/server/src/Http/Controllers/Internal/v1/FuelReportController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +96 -0
- package/server/src/Http/Controllers/Internal/v1/IntegratedVendorController.php +63 -0
- package/server/src/Http/Controllers/Internal/v1/IssueController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +127 -0
- package/server/src/Http/Controllers/Internal/v1/MetricsController.php +75 -0
- package/server/src/Http/Controllers/Internal/v1/MorphController.php +77 -0
- package/server/src/Http/Controllers/Internal/v1/OrderConfigController.php +269 -0
- package/server/src/Http/Controllers/Internal/v1/OrderController.php +564 -0
- package/server/src/Http/Controllers/Internal/v1/PayloadController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/PlaceController.php +163 -0
- package/server/src/Http/Controllers/Internal/v1/ProofController.php +139 -0
- package/server/src/Http/Controllers/Internal/v1/PurchaseRateController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/RouteController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/ServiceAreaController.php +32 -0
- package/server/src/Http/Controllers/Internal/v1/ServiceQuoteController.php +345 -0
- package/server/src/Http/Controllers/Internal/v1/ServiceRateController.php +47 -0
- package/server/src/Http/Controllers/Internal/v1/SettingController.php +30 -0
- package/server/src/Http/Controllers/Internal/v1/TrackingNumberController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/TrackingStatusController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/VehicleController.php +65 -0
- package/server/src/Http/Controllers/Internal/v1/VehicleDeviceController.php +15 -0
- package/server/src/Http/Controllers/Internal/v1/VendorController.php +120 -0
- package/server/src/Http/Controllers/Internal/v1/ZoneController.php +15 -0
- package/server/src/Http/Filter/ContactFilter.php +86 -0
- package/server/src/Http/Filter/DriverFilter.php +148 -0
- package/server/src/Http/Filter/FleetFilter.php +108 -0
- package/server/src/Http/Filter/IntegratedVendorFilter.php +13 -0
- package/server/src/Http/Filter/OrderFilter.php +242 -0
- package/server/src/Http/Filter/PlaceFilter.php +111 -0
- package/server/src/Http/Filter/ServiceAreaFilter.php +13 -0
- package/server/src/Http/Filter/ServiceQuoteFilter.php +13 -0
- package/server/src/Http/Filter/ServiceRateFilter.php +33 -0
- package/server/src/Http/Filter/TrackingStatusFilter.php +43 -0
- package/server/src/Http/Filter/VehicleFilter.php +91 -0
- package/server/src/Http/Filter/VendorFilter.php +83 -0
- package/server/src/Http/Filter/ZoneFilter.php +13 -0
- package/server/src/Http/Requests/CancelOrderRequest.php +31 -0
- package/server/src/Http/Requests/CreateContactRequest.php +33 -0
- package/server/src/Http/Requests/CreateDriverRequest.php +55 -0
- package/server/src/Http/Requests/CreateEntityRequest.php +43 -0
- package/server/src/Http/Requests/CreateFleetRequest.php +32 -0
- package/server/src/Http/Requests/CreateOrderRequest.php +66 -0
- package/server/src/Http/Requests/CreatePayloadRequest.php +37 -0
- package/server/src/Http/Requests/CreatePlaceRequest.php +38 -0
- package/server/src/Http/Requests/CreatePurchaseRateRequest.php +33 -0
- package/server/src/Http/Requests/CreateServiceAreaRequest.php +35 -0
- package/server/src/Http/Requests/CreateServiceQuoteRequest.php +29 -0
- package/server/src/Http/Requests/CreateServiceRateRequest.php +56 -0
- package/server/src/Http/Requests/CreateTrackingNumberRequest.php +34 -0
- package/server/src/Http/Requests/CreateTrackingStatusRequest.php +42 -0
- package/server/src/Http/Requests/CreateVehicleRequest.php +32 -0
- package/server/src/Http/Requests/CreateVendorRequest.php +35 -0
- package/server/src/Http/Requests/CreateZoneRequest.php +35 -0
- package/server/src/Http/Requests/DecodeTrackingNumberQR.php +30 -0
- package/server/src/Http/Requests/DriverSimulationRequest.php +46 -0
- package/server/src/Http/Requests/Internal/AssignOrderRequest.php +31 -0
- package/server/src/Http/Requests/Internal/CreateDriverRequest.php +42 -0
- package/server/src/Http/Requests/Internal/FleetActionRequest.php +32 -0
- package/server/src/Http/Requests/Internal/UpdateDriverRequest.php +7 -0
- package/server/src/Http/Requests/QueryServiceQuotesRequest.php +41 -0
- package/server/src/Http/Requests/UpdateContactRequest.php +20 -0
- package/server/src/Http/Requests/UpdateDriverRequest.php +7 -0
- package/server/src/Http/Requests/UpdateEntityRequest.php +7 -0
- package/server/src/Http/Requests/UpdateFleetRequest.php +7 -0
- package/server/src/Http/Requests/UpdateOrderRequest.php +7 -0
- package/server/src/Http/Requests/UpdatePayloadRequest.php +7 -0
- package/server/src/Http/Requests/UpdatePlaceRequest.php +7 -0
- package/server/src/Http/Requests/UpdatePurchaseRateRequest.php +7 -0
- package/server/src/Http/Requests/UpdateServiceAreaRequest.php +29 -0
- package/server/src/Http/Requests/UpdateServiceQuoteRequest.php +29 -0
- package/server/src/Http/Requests/UpdateServiceRateRequest.php +29 -0
- package/server/src/Http/Requests/UpdateTrackingNumberRequest.php +7 -0
- package/server/src/Http/Requests/UpdateTrackingStatusRequest.php +32 -0
- package/server/src/Http/Requests/UpdateVehicleRequest.php +7 -0
- package/server/src/Http/Requests/UpdateVendorRequest.php +7 -0
- package/server/src/Http/Requests/UpdateZoneRequest.php +7 -0
- package/server/src/Http/Resources/Internal/v1/IntegratedVendorFacilitator.php +37 -0
- package/server/src/Http/Resources/Internal/v1/Vehicle.php +33 -0
- package/server/src/Http/Resources/Internal/v1/Waypoint.php +34 -0
- package/server/src/Http/Resources/v1/Contact.php +62 -0
- package/server/src/Http/Resources/v1/CurrentJob.php +36 -0
- package/server/src/Http/Resources/v1/DeletedResource.php +61 -0
- package/server/src/Http/Resources/v1/Driver.php +89 -0
- package/server/src/Http/Resources/v1/Entity.php +107 -0
- package/server/src/Http/Resources/v1/Fleet.php +60 -0
- package/server/src/Http/Resources/v1/FuelReport.php +67 -0
- package/server/src/Http/Resources/v1/Order.php +131 -0
- package/server/src/Http/Resources/v1/Payload.php +94 -0
- package/server/src/Http/Resources/v1/Place.php +84 -0
- package/server/src/Http/Resources/v1/Proof.php +36 -0
- package/server/src/Http/Resources/v1/PurchaseRate.php +77 -0
- package/server/src/Http/Resources/v1/ServiceArea.php +55 -0
- package/server/src/Http/Resources/v1/ServiceQuote.php +57 -0
- package/server/src/Http/Resources/v1/ServiceRate.php +94 -0
- package/server/src/Http/Resources/v1/ServiceRateFee.php +58 -0
- package/server/src/Http/Resources/v1/ServiceRateParcelFee.php +48 -0
- package/server/src/Http/Resources/v1/TrackingNumber.php +62 -0
- package/server/src/Http/Resources/v1/TrackingStatus.php +84 -0
- package/server/src/Http/Resources/v1/Vehicle.php +75 -0
- package/server/src/Http/Resources/v1/VehicleDevice.php +44 -0
- package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +72 -0
- package/server/src/Http/Resources/v1/Vendor.php +72 -0
- package/server/src/Http/Resources/v1/Zone.php +60 -0
- package/server/src/Imports/OrdersImport.php +18 -0
- package/server/src/Integrations/Lalamove/Lalamove.php +678 -0
- package/server/src/Integrations/Lalamove/LalamoveDeliveryStop.php +97 -0
- package/server/src/Integrations/Lalamove/LalamoveMarket.php +123 -0
- package/server/src/Integrations/Lalamove/LalamoveServiceType.php +161 -0
- package/server/src/Jobs/SimulateDrivingRoute.php +81 -0
- package/server/src/Jobs/SimulateWaypointReached.php +79 -0
- package/server/src/Listeners/HandleOrderCanceled.php +46 -0
- package/server/src/Listeners/HandleOrderCreated.php +23 -0
- package/server/src/Listeners/HandleOrderDispatchFailed.php +35 -0
- package/server/src/Listeners/HandleOrderDispatched.php +108 -0
- package/server/src/Listeners/HandleOrderDriverAssigned.php +42 -0
- package/server/src/Listeners/HandleOrderReady.php +27 -0
- package/server/src/Listeners/HandleUserRemovedFromCompany.php +31 -0
- package/server/src/Models/Contact.php +239 -0
- package/server/src/Models/Driver.php +543 -0
- package/server/src/Models/Entity.php +416 -0
- package/server/src/Models/Fleet.php +203 -0
- package/server/src/Models/FleetDriver.php +73 -0
- package/server/src/Models/FleetVehicle.php +73 -0
- package/server/src/Models/FuelReport.php +125 -0
- package/server/src/Models/IntegratedVendor.php +219 -0
- package/server/src/Models/Issue.php +111 -0
- package/server/src/Models/Order.php +1132 -0
- package/server/src/Models/Payload.php +699 -0
- package/server/src/Models/Place.php +656 -0
- package/server/src/Models/Position.php +119 -0
- package/server/src/Models/Proof.php +94 -0
- package/server/src/Models/PurchaseRate.php +208 -0
- package/server/src/Models/Route.php +128 -0
- package/server/src/Models/ServiceArea.php +161 -0
- package/server/src/Models/ServiceQuote.php +207 -0
- package/server/src/Models/ServiceQuoteItem.php +46 -0
- package/server/src/Models/ServiceRate.php +953 -0
- package/server/src/Models/ServiceRateFee.php +96 -0
- package/server/src/Models/ServiceRateParcelFee.php +116 -0
- package/server/src/Models/TrackingNumber.php +310 -0
- package/server/src/Models/TrackingStatus.php +177 -0
- package/server/src/Models/Vehicle.php +452 -0
- package/server/src/Models/VehicleDevice.php +79 -0
- package/server/src/Models/Vendor.php +244 -0
- package/server/src/Models/Waypoint.php +226 -0
- package/server/src/Models/Zone.php +95 -0
- package/server/src/Notifications/OrderAssigned.php +140 -0
- package/server/src/Notifications/OrderCanceled.php +129 -0
- package/server/src/Notifications/OrderDispatchFailed.php +81 -0
- package/server/src/Notifications/OrderDispatched.php +173 -0
- package/server/src/Notifications/OrderPing.php +162 -0
- package/server/src/Notifications/OrderSplit.php +56 -0
- package/server/src/Observers/DriverObserver.php +34 -0
- package/server/src/Observers/OrderObserver.php +34 -0
- package/server/src/Observers/PayloadObserver.php +30 -0
- package/server/src/Observers/PlaceObserver.php +26 -0
- package/server/src/Observers/PurchaseRateObserver.php +61 -0
- package/server/src/Observers/ServiceAreaObserver.php +35 -0
- package/server/src/Observers/ServiceRateObserver.php +78 -0
- package/server/src/Observers/TrackingNumberObserver.php +44 -0
- package/server/src/Observers/UserObserver.php +20 -0
- package/server/src/Observers/VehicleObserver.php +66 -0
- package/server/src/Providers/EventServiceProvider.php +30 -0
- package/server/src/Providers/FleetOpsServiceProvider.php +94 -0
- package/server/src/Rules/ResolvablePoint.php +37 -0
- package/server/src/Scopes/DriverScope.php +21 -0
- package/server/src/Support/Algo.php +55 -0
- package/server/src/Support/DistanceMatrix.php +27 -0
- package/server/src/Support/Encoding/Polyline.php +168 -0
- package/server/src/Support/Flow.php +622 -0
- package/server/src/Support/Geocoding.php +216 -0
- package/server/src/Support/IntegratedVendors.php +287 -0
- package/server/src/Support/Metrics.php +305 -0
- package/server/src/Support/OSRM.php +191 -0
- package/server/src/Support/ParsePhone.php +21 -0
- package/server/src/Support/Utils.php +1145 -0
- package/server/src/Traits/HasTrackingNumber.php +185 -0
- package/server/src/routes.php +381 -0
- package/server/tests/Feature.php +5 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
7
|
+
use Fleetbase\Support\Http;
|
|
8
|
+
|
|
9
|
+
class ServiceRate extends FleetbaseResource
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Transform the resource into an array.
|
|
13
|
+
*
|
|
14
|
+
* @param \Illuminate\Http\Request $request
|
|
15
|
+
*
|
|
16
|
+
* @return array
|
|
17
|
+
*/
|
|
18
|
+
public function toArray($request)
|
|
19
|
+
{
|
|
20
|
+
return array_merge(
|
|
21
|
+
$this->getInternalIds(),
|
|
22
|
+
[
|
|
23
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
24
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
25
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
26
|
+
'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
|
|
27
|
+
'service_area_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceArea.name')),
|
|
28
|
+
'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
|
|
29
|
+
'zone_name' => $this->when(Http::isInternalRequest(), data_get($this, 'zone.name')),
|
|
30
|
+
'service_name' => $this->service_name,
|
|
31
|
+
'service_type' => $this->service_type,
|
|
32
|
+
'base_fee' => $this->base_fee,
|
|
33
|
+
'rate_calculation_method' => $this->rate_calculation_method,
|
|
34
|
+
'per_meter_flat_rate_fee' => $this->per_meter_flat_rate_fee,
|
|
35
|
+
'per_meter_unit' => $this->per_meter_unit,
|
|
36
|
+
'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
|
|
37
|
+
'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
|
|
38
|
+
'algorithm' => $this->algorithm,
|
|
39
|
+
'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
|
|
40
|
+
'cod_calculation_method' => $this->cod_calculation_method,
|
|
41
|
+
'cod_flat_fee' => $this->cod_flat_fee,
|
|
42
|
+
'cod_percent' => $this->cod_percent,
|
|
43
|
+
'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
|
|
44
|
+
'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
|
|
45
|
+
'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
|
|
46
|
+
'peak_hours_percent' => $this->peak_hours_percent,
|
|
47
|
+
'peak_hours_start' => $this->peak_hours_start,
|
|
48
|
+
'peak_hours_end' => $this->peak_hours_end,
|
|
49
|
+
'currency' => $this->currency,
|
|
50
|
+
'duration_terms' => $this->duration_terms,
|
|
51
|
+
'estimated_days' => $this->estimated_days,
|
|
52
|
+
'updated_at' => $this->updated_at,
|
|
53
|
+
'created_at' => $this->created_at,
|
|
54
|
+
]
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Transform the resource into an webhook payload.
|
|
60
|
+
*
|
|
61
|
+
* @return array
|
|
62
|
+
*/
|
|
63
|
+
public function toWebhookPayload()
|
|
64
|
+
{
|
|
65
|
+
return [
|
|
66
|
+
'id' => $this->public_id,
|
|
67
|
+
'service_area' => new ServiceArea($this->serviceArea),
|
|
68
|
+
'zone' => new Zone($this->zone),
|
|
69
|
+
'service_name' => $this->service_name,
|
|
70
|
+
'service_type' => $this->service_type,
|
|
71
|
+
'base_fee' => $this->base_fee,
|
|
72
|
+
'rate_calculation_method' => $this->rate_calculation_method,
|
|
73
|
+
'per_km_flat_rate_fee' => $this->per_km_flat_rate_fee,
|
|
74
|
+
'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
|
|
75
|
+
'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
|
|
76
|
+
'algorithm' => $this->algorithm,
|
|
77
|
+
'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
|
|
78
|
+
'cod_calculation_method' => $this->cod_calculation_method,
|
|
79
|
+
'cod_flat_fee' => $this->cod_flat_fee,
|
|
80
|
+
'cod_percent' => $this->cod_percent,
|
|
81
|
+
'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
|
|
82
|
+
'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
|
|
83
|
+
'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
|
|
84
|
+
'peak_hours_percent' => $this->peak_hours_percent,
|
|
85
|
+
'peak_hours_start' => $this->peak_hours_start,
|
|
86
|
+
'peak_hours_end' => $this->peak_hours_end,
|
|
87
|
+
'currency' => $this->currency,
|
|
88
|
+
'duration_terms' => $this->duration_terms,
|
|
89
|
+
'estimated_days' => $this->estimated_days,
|
|
90
|
+
'updated_at' => $this->updated_at,
|
|
91
|
+
'created_at' => $this->created_at,
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class ServiceRateFee extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return array_merge(
|
|
20
|
+
$this->getInternalIds(),
|
|
21
|
+
[
|
|
22
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id),
|
|
23
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
24
|
+
'fee' => $this->fee,
|
|
25
|
+
'currency' => $this->currency,
|
|
26
|
+
'size' => $this->size,
|
|
27
|
+
'length' => $this->length,
|
|
28
|
+
'height' => $this->height,
|
|
29
|
+
'dimensions_unit' => $this->dimensions_unit,
|
|
30
|
+
'weight' => $this->weight,
|
|
31
|
+
'weight_unit' => $this->weight_unit,
|
|
32
|
+
'updated_at' => $this->updated_at,
|
|
33
|
+
'created_at' => $this->created_at,
|
|
34
|
+
]
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Transform the resource into an webhook payload.
|
|
40
|
+
*
|
|
41
|
+
* @return array
|
|
42
|
+
*/
|
|
43
|
+
public function toWebhookPayload()
|
|
44
|
+
{
|
|
45
|
+
return [
|
|
46
|
+
'fee' => $this->fee,
|
|
47
|
+
'currency' => $this->currency,
|
|
48
|
+
'size' => $this->size,
|
|
49
|
+
'length' => $this->length,
|
|
50
|
+
'height' => $this->height,
|
|
51
|
+
'dimensions_unit' => $this->dimensions_unit,
|
|
52
|
+
'weight' => $this->weight,
|
|
53
|
+
'weight_unit' => $this->weight_unit,
|
|
54
|
+
'updated_at' => $this->updated_at,
|
|
55
|
+
'created_at' => $this->created_at,
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class ServiceRateParcelFee extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return array_merge(
|
|
20
|
+
$this->getInternalIds(),
|
|
21
|
+
[
|
|
22
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id),
|
|
23
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
24
|
+
'fee' => $this->fee,
|
|
25
|
+
'currency' => $this->currency,
|
|
26
|
+
'distance' => $this->distance,
|
|
27
|
+
'updated_at' => $this->updated_at,
|
|
28
|
+
'created_at' => $this->created_at,
|
|
29
|
+
]
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Transform the resource into an webhook payload.
|
|
35
|
+
*
|
|
36
|
+
* @return array
|
|
37
|
+
*/
|
|
38
|
+
public function toWebhookPayload()
|
|
39
|
+
{
|
|
40
|
+
return [
|
|
41
|
+
'fee' => $this->fee,
|
|
42
|
+
'currency' => $this->currency,
|
|
43
|
+
'distance' => $this->distance,
|
|
44
|
+
'updated_at' => $this->updated_at,
|
|
45
|
+
'created_at' => $this->created_at,
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
7
|
+
use Fleetbase\Support\Http;
|
|
8
|
+
|
|
9
|
+
class TrackingNumber extends FleetbaseResource
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Transform the resource into an array.
|
|
13
|
+
*
|
|
14
|
+
* @param \Illuminate\Http\Request $request
|
|
15
|
+
*
|
|
16
|
+
* @return array
|
|
17
|
+
*/
|
|
18
|
+
public function toArray($request)
|
|
19
|
+
{
|
|
20
|
+
return array_merge(
|
|
21
|
+
$this->getInternalIds(),
|
|
22
|
+
[
|
|
23
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
24
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
25
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
26
|
+
'status_uuid' => $this->when(Http::isInternalRequest(), $this->status_uuid),
|
|
27
|
+
'owner_uuid' => $this->when(Http::isInternalRequest(), $this->owner_uuid),
|
|
28
|
+
'owner_type' => $this->when(Http::isInternalRequest(), $this->owner_type),
|
|
29
|
+
'tracking_number' => $this->tracking_number,
|
|
30
|
+
'subject' => Utils::get($this->owner, 'public_id'),
|
|
31
|
+
'region' => $this->region,
|
|
32
|
+
'status' => $this->last_status,
|
|
33
|
+
'status_code' => $this->last_status_code,
|
|
34
|
+
'qr_code' => $this->qr_code,
|
|
35
|
+
'barcode' => $this->barcode,
|
|
36
|
+
'type' => Utils::getTypeFromClassName($this->owner_type),
|
|
37
|
+
'updated_at' => $this->updated_at,
|
|
38
|
+
'created_at' => $this->created_at,
|
|
39
|
+
]
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Transform the resource into an webhook payload.
|
|
45
|
+
*
|
|
46
|
+
* @return array
|
|
47
|
+
*/
|
|
48
|
+
public function toWebhookPayload()
|
|
49
|
+
{
|
|
50
|
+
return [
|
|
51
|
+
'id' => $this->public_id,
|
|
52
|
+
'tracking_number' => $this->tracking_number,
|
|
53
|
+
'subject' => Utils::get($this->owner, 'public_id'),
|
|
54
|
+
'region' => $this->region,
|
|
55
|
+
'qr_code' => $this->qr_code,
|
|
56
|
+
'barcode' => $this->barcode,
|
|
57
|
+
'type' => Utils::getTypeFromClassName($this->owner_type),
|
|
58
|
+
'updated_at' => $this->updated_at,
|
|
59
|
+
'created_at' => $this->created_at,
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
7
|
+
use Fleetbase\Support\Http;
|
|
8
|
+
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
9
|
+
|
|
10
|
+
class TrackingStatus extends FleetbaseResource
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* Transform the resource into an array.
|
|
14
|
+
*
|
|
15
|
+
* @param \Illuminate\Http\Request $request
|
|
16
|
+
*
|
|
17
|
+
* @return array
|
|
18
|
+
*/
|
|
19
|
+
public function toArray($request)
|
|
20
|
+
{
|
|
21
|
+
return array_merge(
|
|
22
|
+
$this->getInternalIds(),
|
|
23
|
+
[
|
|
24
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
25
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
26
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
27
|
+
'tracking_number_uuid' => $this->when(Http::isInternalRequest(), $this->tracking_number_uuid),
|
|
28
|
+
'proof_uuid' => $this->when(Http::isInternalRequest(), $this->proof_uuid),
|
|
29
|
+
'status' => $this->status,
|
|
30
|
+
'details' => $this->details,
|
|
31
|
+
'code' => $this->code,
|
|
32
|
+
'tracking_number' => $this->trackingNumber(),
|
|
33
|
+
'city' => $this->city,
|
|
34
|
+
'province' => $this->province,
|
|
35
|
+
'postal_code' => $this->postal_code,
|
|
36
|
+
'country' => $this->country,
|
|
37
|
+
'location' => $this->location ?? new Point(0, 0),
|
|
38
|
+
'updated_at' => $this->updated_at,
|
|
39
|
+
'created_at' => $this->created_at,
|
|
40
|
+
]
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Transform the resource into an webhook payload.
|
|
46
|
+
*
|
|
47
|
+
* @return array
|
|
48
|
+
*/
|
|
49
|
+
public function toWebhookPayload()
|
|
50
|
+
{
|
|
51
|
+
return [
|
|
52
|
+
'id' => $this->public_id,
|
|
53
|
+
'status' => $this->status,
|
|
54
|
+
'details' => $this->details,
|
|
55
|
+
'code' => $this->code,
|
|
56
|
+
'tracking_number' => $this->trackingNumber(),
|
|
57
|
+
'city' => $this->city,
|
|
58
|
+
'province' => $this->province,
|
|
59
|
+
'postal_code' => $this->postal_code,
|
|
60
|
+
'country' => $this->country,
|
|
61
|
+
'location' => $this->location ?? new Point(0, 0),
|
|
62
|
+
'updated_at' => $this->updated_at,
|
|
63
|
+
'created_at' => $this->created_at,
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the correct trackingNumber resource if applicable.
|
|
69
|
+
*
|
|
70
|
+
* @return Illuminate\Http\Resources\Json\JsonResource|null
|
|
71
|
+
*/
|
|
72
|
+
public function trackingNumber()
|
|
73
|
+
{
|
|
74
|
+
if (Utils::notEmpty($this->tracking_number_uuid) && Utils::isEmpty($this->trackingNumber)) {
|
|
75
|
+
$this->load(['trackingNumber']);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (Utils::isEmpty($this->trackingNumber)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return new TrackingNumber($this->trackingNumber);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class Vehicle extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return array_merge(
|
|
20
|
+
$this->getInternalIds(),
|
|
21
|
+
[
|
|
22
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
23
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
24
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
25
|
+
'internal_id' => $this->internal_id,
|
|
26
|
+
'name' => $this->display_name,
|
|
27
|
+
'display_name' => $this->when(Http::isInternalRequest(), $this->display_name),
|
|
28
|
+
'vin' => $this->vin ?? null,
|
|
29
|
+
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
30
|
+
'photo' => $this->photoUrl,
|
|
31
|
+
'make' => $this->make,
|
|
32
|
+
'model' => $this->model,
|
|
33
|
+
'year' => $this->year,
|
|
34
|
+
'trim' => $this->trim,
|
|
35
|
+
'type' => $this->type,
|
|
36
|
+
'plate_number' => $this->plate_number,
|
|
37
|
+
'vin_data' => $this->vin_data,
|
|
38
|
+
'status' => $this->status,
|
|
39
|
+
'online' => $this->online,
|
|
40
|
+
'meta' => $this->meta ?? [],
|
|
41
|
+
'updated_at' => $this->updated_at,
|
|
42
|
+
'created_at' => $this->created_at,
|
|
43
|
+
]
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Transform the resource into an webhook payload.
|
|
49
|
+
*
|
|
50
|
+
* @return array
|
|
51
|
+
*/
|
|
52
|
+
public function toWebhookPayload()
|
|
53
|
+
{
|
|
54
|
+
return [
|
|
55
|
+
'id' => $this->public_id,
|
|
56
|
+
'internal_id' => $this->internal_id,
|
|
57
|
+
'name' => $this->name,
|
|
58
|
+
'vin' => $this->vin ?? null,
|
|
59
|
+
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
60
|
+
'photo' => $this->photoUrl,
|
|
61
|
+
'make' => $this->make,
|
|
62
|
+
'model' => $this->model,
|
|
63
|
+
'year' => $this->year,
|
|
64
|
+
'trim' => $this->trim,
|
|
65
|
+
'type' => $this->type,
|
|
66
|
+
'plate_number' => $this->plate_number,
|
|
67
|
+
'vin_data' => $this->vin_data,
|
|
68
|
+
'status' => $this->status,
|
|
69
|
+
'online' => $this->online,
|
|
70
|
+
'meta' => $this->meta ?? [],
|
|
71
|
+
'updated_at' => $this->updated_at,
|
|
72
|
+
'created_at' => $this->created_at,
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
|
|
7
|
+
class VehicleDevice extends FleetbaseResource
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Transform the resource into an array.
|
|
11
|
+
*
|
|
12
|
+
* @param \Illuminate\Http\Request $request
|
|
13
|
+
*
|
|
14
|
+
* @return array
|
|
15
|
+
*/
|
|
16
|
+
public function toArray($request)
|
|
17
|
+
{
|
|
18
|
+
return array_merge(
|
|
19
|
+
$this->getInternalIds(),
|
|
20
|
+
[
|
|
21
|
+
'id' => $this->id,
|
|
22
|
+
'uuid' => $this->uuid,
|
|
23
|
+
'vehicle_uuid' => $this->vehicle_uuid,
|
|
24
|
+
'device_id' => $this->device_id,
|
|
25
|
+
'device_provider' => $this->device_provider,
|
|
26
|
+
'device_type' => $this->device_type,
|
|
27
|
+
'device_name' => $this->device_name,
|
|
28
|
+
'device_model' => $this->device_model,
|
|
29
|
+
'device_location' => $this->device_location,
|
|
30
|
+
'manufacturer' => $this->manufacturer,
|
|
31
|
+
'serial_number' => $this->serial_number,
|
|
32
|
+
'installation_date' => $this->installation_date,
|
|
33
|
+
'last_maintenance_date' => $this->last_maintenance_date,
|
|
34
|
+
'meta' => $this->meta ?? [],
|
|
35
|
+
'data' => $this->data ?? [],
|
|
36
|
+
'status' => $this->status,
|
|
37
|
+
'data_frequency' => $this->data_frequency,
|
|
38
|
+
'notes' => $this->notes,
|
|
39
|
+
'updated_at' => $this->updated_at,
|
|
40
|
+
'created_at' => $this->created_at,
|
|
41
|
+
]
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class VehicleWithoutDriver extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return array_merge(
|
|
20
|
+
$this->getInternalIds(),
|
|
21
|
+
[
|
|
22
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
23
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
24
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
25
|
+
'internal_id' => $this->internal_id,
|
|
26
|
+
'name' => $this->name,
|
|
27
|
+
'vin' => $this->vin ?? null,
|
|
28
|
+
'photo' => $this->photoUrl ?? null,
|
|
29
|
+
'make' => $this->make ?? null,
|
|
30
|
+
'model' => $this->model ?? null,
|
|
31
|
+
'year' => $this->year ?? null,
|
|
32
|
+
'trim' => $this->trim ?? null,
|
|
33
|
+
'type' => $this->type ?? null,
|
|
34
|
+
'plate_number' => $this->plate_number ?? null,
|
|
35
|
+
'vin_data' => $this->vin_data,
|
|
36
|
+
'status' => $this->status,
|
|
37
|
+
'online' => $this->online,
|
|
38
|
+
'meta' => $this->meta,
|
|
39
|
+
'updated_at' => $this->updated_at,
|
|
40
|
+
'created_at' => $this->created_at,
|
|
41
|
+
]
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Transform the resource into an webhook payload.
|
|
47
|
+
*
|
|
48
|
+
* @return array
|
|
49
|
+
*/
|
|
50
|
+
public function toWebhookPayload()
|
|
51
|
+
{
|
|
52
|
+
return [
|
|
53
|
+
'id' => $this->public_id,
|
|
54
|
+
'internal_id' => $this->internal_id,
|
|
55
|
+
'name' => $this->name,
|
|
56
|
+
'vin' => $this->vin ?? null,
|
|
57
|
+
'photo' => $this->photoUrl ?? null,
|
|
58
|
+
'make' => $this->make ?? null,
|
|
59
|
+
'model' => $this->model ?? null,
|
|
60
|
+
'year' => $this->year ?? null,
|
|
61
|
+
'trim' => $this->trim ?? null,
|
|
62
|
+
'type' => $this->type ?? null,
|
|
63
|
+
'plate_number' => $this->plate_number ?? null,
|
|
64
|
+
'vin_data' => $this->vin_data,
|
|
65
|
+
'status' => $this->status,
|
|
66
|
+
'online' => $this->online,
|
|
67
|
+
'meta' => $this->meta,
|
|
68
|
+
'updated_at' => $this->updated_at,
|
|
69
|
+
'created_at' => $this->created_at,
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
7
|
+
use Fleetbase\Support\Http;
|
|
8
|
+
|
|
9
|
+
class Vendor extends FleetbaseResource
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Transform the resource into an array.
|
|
13
|
+
*
|
|
14
|
+
* @param \Illuminate\Http\Request $request
|
|
15
|
+
*
|
|
16
|
+
* @return array
|
|
17
|
+
*/
|
|
18
|
+
public function toArray($request)
|
|
19
|
+
{
|
|
20
|
+
return array_merge(
|
|
21
|
+
$this->getInternalIds(),
|
|
22
|
+
[
|
|
23
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
24
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
25
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
26
|
+
'place_uuid' => $this->when(Http::isInternalRequest(), $this->place_uuid),
|
|
27
|
+
'connect_company_uuid' => $this->when(Http::isInternalRequest(), $this->connect_company_uuid),
|
|
28
|
+
'logo_uuid' => $this->when(Http::isInternalRequest(), $this->logo_uuid),
|
|
29
|
+
'type_uuid' => $this->when(Http::isInternalRequest(), $this->type_uuid),
|
|
30
|
+
'internal_id' => $this->internal_id,
|
|
31
|
+
'business_id' => $this->business_id,
|
|
32
|
+
'name' => $this->name,
|
|
33
|
+
'email' => $this->email,
|
|
34
|
+
'phone' => $this->phone,
|
|
35
|
+
'photo_url' => Utils::or($this, ['logo_url', 'photo_url']),
|
|
36
|
+
'place' => $this->whenLoaded('place', new Place($this->place)),
|
|
37
|
+
'address' => $this->when(Http::isInternalRequest(), data_get($this, 'place.address')),
|
|
38
|
+
'address_street' => $this->when(Http::isInternalRequest(), data_get($this, 'place.street1')),
|
|
39
|
+
'type' => $this->type,
|
|
40
|
+
'meta' => $this->meta ?? [],
|
|
41
|
+
'slug' => $this->slug,
|
|
42
|
+
'updated_at' => $this->updated_at,
|
|
43
|
+
'created_at' => $this->created_at,
|
|
44
|
+
]
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Transform the resource into an webhook payload.
|
|
50
|
+
*
|
|
51
|
+
* @return array
|
|
52
|
+
*/
|
|
53
|
+
public function toWebhookPayload()
|
|
54
|
+
{
|
|
55
|
+
return [
|
|
56
|
+
'id' => $this->public_id,
|
|
57
|
+
'internal_id' => $this->internal_id,
|
|
58
|
+
'name' => $this->name,
|
|
59
|
+
'email' => $this->email,
|
|
60
|
+
'phone' => $this->phone,
|
|
61
|
+
'photo_url' => Utils::or($this, ['logo_url', 'photo_url']),
|
|
62
|
+
'place' => $this->whenLoaded('place', new Place($this->place)),
|
|
63
|
+
'address' => data_get($this, 'place.address'),
|
|
64
|
+
'address_street' => data_get($this, 'place.street1'),
|
|
65
|
+
'type' => $this->type,
|
|
66
|
+
'meta' => $this->meta ?? [],
|
|
67
|
+
'slug' => $this->slug,
|
|
68
|
+
'updated_at' => $this->updated_at,
|
|
69
|
+
'created_at' => $this->created_at,
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
7
|
+
use Fleetbase\Support\Http;
|
|
8
|
+
use Grimzy\LaravelMysqlSpatial\Types\Polygon;
|
|
9
|
+
|
|
10
|
+
class Zone extends FleetbaseResource
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* Transform the resource into an array.
|
|
14
|
+
*
|
|
15
|
+
* @param \Illuminate\Http\Request $request
|
|
16
|
+
*
|
|
17
|
+
* @return array
|
|
18
|
+
*/
|
|
19
|
+
public function toArray($request)
|
|
20
|
+
{
|
|
21
|
+
return array_merge(
|
|
22
|
+
$this->getInternalIds(),
|
|
23
|
+
[
|
|
24
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
25
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
26
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
27
|
+
'name' => $this->name,
|
|
28
|
+
'description' => $this->description,
|
|
29
|
+
'coordinates' => $this->when($this->border instanceof Polygon, Utils::getCoordinatesFromPolygon($this->border), []),
|
|
30
|
+
'border' => $this->border,
|
|
31
|
+
'color' => $this->color,
|
|
32
|
+
'stroke_color' => $this->stroke_color,
|
|
33
|
+
'status' => $this->status,
|
|
34
|
+
'updated_at' => $this->updated_at,
|
|
35
|
+
'created_at' => $this->created_at,
|
|
36
|
+
]
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Transform the resource into an webhook payload.
|
|
42
|
+
*
|
|
43
|
+
* @return array
|
|
44
|
+
*/
|
|
45
|
+
public function toWebhookPayload()
|
|
46
|
+
{
|
|
47
|
+
return [
|
|
48
|
+
'id' => $this->public_id,
|
|
49
|
+
'name' => $this->name,
|
|
50
|
+
'description' => $this->description,
|
|
51
|
+
'coordinates' => data_get($this->border, 'coordinates', []),
|
|
52
|
+
'border' => $this->border,
|
|
53
|
+
'color' => $this->color,
|
|
54
|
+
'stroke_color' => $this->stroke_color,
|
|
55
|
+
'status' => $this->status,
|
|
56
|
+
'updated_at' => $this->updated_at,
|
|
57
|
+
'created_at' => $this->created_at,
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
}
|