@fleetbase/fleetops-engine 0.3.3 → 0.3.4

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 (110) hide show
  1. package/addon/components/contact-form-panel.hbs +28 -6
  2. package/addon/components/driver-form-panel.hbs +10 -0
  3. package/addon/components/driver-form-panel.js +51 -0
  4. package/addon/components/driver-panel/details.hbs +1 -5
  5. package/addon/components/driver-panel.hbs +21 -3
  6. package/addon/components/fleet-form-panel.hbs +60 -6
  7. package/addon/components/fleet-panel/details.hbs +1 -1
  8. package/addon/components/fuel-report-form-panel.hbs +84 -8
  9. package/addon/components/fuel-report-form-panel.js +6 -0
  10. package/addon/components/fuel-report-panel/details.hbs +4 -0
  11. package/addon/components/issue-form-panel.hbs +99 -11
  12. package/addon/components/issue-form-panel.js +5 -13
  13. package/addon/components/layout/fleet-ops-sidebar.js +8 -0
  14. package/addon/components/live-map-drawer.hbs +1 -1
  15. package/addon/components/live-map.hbs +1 -1
  16. package/addon/components/modals/driver-assign-vehicle.hbs +2 -11
  17. package/addon/components/modals/driver-assign-vendor.hbs +1 -9
  18. package/addon/components/modals/fuel-report-details.hbs +4 -0
  19. package/addon/components/order/schedule-card.hbs +32 -4
  20. package/addon/components/order/schedule-card.js +155 -5
  21. package/addon/components/place-form-panel.hbs +14 -7
  22. package/addon/components/place-form-panel.js +71 -0
  23. package/addon/components/place-panel/details.hbs +9 -19
  24. package/addon/components/vehicle-form-panel.hbs +67 -7
  25. package/addon/components/vehicle-form-panel.js +37 -0
  26. package/addon/components/vehicle-panel/details.hbs +9 -5
  27. package/addon/components/vehicle-panel.hbs +18 -4
  28. package/addon/components/vendor-form-panel/create-form.hbs +72 -11
  29. package/addon/components/vendor-form-panel/edit-form.hbs +1 -1
  30. package/addon/components/vendor-form-panel.hbs +70 -30
  31. package/addon/components/vendor-form-panel.js +4 -40
  32. package/addon/components/vendor-panel/details.hbs +2 -2
  33. package/addon/components/vendor-panel.hbs +16 -2
  34. package/addon/controllers/management/contacts/index.js +42 -3
  35. package/addon/controllers/management/fleets/index.js +12 -23
  36. package/addon/controllers/management/fuel-reports/index/new.js +1 -1
  37. package/addon/controllers/management/fuel-reports/index.js +73 -20
  38. package/addon/controllers/management/issues/index/new.js +2 -2
  39. package/addon/controllers/management/issues/index.js +65 -45
  40. package/addon/controllers/management/places/index.js +59 -18
  41. package/addon/controllers/management/vehicles/index.js +67 -8
  42. package/addon/controllers/management/vendors/index.js +63 -8
  43. package/addon/controllers/operations/orders/index.js +42 -1
  44. package/addon/routes/management/contacts/index.js +8 -0
  45. package/addon/routes/management/fleets/index.js +8 -2
  46. package/addon/routes/management/fuel-reports/index.js +6 -0
  47. package/addon/routes/management/issues/index.js +9 -1
  48. package/addon/routes/management/places/index.js +11 -1
  49. package/addon/routes/management/vehicles/index.js +3 -3
  50. package/addon/routes/management/vendors/index.js +8 -0
  51. package/addon/routes/operations/scheduler/index.js +1 -1
  52. package/addon/templates/operations/orders/index.hbs +1 -1
  53. package/addon/utils/get-issue-categories.js +30 -0
  54. package/addon/utils/get-issue-types.js +3 -0
  55. package/addon/utils/get-vendor-status-options.js +3 -0
  56. package/addon/utils/get-vendor-type-options.js +41 -0
  57. package/app/utils/get-issue-categories.js +1 -0
  58. package/app/utils/get-issue-types.js +1 -0
  59. package/app/utils/get-vendor-categories.js +1 -0
  60. package/app/utils/get-vendor-status-options.js +1 -0
  61. package/app/utils/get-vendor-type-options.js +1 -0
  62. package/app/utils/get-vendor-types.js +1 -0
  63. package/composer.json +1 -1
  64. package/extension.json +1 -1
  65. package/package.json +4 -4
  66. package/server/migrations/2023_11_09_041807_add_status_column_to_fuel_reports_table.php +32 -0
  67. package/server/migrations/2023_11_15_062814_add_comments_column_and_resolved_at_column_to_vehicle_device_events_table.php +33 -0
  68. package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -2
  69. package/server/src/Http/Controllers/Api/v1/VehicleController.php +2 -2
  70. package/server/src/Http/Controllers/Internal/v1/DriverController.php +5 -13
  71. package/server/src/Http/Controllers/Internal/v1/OrderController.php +1 -3
  72. package/server/src/Http/Filter/ContactFilter.php +10 -0
  73. package/server/src/Http/Filter/FleetFilter.php +8 -6
  74. package/server/src/Http/Filter/FuelReportFilter.php +51 -0
  75. package/server/src/Http/Filter/IssueFilter.php +61 -5
  76. package/server/src/Http/Filter/PlaceFilter.php +48 -6
  77. package/server/src/Http/Filter/VehicleFilter.php +21 -6
  78. package/server/src/Http/Filter/VendorFilter.php +11 -8
  79. package/server/src/Http/Middleware/TransformLocationMiddleware.php +1 -1
  80. package/server/src/Http/Resources/Internal/v1/IntegratedVendorFacilitator.php +17 -18
  81. package/server/src/Http/Resources/v1/Contact.php +16 -19
  82. package/server/src/Http/Resources/v1/CurrentJob.php +13 -16
  83. package/server/src/Http/Resources/v1/Driver.php +59 -57
  84. package/server/src/Http/Resources/v1/Entity.php +30 -33
  85. package/server/src/Http/Resources/v1/FuelReport.php +16 -14
  86. package/server/src/Http/Resources/v1/Order.php +1 -1
  87. package/server/src/Http/Resources/v1/Payload.php +21 -24
  88. package/server/src/Http/Resources/v1/Place.php +27 -30
  89. package/server/src/Http/Resources/v1/Proof.php +13 -16
  90. package/server/src/Http/Resources/v1/PurchaseRate.php +14 -17
  91. package/server/src/Http/Resources/v1/ServiceArea.php +13 -16
  92. package/server/src/Http/Resources/v1/ServiceQuote.php +15 -18
  93. package/server/src/Http/Resources/v1/ServiceRate.php +33 -36
  94. package/server/src/Http/Resources/v1/ServiceRateFee.php +14 -17
  95. package/server/src/Http/Resources/v1/ServiceRateParcelFee.php +9 -12
  96. package/server/src/Http/Resources/v1/TrackingNumber.php +18 -21
  97. package/server/src/Http/Resources/v1/TrackingStatus.php +18 -21
  98. package/server/src/Http/Resources/v1/Vehicle.php +31 -34
  99. package/server/src/Http/Resources/v1/VehicleDevice.php +23 -25
  100. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +38 -32
  101. package/server/src/Http/Resources/v1/Vendor.php +31 -26
  102. package/server/src/Http/Resources/v1/Zone.php +14 -17
  103. package/server/src/Models/Driver.php +7 -1
  104. package/server/src/Models/FuelReport.php +1 -0
  105. package/server/src/Models/IntegratedVendor.php +6 -1
  106. package/server/src/Models/Order.php +2 -2
  107. package/server/src/Models/Place.php +2 -2
  108. package/server/src/Models/VehicleDeviceEvent.php +1 -0
  109. package/server/src/Models/Vendor.php +1 -1
  110. package/server/src/Observers/DriverObserver.php +15 -0
@@ -1,4 +1,11 @@
1
- <Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizeble={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
1
+ <Overlay
2
+ @onLoad={{this.setOverlayContext}}
3
+ @position="right"
4
+ @noBackdrop={{true}}
5
+ @fullHeight={{true}}
6
+ @isResizeble={{or this.isResizable @isResizable}}
7
+ @width={{or this.width @width "600px"}}
8
+ >
2
9
  <Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
3
10
  <div class="flex flex-row items-center justify-between w-full mb-4">
4
11
  <div class="flex flex-1 space-x-2">
@@ -8,9 +15,21 @@
8
15
  </div>
9
16
  <div class="flex flex-1 justify-end">
10
17
  <div class="mr-2">
11
- <Button @icon={{if this.vehicle.id "save" "check"}} @type="primary" @text={{if this.vehicle.id "Save Vehicle" "Create Vehicle"}} @onClick={{this.save}} @isLoading={{this.isLoading}} />
18
+ <Button
19
+ @icon={{if this.vehicle.id "save" "check"}}
20
+ @type="primary"
21
+ @text={{if this.vehicle.id "Save Vehicle" "Create Vehicle"}}
22
+ @onClick={{this.save}}
23
+ @isLoading={{this.isLoading}}
24
+ />
12
25
  </div>
13
- <Button @type="default" @icon="times" @helpText={{if this.vehicle.id "Cancel edit vehicle" "Cancel new vehicle"}} @onClick={{this.onPressCancel}} @disabled={{this.isLoading}} />
26
+ <Button
27
+ @type="default"
28
+ @icon="times"
29
+ @helpText={{if this.vehicle.id "Cancel edit vehicle" "Cancel new vehicle"}}
30
+ @onClick={{this.onPressCancel}}
31
+ @disabled={{this.isLoading}}
32
+ />
14
33
  </div>
15
34
  </div>
16
35
  <div class="flex flex-row justify-between w-full">
@@ -23,7 +42,15 @@
23
42
  <InputInfo @text="Upload new photo" />
24
43
  </Attach::Tooltip>
25
44
  <div class="upload-avatar-button-wrapper rounded-lg">
26
- <UploadButton @name="photos" @accept="image/*" @onFileAdded={{this.onUploadNewPhoto}} @icon="upload" @hideButtonText={{true}} @labelClass="upload-avatar-label-overlay" class="w-12 btn-reset" />
45
+ <UploadButton
46
+ @name="photos"
47
+ @accept="image/*"
48
+ @onFileAdded={{this.onUploadNewPhoto}}
49
+ @icon="upload"
50
+ @hideButtonText={{true}}
51
+ @labelClass="upload-avatar-label-overlay"
52
+ class="w-12 btn-reset"
53
+ />
27
54
  </div>
28
55
  </div>
29
56
  </div>
@@ -88,18 +115,43 @@
88
115
  </InputGroup>
89
116
 
90
117
  <InputGroup @name="Driver Assigned">
91
- <ModelSelect @modelName="driver" @selectedModel={{this.vehicle.driver}} @placeholder="Select Driver" @triggerClass="form-select form-input" @infiniteScroll={{false}} @renderInPlace={{true}} @onChange={{fn (mut this.vehicle.driver)}} as |model|>
118
+ <ModelSelect
119
+ @modelName="driver"
120
+ @selectedModel={{this.vehicle.driver}}
121
+ @placeholder="Select Driver"
122
+ @triggerClass="form-select form-input"
123
+ @infiniteScroll={{false}}
124
+ @renderInPlace={{true}}
125
+ @onChange={{fn (mut this.vehicle.driver)}}
126
+ as |model|
127
+ >
92
128
  {{model.name}}
93
129
  </ModelSelect>
94
130
  </InputGroup>
95
131
 
96
132
  <InputGroup @name="Status">
97
133
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
98
- <PowerSelect @options={{this.vehicleStatusOptions}} @selected={{this.vehicle.status}} @onChange={{fn (mut this.vehicle.status)}} @placeholder="Select vehicle status" @triggerClass="form-select form-input" as |status|>
134
+ <PowerSelect
135
+ @options={{this.vehicleStatusOptions}}
136
+ @selected={{this.vehicle.status}}
137
+ @onChange={{fn (mut this.vehicle.status)}}
138
+ @placeholder="Select vehicle status"
139
+ @triggerClass="form-select form-input"
140
+ as |status|
141
+ >
99
142
  {{smart-humanize status}}
100
143
  </PowerSelect>
101
144
  </div>
102
145
  </InputGroup>
146
+ <InputGroup @name="Coordinates" @wrapperClass="col-span-2">
147
+ <CoordinatesInput
148
+ @value={{this.vehicle.location}}
149
+ @onChange={{this.onCoordinatesChanged}}
150
+ @onGeocode={{this.onAutocomplete}}
151
+ @onUpdatedFromMap={{this.onCoordinatesChanged}}
152
+ @onInit={{this.setCoordinatesInput}}
153
+ />
154
+ </InputGroup>
103
155
  </div>
104
156
  </ContentPanel>
105
157
 
@@ -107,7 +159,15 @@
107
159
  <div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
108
160
  <div class="input-group mb-2">
109
161
  <InputLabel @labelText="Select map avatar" @helpText="Select an avatar to be used for rendering on maps when using geolocation tracking features." />
110
- <FetchSelect @wrapperClass="w-60" @placeholder="Select avatar" @endpoint="vehicles/avatars" @selected={{this.vehicle.avatar_url}} @optionValue="value" @onChange={{fn (mut this.vehicle.avatar_url)}} as |option|>
162
+ <FetchSelect
163
+ @wrapperClass="w-60"
164
+ @placeholder="Select avatar"
165
+ @endpoint="vehicles/avatars"
166
+ @selected={{this.vehicle.avatar_url}}
167
+ @optionValue="value"
168
+ @onChange={{fn (mut this.vehicle.avatar_url)}}
169
+ as |option|
170
+ >
111
171
  {{titleize (humanize option.key)}}
112
172
  </FetchSelect>
113
173
  </div>
@@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
4
4
  import { action } from '@ember/object';
5
5
  import contextComponentCallback from '../utils/context-component-callback';
6
6
  import applyContextComponentArguments from '../utils/apply-context-component-arguments';
7
+ import Point from '@fleetbase/fleetops-data/utils/geojson/point';
7
8
 
8
9
  export default class VehicleFormPanelComponent extends Component {
9
10
  /**
@@ -160,4 +161,40 @@ export default class VehicleFormPanelComponent extends Component {
160
161
  @action onPressCancel() {
161
162
  return contextComponentCallback(this, 'onPressCancel', this.vehicle);
162
163
  }
164
+
165
+ @action onAutocomplete({ location }) {
166
+ if (location) {
167
+ this.vehicle.setProperties({ location });
168
+
169
+ if (this.coordinatesInputComponent) {
170
+ this.coordinatesInputComponent.updateCoordinates(location);
171
+ }
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Sets the coordinates input component.
177
+ *
178
+ * @action
179
+ * @param {Object} coordinatesInputComponent - The coordinates input component to be set.
180
+ * @memberof PlaceFormPanelComponent
181
+ */
182
+ @action setCoordinatesInput(coordinatesInputComponent) {
183
+ this.coordinatesInputComponent = coordinatesInputComponent;
184
+ }
185
+
186
+ /**
187
+ * Updates the Vehicle coordinates with the given latitude and longitude.
188
+ *
189
+ * @action
190
+ * @param {Object} coordinates - The latitude and longitude coordinates.
191
+ * @param {number} coordinates.latitude - Latitude value.
192
+ * @param {number} coordinates.longitude - Longitude value.
193
+ * @memberof PlaceFormPanelComponent
194
+ */
195
+ @action onCoordinatesChanged({ latitude, longitude }) {
196
+ const location = new Point(longitude, latitude);
197
+
198
+ this.vehicle.setProperties({ location });
199
+ }
163
200
  }
@@ -5,10 +5,6 @@
5
5
  <div class="field-name">Name</div>
6
6
  <div class="field-value">{{n-a @vehicle.display_name}}</div>
7
7
  </div>
8
- <div class="field-info-container">
9
- <div class="field-name">Internal ID</div>
10
- <div class="field-value">{{n-a @vehicle.internal_id}}</div>
11
- </div>
12
8
  <div class="field-info-container">
13
9
  <div class="field-name">Plate Number</div>
14
10
  <div class="field-value">{{n-a @vehicle.plate_number}}</div>
@@ -19,7 +15,7 @@
19
15
  </div>
20
16
  <div class="field-info-container">
21
17
  <div class="field-name">Make</div>
22
- <div class="field-value">{{n-a @vehicle.name}}</div>
18
+ <div class="field-value">{{n-a @vehicle.make}}</div>
23
19
  </div>
24
20
  <div class="field-info-container">
25
21
  <div class="field-name">Model</div>
@@ -29,6 +25,14 @@
29
25
  <div class="field-name">Year</div>
30
26
  <div class="field-value">{{n-a @vehicle.year}}</div>
31
27
  </div>
28
+ <div class="field-info-container col-span-3">
29
+ <div class="field-name">
30
+ Coordinates
31
+ </div>
32
+ <div class="field-value">
33
+ {{point-coordinates @vehicle.location}}
34
+ </div>
35
+ </div>
32
36
  </div>
33
37
  </ContentPanel>
34
38
 
@@ -1,4 +1,11 @@
1
- <Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
1
+ <Overlay
2
+ @onLoad={{this.setOverlayContext}}
3
+ @position="right"
4
+ @noBackdrop={{true}}
5
+ @fullHeight={{true}}
6
+ @isResizable={{or this.isResizable @isResizable}}
7
+ @width={{or this.width @width "600px"}}
8
+ >
2
9
  <Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
3
10
  <div class="flex flex-row items-center justify-between w-full mb-4">
4
11
  <div class="flex flex-1 space-x-2">
@@ -13,7 +20,14 @@
13
20
  <div class="flex flex-row">
14
21
  <div class="w-14">
15
22
  <div class="w-12 h-12 flex items-center justify-start rounded-lg">
16
- <Image src={{this.vehicle.photo_url}} @fallbackSrc={{config "defaultValues.vehicleImage"}} alt={{this.vehicle.name}} height="48" width="48" class="h-12 w-12 rounded-lg shadow-sm" />
23
+ <Image
24
+ src={{this.vehicle.photo_url}}
25
+ @fallbackSrc={{config "defaultValues.vehicleImage"}}
26
+ alt={{this.vehicle.name}}
27
+ height="48"
28
+ width="48"
29
+ class="h-12 w-12 rounded-lg shadow-sm"
30
+ />
17
31
  <Attach::Tooltip @class="clean" @animation="scale" @placement="top">
18
32
  <InputInfo @text={{this.vehicle.displayName}} />
19
33
  </Attach::Tooltip>
@@ -29,7 +43,7 @@
29
43
  {{else}}
30
44
  <div class="flex flex-row items-center">
31
45
  <span class="text-sm dark:text-gray-500 text-gray-700 mr-3">No driver assigned</span>
32
- {{!-- <Button @icon="user-plus" @size="xs" @helpText="Assign a driver to vehicle" /> --}}
46
+ {{! <Button @icon="user-plus" @size="xs" @helpText="Assign a driver to vehicle" /> }}
33
47
  </div>
34
48
  {{/if}}
35
49
  </div>
@@ -46,7 +60,7 @@
46
60
  <div class="ui-tabs mt-4">
47
61
  <nav>
48
62
  {{#each this.tabs as |tab|}}
49
- <a href="javascript:;" class="ui-tab {{if (eq this.tab.slug tab.slug) 'active' }}" {{on "click" (fn this.onTabChanged tab.slug)}}>
63
+ <a href="javascript:;" class="ui-tab {{if (eq this.tab.slug tab.slug) 'active'}}" {{on "click" (fn this.onTabChanged tab.slug)}}>
50
64
  <FaIcon @icon={{tab.icon}} class="mr-1" />
51
65
  <span>{{tab.title}}</span>
52
66
  </a>
@@ -2,7 +2,14 @@
2
2
  <ContentPanel @title="Setup" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
3
3
  <InputGroup @name="Select vendor type">
4
4
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
5
- <PowerSelect @options={{this.vendorTypes}} @selected={{this.selectedVendorType}} @onChange={{this.onSelectVendorType}} @placeholder="Select vendor type" @triggerClass="form-select form-input" as |vendorType|>
5
+ <PowerSelect
6
+ @options={{this.vendorTypes}}
7
+ @selected={{this.selectedVendorType}}
8
+ @onChange={{this.onSelectVendorType}}
9
+ @placeholder="Select vendor type"
10
+ @triggerClass="form-select form-input"
11
+ as |vendorType|
12
+ >
6
13
  {{vendorType.label}}
7
14
  </PowerSelect>
8
15
  </div>
@@ -10,7 +17,14 @@
10
17
  {{#if (eq this.selectedVendorType.value "integrated-vendor")}}
11
18
  <InputGroup @name="Choose integrated vendor provider">
12
19
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
13
- <PowerSelect @options={{this.supportedIntegratedVendors}} @selected={{this.selectedIntegratedVendor}} @onChange={{this.onSelectIntegratedVendor}} @placeholder="Select integrated vendor provider" @triggerClass="form-select form-input" as |integratedVendor|>
20
+ <PowerSelect
21
+ @options={{this.supportedIntegratedVendors}}
22
+ @selected={{this.selectedIntegratedVendor}}
23
+ @onChange={{this.onSelectIntegratedVendor}}
24
+ @placeholder="Select integrated vendor provider"
25
+ @triggerClass="form-select form-input"
26
+ as |integratedVendor|
27
+ >
14
28
  <div class="flex flex-row items-center">
15
29
  <Image src={{integratedVendor.logo}} alt={{integratedVendor.code}} class="w-4 h-4" width="16" height="16" />
16
30
  <h3 class="text-sm ml-4 dark:text-white">{{integratedVendor.name}}</h3>
@@ -31,17 +45,33 @@
31
45
  </ContentPanel>
32
46
  <ContentPanel @title="Credentials" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
33
47
  {{#each this.selectedIntegratedVendor.credential_params as |param|}}
34
- <InputGroup @name={{smart-humanize param.key}} @value={{mut (get this.integratedVendor.credentials param.key)}} @helpText={{concat "Optionally supply your own " (smart-humanize param.key) " to configure this vendor."}} />
48
+ <InputGroup
49
+ @name={{smart-humanize param.key}}
50
+ @value={{mut (get this.integratedVendor.credentials param.key)}}
51
+ @helpText={{concat "Optionally supply your own " (smart-humanize param.key) " to configure this vendor."}}
52
+ />
35
53
  {{/each}}
36
54
  </ContentPanel>
37
55
  <ContentPanel @title="Options" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
38
56
  {{#each this.selectedIntegratedVendor.option_params as |param|}}
39
57
  {{#if param.options}}
40
58
  <InputGroup @name={{smart-humanize param.key}}>
41
- <Select @value={{mut (get this.integratedVendor.options param.key)}} @options={{param.options}} @optionValue={{param.optionValue}} @optionLabel={{param.optionLabel}} @humanize={{true}} @placeholder={{concat "Select " (smart-humanize param.key)}} @onSelect={{fn (mut (get this.integratedVendor.options param.key))}} />
59
+ <Select
60
+ @value={{mut (get this.integratedVendor.options param.key)}}
61
+ @options={{param.options}}
62
+ @optionValue={{param.optionValue}}
63
+ @optionLabel={{param.optionLabel}}
64
+ @humanize={{true}}
65
+ @placeholder={{concat "Select " (smart-humanize param.key)}}
66
+ @onSelect={{fn (mut (get this.integratedVendor.options param.key))}}
67
+ />
42
68
  </InputGroup>
43
69
  {{else}}
44
- <InputGroup @name={{smart-humanize param.key}} @value={{mut (get this.integratedVendor.options param.key)}} @helpText={{concat "Optionally supply your own " (smart-humanize param.key) " to configure this vendor."}} />
70
+ <InputGroup
71
+ @name={{smart-humanize param.key}}
72
+ @value={{mut (get this.integratedVendor.options param.key)}}
73
+ @helpText={{concat "Optionally supply your own " (smart-humanize param.key) " to configure this vendor."}}
74
+ />
45
75
  {{/if}}
46
76
  {{/each}}
47
77
  <InputGroup>
@@ -59,8 +89,16 @@
59
89
  {{#if this.showAdvancedOptions}}
60
90
  <div class="mt-4">
61
91
  <InputGroup @name="Custom Host" @value={{this.integratedVendor.host}} @helpText="Optionally provide a custom host that should be used for this integration." />
62
- <InputGroup @name="Custom Namespace" @value={{this.integratedVendor.namespace}} @helpText="Optionally provide a custom namespace or api version that should be used for the integration." />
63
- <InputGroup @name="Webhook URL" @value={{this.integratedVendor.webhook_url}} @helpText="Integrated vendors will typically require this so that Fleetbase can receive activity updates on the order. Do not change unless you know what you are doing! Changing this may break your order updates!" />
92
+ <InputGroup
93
+ @name="Custom Namespace"
94
+ @value={{this.integratedVendor.namespace}}
95
+ @helpText="Optionally provide a custom namespace or api version that should be used for the integration."
96
+ />
97
+ <InputGroup
98
+ @name="Webhook URL"
99
+ @value={{this.integratedVendor.webhook_url}}
100
+ @helpText="Integrated vendors will typically require this so that Fleetbase can receive activity updates on the order. Do not change unless you know what you are doing! Changing this may break your order updates!"
101
+ />
64
102
  </div>
65
103
  {{/if}}
66
104
  </ContentPanel>
@@ -74,17 +112,31 @@
74
112
  <InputGroup @name="Name" @value={{this.vendor.name}} @helpText="The vendor's name, typically the name of a business." />
75
113
  <InputGroup @name="Email" @type="email" @value={{this.vendor.email}} @helpText="The vendor's email, this can be used to trigger emails to the vendor." />
76
114
  <InputGroup @name="Phone" @type="tel" @value={{this.vendor.phone}} @helpText="The vendor's phone #, this can be used to trigger SMS or messages to the vendor." />
77
- <InputGroup @name="Website" @value={{this.vendor.website}} @helpText="The vendor's website, optionally add the vendors website for reference." />
115
+ <InputGroup @name="Website" @value={{this.vendor.website_url}} @helpText="The vendor's website, optionally add the vendors website for reference." />
78
116
  <InputGroup @name="Type">
79
117
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
80
- <PowerSelect @options={{@vendorTypes}} @selected={{this.vendor.type}} @onChange={{fn (mut this.vendor.type)}} @placeholder="Select vendor type" @triggerClass="form-select form-input" as |type|>
118
+ <PowerSelect
119
+ @options={{@vendorTypes}}
120
+ @selected={{this.vendor.type}}
121
+ @onChange={{fn (mut this.vendor.type)}}
122
+ @placeholder="Select vendor type"
123
+ @triggerClass="form-select form-input"
124
+ as |type|
125
+ >
81
126
  {{smart-humanize type}}
82
127
  </PowerSelect>
83
128
  </div>
84
129
  </InputGroup>
85
130
  <InputGroup @name="Status">
86
131
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
87
- <PowerSelect @options={{@vendorStatusOptions}} @selected={{this.vendor.status}} @onChange={{fn (mut this.vendor.status)}} @placeholder="Select vendor status" @triggerClass="form-select form-input" as |status|>
132
+ <PowerSelect
133
+ @options={{@vendorStatusOptions}}
134
+ @selected={{this.vendor.status}}
135
+ @onChange={{fn (mut this.vendor.status)}}
136
+ @placeholder="Select vendor status"
137
+ @triggerClass="form-select form-input"
138
+ as |status|
139
+ >
88
140
  {{smart-humanize status}}
89
141
  </PowerSelect>
90
142
  </div>
@@ -98,7 +150,16 @@
98
150
  <Button @type="default" @size="xs" @icon="edit" @text={{if this.vendor.has_place "Edit" "New Address"}} @onClick={{this.editAddress}} />
99
151
  </div>
100
152
  </div>
101
- <ModelSelect @modelName="place" @selectedModel={{this.vendor.place}} @placeholder="Select Address" @triggerClass="form-select form-input" @infiniteScroll={{false}} @renderInPlace={{true}} @onChange={{this.selectVendorAddress}} as |model|>
153
+ <ModelSelect
154
+ @modelName="place"
155
+ @selectedModel={{this.vendor.place}}
156
+ @placeholder="Select Address"
157
+ @triggerClass="form-select form-input"
158
+ @infiniteScroll={{false}}
159
+ @renderInPlace={{true}}
160
+ @onChange={{this.selectVendorAddress}}
161
+ as |model|
162
+ >
102
163
  <div class="flex items-center flex-row justify-between">
103
164
  <div class="truncate flex-1">{{n-a model.address}}</div>
104
165
  <Badge @hideStatusDot={{true}} @status="info">{{model.public_id}}</Badge>
@@ -60,7 +60,7 @@
60
60
  <InputGroup @name="Name" @value={{this.vendor.name}} @helpText="The vendor's name, typically the name of a business." />
61
61
  <InputGroup @name="Email" @type="email" @value={{this.vendor.email}} @helpText="The vendor's email, this can be used to trigger emails to the vendor." />
62
62
  <InputGroup @name="Phone" @type="tel" @value={{this.vendor.phone}} @helpText="The vendor's phone #, this can be used to trigger SMS or messages to the vendor." />
63
- <InputGroup @name="Website" @value={{this.vendor.website}} @helpText="The vendor's website, optionally add the vendors website for reference." />
63
+ <InputGroup @name="Website" @value={{this.vendor.website_url}} @helpText="The vendor's website, optionally add the vendors website for reference." />
64
64
  <InputGroup @name="Type">
65
65
  <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
66
66
  <PowerSelect @options={{@vendorTypes}} @selected={{this.vendor.type}} @onChange={{fn (mut this.vendor.type)}} @placeholder="Select vendor type" @triggerClass="form-select form-input" as |type|>
@@ -1,48 +1,88 @@
1
- <Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizeble={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
1
+ <Overlay
2
+ @onLoad={{this.setOverlayContext}}
3
+ @position="right"
4
+ @noBackdrop={{true}}
5
+ @fullHeight={{true}}
6
+ @isResizeble={{or this.isResizable @isResizable}}
7
+ @width={{or this.width @width "600px"}}
8
+ >
2
9
  <Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i">
10
+ <div class="flex flex-row items-center justify-between w-full mb-4">
11
+ <div class="flex flex-1 space-x-2">
12
+ {{#if this.vendor.id}}
13
+ <Button @type="default" @icon="warehouse" @helpText="View vendor details" @onClick={{this.onViewDetails}} />
14
+ {{/if}}
15
+ </div>
16
+ <div class="flex flex-1 justify-end">
17
+ <div class="mr-2">
18
+ <Button @icon={{if this.vendor.id "save" "check"}} @type="primary" @text={{if this.vendor.id "Save Vendor" "Create Vendor"}} @onClick={{this.save}} />
19
+ </div>
20
+ <Button @type="default" @icon="times" @helpText={{if this.vendor.id "Cancel edit vendor" "Cancel new vendor"}} @onClick={{this.onPressCancel}} />
21
+ </div>
22
+ </div>
3
23
  <div class="flex flex-row justify-between w-full">
4
- <div class="flex flex-1 flex-row">
5
- <div class="w-14">
6
- <div class="upload-avatar-overlay w-12 h-12 flex items-center justify-start rounded-lg">
7
- <img src={{this.vendor.logo_url}} alt={{this.vendor.name}} height="48" width="48" class="h-12 w-12 rounded-lg shadow-sm" />
8
- <Attach::Tooltip @class="clean" @animation="scale" @placement="top">
9
- <InputInfo @text="Upload new photo" />
10
- </Attach::Tooltip>
11
- <div class="upload-avatar-button-wrapper rounded-lg">
12
- <UploadButton @name="photos" @accept="image/*" @onFileAdded={{this.onUploadNewPhoto}} @icon="upload" @hideButtonText={{true}} @labelClass="upload-avatar-label-overlay" class="w-12 btn-reset" />
24
+ <div class="flex flex-col flex-1 w-3/4">
25
+ <div class="flex flex-row">
26
+ <div class="w-14">
27
+ <div class="upload-avatar-overlay w-12 h-12 flex items-center justify-start rounded-lg">
28
+ <img src={{this.vendor.logo_url}} alt={{this.vendor.name}} height="48" width="48" class="h-12 w-12 rounded-lg shadow-sm" />
29
+ <Attach::Tooltip @class="clean" @animation="scale" @placement="top">
30
+ <InputInfo @text="Upload new photo" />
31
+ </Attach::Tooltip>
32
+ <div class="upload-avatar-button-wrapper rounded-lg">
33
+ <UploadButton
34
+ @name="photos"
35
+ @accept="image/*"
36
+ @onFileAdded={{this.onUploadNewPhoto}}
37
+ @icon="upload"
38
+ @hideButtonText={{true}}
39
+ @labelClass="upload-avatar-label-overlay"
40
+ class="w-12 btn-reset"
41
+ />
42
+ </div>
13
43
  </div>
14
44
  </div>
15
- </div>
16
- <div class="flex flex-col">
17
- <h1 class="text-gray-900 dark:text-white text-2xl">
18
- {{#if this.vendor.id}}
19
- {{this.vendor.name}}
20
- {{else}}
21
- <span>New Vendor</span>
22
- {{/if}}
23
- </h1>
24
- <div class="-mt-1">
25
- <div class="flex flex-row items-center">
26
- <span class="text-sm dark:text-gray-500 text-gray-700 mr-3">{{n-a (smart-humanize this.vendor.type)}}</span>
45
+ <div class="flex flex-col">
46
+ <h1 class="text-gray-900 dark:text-white text-2xl">
47
+ {{#if this.vendor.id}}
48
+ {{this.vendor.name}}
49
+ {{else}}
50
+ {{#if this.vendor.name}}
51
+ {{this.vendor.name}}
52
+ {{else}}
53
+ <span>New Vendor</span>
54
+ {{/if}}
55
+ {{/if}}
56
+ </h1>
57
+ <div class="-mt-1">
58
+ <div class="flex flex-row items-center">
59
+ <span class="text-sm dark:text-blue-400 text-blue-600">{{n-a (smart-humanize this.vendor.type)}}</span>
60
+ </div>
27
61
  </div>
28
62
  </div>
29
63
  </div>
30
64
  </div>
31
- <div>
32
- <Button @icon={{if this.vendor.id "save" "check"}} @type="primary" @text={{if this.vendor.id "Save Vendor" "Create Vendor"}} @onClick={{this.save}} @wrapperClass="mr-2" />
33
- {{#if this.vendor.id}}
34
- <Button @type="default" @icon="id-card" @helpText="View fleet details" @onClick={{this.onViewDetails}} @wrapperClass="mr-2" />
35
- {{/if}}
36
- <Button @type="default" @icon="times" @helpText={{if this.vendor.id "Cancel edit vendor" "Cancel new vendor"}} @onClick={{this.onPressCancel}} />
65
+ <div class="flex justify-end w-1/4">
66
+ <Badge @status={{this.vendor.status}} @type="info" @hideStatusDot={{true}} />
37
67
  </div>
38
68
  </div>
39
69
  </Overlay::Header>
40
70
 
41
71
  <Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 space-y-4 pt-4" @increaseInnerBodyHeightBy={{1000}}>
42
72
  {{#if this.isEditing}}
43
- <VendorFormPanel::EditForm @vendor={{this.vendor}} @vendorTypes={{this.vendorTypeOptions}} @vendorStatusOptions={{this.vendorStatusOptions}} @onVendorChanged={{this.onVendorChanged}} />
73
+ <VendorFormPanel::EditForm
74
+ @vendor={{this.vendor}}
75
+ @vendorTypes={{this.vendorTypeOptions}}
76
+ @vendorStatusOptions={{this.vendorStatusOptions}}
77
+ @onVendorChanged={{this.onVendorChanged}}
78
+ />
44
79
  {{else}}
45
- <VendorFormPanel::CreateForm @vendor={{this.vendor}} @vendorTypes={{this.vendorTypeOptions}} @vendorStatusOptions={{this.vendorStatusOptions}} @onVendorChanged={{this.onVendorChanged}} />
80
+ <VendorFormPanel::CreateForm
81
+ @vendor={{this.vendor}}
82
+ @vendorTypes={{this.vendorTypeOptions}}
83
+ @vendorStatusOptions={{this.vendorStatusOptions}}
84
+ @onVendorChanged={{this.onVendorChanged}}
85
+ />
46
86
  {{/if}}
47
87
  </Overlay::Body>
48
88
  </Overlay>
@@ -4,6 +4,8 @@ import { inject as service } from '@ember/service';
4
4
  import { action } from '@ember/object';
5
5
  import contextComponentCallback from '../utils/context-component-callback';
6
6
  import applyContextComponentArguments from '../utils/apply-context-component-arguments';
7
+ import getVendorTypeOptions from '../utils/get-vendor-type-options';
8
+ import getVendorStatusOptions from '../utils/get-vendor-status-options';
7
9
 
8
10
  export default class VendorFormPanelComponent extends Component {
9
11
  /**
@@ -64,52 +66,14 @@ export default class VendorFormPanelComponent extends Component {
64
66
  *
65
67
  * @memberof VendorFormPanelComponent
66
68
  */
67
- @tracked vendorTypeOptions = [
68
- 'carrier-trucking-company',
69
- 'carrier-shipping-line',
70
- 'carrier-air-cargo',
71
- 'carrier-rail',
72
- 'freight-forwarder',
73
- 'warehouse-provider',
74
- 'broker',
75
- 'maintenance-repair-facility',
76
- 'fuel-station',
77
- 'tire-service-provider',
78
- 'equipment-rental',
79
- 'customs-broker',
80
- 'third-party-logistics-provider',
81
- 'technology-provider',
82
- 'consultant',
83
- 'insurance-provider',
84
- 'last-mile-delivery-service',
85
- 'packing-crating-service',
86
- 'intermodal-operator',
87
- 'drayage-service-provider',
88
- 'cold-chain-provider',
89
- 'hazardous-material-specialist',
90
- 'parcel-courier',
91
- 'bulk-material-handler',
92
- 'towing-service',
93
- 'cargo-inspector',
94
- 'pallet-provider',
95
- 'label-packaging-material-supplier',
96
- 'driver-leasing-service',
97
- 'vehicle-manufacturer',
98
- 'vehicle-dealership',
99
- 'parts-supplier',
100
- 'logistics-association',
101
- 'regulatory-body',
102
- 'training-certification-provider',
103
- 'general-vendor',
104
- 'ecommerce',
105
- ];
69
+ @tracked vendorTypeOptions = getVendorTypeOptions();
106
70
 
107
71
  /**
108
72
  * Applicable status options for vendor.
109
73
  *
110
74
  * @memberof VendorFormPanelComponent
111
75
  */
112
- @tracked vendorStatusOptions = ['pending', 'active', 'do-not-contact', 'prospective', 'archived'];
76
+ @tracked vendorStatusOptions = getVendorStatusOptions();
113
77
 
114
78
  /**
115
79
  * Constructs the component and applies initial state.
@@ -32,7 +32,7 @@
32
32
  {{/if}}
33
33
  </div>
34
34
  {{else}}
35
- <div class="grid grid-cols-3 md:grid-cols-2 gap-2 text-xs dark:text-gray-100">
35
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-2 text-xs dark:text-gray-100">
36
36
  <div class="field-info-container">
37
37
  <div class="field-name">Name</div>
38
38
  <div class="field-value">{{n-a this.vendor.name}}</div>
@@ -67,7 +67,7 @@
67
67
  </div>
68
68
  </div>
69
69
 
70
- <div class="field-info-container">
70
+ <div class="field-info-container col-span-2">
71
71
  <div class="field-name">Address</div>
72
72
  <div class="field-value">{{n-a this.vendor.address}}</div>
73
73
  </div>
@@ -1,4 +1,11 @@
1
- <Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
1
+ <Overlay
2
+ @onLoad={{this.setOverlayContext}}
3
+ @position="right"
4
+ @noBackdrop={{true}}
5
+ @fullHeight={{true}}
6
+ @isResizable={{or this.isResizable @isResizable}}
7
+ @width={{or this.width @width "600px"}}
8
+ >
2
9
  <Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i">
3
10
  <div class="flex flex-row items-center justify-between w-full mb-4">
4
11
  <div class="flex flex-1 space-x-2">
@@ -12,7 +19,14 @@
12
19
  <div class="flex flex-1 flex-row">
13
20
  <div class="w-14">
14
21
  <div class="w-12 h-12 flex items-center justify-start rounded-lg">
15
- <Image src={{this.vendor.logo_url}} @fallbackSrc={{config "defaultValues.vendorImage"}} alt={{this.vendor.name}} height="48" width="48" class="h-12 w-12 rounded-lg shadow-sm" />
22
+ <Image
23
+ src={{this.vendor.logo_url}}
24
+ @fallbackSrc={{config "defaultValues.vendorImage"}}
25
+ alt={{this.vendor.name}}
26
+ height="48"
27
+ width="48"
28
+ class="h-12 w-12 rounded-lg shadow-sm"
29
+ />
16
30
  <Attach::Tooltip @class="clean" @animation="scale" @placement="top">
17
31
  <InputInfo @text={{this.vendor.name}} />
18
32
  </Attach::Tooltip>