Commit d2ccca55 authored by Pearu Sarv's avatar Pearu Sarv
Browse files

TEIS-2443 Add NOII general data

parent 56b17fc5
<teis-form-row-details [label]="'controlled_period' | translate">
<span class="font-weight-bold">
{{ itemsDetails.controlledPeriodBeginning | date: 'dd.MM.yyyy' }} - {{ itemsDetails.controlledPeriodEnd | date: 'dd.MM.yyyy' }}
</span>
</teis-form-row-details>
<teis-form-row-details [label]="'number_of_drivers' | translate">
<span class="font-weight-bold">
{{ itemsDetails.numberOfDrivers || '-' }}
</span>
</teis-form-row-details>
<teis-form-row-details [label]="'number_of_vehicles' | translate">
<span class="font-weight-bold">
{{ itemsDetails.numberOfVehicles || '-' }}
</span>
</teis-form-row-details>
<teis-form-row-details [label]="'inspection_type' | translate">
<span class="font-weight-bold">
{{ itemsDetails.inspectionType?.name || '-' }}
</span>
</teis-form-row-details>
<teis-form-row-details [label]="'misdemeanor_ref_number' | translate" class="boldBottom">
<span class="font-weight-bold">
{{ misdemeanorData || '-' }}
</span>
</teis-form-row-details>
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { DriversInspectionInspectedItemsDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
@Component({
selector: 'number-of-inspected-items-detail',
templateUrl: './number-of-inspected-items-detail.component.html',
styleUrls: ['./number-of-inspected-items-detail.component.scss']
})
export class NumberOfInspectedItemsDetailComponent implements OnChanges {
@Input() itemsDetails: DriversInspectionInspectedItemsDto;
misdemeanorData: string;
constructor() { }
ngOnChanges(changes: SimpleChanges): void {
if (changes.itemsDetails) {
this.updateMisdemeanorData();
}
}
updateMisdemeanorData(): void {
let data = this.itemsDetails.misdemeanorRefNumber;
if (this.itemsDetails.convictedPersonCode) {
data += `, ${this.itemsDetails.convictedPersonCode}, ${this.itemsDetails.convictedPersonName}`;
}
this.misdemeanorData = data;
}
}
......@@ -4,6 +4,8 @@
<teis-header variant="block" [title]="'inspected_numbers' | translate"> </teis-header>
</div>
<number-of-inspected-items-detail [itemsDetails]="inspectionInspectedItems$ | async"></number-of-inspected-items-detail>
<p class="font-weight-bold">{{ 'inspected_drivers' | translate }}</p>
<teis-number-of-inspected-items-table
*ngIf="(numberOfDriversItems$ | async)?.length; else inspectedDriversNotFound"
......
......@@ -21,6 +21,7 @@ export class NumberOfInspectedItemsComponent implements OnInit {
numberOfWorkDaysItems$ = this.facade.numberOfWorkingDaysItems.pipe(shareReplay({ refCount: true }));
totalSumOfWorkDaysItems$ = this.facade.numberOfWorkingDaysItems.pipe(map(calculateTotalSum), shareReplay({ refCount: true }));
inspectionType$ = this.facade.driversInspectionInspectedItems.pipe(map(items => items.inspectionType?.code), shareReplay({ refCount: true }));
inspectionInspectedItems$ = this.facade.driversInspectionInspectedItems;
inspectionId$ = this.facade.driversInspectionId;
readonly addItemPermission = DriversInspectionPermission.ADD_DRIVERS_NUMBER_OF_INSPECTED_ITEM;
......
......@@ -7,6 +7,7 @@ import { NumberOfInspectedItemsComponent } from './containers/number-of-inspecte
import { NumberOfInspectedItemsTableComponent } from './containers/number-of-inspected-items-table/number-of-inspected-items-table.component';
import { AddFileComponent } from './containers/add-file/add-file.component';
import { AddOrEditNumberOfInspectedItemsComponent } from './containers/add-or-edit-number-of-inspected-items/add-or-edit-number-of-inspected-items.component';
import { NumberOfInspectedItemsDetailComponent } from './containers/number-of-inspected-items-detail/number-of-inspected-items-detail.component';
@NgModule({
declarations: [
......@@ -16,6 +17,7 @@ import { AddOrEditNumberOfInspectedItemsComponent } from './containers/add-or-ed
NumberOfInspectedItemsTableComponent,
AddFileComponent,
AddOrEditNumberOfInspectedItemsComponent,
NumberOfInspectedItemsDetailComponent,
],
exports: [],
imports: [DriversInspectionsRoutingModule, DriversInspectionsSharedModule],
......
......@@ -1167,5 +1167,10 @@
"edit_number_of_inspected_items_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine EN",
"edit_number_of_inspected_items_success_DRIVERS": "Kontrollitud juhtide arvude muutmine edukas EN",
"edit_number_of_inspected_items_success_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine edukas EN",
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga EN"
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga EN",
"controlled_period": "Kontrollitud ajavahemik EN",
"number_of_drivers": "Juhtide arv kontrollitud ettevõttes EN",
"number_of_vehicles": "Sõidukite arv kontrollitud ettevõttes EN",
"inspection_type": "Kontrolli tüüp EN",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber EN"
}
\ No newline at end of file
......@@ -1167,5 +1167,10 @@
"edit_number_of_inspected_items_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine",
"edit_number_of_inspected_items_success_DRIVERS": "Kontrollitud juhtide arvude muutmine edukas",
"edit_number_of_inspected_items_success_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine edukas",
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga "
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga ",
"controlled_period": "Kontrollitud ajavahemik",
"number_of_drivers": "Juhtide arv kontrollitud ettevõttes",
"number_of_vehicles": "Sõidukite arv kontrollitud ettevõttes",
"inspection_type": "Kontrolli tüüp",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber"
}
\ No newline at end of file
......@@ -1167,5 +1167,10 @@
"edit_number_of_inspected_items_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine RU",
"edit_number_of_inspected_items_success_DRIVERS": "Kontrollitud juhtide arvude muutmine edukas RU",
"edit_number_of_inspected_items_success_WORKINGDAYS": "Kontrollitud tööpäevade arvude muutmine edukas RU",
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga RU"
"sum_error": "Veose ja sõitjate veo arvude summa peab võrduma tasulise veo ja oma tarbeks veo arvude summaga RU",
"controlled_period": "Kontrollitud ajavahemik RU",
"number_of_drivers": "Juhtide arv kontrollitud ettevõttes RU",
"number_of_vehicles": "Sõidukite arv kontrollitud ettevõttes RU",
"inspection_type": "Kontrolli tüüp RU",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber RU"
}
\ No newline at end of file
<teis-form-row-details [label]="'justification' | translate">
<teis-form-row-details [label]="'justification' | translate" class="boldBottom">
<teis-flex position="left" *ngIf="!(showForm$ | async); else justificationEdit">
<p class="font-weight-bold flex-grow-1 pre-wrap">{{ violation.justification || '-' }}</p>
<teis-icon-button *ngIf="hasEditPermission$ | async" role="button" variant="no-style" icon="icon-edit" (click)="editingJustification$.next(true)"> </teis-icon-button>
......
......@@ -89,7 +89,6 @@ export class DriversInspectionsFacade implements OnDestroy {
private violationDetails$ = new BehaviorSubject<DriversViolationDto[]>([]);
private openedViolation$ = new BehaviorSubject<string>(null);
private driversInspectionFiles$ = new BehaviorSubject<DriversInspectionFileDto[]>([]);
private numberOfInspectedItems$ = new BehaviorSubject<NumberOfInspectedItemsDto[]>([]);
private driversInspectionInspectedItems$ = new BehaviorSubject<DriversInspectionInspectedItemsDto>(null);
driversViolationsFilter = new FormControl(this.allDriversFilterOption);
private driversViolationsFilterValue$ = new BehaviorSubject<DriverDto>(null);
......@@ -143,11 +142,17 @@ export class DriversInspectionsFacade implements OnDestroy {
}
get numberOfDriversItems(): Observable<NumberOfInspectedItemsDto[]> {
return this.numberOfInspectedItems$.asObservable().pipe(map((items: NumberOfInspectedItemsDto[]) => items.filter((item: NumberOfInspectedItemsDto) => item.item === InspectedItem.DRIVERS)));
return this.driversInspectionInspectedItems$
.asObservable()
.pipe(map((inspectedItems: DriversInspectionInspectedItemsDto) => inspectedItems?.numberOfInspectedItems.filter((item: NumberOfInspectedItemsDto) => item.item === InspectedItem.DRIVERS) ?? []));
}
get numberOfWorkingDaysItems(): Observable<NumberOfInspectedItemsDto[]> {
return this.numberOfInspectedItems$.asObservable().pipe(map((items: NumberOfInspectedItemsDto[]) => items.filter((item: NumberOfInspectedItemsDto) => item.item === InspectedItem.WORKINGDAYS)));
return this.driversInspectionInspectedItems$
.asObservable()
.pipe(
map((inspectedItems: DriversInspectionInspectedItemsDto) => inspectedItems?.numberOfInspectedItems.filter((item: NumberOfInspectedItemsDto) => item.item === InspectedItem.WORKINGDAYS) ?? [])
);
}
get driversInspectionInspectedItems(): Observable<DriversInspectionInspectedItemsDto> {
......@@ -358,12 +363,10 @@ export class DriversInspectionsFacade implements OnDestroy {
this.driversInspectionOfficeApi.getNumberOfInspectedItems(id).subscribe(
(items: DriversInspectionInspectedItemsDto) => {
this.driversInspectionInspectedItems$.next(items);
this.numberOfInspectedItems$.next(items.numberOfInspectedItems);
this.handleLoading('numberOfInspectedItems', false);
},
() => {
this.driversInspectionInspectedItems$.next(null);
this.numberOfInspectedItems$.next([]);
this.handleLoading('numberOfInspectedItems', false);
}
);
......@@ -462,7 +465,6 @@ export class DriversInspectionsFacade implements OnDestroy {
this.loading$.next(initialLoading);
this.driversInspectionFiles$.next([]);
this.driversInspectionInspectedItems$.next(null);
this.numberOfInspectedItems$.next([]);
this.driversViolationTypes$.next([]);
}
......
Markdown is supported
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