mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-01-08 07:16:49 +00:00
* Added bulk assign driver * Improved performance for order dispatch/ bulk order dispatch/ bulk assign driver * Added new columns to order export * Added downloadable import templates for all importable resources via Import Modal * Patched custom field rendering for order viewing * Patched custom field values reset after order creation * Added notification settings to FleetOps * Added bulk search by ID or Tracking Number for Orders * Patched all filters and filter indicator component * Patched issue unable to select driver after selecting facilitator * Fixed extension booting when not authenticated * Fixed Internal ID rendering on order view * Added ability to filter orders without a driver
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
import { classify } from '@ember/string';
|
|
|
|
export default function getPermissionAction(permissionName) {
|
|
const permissionNameParts = permissionName.split(':');
|
|
const fullActionName = permissionNameParts.lastObject;
|
|
const actions = [
|
|
'create',
|
|
'update',
|
|
'delete',
|
|
'deactivate',
|
|
'get',
|
|
'list',
|
|
'cancel',
|
|
'optimize',
|
|
'roll',
|
|
'export',
|
|
'batch_delete',
|
|
'batch_cancel',
|
|
'notify',
|
|
'assign_vehicle',
|
|
'assign_order_to',
|
|
'assign_driver_to',
|
|
'assign_vehicle_to',
|
|
'dispatch_order_to',
|
|
'dispatch',
|
|
'assign',
|
|
'attach',
|
|
'sub_contract',
|
|
'create_order_for',
|
|
];
|
|
|
|
if (permissionName.startsWith('auth')) {
|
|
return fullActionName;
|
|
}
|
|
|
|
if (fullActionName === '*') {
|
|
return 'All';
|
|
}
|
|
|
|
for (let i = 0; i < actions.length; i++) {
|
|
const action = actions.objectAt(i);
|
|
|
|
if (fullActionName.toLowerCase().startsWith(classify(action).toLowerCase())) {
|
|
return classify(action);
|
|
}
|
|
}
|
|
|
|
return 'N/A';
|
|
}
|