This commit is contained in:
parent
d8e7c2700a
commit
3423ce612c
|
@ -1,3 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||
VALUES
|
||||
('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee');
|
||||
('Vehicle','sorted','WRITE','ALLOW','employee');
|
|
@ -24,7 +24,7 @@ describe('Route basic Data path', () => {
|
|||
const form = 'vn-route-basic-data form';
|
||||
const values = {
|
||||
worker: 'adminBossNick',
|
||||
vehicle: '1111-IMK',
|
||||
vehicle: '1111-IMK - Warehouse One',
|
||||
created: nextMonth,
|
||||
kmStart: 1,
|
||||
kmEnd: 2,
|
||||
|
|
|
@ -174,7 +174,6 @@ export default class Autocomplete extends Field {
|
|||
|
||||
refreshDisplayed() {
|
||||
let display = '';
|
||||
let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem');
|
||||
|
||||
if (this._selection && this.showField) {
|
||||
if (this.multiple && Array.isArray(this._selection)) {
|
||||
|
@ -182,19 +181,8 @@ export default class Autocomplete extends Field {
|
|||
if (display.length > 0) display += ', ';
|
||||
display += item[this.showField];
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
display = this._selection[this.showField];
|
||||
if (hasTemplate) {
|
||||
let template = this.$transclude(() => {}, null, 'tplItem');
|
||||
const element = template[0];
|
||||
const description = element.querySelector('.text-secondary');
|
||||
if (description) description.remove();
|
||||
|
||||
const displayElement = angular.element(element);
|
||||
const displayText = displayElement.text();
|
||||
display = this.$interpolate(displayText)(this._selection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.input.value = display;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getVehiclesSorted', {
|
||||
Self.remoteMethod('sorted', {
|
||||
description: 'Sort the vehicles by warehouse',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -11,12 +11,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getVehiclesSorted`,
|
||||
path: `/sorted`,
|
||||
verb: `POST`
|
||||
}
|
||||
});
|
||||
|
||||
Self.getVehiclesSorted = async warehouseFk => {
|
||||
Self.sorted = async warehouseFk => {
|
||||
const vehicles = await Self.rawSql(`
|
||||
SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order',
|
||||
v.id,
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/vehicle/getVehiclesSorted')(Self);
|
||||
require('../methods/vehicle/sorted')(Self);
|
||||
};
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
show-field="description"
|
||||
order="order"
|
||||
value-field="id"
|
||||
label="Vehicle">
|
||||
label="Vehicle"
|
||||
vn-name="vehicle">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
|
|
@ -12,7 +12,7 @@ class Controller extends Section {
|
|||
this.$http.get(`UserConfigs/getUserConfig`)
|
||||
.then(res => {
|
||||
if (res && res.data) {
|
||||
this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk})
|
||||
this.$http.post(`Vehicles/sorted`, {warehouseFk: res.data.warehouseFk})
|
||||
.then(res => {
|
||||
if (res && res.data)
|
||||
this.vehicles = res.data;
|
||||
|
|
Loading…
Reference in New Issue