changed device_name to devices

This commit is contained in:
VLE2FE 2020-08-06 14:08:11 +02:00
parent e8ad6aaa7a
commit 4376adc1eb
6 changed files with 3778 additions and 21 deletions

View File

@ -9,7 +9,7 @@ export class UserModel extends BaseModel{
email = '';
level = '';
location = '';
device_name = '';
devices = [''];
edit = false;
deserialize(input: any): this {
@ -19,7 +19,7 @@ export class UserModel extends BaseModel{
}
sendFormat(mode = 'user') {
const keys = ['name', 'email', 'location', 'device_name'];
const keys = ['name', 'email', 'location', 'devices'];
if (mode === 'admin') {
keys.push('level');
}

View File

@ -137,7 +137,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
this.loading--;
});
this.d.load('user', () => {
this.defaultDevice = this.d.d.user.device_name;
this.defaultDevice = this.d.d.user.devices[0];
});
if (!this.new) {
this.loading++;

View File

@ -97,6 +97,7 @@ export class SamplesComponent implements OnInit {
this.filters.filters.find(e => e.field === 'color').autocomplete =
[...new Set(this.d.arr.materials.reduce((s, e) => {s.push(...e.numbers.map(el => el.color)); return s; }, []))];
this.loadSamples();
console.log(this.d.id.materials);
});
this.d.load('materialSuppliers', () => {
this.filters.filters.find(e => e.field === 'material.supplier').autocomplete = this.d.arr.materialSuppliers;

View File

@ -15,10 +15,13 @@
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
</rb-form-input>
<rb-form-input name="device" label="device" appValidate="string" [(ngModel)]="user.device_name"
<rb-array-input [(ngModel)]="user.devices" name="devices" [pushTemplate]="''">
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value"
#deviceInput="ngModel">
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
</rb-form-input>
</rb-array-input>
<rb-icon-button icon="save" mode="primary" type="submit" [disabled]="!userForm.form.valid" (click)="saveUser()">
Save change
</rb-icon-button>

View File

@ -21,10 +21,13 @@
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
</rb-form-input>
<rb-form-input name="device" label="device" appValidate="string" [(ngModel)]="newUser.device_name"
<rb-array-input [(ngModel)]="newUser.devices" name="devices" [pushTemplate]="''">
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value"
#deviceInput="ngModel">
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
</rb-form-input>
</rb-array-input>
<rb-form-input name="passA" type="password" label="new password" appValidate="password" required
[(ngModel)]="newUserPass" #passAInput="ngModel">
<ng-template rbFormValidationMessage="failure">{{passAInput.errors.failure}}</ng-template>
@ -54,12 +57,13 @@
<td>{{user.email}}</td>
<td>{{user.level}}</td>
<td>{{user.location}}</td>
<td>{{user.device_name}}</td>
<td>{{user.devices}}</td>
<td><span class="rb-ic rb-ic-edit clickable" (click)="user.edit = true"></span></td>
</ng-container>
<ng-template #editUser>
<td>
<rb-form-input [name]="'name-' + user.name" appValidate="username" required [(ngModel)]="user.name" #nameInput="ngModel">
<rb-form-input [name]="'name-' + user.name" appValidate="username" required [(ngModel)]="user.name"
#nameInput="ngModel">
<ng-template rbFormValidationMessage="failure">{{nameInput.errors.failure}}</ng-template>
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
</rb-form-input>
@ -83,12 +87,18 @@
</rb-form-input>
</td>
<td>
<rb-form-input [name]="'device-' + user.name" appValidate="string" [(ngModel)]="user.device_name"
#deviceInput="ngModel">
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
<rb-array-input [(ngModel)]="user.devices" name="devices" [pushTemplate]="''">
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value">
</rb-form-input>
</rb-array-input>
</td>
<td>
<rb-icon-button icon="save" mode="primary" (click)="saveUser(user)"
[disabled]="nameInput.invalid || emailInput.invalid || locationInput.invalid">
Save
</rb-icon-button>
</td>
<td><rb-icon-button icon="save" mode="primary" (click)="saveUser(user)" [disabled]="nameInput.invalid || emailInput.invalid || locationInput.invalid || deviceInput.invalid">Save</rb-icon-button></td>
</ng-template>
</tr>
</rb-table>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 129 KiB