template fixes
This commit is contained in:
parent
6f95ff4148
commit
04c2ff2678
@ -37,7 +37,7 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<div *rbSubBrandHeader>
|
<div *rbSubBrandHeader>
|
||||||
<rb-icon-button icon="bug" mode="secondary" class="space-right" [rbModal]="bugModal" *ngIf="false">
|
<rb-icon-button icon="bug" mode="secondary" class="space-right" [rbModal]="bugModal">
|
||||||
Bug
|
Bug
|
||||||
</rb-icon-button>
|
</rb-icon-button>
|
||||||
<ng-template let-close="close" #bugModal>
|
<ng-template let-close="close" #bugModal>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<rb-icon-button icon="mail" mode="primary" (mouseup)="closeBugReport(close)">Send report</rb-icon-button>
|
<rb-icon-button icon="mail" mode="primary" (mouseup)="closeBugReport(close)">Send report</rb-icon-button>
|
||||||
</a>
|
</a>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<span class="dev-label" *ngIf="devMode && false">DEVELOPMENT</span>
|
<span class="dev-label" *ngIf="devMode">DEVELOPMENT</span>
|
||||||
DeFinMa
|
DeFinMa
|
||||||
</div>
|
</div>
|
||||||
</rb-full-header>
|
</rb-full-header>
|
||||||
|
@ -41,8 +41,12 @@ export class SampleModel extends BaseModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFormat() {
|
sendFormat(pickCondition = true) {
|
||||||
const tmp = pick(this.conditionTemplateCheck(), ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
|
const pickFields = ['color', 'type', 'batch', 'material_id', 'notes'];
|
||||||
|
if (pickCondition) {
|
||||||
|
pickFields.push('condition');
|
||||||
|
}
|
||||||
|
const tmp = pick(this.conditionTemplateCheck(), pickFields);
|
||||||
Object.keys(tmp).forEach(key => {
|
Object.keys(tmp).forEach(key => {
|
||||||
if (tmp[key] === undefined) {
|
if (tmp[key] === undefined) {
|
||||||
delete tmp[key];
|
delete tmp[key];
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<h2>{{mode === 'new' ? 'Add new sample' : 'Edit sample'}}</h2>
|
<h2>{{mode === 'new' ? 'Add new sample' : 'Edit sample'}}</h2>
|
||||||
<!--TODO: title-->
|
|
||||||
|
|
||||||
<rb-loading-spinner *ngIf="loading; else content"></rb-loading-spinner>
|
<rb-loading-spinner *ngIf="loading; else content"></rb-loading-spinner>
|
||||||
|
|
||||||
@ -14,13 +13,13 @@
|
|||||||
[rbFormInputAutocomplete]="autocomplete.bind(this, materialNames)" appValidate="stringOf"
|
[rbFormInputAutocomplete]="autocomplete.bind(this, materialNames)" appValidate="stringOf"
|
||||||
(keydown)="preventDefault($event)" (ngModelChange)="findMaterial($event)" ngModel
|
(keydown)="preventDefault($event)" (ngModelChange)="findMaterial($event)" ngModel
|
||||||
[appValidateArgs]="[materialNames]" required [(ngModel)]="material.name" [autofocus]="true"
|
[appValidateArgs]="[materialNames]" required [(ngModel)]="material.name" [autofocus]="true"
|
||||||
*ngIf="baseSample.material !== undefined || mode === 'new'"
|
*ngIf="baseSample.material.name !== undefined || mode === 'new'"
|
||||||
title="trade name of the material, eg. Ultradur B4300 G6">
|
title="trade name of the material, eg. Ultradur B4300 G6">
|
||||||
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
<ng-template rbFormValidationMessage="required">Cannot be empty</ng-template>
|
||||||
<ng-template rbFormValidationMessage="failure">Unknown material, add properties for new material</ng-template>
|
<ng-template rbFormValidationMessage="failure">Unknown material, add properties for new material</ng-template>
|
||||||
</rb-form-input>
|
</rb-form-input>
|
||||||
<rb-icon-button class="set-new-material space-below" icon="add" mode="secondary"
|
<rb-icon-button class="set-new-material space-below" icon="add" mode="secondary"
|
||||||
(click)="setNewMaterial(!newMaterial)" *ngIf="baseSample.material !== undefined">
|
(click)="setNewMaterial(!newMaterial)" *ngIf="baseSample.material.name !== undefined">
|
||||||
New material
|
New material
|
||||||
</rb-icon-button>
|
</rb-icon-button>
|
||||||
</div>
|
</div>
|
||||||
@ -197,8 +196,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</h5>
|
</h5>
|
||||||
<div *ngIf="sample.condition.condition_template" [@inOut]>
|
<div *ngIf="sample.condition.condition_template" [@inOut]>
|
||||||
<rb-form-select name="conditionSelect" label="Condition"
|
<rb-form-select [name]="'conditionSelect-' + gIndex" label="Condition"
|
||||||
[(ngModel)]="sample.condition.condition_template">
|
[(ngModel)]="sample.condition.condition_template">
|
||||||
|
<option [value]="sample.condition.condition_template">
|
||||||
|
{{d.id.conditionTemplates[sample.condition.condition_template].name}} - current
|
||||||
|
</option>
|
||||||
<option *ngFor="let c of d.latest.conditionTemplates" [value]="c._id">{{c.name}}</option>
|
<option *ngFor="let c of d.latest.conditionTemplates" [value]="c._id">{{c.name}}</option>
|
||||||
</rb-form-select>
|
</rb-form-select>
|
||||||
|
|
||||||
@ -234,9 +236,11 @@
|
|||||||
<rb-form-select [name]="'measurementTemplateSelect-' + gIndex + '-' + mIndex" label="Template"
|
<rb-form-select [name]="'measurementTemplateSelect-' + gIndex + '-' + mIndex" label="Template"
|
||||||
[(ngModel)]="measurement.measurement_template"
|
[(ngModel)]="measurement.measurement_template"
|
||||||
(ngModelChange)="clearMeasurement(gIndex, mIndex)">
|
(ngModelChange)="clearMeasurement(gIndex, mIndex)">
|
||||||
|
<option [value]="sample.condition.condition_template">
|
||||||
|
{{d.id.measurementTemplates[measurement.measurement_template].name}} - current
|
||||||
|
</option>
|
||||||
<option *ngFor="let m of d.latest.measurementTemplates" [value]="m._id">{{m.name}}</option>
|
<option *ngFor="let m of d.latest.measurementTemplates" [value]="m._id">{{m.name}}</option>
|
||||||
</rb-form-select>
|
</rb-form-select>
|
||||||
|
|
||||||
<div *ngFor="let parameter of d.id.measurementTemplates[measurement.measurement_template].parameters;
|
<div *ngFor="let parameter of d.id.measurementTemplates[measurement.measurement_template].parameters;
|
||||||
index as pIndex">
|
index as pIndex">
|
||||||
<ng-container [ngSwitch]="(parameter.range.type ? 1 : 0) + (parameter.range.values ? 2 : 0)">
|
<ng-container [ngSwitch]="(parameter.range.type ? 1 : 0) + (parameter.range.values ? 2 : 0)">
|
||||||
|
@ -225,6 +225,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
|
|||||||
}
|
}
|
||||||
this.loading--;
|
this.loading--;
|
||||||
this.checkFormAfterInit = true;
|
this.checkFormAfterInit = true;
|
||||||
|
console.log(this.baseSample.material.name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -355,7 +356,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
|
|||||||
else {
|
else {
|
||||||
this.samples.forEach((sample, i) => {
|
this.samples.forEach((sample, i) => {
|
||||||
console.log(sample._id);
|
console.log(sample._id);
|
||||||
this.api.put<SampleModel>('/sample/' + sample._id, this.baseSample.sendFormat(), data => {
|
this.api.put<SampleModel>('/sample/' + sample._id, this.baseSample.sendFormat(false), data => {
|
||||||
merge(this.samples[i], omit(data, ['condition']));
|
merge(this.samples[i], omit(data, ['condition']));
|
||||||
this.samples[i].material = this.d.arr.materials.find(e => e._id === this.samples[0].material_id);
|
this.samples[i].material = this.d.arr.materials.find(e => e._id === this.samples[0].material_id);
|
||||||
this.view.base = false;
|
this.view.base = false;
|
||||||
|
@ -340,7 +340,7 @@ export class SamplesComponent implements OnInit {
|
|||||||
|
|
||||||
updateFilterFields(field) {
|
updateFilterFields(field) {
|
||||||
const filter = this.filters.filters.find(e => e.field === field);
|
const filter = this.filters.filters.find(e => e.field === field);
|
||||||
filter.active = true;
|
filter.active = !(filter.values.length === 1 && filter.values[0] === '');
|
||||||
}
|
}
|
||||||
|
|
||||||
setSort(string) {
|
setSort(string) {
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
<th>Device</th>
|
<th>Device</th>
|
||||||
<th>Models</th>
|
<th>Models</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr *ngFor="let user of users">
|
<tr *ngFor="let user of users">
|
||||||
@ -71,8 +70,7 @@
|
|||||||
{{(i > 0 ? ', ' : '') + modelIds[model]}}
|
{{(i > 0 ? ', ' : '') + modelIds[model]}}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</td>
|
</td>
|
||||||
<td><span [class]="'rb-ic clickable ' + (user.status === 'new' ? 'rb-ic-edit': 'rb-ic-undo')"
|
<td><span class="rb-ic clickable rb-ic-edit" (click)="user.edit = true"></span></td>
|
||||||
(click)="user.status === 'new' ? user.edit = true: restoreUser(user)"></span></td>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template #editUser>
|
<ng-template #editUser>
|
||||||
<td>
|
<td>
|
||||||
@ -134,6 +132,37 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</rb-table>
|
</rb-table>
|
||||||
|
|
||||||
|
<rb-accordion>
|
||||||
|
<rb-accordion-title [open]="false"><span class="rb-ic rb-ic-delete"></span> Deleted users</rb-accordion-title>
|
||||||
|
<rb-accordion-body>
|
||||||
|
<rb-table scrollTop>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Level</th>
|
||||||
|
<th>Location</th>
|
||||||
|
<th>Device</th>
|
||||||
|
<th>Models</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr *ngFor="let user of deletedUsers">
|
||||||
|
<td>{{user.name}}</td>
|
||||||
|
<td>{{user.email}}</td>
|
||||||
|
<td>{{user.level}}</td>
|
||||||
|
<td>{{user.location}}</td>
|
||||||
|
<td>{{user.devices}}</td>
|
||||||
|
<td>
|
||||||
|
<ng-container *ngFor="let model of user.models; index as i">
|
||||||
|
{{(i > 0 ? ', ' : '') + modelIds[model]}}
|
||||||
|
</ng-container>
|
||||||
|
</td>
|
||||||
|
<td><span class="rb-ic clickable rb-ic-undo" (click)="restoreUser(user)"></span></td>
|
||||||
|
</tr>
|
||||||
|
</rb-table>
|
||||||
|
</rb-accordion-body>
|
||||||
|
</rb-accordion>
|
||||||
|
|
||||||
<ng-template #modelOptions>
|
<ng-template #modelOptions>
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<ng-container *ngFor="let model of modelSelect">
|
<ng-container *ngFor="let model of modelSelect">
|
||||||
|
@ -14,6 +14,7 @@ import {DataService} from '../services/data.service';
|
|||||||
export class UsersComponent implements OnInit {
|
export class UsersComponent implements OnInit {
|
||||||
|
|
||||||
users: UserModel[] = [];
|
users: UserModel[] = [];
|
||||||
|
deletedUsers: UserModel[] = [];
|
||||||
newUser: UserModel | null = null;
|
newUser: UserModel | null = null;
|
||||||
newUserPass = '';
|
newUserPass = '';
|
||||||
modelSelect: {id: string, name: string}[] = [];
|
modelSelect: {id: string, name: string}[] = [];
|
||||||
@ -28,7 +29,8 @@ export class UsersComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.api.get<UserModel[]>('/users', data => {
|
this.api.get<UserModel[]>('/users', data => {
|
||||||
this.users = data.map(e => new UserModel().deserialize(e));
|
this.users = data.map(e => new UserModel().deserialize(e)).filter(e => e.status !== 'deleted');
|
||||||
|
this.deletedUsers = data.map(e => new UserModel().deserialize(e)).filter(e => e.status === 'deleted');
|
||||||
});
|
});
|
||||||
this.d.load('modelGroups', () => {
|
this.d.load('modelGroups', () => {
|
||||||
this.d.arr.modelGroups.forEach(group => {
|
this.d.arr.modelGroups.forEach(group => {
|
||||||
@ -63,6 +65,8 @@ export class UsersComponent implements OnInit {
|
|||||||
this.api.delete('/user/' + user.name, () => {
|
this.api.delete('/user/' + user.name, () => {
|
||||||
user.status = 'deleted';
|
user.status = 'deleted';
|
||||||
user.edit = false;
|
user.edit = false;
|
||||||
|
this.deletedUsers.push(user);
|
||||||
|
this.users.splice(this.users.findIndex(e => e.name === user.name), 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -71,6 +75,8 @@ export class UsersComponent implements OnInit {
|
|||||||
restoreUser(user) {
|
restoreUser(user) {
|
||||||
this.api.put('/user/restore/' + user.name, {}, () => {
|
this.api.put('/user/restore/' + user.name, {}, () => {
|
||||||
user.status = 'new';
|
user.status = 'new';
|
||||||
|
this.users.push(user);
|
||||||
|
this.deletedUsers.splice(this.deletedUsers.findIndex(e => e.name === user.name), 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user