7489-testToMaster #2515
|
@ -81,15 +81,9 @@
|
|||
ng-model="$ctrl.worker.SSN"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<!-- <vn-autocomplete
|
||||
ng-if="$ctrl.$.locker"
|
||||
label="Locker"
|
||||
data="$ctrl.$.locker.data"
|
||||
show-field="code"
|
||||
value-field="id"
|
||||
ng-model="$ctrl.worker.locker.id">
|
||||
</vn-autocomplete> -->
|
||||
<!-- {{$ctrl.$.locker}} -->
|
||||
<vn-input-number
|
||||
min="0"
|
||||
ng-model="$ctrl.$.locker"
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -8,23 +8,9 @@ class Controller extends Section {
|
|||
{code: 'M', name: this.$t('Married')},
|
||||
{code: 'S', name: this.$t('Single')}
|
||||
];
|
||||
// this.$.lockerFilter = {workerFk: null};
|
||||
}
|
||||
// get worker() {
|
||||
// return this._worker;
|
||||
// }
|
||||
|
||||
// set worker(value) {
|
||||
// this._worker = value;
|
||||
// console.log('VALUE', value);
|
||||
// if (value)
|
||||
// this.$.lockerFilter = {where: {AND: [{workerFk: null}, {gender: value.sex}]}};
|
||||
// // this.$.locker.refresh();
|
||||
// }
|
||||
onSubmit() {
|
||||
console.log(this.worker);
|
||||
console.log(this.$.watcher.orgData);
|
||||
// if(this.$.worker.locker.id != )
|
||||
return this.$.watcher.submit()
|
||||
.then(() => this.card.reload());
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<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>
|
|
@ -1,53 +0,0 @@
|
|||
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,
|
||||
});
|
|
@ -1,6 +0,0 @@
|
|||
@import "./variables";
|
||||
|
||||
.text-grey {
|
||||
color: $color-font-light;
|
||||
}
|
||||
|
|
@ -58,9 +58,8 @@
|
|||
phone-number="worker.client.phone"
|
||||
></vn-link-phone>
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Locker"
|
||||
value="{{worker.locker.code}}"
|
||||
<vn-label-value label="Locker"
|
||||
value="{{worker.locker.code}}"
|
||||
>
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
|
|
Loading…
Reference in New Issue