Skip to content

Commit

Permalink
Merge pull request #93 from fleetbase/dev-v0.4.20
Browse files Browse the repository at this point in the history
v0.4.20
  • Loading branch information
roncodes authored Mar 15, 2024
2 parents 7a90049 + dfd9031 commit 7a99c4d
Show file tree
Hide file tree
Showing 70 changed files with 453 additions and 165 deletions.
2 changes: 1 addition & 1 deletion addon/components/activity-event-selector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import contextComponentCallback from '../utils/context-component-callback';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default';

/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/activity-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { underscore, capitalize, w } from '@ember/string';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

/**
* Component class for managing activity forms.
Expand Down
2 changes: 1 addition & 1 deletion addon/components/activity-logic-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import { isNone } from '@ember/utils';
import contextComponentCallback from '../utils/context-component-callback';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default';

export default class ActivityLogicBuilderComponent extends Component {
Expand Down
78 changes: 77 additions & 1 deletion addon/components/admin/navigator-app.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,84 @@
<ContentPanel @title={{t "fleet-ops.component.admin.navigator-app.title"}} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<ContentPanel @title={{t "fleet-ops.component.admin.navigator-app.title"}} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800 mb-4">
<InputGroup @name={{t "fleet-ops.component.admin.navigator-app.name"}}>
<ClickToCopy class="px-4 py-2 border rounded-md bg-gray-100 shadow-sm dark:bg-gray-700 border-gray-200 dark:border-gray-800" @value={{this.url}}>{{this.url}}</ClickToCopy>
<Attach::Tooltip @class="clean" @animation="scale" @placement="top">
<InputInfo>{{t "fleet-ops.component.admin.navigator-app.message" htmlSafe=true companyName=@app.name}}</InputInfo>
</Attach::Tooltip>
</InputGroup>
</ContentPanel>

<ContentPanel @title={{t "fleet-ops.component.admin.navigator-app.settings"}} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup>
<div class="flex items-center">
<Toggle @isToggled={{this.isEntityFieldsEditable}} @onToggle={{this.enableEditableEntityFields}} />
<div class="ml-2">{{t "fleet-ops.component.admin.navigator-app.select-input"}}</div>
</div>
</InputGroup>
{{#if this.isEntityFieldsEditable}}
<OrderConfigManager @onConfigChanged={{this.onConfigChanged}} as |Action Context|>
<div class="mt-2">
<InputGroup @name="Select order config" @helpText="Apply entity editing settings for an order config.">
<DropdownButton
class="order-config-select-button mr-2"
@disabled={{not Context.configs}}
@text={{if Context.currentConfig.name Context.currentConfig.name (t "fleet-ops.component.order-config-manager.select-order-config")}}
@textClass="text-sm mr-2"
@buttonClass="flex-row-reverse w-44 justify-between"
@icon="caret-down"
@iconClass="mr-0i"
@size="sm"
@iconPrefix="fas"
@triggerClass="hidden md:flex"
as |dd|
>
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
<div class="p-1">
{{#each Context.configs as |orderConfig|}}
<a href="javascript:;" class="next-dd-item" {{on "click" (dropdown-fn dd Context.selectConfig orderConfig)}}>
<div class="flex-1 flex flex-row items-center">
<div class="w-6">
<FaIcon @icon="cogs" />
</div>
<span>{{orderConfig.name}}</span>
</div>
<div>
{{#if (eq Context.currentConfig.id orderConfig.id)}}
<FaIcon @icon="check" class="text-green-500" />
{{/if}}
</div>
</a>
{{/each}}
</div>
</div>
</DropdownButton>
</InputGroup>
</div>
</OrderConfigManager>
{{#if this.selectedOrderConfig}}
<div class="bg-gray-400 border-gray-600 rounded-lg px-4 py-2 dark:bg-gray-700 dark:border-gray-800">
{{#let (get (get this.entityEditingSettings this.selectedOrderConfig.id) "editable_entity_fields") as |editableEntityFields|}}
{{#each this.entityFields as |entityField|}}
<div class="mt-1">
<Checkbox
@value={{includes entityField editableEntityFields}}
@label={{smart-humanize entityField}}
@onToggle={{fn this.toggleFieldEditable entityField}}
@helpText={{t "fleet-ops.component.admin.visibility-controls.checkbox-text"}}
/>
</div>
{{/each}}
{{/let}}
</div>
<div class="mt-3 flex items-center">
<Button
@type="primary"
@size="lg"
@icon="save"
@text={{t "fleet-ops.common.save-changes"}}
@onClick={{perform this.saveEntityEditingSettings}}
@isLoading={{not this.saveEntityEditingSettings.isIdle}}
/>
</div>
{{/if}}
{{/if}}
</ContentPanel>
77 changes: 65 additions & 12 deletions addon/components/admin/navigator-app.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,80 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import { task } from 'ember-concurrency-decorators';

export default class NavigatorAppControlsComponent extends Component {
@service fetch;
@tracked isLoading = false;
@tracked url;
@tracked selectedOrderConfig;
@tracked entityFields = ['name', 'description', 'sku', 'height', 'width', 'length', 'weight', 'declared_value', 'sale_price'];
@tracked entityEditingSettings = {};
@tracked isEntityFieldsEditable = false;

constructor() {
super(...arguments);
this.getAppLinkUrl();
this.getAppLinkUrl.perform();
this.getEntityEditableSettings.perform();
}

@action enableEditableEntityFields(isEntityFieldsEditable) {
this.isEntityFieldsEditable = isEntityFieldsEditable;
}

@action onConfigChanged(orderConfig) {
this.selectedOrderConfig = orderConfig;
}

@action toggleFieldEditable(fieldName, isEditable) {
const editableFields = this.entityEditingSettings[this.selectedOrderConfig.id]?.editable_entity_fields;
if (isArray(editableFields)) {
if (isEditable) {
editableFields.pushObject(fieldName);
} else {
editableFields.removeObject(fieldName);
}
} else {
this.entityEditingSettings = {
...this.entityEditingSettings,
[this.selectedOrderConfig.id]: {
editable_entity_fields: [],
},
};
return this.toggleFieldEditable(...arguments);
}

this.updateEditableEntityFieldsForOrderConfig(editableFields);
}

updateEditableEntityFieldsForOrderConfig(editableFields = [], orderConfig = null) {
orderConfig = orderConfig === null ? this.selectedOrderConfig : orderConfig;
this.entityEditingSettings = {
...this.entityEditingSettings,
[orderConfig.id]: {
editable_entity_fields: editableFields,
},
};
}

getAppLinkUrl() {
this.isLoading = true;
@task *getAppLinkUrl() {
const response = yield this.fetch.get('fleet-ops/navigator/get-link-app');
const { linkUrl } = response;
if (linkUrl) {
this.url = linkUrl;
}
}

@task *getEntityEditableSettings() {
const { entityEditingSettings, isEntityFieldsEditable } = yield this.fetch.get('fleet-ops/settings/entity-editing-settings');
this.entityEditingSettings = entityEditingSettings;
this.isEntityFieldsEditable = isEntityFieldsEditable;
}

return this.fetch
.get('fleet-ops/navigator/get-link-app')
.then(({ linkUrl }) => {
this.url = linkUrl;
})
.finally(() => {
this.isLoading = false;
});
@task *saveEntityEditingSettings() {
const { entityEditingSettings, isEntityFieldsEditable } = this;
yield this.fetch.post('fleet-ops/settings/entity-editing-settings', { entityEditingSettings, isEntityFieldsEditable });
}
}
4 changes: 2 additions & 2 deletions addon/components/contact-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class ContactFormPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/contact-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isArray } from '@ember/array';
import ContactPanelDetailComponent from './contact-panel/details';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class ContactPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/custom-field-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { action } from '@ember/object';
import { dasherize, camelize } from '@ember/string';
import { task } from 'ember-concurrency-decorators';
import isObject from '@fleetbase/ember-core/utils/is-object';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
import getCustomFieldTypeMap from '../utils/get-custom-field-type-map';

/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/driver-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import Point from '@fleetbase/fleetops-data/utils/geojson/point';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class DriverFormPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/driver-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isArray } from '@ember/array';
import DriverPanelDetailComponent from './driver-panel/details';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class DriverPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/edit-order-route-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isArray } from '@ember/array';
import { task } from 'ember-concurrency-decorators';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
import getRoutingHost from '@fleetbase/ember-core/utils/get-routing-host';
import Point from '@fleetbase/fleetops-data/utils/geojson/point';
import findClosestWaypoint from '@fleetbase/ember-core/utils/find-closest-waypoint';
Expand Down
4 changes: 2 additions & 2 deletions addon/components/fleet-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { underscore } from '@ember/string';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class FleetFormPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/fleet-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { isArray } from '@ember/array';
import FleetPanelDetailComponent from './fleet-panel/details';
import FleetPanelDriverListingComponent from './fleet-panel/driver-listing';
import FleetPanelVehicleListingComponent from './fleet-panel/vehicle-listing';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class FleetPanelComponent extends Component {
/**
Expand Down
2 changes: 1 addition & 1 deletion addon/components/fleet-panel/driver-listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isBlank } from '@ember/utils';
import { action, set } from '@ember/object';
import { timeout } from 'ember-concurrency';
import { task } from 'ember-concurrency-decorators';
import contextComponentCallback from '../../utils/context-component-callback';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';

export default class FleetPanelDriverListingComponent extends Component {
/**
Expand Down
2 changes: 1 addition & 1 deletion addon/components/fleet-panel/vehicle-listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isBlank } from '@ember/utils';
import { action, set } from '@ember/object';
import { timeout } from 'ember-concurrency';
import { task } from 'ember-concurrency-decorators';
import contextComponentCallback from '../../utils/context-component-callback';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';

export default class FleetPanelVehicleListingComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/fuel-report-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class FuelReportFormPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/fuel-report-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import FuelReportPanelDetailsComponent from './fuel-report-panel/details';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';

export default class FuelReportPanelComponent extends Component {
/**
Expand Down
4 changes: 2 additions & 2 deletions addon/components/issue-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
import getIssueTypes from '../utils/get-issue-types';
import getIssueCategories from '../utils/get-issue-categories';

Expand Down
4 changes: 2 additions & 2 deletions addon/components/issue-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isArray } from '@ember/array';
import IssuePanelDetailComponent from './issue-panel/details';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
export default class IssuePanelComponent extends Component {
/**
* Service for fetching data.
Expand Down
4 changes: 2 additions & 2 deletions addon/components/live-map-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isArray } from '@ember/array';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
import LiveMapDrawerVehicleListingComponent from './live-map-drawer/vehicle-listing';
import LiveMapDrawerDriverListingComponent from './live-map-drawer/driver-listing';
import LiveMapDrawerPlaceListingComponent from './live-map-drawer/place-listing';
Expand Down
Loading

0 comments on commit 7a99c4d

Please sign in to comment.