diff --git a/db/changes/232401/00-ACLgetVehiclesSorted.sql b/db/changes/232401/00-ACLgetVehiclesSorted.sql
new file mode 100644
index 000000000..6625f0d5c
--- /dev/null
+++ b/db/changes/232401/00-ACLgetVehiclesSorted.sql
@@ -0,0 +1,3 @@
+INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
+ VALUES
+ ('Vehicle','sorted','WRITE','ALLOW','employee');
\ No newline at end of file
diff --git a/modules/route/back/methods/vehicle/sorted.js b/modules/route/back/methods/vehicle/sorted.js
new file mode 100644
index 000000000..b379743bc
--- /dev/null
+++ b/modules/route/back/methods/vehicle/sorted.js
@@ -0,0 +1,27 @@
+module.exports = Self => {
+ Self.remoteMethod('sorted', {
+ description: 'Sort the vehicles by warehouse',
+ accessType: 'WRITE',
+ accepts: [{
+ arg: 'warehouseFk',
+ type: 'number'
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/sorted`,
+ verb: `POST`
+ }
+ });
+
+ Self.sorted = async warehouseFk => {
+ return Self.rawSql(`
+ SELECT v.id, v.warehouseFk, v.numberPlate, w.name
+ FROM vehicle v
+ JOIN warehouse w ON w.id = v.warehouseFk
+ ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC;
+ `, [warehouseFk]);
+ };
+};
diff --git a/modules/route/back/models/vehicle.js b/modules/route/back/models/vehicle.js
new file mode 100644
index 000000000..73e321443
--- /dev/null
+++ b/modules/route/back/models/vehicle.js
@@ -0,0 +1,3 @@
+module.exports = Self => {
+ require('../methods/vehicle/sorted')(Self);
+};
diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html
index c63fee53b..ade9230e8 100644
--- a/modules/route/front/basic-data/index.html
+++ b/modules/route/front/basic-data/index.html
@@ -23,19 +23,21 @@
+ {{::numberPlate}} - {{::name}}
+ vn-name="created">
{
+ this.vehicles = res.data;
+ });
+ }
+
onSubmit() {
this.$.watcher.submit().then(() =>
this.card.reload()