changed device_name to devices
This commit is contained in:
parent
e8ad6aaa7a
commit
4376adc1eb
@ -9,7 +9,7 @@ export class UserModel extends BaseModel{
|
|||||||
email = '';
|
email = '';
|
||||||
level = '';
|
level = '';
|
||||||
location = '';
|
location = '';
|
||||||
device_name = '';
|
devices = [''];
|
||||||
edit = false;
|
edit = false;
|
||||||
|
|
||||||
deserialize(input: any): this {
|
deserialize(input: any): this {
|
||||||
@ -19,7 +19,7 @@ export class UserModel extends BaseModel{
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendFormat(mode = 'user') {
|
sendFormat(mode = 'user') {
|
||||||
const keys = ['name', 'email', 'location', 'device_name'];
|
const keys = ['name', 'email', 'location', 'devices'];
|
||||||
if (mode === 'admin') {
|
if (mode === 'admin') {
|
||||||
keys.push('level');
|
keys.push('level');
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
|
|||||||
this.loading--;
|
this.loading--;
|
||||||
});
|
});
|
||||||
this.d.load('user', () => {
|
this.d.load('user', () => {
|
||||||
this.defaultDevice = this.d.d.user.device_name;
|
this.defaultDevice = this.d.d.user.devices[0];
|
||||||
});
|
});
|
||||||
if (!this.new) {
|
if (!this.new) {
|
||||||
this.loading++;
|
this.loading++;
|
||||||
|
@ -97,6 +97,7 @@ export class SamplesComponent implements OnInit {
|
|||||||
this.filters.filters.find(e => e.field === 'color').autocomplete =
|
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; }, []))];
|
[...new Set(this.d.arr.materials.reduce((s, e) => {s.push(...e.numbers.map(el => el.color)); return s; }, []))];
|
||||||
this.loadSamples();
|
this.loadSamples();
|
||||||
|
console.log(this.d.id.materials);
|
||||||
});
|
});
|
||||||
this.d.load('materialSuppliers', () => {
|
this.d.load('materialSuppliers', () => {
|
||||||
this.filters.filters.find(e => e.field === 'material.supplier').autocomplete = this.d.arr.materialSuppliers;
|
this.filters.filters.find(e => e.field === 'material.supplier').autocomplete = this.d.arr.materialSuppliers;
|
||||||
|
@ -15,10 +15,13 @@
|
|||||||
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
|
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
|
||||||
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
||||||
</rb-form-input>
|
</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]="''">
|
||||||
#deviceInput="ngModel">
|
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
|
||||||
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
|
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value"
|
||||||
</rb-form-input>
|
#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()">
|
<rb-icon-button icon="save" mode="primary" type="submit" [disabled]="!userForm.form.valid" (click)="saveUser()">
|
||||||
Save change
|
Save change
|
||||||
</rb-icon-button>
|
</rb-icon-button>
|
||||||
|
@ -21,10 +21,13 @@
|
|||||||
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
|
<ng-template rbFormValidationMessage="failure">{{locationInput.errors.failure}}</ng-template>
|
||||||
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
||||||
</rb-form-input>
|
</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]="''">
|
||||||
#deviceInput="ngModel">
|
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
|
||||||
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
|
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value"
|
||||||
</rb-form-input>
|
#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
|
<rb-form-input name="passA" type="password" label="new password" appValidate="password" required
|
||||||
[(ngModel)]="newUserPass" #passAInput="ngModel">
|
[(ngModel)]="newUserPass" #passAInput="ngModel">
|
||||||
<ng-template rbFormValidationMessage="failure">{{passAInput.errors.failure}}</ng-template>
|
<ng-template rbFormValidationMessage="failure">{{passAInput.errors.failure}}</ng-template>
|
||||||
@ -54,12 +57,13 @@
|
|||||||
<td>{{user.email}}</td>
|
<td>{{user.email}}</td>
|
||||||
<td>{{user.level}}</td>
|
<td>{{user.level}}</td>
|
||||||
<td>{{user.location}}</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>
|
<td><span class="rb-ic rb-ic-edit clickable" (click)="user.edit = true"></span></td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template #editUser>
|
<ng-template #editUser>
|
||||||
<td>
|
<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="failure">{{nameInput.errors.failure}}</ng-template>
|
||||||
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
||||||
</rb-form-input>
|
</rb-form-input>
|
||||||
@ -83,12 +87,18 @@
|
|||||||
</rb-form-input>
|
</rb-form-input>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<rb-form-input [name]="'device-' + user.name" appValidate="string" [(ngModel)]="user.device_name"
|
<rb-array-input [(ngModel)]="user.devices" name="devices" [pushTemplate]="''">
|
||||||
#deviceInput="ngModel">
|
<rb-form-input *rbArrayInputItem="let item" rbArrayInputListener="devices" [index]="item.i"
|
||||||
<ng-template rbFormValidationMessage="failure">{{deviceInput.errors.failure}}</ng-template>
|
label="device" appValidate="string" [name]="'device-' + item.i" [ngModel]="item.value">
|
||||||
</rb-form-input>
|
</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>
|
||||||
<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>
|
</ng-template>
|
||||||
</tr>
|
</tr>
|
||||||
</rb-table>
|
</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 |
Loading…
Reference in New Issue
Block a user