refs #5919 fix section
This commit is contained in:
parent
c0c3d913b7
commit
bf796c445d
|
@ -1,7 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "Locker",
|
"name": "Locker",
|
||||||
"description": "Employee's locker",
|
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
|
"description": "Employee's locker",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "locker"
|
||||||
|
}
|
||||||
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="locker"
|
vn-id="locker"
|
||||||
url="Lockers"
|
url="lockers"
|
||||||
filter="$ctrl.$.lockerFilter"
|
filter="$ctrl.$.lockerFilter"
|
||||||
auto-load="false">
|
auto-load="false">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -8,20 +8,19 @@ class Controller extends Section {
|
||||||
{code: 'M', name: this.$t('Married')},
|
{code: 'M', name: this.$t('Married')},
|
||||||
{code: 'S', name: this.$t('Single')}
|
{code: 'S', name: this.$t('Single')}
|
||||||
];
|
];
|
||||||
this.$.lockerFilter = {workerFk: null};
|
// this.$.lockerFilter = {workerFk: null};
|
||||||
}
|
|
||||||
get worker() {
|
|
||||||
return this._worker;
|
|
||||||
}
|
}
|
||||||
|
// get worker() {
|
||||||
|
// return this._worker;
|
||||||
|
// }
|
||||||
|
|
||||||
set worker(value) {
|
// set worker(value) {
|
||||||
this._worker = value;
|
// this._worker = value;
|
||||||
console.log('VALUE', value);
|
// console.log('VALUE', value);
|
||||||
if (value) {
|
// if (value)
|
||||||
this.$.lockerFilter = {where: {AND: [{workerFk: null}, {gender: value.sex}]}};
|
// this.$.lockerFilter = {where: {AND: [{workerFk: null}, {gender: value.sex}]}};
|
||||||
this.$.locker.refresh();
|
// // this.$.locker.refresh();
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
console.log(this.worker);
|
console.log(this.worker);
|
||||||
console.log(this.$.watcher.orgData);
|
console.log(this.$.watcher.orgData);
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<div class="vn-w-md" ng-show="$ctrl.currentPDA">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
label="Current PDA"
|
||||||
|
ng-model="$ctrl.currentPDA.description"
|
||||||
|
disabled="true">
|
||||||
|
<append>
|
||||||
|
<vn-icon-button
|
||||||
|
icon="delete"
|
||||||
|
vn-tooltip="Deallocate PDA"
|
||||||
|
ng-click="$ctrl.deallocatePDA()"
|
||||||
|
vn-acl="hr, productionAssi">
|
||||||
|
</vn-icon-button>
|
||||||
|
</append>
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
</div>
|
||||||
|
<form name="form" ng-show="!$ctrl.currentPDA" ng-submit="$ctrl.allocatePDA()" class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-autocomplete
|
||||||
|
vn-acl="hr, productionAssi"
|
||||||
|
ng-model="$ctrl.newPDA"
|
||||||
|
url="DeviceProductions"
|
||||||
|
fields="['id', 'modelFk', 'serialNumber']"
|
||||||
|
where="{'stateFk': 'idle'}"
|
||||||
|
label="New PDA"
|
||||||
|
order="id"
|
||||||
|
value-field="id"
|
||||||
|
show-field="serialNumber">
|
||||||
|
<tpl-item>
|
||||||
|
<div>
|
||||||
|
ID: {{id}}
|
||||||
|
</div>
|
||||||
|
<div class="text-caption text-grey">
|
||||||
|
{{modelFk}}, {{serialNumber}}
|
||||||
|
</div>
|
||||||
|
</tpl-item>
|
||||||
|
</vn-autocomplete>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
disabled="!$ctrl.newPDA"
|
||||||
|
label="Assign">
|
||||||
|
</vn-submit>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -0,0 +1,53 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
const filter = {
|
||||||
|
where: {userFk: this.$params.id},
|
||||||
|
include: {relation: 'deviceProduction'}
|
||||||
|
};
|
||||||
|
this.$http.get('DeviceProductionUsers', {filter}).
|
||||||
|
then(res => {
|
||||||
|
if (res.data && res.data.length > 0)
|
||||||
|
this.setCurrentPDA(res.data[0]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deallocatePDA() {
|
||||||
|
this.$http.post(`Workers/${this.$params.id}/deallocatePDA`, {pda: this.currentPDA.deviceProductionFk})
|
||||||
|
.then(() => {
|
||||||
|
this.vnApp.showSuccess(this.$t('PDA deallocated'));
|
||||||
|
delete this.currentPDA;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
allocatePDA() {
|
||||||
|
this.$http.post(`Workers/${this.$params.id}/allocatePDA`, {pda: this.newPDA})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data)
|
||||||
|
this.setCurrentPDA(res.data);
|
||||||
|
|
||||||
|
this.vnApp.showSuccess(this.$t('PDA allocated'));
|
||||||
|
delete this.newPDA;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setCurrentPDA(data) {
|
||||||
|
this.currentPDA = data;
|
||||||
|
this.currentPDA.description = [];
|
||||||
|
this.currentPDA.description.push(`ID: ${this.currentPDA.deviceProductionFk}`);
|
||||||
|
this.currentPDA.description.push(`${this.$t('Model')}: ${this.currentPDA.deviceProduction.modelFk}`);
|
||||||
|
this.currentPDA.description.push(`${this.$t('Serial Number')}: ${this.currentPDA.deviceProduction.serialNumber}`);
|
||||||
|
this.currentPDA.description = this.currentPDA.description.join(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.$inject = ['$element', '$scope'];
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnWorkerPda', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
});
|
|
@ -0,0 +1,6 @@
|
||||||
|
@import "./variables";
|
||||||
|
|
||||||
|
.text-grey {
|
||||||
|
color: $color-font-light;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue