Commit 04e1bb37 authored by Juraj Fiala's avatar Juraj Fiala
Browse files

fix: Assignment visuals

parent b9ec5bf6
Pipeline #142616 waiting for manual action with stage
......@@ -2,41 +2,47 @@
Error loading create page: {{ errorMessage }}
</div>
<div *ngIf="confirmMessage">Assignment has been created.</div>
<div *ngIf="agents && missions && state === requestState.SUCCESS">
<form [formGroup]="edit">
<mat-toolbar>Agent Assignment record</mat-toolbar>
<mat-form-field appearance="fill">
<mat-toolbar color="primary">Agent Assignment record</mat-toolbar>
<div *ngIf="agents && missions && state === requestState.SUCCESS" class="main-container">
<form [formGroup]="edit" class="flex flex-col px-4">
<mat-form-field floatLabel="always">
<mat-label>Start date:</mat-label>
<input matInput type="Date" formControlName="start"/>
<input matInput type="Date" formControlName="start" />
</mat-form-field>
<mat-form-field appearance="fill">
<mat-form-field>
<mat-label>Duration (days):</mat-label>
<input matInput formControlName="durationInDays" type="number" min="0"/>
<input matInput formControlName="durationInDays" type="number" min="0" />
</mat-form-field>
</form>
<div>
<mat-form-field appearance="fill">
<div class="flex flex-col px-4">
<mat-form-field>
<mat-label>Agent:</mat-label>
<mat-select id="select-agent" [(ngModel)]="assignment.agentId" class="bx--text-input" required name="actionSelection" >
<mat-option *ngFor="let agent of agents" [value]="agent.id" >{{agent.name}}</mat-option>
<mat-select id="select-agent" [(ngModel)]="assignment.agentId" class="bx--text-input" required
name="actionSelection">
<mat-option *ngFor="let agent of agents" [value]="agent.id">{{agent.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill">
</mat-form-field>
<mat-form-field>
<mat-label>Mission:</mat-label>
<mat-select id="select-mission" [(ngModel)]="assignment.missionId" class="bx--text-input" required name="actionSelection" >
<mat-option *ngFor="let mission of missions" [value]="mission.id">{{mission.name}}</mat-option>
<mat-select id="select-mission" [(ngModel)]="assignment.missionId" class="bx--text-input" required
name="actionSelection">
<mat-option *ngFor="let mission of missions" [value]="mission.id">{{mission.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Agent's report:</mat-label>
<input matInput [(ngModel)]="assignment.report" />
</mat-form-field>
</div>
</div>
<div *ngIf="agents && missions && state === requestState.SUCCESS">
<mat-form-field appearance="fill">
<mat-label>Agent's report:</mat-label>
<input matInput [(ngModel)]="assignment.report" />
</mat-form-field>
</div>
<div>
<button mat-button (click)="createAssignment()" disabled="{{ !edit.valid }}">Create</button>
</div>
<button mat-fab color="accent" class="!fixed right-8 bottom-20" routerLink="../assignment/create"
aria-label="Create a new assignment"
(click)="createAssignment()"
disabled="{{ !edit.valid }}"
>
<mat-icon>done</mat-icon>
</button>
......@@ -2,41 +2,59 @@
Error showing assignment detail: {{ errorMessage }}
</div>
<div *ngIf="assignmentSaved">Assignment has been updated.</div>
<div *ngIf="assignment && state === requestState.SUCCESS">
<form [formGroup]="edit">
<mat-toolbar>Agent Assignment record</mat-toolbar>
<mat-form-field appearance="fill">
<mat-toolbar color="primary">
Agent Assignment record
<span class="flex-1"></span>
<button mat-icon-button [matMenuTriggerFor]="menu" aria-label="Menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteAssignment()">Delete</button>
</mat-menu>
</mat-toolbar>
<div *ngIf="assignment && state === requestState.SUCCESS" class="main-container flex flex-col px-4">
<form [formGroup]="edit" class="flex flex-col">
<mat-form-field>
<mat-label>Start date:</mat-label>
<input matInput [disabled]="!editing" type="Date" formControlName="start"/>
<input matInput [disabled]="!editing" type="Date" formControlName="start" />
</mat-form-field>
<mat-form-field appearance="fill">
<mat-form-field>
<mat-label>Duration (days):</mat-label>
<input matInput [disabled]="!editing" formControlName="durationInDays" type="number" min="0"/>
<input matInput [disabled]="!editing" formControlName="durationInDays" type="number" min="0" />
</mat-form-field>
</form>
<div routerLink="../agent/{{ assignment.agent.id }}">
<mat-label>Agent's name:</mat-label>
{{assignment.agent.name}}
<div routerLink="../../agent/{{ assignment.agent.id }}">
<h4 class="!m-0">Agent</h4>
<p>
{{assignment.agent.name}}
</p>
</div>
<div routerLink="../mission/{{ assignment.mission.id }}">
<mat-label>Mission:</mat-label>
{{assignment.mission.name}}
<div routerLink="../../mission/{{ assignment.mission.id }}">
<h4 class="!m-0">Mission</h4>
<p>
{{assignment.mission.name}}
</p>
</div>
<h4 class="!m-0">Report</h4>
<p>{{assignment.report}}</p>
</div>
<div *ngIf="assignment && state === requestState.SUCCESS" class="w-full">
<mat-form-field appearance="fill">
<mat-label>Agent's report:</mat-label>
<textarea matInput placeholder="Agent's report" [(ngModel)]="assignment.report" [disabled]="!editing"></textarea>
</mat-form-field>
</div>
<mat-divider></mat-divider>
<div>
<section>
<button mat-raised-button *ngIf="!editing" (click)="setEditing(true)">Edit</button>
<button mat-raised-button *ngIf="editing" (click)="setEditing(false); saveAssignment();" disabled="{{ !edit.valid }}">Save</button>
<button mat-raised-button *ngIf="editing" (click)="setEditing(false); loadAssignment();">Cancel</button>
</section>
<section>
<button mat-raised-button (click)="deleteAssignment()">Delete</button>
</section>
</div>
<button mat-fab color="accent" class="!fixed right-8 bottom-20" aria-label="Edit" *ngIf="!editing"
(click)="setEditing(true)">
<mat-icon>edit</mat-icon>
</button>
<button mat-fab color="accent" class="!fixed right-8 bottom-20" *ngIf="editing"
(click)="setEditing(false); saveAssignment();" disabled="{{ !edit.valid }}">
</button>
......@@ -2,7 +2,12 @@
Error showing assignment detail: {{ errorMessage }}
</div>
<h2>Assignments:</h2>
<button mat-raised-button routerLink="../assignment/create">Create a new assignment</button>
<button mat-fab color="accent" class="!fixed right-8 bottom-20" routerLink="../assignment/create"
aria-label="Create a new assignment">
<mat-icon>add</mat-icon>
</button>
<div *ngIf="assignments && state === requestState.SUCCESS">
<table mat-table [dataSource]="assignments" class="w-full">
<ng-container matColumnDef="start">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment