refs #5066 metodo getVehiclesSorted
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-04-19 15:09:52 +02:00
parent c69864aa3b
commit 365c209d9f
5 changed files with 23 additions and 16 deletions

View File

@ -22,7 +22,7 @@ describe('Route basic Data path', () => {
nextMonth.setMonth(nextMonth.getMonth() + 1);
await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick');
await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK - Warehouse One');
await page.autocompleteSearch(selectors.routeBasicData.vehicle, '3333-BAT - Warehouse One');
await page.pickDate(selectors.routeBasicData.createdDate, nextMonth);
await page.clearInput(selectors.routeBasicData.kmStart);
await page.write(selectors.routeBasicData.kmStart, '1');

View File

@ -273,7 +273,9 @@
"Not exist this branch": "La rama no existe",
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
"Insert a date range": "Inserte un rango de fechas",
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen"
}
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3",
"No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº 2": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº 2"
}

View File

@ -1,5 +1,5 @@
module.exports = Self => {
Self.remoteMethodCtx('getVehiclesSorted', {
Self.remoteMethod('getVehiclesSorted', {
description: 'Sort the vehicles by a warehouse',
accessType: 'WRITE',
accepts: [{
@ -16,16 +16,13 @@ module.exports = Self => {
}
});
Self.getVehiclesSorted = async(ctx, options) => {
const args = ctx.args;
Self.getVehiclesSorted = async warehouseFk => {
const vehicles = await Self.rawSql(`
SELECT v.id, v.numberPlate, w.name
FROM vehicle v
JOIN warehouse w ON w.id = v.warehouseFk
WHERE v.warehouseFk = ?
ORDER BY v.warehouseFk DESC, v.numberPlate ASC`, args.warehouseFk);
JOIN warehouse w ON w.id = v.warehouseFk
ORDER BY v.warehouseFk = ? DESC, v.numberPlate ASC`, [warehouseFk]);
return [vehicles];
return vehicles;
};
};

View File

@ -21,7 +21,6 @@
<div>{{name}} - {{nickname}}</div>
</tpl-item>
</vn-autocomplete>
{{$ctrl.route.vehicleFk}}
<vn-autocomplete
vn-one
ng-model="$ctrl.route.vehicleFk"
@ -30,7 +29,7 @@
value-field="id"
label="Vehicle">
<tpl-item>
{{numberPlate}} - {{warehouse.name}}
{{numberPlate}} - {{name}}
</tpl-item>
</vn-autocomplete>
</vn-horizontal>

View File

@ -9,7 +9,16 @@ class Controller extends Section {
}
constructor($element, $) {
super($element, $);
this.$http.post(`Vehicles/getVehiclesSorted`, {params: {warehouseFk: 1}});
this.$http.get(`UserConfigs/getUserConfig`)
.then(res => {
if (res && res.data) {
this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk})
.then(res => {
if (res && res.data)
this.vehicles = res.data;
});
}
});
}
}