mirror of
https://github.com/allerta-vvf/allerta-vvf
synced 2025-06-06 00:49:21 +02:00
Support for non-chief
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Disponibile</th>
|
||||
<ng-container *ngIf="auth.profile.chief">
|
||||
<th>Autista</th>
|
||||
<th>Chiama</th>
|
||||
<th>Scrivi</th>
|
||||
<th>Interventi</th>
|
||||
<th>Minuti disponibilità</th>
|
||||
</ng-container>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_body">
|
||||
@@ -19,10 +21,11 @@
|
||||
<ng-container *ngIf="(getTime() - row.online_time) < 30"><u>{{ row.name }}</u></ng-container>
|
||||
<ng-container *ngIf="(getTime() - row.online_time) > 30">{{ row.name }}</ng-container>
|
||||
</td>
|
||||
<td (click)="changeAvailability.emit({user: row.id, newState: row.available ? 0 : 1})">
|
||||
<td (click)="onChangeAvailability(row.id, row.available ? 0 : 1)">
|
||||
<i class="fa fa-check" style="color:green" *ngIf="row.available"></i>
|
||||
<i class="fa fa-times" style="color:red" *ngIf="!row.available"></i>
|
||||
</td>
|
||||
<ng-container *ngIf="auth.profile.chief">
|
||||
<td>
|
||||
<img alt="driver" src="./assets/img/wheel.png" width="20px" *ngIf="row.driver">
|
||||
</td>
|
||||
@@ -34,6 +37,7 @@
|
||||
</td>
|
||||
<td>{{ row.services }}</td>
|
||||
<td>{{ row.availability_minutes }}</td>
|
||||
</ng-container>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { TableType } from 'src/app/_models/TableType';
|
||||
import { ApiClientService } from 'src/app/_services/api-client.service';
|
||||
import { AuthService } from '../../_services/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-table',
|
||||
@@ -15,7 +16,7 @@ export class TableComponent implements OnInit {
|
||||
|
||||
public data: any = [];
|
||||
|
||||
constructor(public apiClient: ApiClientService) {}
|
||||
constructor(public apiClient: ApiClientService, public auth: AuthService) {}
|
||||
|
||||
getTime() {
|
||||
return Math.floor(Date.now() / 1000);
|
||||
@@ -36,4 +37,9 @@ export class TableComponent implements OnInit {
|
||||
this.loadTableData();
|
||||
}
|
||||
|
||||
onChangeAvailability(user: number, newState: 0|1) {
|
||||
if(this.auth.profile.chief) {
|
||||
this.changeAvailability.emit({user, newState});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user