Skip to content

Commit

Permalink
Merge pull request #17 from helyOSFramework/dashboard_dev
Browse files Browse the repository at this point in the history
Dashboard: Filtering assignments and services
  • Loading branch information
cviolbarbosa committed May 22, 2024
2 parents 8c47a9f + 36765dc commit 822af22
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ <h1>Agent Assignments </h1>
</div>
</div>

<div class="row" style="align-items:flex-end">
<fieldset class="form-group col-xl-3">
<label>Work process id</label>
<input type="number" class="form-control" [(ngModel)]="filterWprocId" name="filterWprocId" (keydown.enter)="filterList(0)" />
</fieldset>

<button style="margin-bottom:16px; height: fit-content;" class="btn btn-primary" (click)="filterList(0)" type="submit">APPLY</button>
</div>

<div class="card mb-3">
<div class="card-header" style="display: flex; justify-content: space-between;">
<div class="clickable" (click)="filterList(0)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class AgentAssignmentsComponent implements OnInit {
public filterObj: any = {};
public first: number = 15;
public page: number = 1;
public filterWprocId: number = null;

constructor(private helyosService: HelyosService) {

Expand All @@ -38,6 +39,10 @@ export class AgentAssignmentsComponent implements OnInit {
this.page = 1;
}
this.filterObj = {};
if (this.filterWprocId) {
this.filterObj['workProcessId'] = this.filterWprocId;
}

this.list();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ <h5>Spatial Properties</h5>
<div class="row">
<fieldset class="form-group col-xl-3">
<label>x (unit)</label>
<input type="number" class="form-control" [(ngModel)]="selectedItem.x" name="x" placeholder=5000 />
<input type="number" class="form-control" [(ngModel)]="selectedItem.x" name="x" placeholder=0 />
</fieldset>
<fieldset class="form-group col-xl-3">
<label>y (unit)</label>
<input type="number" class="form-control" [(ngModel)]="selectedItem.y" name="y" placeholder=13000 />
<input type="number" class="form-control" [(ngModel)]="selectedItem.y" name="y" placeholder=0 />
</fieldset>
<fieldset class="form-group col-xl-3">
<label>z (unit)</label>
<input type="number" class="form-control" [(ngModel)]="selectedItem.z" name="z" placeholder=13000 />
<input type="number" class="form-control" [(ngModel)]="selectedItem.z" name="z" placeholder=0 />
</fieldset>
<fieldset class="form-group col-xl-3">
<label>unit</label>
Expand All @@ -181,12 +181,12 @@ <h5>Spatial Properties</h5>
<div class="row">

<fieldset class="form-group col-xl-4">
<label>orientation (mrad)</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3142" />
<label>orientation</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3.14" />
</fieldset>
<fieldset class="form-group col-xl-6">
<label>orientations (mrad)</label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="3142" />
<label>orientations </label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="1.57, 3.14,..." />
</fieldset>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,13 @@ export class AgentChargeStationsComponent implements OnInit {
}

try {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
if (patch.orientations) {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
}
} else {
patch.orientations = [];
}
} catch (error) {
alert('orientations should be a list. E.g; 1230, 1235, 7879');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ <h5>Spatial Properties</h5>
<div class="row">

<fieldset class="form-group col-xl-4">
<label>orientation (mrad)</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3142" />
<label>orientation</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3.14" />
</fieldset>
<fieldset class="form-group col-xl-6">
<label>orientations (mrad)</label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="3142" />
<label>orientations </label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="1.57, 3.14,..." />
</fieldset>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,13 @@ export class AgentToolsComponent implements OnInit {
}

try {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
if (patch.orientations) {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
}
} else {
patch.orientations = [];
}
} catch (error) {
alert('orientations should be a list. E.g; 1230, 1235, 7879');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ <h5>Spatial Properties</h5>
<div class="row">

<fieldset class="form-group col-xl-4">
<label>orientation (mrad)</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3142" />
<label>orientation</label>
<input type="number" step=1 class="form-control" [(ngModel)]="selectedItem.orientation" name="orientation" placeholder="3.14" />
</fieldset>
<fieldset class="form-group col-xl-6">
<label>orientations (mrad)</label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="3142" />
<label>orientations </label>
<input class="form-control" [(ngModel)]="selectedItem.orientations" name="orientations" placeholder="1.57, 3.14,..." />
</fieldset>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ export class AgentVehiclesComponent implements OnInit {
alert('wpClearance is no a valid JSON');
return;
}

try {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
if (patch.orientations) {
if (!Array.isArray(patch.orientations)){
patch.orientations = patch.orientations.split(',');
patch.orientations = patch.orientations.map(e => parseFloat(e));
}
} else {
patch.orientations = [];
}
} catch (error) {
alert('orientations should be a list. E.g; 1230, 1235, 7879');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ <h1>Dispatched Services </h1>
</div>
</div>

<div class="row" style="align-items:flex-end">
<fieldset class="form-group col-xl-3">
<label>Work process id</label>
<input type="number" class="form-control" [(ngModel)]="filterWprocId" name="filterWprocId" (keydown.enter)="filterList(0)" />
</fieldset>

<button style="margin-bottom:16px; height: fit-content;" class="btn btn-primary" (click)="filterList(0)" type="submit">APPLY</button>
</div>

<div class="card mb-3">
<div class="card-header" style="display: flex; justify-content: space-between;">
<div class="clickable" (click)="filterList(0)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class DispatchServicesComponent implements OnInit {
public filterObj: any = {};
public first: number = 15;
public page: number = 1;
public filterWprocId = null;

constructor(private helyosService: HelyosService) {

Expand All @@ -35,15 +36,19 @@ export class DispatchServicesComponent implements OnInit {
.then( r => this.items = r );
}

filterList(pageDelta:number=0) {
this.page += pageDelta;
if (this.page < 1){
this.page = 1;
}
this.filterObj = {};
this.list();
filterList(pageDelta:number=0) {
this.page += pageDelta;
if (this.page < 1){
this.page = 1;
}
this.filterObj = {};
if (this.filterWprocId) {
this.filterObj['workProcessId'] = this.filterWprocId;
}

this.list();
}

getItem(itemId) {
this.helyosService.methods.servciceRequests.get(itemId)
.then( (r:any)=> {
Expand Down

0 comments on commit 822af22

Please sign in to comment.