Merge pull request #40 in ~VLE2FE/definma-ui from f/edit-button-placement to master

* commit '7e82b43e069085e5975dd618ec2ebd0e4e43eb82':
  Store current sample page
  Move Sample edit-button to the left hand side
This commit is contained in:
Hartenstein Ruben (PEA4-Fe) 2020-12-03 14:44:49 +01:00
commit ad20fdb1bb
2 changed files with 19 additions and 16 deletions

View File

@ -161,6 +161,10 @@
<rb-table class="samples-table" scrollTop ellipsis>
<tr>
<th *ngIf="login.isLevel.write">
<span class="rb-ic rb-ic-edit clickable" *ngIf="login.isLevel.dev" (click)="batchEdit()"></span>
<span class="rb-ic rb-ic-close clickable" *ngIf="sampleSelect === 1" (click)="sampleSelect = 0"></span>
</th>
<th *ngIf="sampleSelect">
<rb-form-checkbox name="select-all" (change)="selectAll($event)">all</rb-form-checkbox>
</th>
@ -177,14 +181,19 @@
</div>
</div>
</th>
<th *ngIf="login.isLevel.write">
<span class="rb-ic rb-ic-edit clickable" *ngIf="login.isLevel.dev" (click)="batchEdit()"></span>
<span class="rb-ic rb-ic-close clickable" *ngIf="sampleSelect === 1" (click)="sampleSelect = 0"></span>
</th>
</tr>
<tr *ngFor="let sample of samples; index as i" class="clickable" (click)="sampleDetails(sample._id, sampleModal)">
<td *ngIf="sampleSelect">
<td *ngIf="login.isLevel.write">
<a [routerLink]="'/samples/edit/' + sample._id"
*ngIf="sample.status !== 'deleted' &&
(login.isLevel.dev || (login.isLevel.write && sample.user_id === login.userId))">
<span class="rb-ic rb-ic-edit clickable"></span>
</a>
<span class="rb-ic rb-ic-undo clickable" *ngIf="sample.status === 'deleted' && login.isLevel.dev"
(click)="restoreSample(sample._id, restoreConfirm, $event)"></span>
</td>
<td *ngIf="sampleSelect">
<rb-form-checkbox *ngIf="sample.status !== 'deleted'" [name]="'validate-' + i" (click)="stopPropagation($event)"
[(ngModel)]="sample.selected">
</rb-form-checkbox>
@ -208,15 +217,6 @@
<td *ngFor="let key of activeTemplateKeys.measurements">{{sample[key[1]] | exists: key[2]}}</td>
<td *ngIf="isActiveKey['status']">{{sample.status}}</td>
<td *ngIf="isActiveKey['added']">{{sample.added | date:'dd/MM/yy'}}</td>
<td *ngIf="login.isLevel.write">
<a [routerLink]="'/samples/edit/' + sample._id"
*ngIf="sample.status !== 'deleted' &&
(login.isLevel.dev || (login.isLevel.write && sample.user_id === login.userId))">
<span class="rb-ic rb-ic-edit clickable"></span>
</a>
<span class="rb-ic rb-ic-undo clickable" *ngIf="sample.status === 'deleted' && login.isLevel.dev"
(click)="restoreSample(sample._id, restoreConfirm, $event)"></span>
</td>
</tr>
</rb-table>

View File

@ -126,6 +126,10 @@ export class SamplesComponent implements OnInit {
this.loadTemplateKeys('material', 'type', onLoad);
this.loadTemplateKeys('condition', 'notes.comment', onLoad);
this.loadTemplateKeys('measurement', 'status', onLoad);
if("currentPage" in localStorage){
this.page = Number(localStorage.getItem("currentPage"));
}
}
loadTemplateKeys(collection, insertBefore, f) {
@ -303,6 +307,7 @@ export class SamplesComponent implements OnInit {
return;
}
this.page += delta;
localStorage.setItem("currentPage", this.page.toString());
this.loadSamples({toPage: delta});
}
@ -498,6 +503,4 @@ export class SamplesComponent implements OnInit {
ucFirst(string) { // convert first character of string to uppercase
return string[0].toUpperCase() + string.slice(1);
}
}