Merge branch 'dev' into 5983_inventory_parking
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e2f50d63f6
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||||
|
VALUES
|
||||||
|
('Vehicle','sorted','WRITE','ALLOW','employee');
|
|
@ -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]);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/vehicle/sorted')(Self);
|
||||||
|
};
|
|
@ -23,19 +23,21 @@
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
label="Vehicle"
|
||||||
ng-model="$ctrl.route.vehicleFk"
|
ng-model="$ctrl.route.vehicleFk"
|
||||||
url="Vehicles"
|
data="$ctrl.vehicles"
|
||||||
show-field="numberPlate"
|
show-field="numberPlate"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
label="Vehicle"
|
order="false"
|
||||||
vn-name="vehicle">
|
vn-name="vehicle">
|
||||||
|
<tpl-item>{{::numberPlate}} - {{::name}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
label="Created"
|
label="Created"
|
||||||
ng-model="$ctrl.route.created"
|
ng-model="$ctrl.route.created"
|
||||||
vn-name="created">
|
vn-name="created">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
ng-model="$ctrl.route.agencyModeFk"
|
ng-model="$ctrl.route.agencyModeFk"
|
||||||
|
|
|
@ -2,6 +2,13 @@ import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
|
$onInit() {
|
||||||
|
this.$http.post(`Vehicles/sorted`, {warehouseFk: this.vnConfig.warehouseFk})
|
||||||
|
.then(res => {
|
||||||
|
this.vehicles = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$.watcher.submit().then(() =>
|
this.$.watcher.submit().then(() =>
|
||||||
this.card.reload()
|
this.card.reload()
|
||||||
|
|
Loading…
Reference in New Issue