diff --git a/addon/controllers/operations/orders/index/new.js b/addon/controllers/operations/orders/index/new.js index 4a87f30e..82be1130 100644 --- a/addon/controllers/operations/orders/index/new.js +++ b/addon/controllers/operations/orders/index/new.js @@ -196,6 +196,11 @@ export default class OperationsOrdersIndexNewController extends BaseController { return renderableComponents; } + get renderableEntityInputComponents() { + const renderableComponents = this.universe.getRenderableComponentsFromRegistry('fleet-ops:template:operations:orders:new:entities-input'); + return renderableComponents; + } + @not('isServicable') isNotServicable; @alias('currentUser.latitude') userLatitude; @alias('currentUser.longitude') userLongitude; @@ -1418,6 +1423,12 @@ export default class OperationsOrdersIndexNewController extends BaseController { this.entities.pushObject(entity); } + @action addEntities(entities = []) { + if (isArray(entities)) { + this.entities.pushObjects(entities); + } + } + @action addEntity(importId = null) { const entity = this.store.createRecord('entity', { _import_id: importId, diff --git a/addon/engine.js b/addon/engine.js index 881b5e62..502a988e 100644 --- a/addon/engine.js +++ b/addon/engine.js @@ -67,6 +67,7 @@ export default class FleetOpsEngine extends Engine { // create all registries necessary universe.createRegistries([ 'engine:fleet-ops', + 'component:live-map-drawer', 'component:vehicle-panel', 'component:driver-panel', 'component:order-config-manager', @@ -74,6 +75,7 @@ export default class FleetOpsEngine extends Engine { 'contextmenu:driver', 'fleet-ops:template:operations:orders:view', 'fleet-ops:template:operations:orders:new', + 'fleet-ops:template:operations:orders:new:entities-input', ]); }; } diff --git a/addon/templates/operations/orders/index/new.hbs b/addon/templates/operations/orders/index/new.hbs index 89208b2a..2abd0bc9 100644 --- a/addon/templates/operations/orders/index/new.hbs +++ b/addon/templates/operations/orders/index/new.hbs @@ -526,7 +526,7 @@ {{#if this.renderableComponents}} {{#each this.renderableComponents as |renderableComponent|}} - {{component renderableComponent order=this.order}} + {{component renderableComponent order=this.order controller=this}} {{/each}} {{/if}} @@ -568,6 +568,11 @@ {{/if}} + {{#if this.renderableEntityInputComponents}} + {{#each this.renderableEntityInputComponents as |renderableEntityInputComponent|}} + {{component renderableEntityInputComponent order=this.order controller=this}} + {{/each}} + {{/if}} {{/if}} {{#if this.isCsvImportedOrder}} diff --git a/composer.json b/composer.json index f655c998..d9fe78e9 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "fleetbase/fleetops-api", - "version": "0.4.30", + "version": "0.5.0", "description": "Fleet & Transport Management Extension for Fleetbase", "keywords": [ "fleetbase-extension", @@ -22,7 +22,7 @@ ], "require": { "php": "^8.0", - "fleetbase/core-api": "^1.4.25", + "fleetbase/core-api": "^1.4.26", "barryvdh/laravel-dompdf": "^2.0", "brick/geo": "0.7.2", "cknow/laravel-money": "^7.1", diff --git a/extension.json b/extension.json index 232ab1c2..c69f8477 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Fleet-Ops", - "version": "0.4.30", + "version": "0.5.0", "description": "Fleet & Transport Management Extension for Fleetbase", "repository": "https://github.com/fleetbase/fleetops", "license": "MIT", diff --git a/package.json b/package.json index b43621e8..b70d4692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/fleetops-engine", - "version": "0.4.30", + "version": "0.5.0", "description": "Fleet & Transport Management Extension for Fleetbase", "fleetbase": { "route": "fleet-ops" @@ -43,7 +43,7 @@ "dependencies": { "@babel/core": "^7.23.2", "@fleetbase/ember-core": "^0.2.11", - "@fleetbase/ember-ui": "^0.2.16", + "@fleetbase/ember-ui": "^0.2.17", "@fleetbase/fleetops-data": "^0.1.15", "@fleetbase/leaflet-routing-machine": "^3.2.16", "@fortawesome/ember-fontawesome": "^0.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c007c247..552b7f3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,8 +8,8 @@ dependencies: specifier: ^0.2.11 version: 0.2.11(@ember/test-helpers@3.2.0)(ember-source@5.4.0)(webpack@5.89.0) '@fleetbase/ember-ui': - specifier: ^0.2.16 - version: 0.2.16(@ember/test-helpers@3.2.0)(@glimmer/component@1.1.2)(@glimmer/tracking@1.1.2)(ember-source@5.4.0)(postcss@8.4.35)(rollup@4.12.0)(tracked-built-ins@3.3.0)(webpack@5.89.0) + specifier: ^0.2.17 + version: 0.2.17(@ember/test-helpers@3.2.0)(@glimmer/component@1.1.2)(@glimmer/tracking@1.1.2)(ember-source@5.4.0)(postcss@8.4.35)(rollup@4.12.0)(tracked-built-ins@3.3.0)(webpack@5.89.0) '@fleetbase/fleetops-data': specifier: ^0.1.15 version: 0.1.15 @@ -1591,9 +1591,9 @@ packages: peerDependencies: postcss: ^8.4 dependencies: - '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.0.15) + '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.1.0) postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /@csstools/postcss-color-function@3.0.16(postcss@8.4.35): @@ -1714,9 +1714,9 @@ packages: peerDependencies: postcss: ^8.4 dependencies: - '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.0.15) + '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.1.0) postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /@csstools/postcss-light-dark-function@1.0.5(postcss@8.4.35): @@ -1871,7 +1871,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /@csstools/postcss-stepped-value-functions@3.0.8(postcss@8.4.35): @@ -1936,15 +1936,6 @@ packages: postcss-selector-parser: 6.0.15 dev: true - /@csstools/selector-specificity@3.1.1(postcss-selector-parser@6.0.15): - resolution: {integrity: sha512-a7cxGcJ2wIlMFLlh8z2ONm+715QkPHiyJcxwQlKOz/03GPw1COpfhcmC9wm4xlZfp//jWHNNMwzjtqHXVWU9KA==} - engines: {node: ^14 || ^16 || >=18} - peerDependencies: - postcss-selector-parser: ^6.0.13 - dependencies: - postcss-selector-parser: 6.0.15 - dev: false - /@csstools/selector-specificity@3.1.1(postcss-selector-parser@6.1.0): resolution: {integrity: sha512-a7cxGcJ2wIlMFLlh8z2ONm+715QkPHiyJcxwQlKOz/03GPw1COpfhcmC9wm4xlZfp//jWHNNMwzjtqHXVWU9KA==} engines: {node: ^14 || ^16 || >=18} @@ -2538,8 +2529,8 @@ packages: - webpack dev: false - /@fleetbase/ember-ui@0.2.16(@ember/test-helpers@3.2.0)(@glimmer/component@1.1.2)(@glimmer/tracking@1.1.2)(ember-source@5.4.0)(postcss@8.4.35)(rollup@4.12.0)(tracked-built-ins@3.3.0)(webpack@5.89.0): - resolution: {integrity: sha512-RLdqzTDAEbOyIfSrNb3JsS/i9wZ5hy0/CnfK68ccIpC6AePImxBrmqUUYDiTzN3afUFjBGpg7P+uwNT8FwM2nw==} + /@fleetbase/ember-ui@0.2.17(@ember/test-helpers@3.2.0)(@glimmer/component@1.1.2)(@glimmer/tracking@1.1.2)(ember-source@5.4.0)(postcss@8.4.35)(rollup@4.12.0)(tracked-built-ins@3.3.0)(webpack@5.89.0): + resolution: {integrity: sha512-eJLMBZfIotEeGH7QjlAA2Ns/K83QQztVlnWzvLBjD5YxvQflw2dAJE6EPxPWxbjeCi8B9hOoyIP4ZmtSdcz6mQ==} engines: {node: '>= 18'} dependencies: '@babel/core': 7.23.2 @@ -6487,7 +6478,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /css-color-converter@2.0.0: @@ -6509,9 +6500,9 @@ packages: peerDependencies: postcss: ^8.4 dependencies: - '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.0.15) + '@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.1.0) postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 postcss-value-parser: 4.2.0 dev: false @@ -12670,7 +12661,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-clamp@4.1.0(postcss@8.4.35): @@ -12766,7 +12757,7 @@ packages: '@csstools/css-parser-algorithms': 2.6.3(@csstools/css-tokenizer@2.3.1) '@csstools/css-tokenizer': 2.3.1 postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-dir-pseudo-class@8.0.1(postcss@8.4.35): @@ -12776,7 +12767,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-double-position-gradients@5.0.6(postcss@8.4.35): @@ -12807,7 +12798,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-focus-within@8.0.1(postcss@8.4.35): @@ -12817,7 +12808,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-font-variant@5.0.0(postcss@8.4.35): @@ -12968,7 +12959,7 @@ packages: postcss: ^8.2.14 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-nesting@12.1.5(postcss@8.4.35): @@ -13096,7 +13087,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-replace-overflow-wrap@4.0.0(postcss@8.4.35): @@ -13127,7 +13118,7 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.35 - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 dev: false /postcss-selector-parser@6.0.15: @@ -14881,7 +14872,7 @@ packages: postcss-js: 4.0.1(postcss@8.4.35) postcss-load-config: 4.0.2(postcss@8.4.35) postcss-nested: 6.0.1(postcss@8.4.35) - postcss-selector-parser: 6.0.15 + postcss-selector-parser: 6.1.0 resolve: 1.22.8 sucrase: 3.35.0 transitivePeerDependencies: diff --git a/server/src/Http/Controllers/Api/v1/DriverController.php b/server/src/Http/Controllers/Api/v1/DriverController.php index 5c4ad427..c108b13c 100644 --- a/server/src/Http/Controllers/Api/v1/DriverController.php +++ b/server/src/Http/Controllers/Api/v1/DriverController.php @@ -36,8 +36,6 @@ class DriverController extends Controller /** * Creates a new Fleetbase Driver resource. * - * @param \Fleetbase\Http\Requests\CreateDriverRequest $request - * * @return \Fleetbase\Http\Resources\Driver */ public function create(CreateDriverRequest $request) @@ -52,7 +50,12 @@ public function create(CreateDriverRequest $request) $userDetails = $request->only(['name', 'password', 'email', 'phone', 'timezone']); // Get current company session - $company = Auth::getCompany(); + $company = $request->has('company') ? Auth::getCompanyFromRequest($request) : Auth::getCompany(); + + // Debugging: Ensure company is retrieved correctly + if (!$company) { + return response()->apiError('Company not found.'); + } // Apply user infos $userDetails = User::applyUserInfoFromRequest($request, $userDetails); @@ -74,13 +77,13 @@ public function create(CreateDriverRequest $request) // set user id $input['user_uuid'] = $user->uuid; - $input['company_uuid'] = $company->uuid; + $input['company_uuid'] = $company->uuid; // Ensure correct company_uuid is set // vehicle assignment public_id -> uuid if ($request->has('vehicle')) { $input['vehicle_uuid'] = Utils::getUuid('vehicles', [ 'public_id' => $request->input('vehicle'), - 'company_uuid' => session('company'), + 'company_uuid' => $company->uuid, // Use $company->uuid instead of session ]); } @@ -88,7 +91,7 @@ public function create(CreateDriverRequest $request) if ($request->has('vendor')) { $input['vendor_uuid'] = Utils::getUuid('vendors', [ 'public_id' => $request->input('vendor'), - 'company_uuid' => session('company'), + 'company_uuid' => $company->uuid, // Use $company->uuid instead of session ]); } @@ -96,7 +99,7 @@ public function create(CreateDriverRequest $request) if ($request->has('job')) { $input['current_job_uuid'] = Utils::getUuid('orders', [ 'public_id' => $request->input('job'), - 'company_uuid' => session('company'), + 'company_uuid' => $company->uuid, // Use $company->uuid instead of session ]); } diff --git a/server/src/Http/Controllers/Api/v1/IssueController.php b/server/src/Http/Controllers/Api/v1/IssueController.php index 076d2634..e4409a13 100644 --- a/server/src/Http/Controllers/Api/v1/IssueController.php +++ b/server/src/Http/Controllers/Api/v1/IssueController.php @@ -30,6 +30,7 @@ public function create(CreateIssueRequest $request) 'type', 'report', 'priority', + 'status', ]); // Find driver who is reporting @@ -83,6 +84,7 @@ public function update($id, UpdateIssueRequest $request) 'type', 'report', 'priority', + 'status', ]); // update the issue diff --git a/server/src/Http/Controllers/Api/v1/NavigatorController.php b/server/src/Http/Controllers/Api/v1/NavigatorController.php index ac07c7ae..91f02c09 100644 --- a/server/src/Http/Controllers/Api/v1/NavigatorController.php +++ b/server/src/Http/Controllers/Api/v1/NavigatorController.php @@ -3,6 +3,7 @@ namespace Fleetbase\FleetOps\Http\Controllers\Api\v1; use Fleetbase\Http\Controllers\Controller; +use Fleetbase\Models\Company; use Fleetbase\Models\Setting; class NavigatorController extends Controller @@ -25,7 +26,8 @@ class NavigatorController extends Controller */ public function getDriverOnboardSettings($companyId) { - $driverOnboardSettings = Setting::where('key', 'fleet-ops.driver-onboard-settings.' . $companyId)->value('value'); + $company = Company::select()->where('public_id', $companyId)->first(); + $driverOnboardSettings = Setting::where('key', 'fleet-ops.driver-onboard-settings.' . $company->uuid)->value('value'); if (!$driverOnboardSettings) { $driverOnboardSettings = []; } diff --git a/server/src/Http/Controllers/Api/v1/OrganizationController.php b/server/src/Http/Controllers/Api/v1/OrganizationController.php index 3f3c6a21..4f9dc694 100644 --- a/server/src/Http/Controllers/Api/v1/OrganizationController.php +++ b/server/src/Http/Controllers/Api/v1/OrganizationController.php @@ -23,7 +23,7 @@ public function listOrganizations(Request $request) $companies = Company::whereHas('users')->get()->map(function ($company) { return [ 'name' => $company->name, - 'uuid' => $company->uuid, + 'id' => $company->public_id, ]; });