Commit 5d3d2b2f authored by Madis Põld's avatar Madis Põld
Browse files

Merge branch 'feature/TEIS-2446' into 'develop'

TEIS-2445, TEIS-2446

See merge request teis/public-web-client!734
parents 00931532 e76e4383
<teis-modal [title]="'edit_data' | translate" icon="icon-edit" [loading]="!form">
<teis-form-layout [colsize]="20">
<form [formGroup]="form" (ngSubmit)="submit()" *ngIf="form">
<div class="mb-4">
<form-row [label]="'controlled_period_start' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-datepicker class="flex-grow-1 mr-2" formControlName="controlledPeriodBeginning"> </ska-datepicker>
</form-row>
<form-row [label]="'controlled_period_end' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-datepicker class="flex-grow-1 mr-2" formControlName="controlledPeriodEnd"> </ska-datepicker>
</form-row>
<form-row [label]="'inspection_type' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-select formControlName="inspectionType" [data]="inspectionTypes" [displayFunc]="classifierDisplayFunc"></ska-select>
</form-row>
<form-row [label]="'number_of_vehicles' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-number min="0" max="999999999" formControlName="numberOfVehicles" [name]="'number_of_vehicles' | translate" required pattern="\d+"></ska-number>
</form-row>
<form-row [label]="'number_of_drivers' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-number min="0" max="999999999" formControlName="numberOfDrivers" [name]="'number_of_drivers' | translate" required pattern="\d+"></ska-number>
</form-row>
</div>
<teis-flex>
<form-button-with-confirmation [form]="form" [buttonBackLabel]="'abandon' | translate" (confirm)="cancel()"> </form-button-with-confirmation>
<button teis-button teis-submitting type="submit">
{{ 'save' | translate }}
</button>
</teis-flex>
</form>
</teis-form-layout>
</teis-modal>
\ No newline at end of file
import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DriversInspectionsFacade } from '@teis/features/drivers-inspections/drivers-inspections-facade.service';
import { DriversInspectionInspectedItemsDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { ClassifiersApi } from '@teis/services/classifiers/classifiers.api.service';
import { ClassifierItemDefinitionId, ClassifierItemDto } from '@teis/services/classifiers/classifiers.models';
import { triggerValidation } from '@teis/utils';
import { ModalService } from '@teis/widgets/teis-modal/modal.service';
@Component({
selector: 'teis-edit-inspection-data',
templateUrl: './edit-inspection-data.component.html',
styleUrls: ['./edit-inspection-data.component.scss']
})
export class EditInspectionDataComponent implements OnInit {
constructor(private fb: FormBuilder, private classifiersApi: ClassifiersApi, private modal: ModalService, private facade: DriversInspectionsFacade) { }
@Input() inspectionData: DriversInspectionInspectedItemsDto;
form: FormGroup;
inspectionTypes: ClassifierItemDto[] = [];
classifierDisplayFunc = (item: ClassifierItemDto) => item.name;
ngOnInit(): void {
this.classifiersApi.fetchClassifierItems({ definitionId: ClassifierItemDefinitionId.DriversInspectionType }).subscribe((inspectionTypes: ClassifierItemDto[]) => {
this.inspectionTypes = inspectionTypes;
this.initializeForm(inspectionTypes);
});
}
initializeForm(inspectionTypes: ClassifierItemDto[]): void {
const inspectionTypeValue = inspectionTypes.find(inspectionType => inspectionType.id === this.inspectionData.inspectionType?.id);
this.form = this.fb.group({
controlledPeriodBeginning: [this.inspectionData.controlledPeriodBeginning],
controlledPeriodEnd: [this.inspectionData.controlledPeriodEnd],
numberOfDrivers: [this.inspectionData.numberOfDrivers],
numberOfVehicles: [this.inspectionData.numberOfVehicles],
inspectionType: [inspectionTypeValue],
});
}
cancel(): void {
this.modal.close();
}
submit(): void {
triggerValidation(this.form);
if (this.form.valid) {
this.facade.editDriversInspectionData(this.form.value);
}
}
}
<teis-modal [title]="'edit_data' | translate" icon="icon-edit" [loading]="!form">
<teis-form-layout [colsize]="20">
<form [formGroup]="form" (ngSubmit)="submit()" *ngIf="form">
<div class="mb-4">
<form-row [label]="'convicted_person' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<div class="d-flex flex-column justify-content-around">
<div class="custom-control custom-radio">
<input
class="custom-control-input"
type="radio"
id="radio-{{convictedPersonType.EmployerUnderProceedings}}"
[value]="convictedPersonType.EmployerUnderProceedings"
formControlName="convictedPersonType"
/>
<label class="custom-control-label" for="radio-{{convictedPersonType.EmployerUnderProceedings}}">{{ convictedPersonType.EmployerUnderProceedings | translate }}</label>
</div>
<div class="custom-control custom-radio">
<input
class="custom-control-input"
type="radio"
id="radio-{{convictedPersonType.NaturalPerson}}"
[value]="convictedPersonType.NaturalPerson"
formControlName="convictedPersonType"
/>
<label class="custom-control-label" for="radio-{{convictedPersonType.NaturalPerson}}">{{ convictedPersonType.NaturalPerson | translate }}</label>
</div>
</div>
</form-row>
<form-row [label]="'misdemeanor_ref_number' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-input type="text" formControlName="misdemeanorRefNumber" minlength="12" maxlength="12"></ska-input>
</form-row>
<ng-container *ngIf="form.value.convictedPersonType === convictedPersonType.NaturalPerson">
<form-row [label]="'name' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-input type="text" [required]="true" formControlName="convictedPersonName"></ska-input>
</form-row>
<form-row [label]="'id_code' | translate" [comment]="'required' | translate" labelClass="text-left justify-start col-xs-20 col-md-5" contentClass="col-xs-20 col-md-12">
<ska-input type="text" [required]="true" formControlName="convictedPersonCode" minlength="11" maxlength="11"></ska-input>
</form-row>
</ng-container>
</div>
<teis-flex>
<form-button-with-confirmation [form]="form" [buttonBackLabel]="'abandon' | translate" (confirm)="cancel()"> </form-button-with-confirmation>
<button teis-button teis-submitting type="submit">
{{ 'save' | translate }}
</button>
</teis-flex>
</form>
</teis-form-layout>
</teis-modal>
\ No newline at end of file
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DriversInspectionsFacade } from '@teis/features/drivers-inspections/drivers-inspections-facade.service';
import { EditMisdemeanorDataDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { triggerValidation } from '@teis/utils';
import { ModalService } from '@teis/widgets/teis-modal/modal.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
enum ConvictedPersonType {
NaturalPerson = 'natural_person',
EmployerUnderProceedings = 'employer_under_proceedings'
}
@Component({
selector: 'teis-edit-misdemeanor-data',
templateUrl: './edit-misdemeanor-data.component.html',
styleUrls: ['./edit-misdemeanor-data.component.scss']
})
export class EditMisdemeanorDataComponent implements OnInit, OnDestroy {
constructor(private fb: FormBuilder, private modal: ModalService, private facade: DriversInspectionsFacade) { }
@Input() misdemeanorData: EditMisdemeanorDataDto;
readonly convictedPersonType = ConvictedPersonType;
private destroy$ = new Subject<boolean>();
form: FormGroup;
ngOnInit(): void {
this.initializeForm();
this.onConvictedPersonTypeChange();
}
initializeForm(): void {
const convictedPersonType = this.misdemeanorData.convictedPersonCode ? ConvictedPersonType.NaturalPerson : ConvictedPersonType.EmployerUnderProceedings;
this.form = this.fb.group({
convictedPersonType: [convictedPersonType],
convictedPersonCode: [this.misdemeanorData.convictedPersonCode],
convictedPersonName: [this.misdemeanorData.convictedPersonName],
misdemeanorRefNumber: [this.misdemeanorData.misdemeanorRefNumber],
});
}
onConvictedPersonTypeChange(): void {
this.form.get('convictedPersonType').valueChanges.pipe(takeUntil(this.destroy$)).subscribe((convictedPersonType: ConvictedPersonType) => {
const codeControl = this.form.get('convictedPersonCode');
const nameControl = this.form.get('convictedPersonName');
if (convictedPersonType === ConvictedPersonType.EmployerUnderProceedings) {
codeControl.clearValidators();
codeControl.reset();
codeControl.markAsPristine();
nameControl.clearValidators();
nameControl.reset();
nameControl.markAsPristine();
}
});
}
cancel(): void {
this.modal.close();
}
submit(): void {
this.form.updateValueAndValidity();
triggerValidation(this.form);
if (this.form.valid) {
const formValue = this.form.value;
const misdemeanorData: EditMisdemeanorDataDto = {
convictedPersonCode: formValue.convictedPersonCode,
convictedPersonName: formValue.convictedPersonName,
misdemeanorRefNumber: formValue.misdemeanorRefNumber,
};
this.facade.editDriversInspectionMisdemeanorData(misdemeanorData);
}
}
ngOnDestroy(): void {
this.destroy$.next(true);
this.destroy$.complete();
}
}
<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>
<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]="'inspection_type' | translate">
......@@ -26,4 +24,14 @@
<span class="font-weight-bold">
{{ misdemeanorData || '-' }}
</span>
<teis-icon-button
*permission="{ id: inspectionId$ | async, type: permissionType, permission: editMisdemeanorPermission }"
class="actions"
role="button"
variant="no-style"
icon="icon-edit"
iconSize="medium"
(click)="openEditMisdemeanorDataModal()"
>
</teis-icon-button>
</teis-form-row-details>
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { DriversInspectionInspectedItemsDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { DriversInspectionsFacade } from '@teis/features/drivers-inspections/drivers-inspections-facade.service';
import { DriversInspectionInspectedItemsDto, DriversInspectionPermission, EditMisdemeanorDataDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { PermissionDataObjectType } from '@teis/services/permissions/permissions.model';
import { ModalService } from '@teis/widgets/teis-modal/modal.service';
import { Observable } from 'rxjs';
import { EditMisdemeanorDataComponent } from '../edit-misdemeanor-data/edit-misdemeanor-data.component';
@Component({
selector: 'number-of-inspected-items-detail',
templateUrl: './number-of-inspected-items-detail.component.html',
styleUrls: ['./number-of-inspected-items-detail.component.scss']
styleUrls: ['./number-of-inspected-items-detail.component.scss'],
})
export class NumberOfInspectedItemsDetailComponent implements OnChanges {
constructor(private facade: DriversInspectionsFacade, private modal: ModalService) {}
@Input() itemsDetails: DriversInspectionInspectedItemsDto;
misdemeanorData: string;
constructor() { }
inspectionId$: Observable<string> = this.facade.driversInspectionId;
readonly editMisdemeanorPermission = DriversInspectionPermission.ENTER_MISDEMEANOR_DATA;
readonly permissionType = PermissionDataObjectType.DRIVERS_INSPECTION;
ngOnChanges(changes: SimpleChanges): void {
if (changes.itemsDetails) {
this.updateMisdemeanorData();
}
}
openEditMisdemeanorDataModal() {
const misdemeanorData: EditMisdemeanorDataDto = {
convictedPersonCode: this.itemsDetails.convictedPersonCode,
convictedPersonName: this.itemsDetails.convictedPersonName,
misdemeanorRefNumber: this.itemsDetails.misdemeanorRefNumber,
};
this.modal.openWithComponent(EditMisdemeanorDataComponent, { misdemeanorData });
}
updateMisdemeanorData(): void {
let data = this.itemsDetails.misdemeanorRefNumber ?? '-';
if (this.itemsDetails.convictedPersonCode) {
......@@ -25,5 +44,4 @@ export class NumberOfInspectedItemsDetailComponent implements OnChanges {
}
this.misdemeanorData = data;
}
}
......@@ -24,7 +24,7 @@ export const calculateSums = (items: NumberOfInspectedItemsDto[], inspectionType
}, {});
};
export const calculateTotalSum = (items: NumberOfInspectedItemsDto[]): number | null => {
export const calculateTotalSum = (items: NumberOfInspectedItemsDto[]): number => {
return !items?.length
? null
: items.reduce((totalSum, item) => {
......
<teis-loader *ngIf="(facade.loading | async).numberOfInspectedItems; else content"></teis-loader>
<ng-template #content>
<div class="mt-4">
<teis-header variant="block" [title]="'inspected_numbers' | translate"> </teis-header>
<teis-header variant="block" [title]="'inspected_numbers' | translate">
<button *permission="{ id: inspectionId$ | async, type: permissionType, permission: editInspectionPermission }" teis-button variant="plain" (click)="openEditInspectionDataModal()">
<teis-icon icon="icon-edit"></teis-icon>
{{ 'edit' | translate }}
</button>
</teis-header>
</div>
<number-of-inspected-items-detail [itemsDetails]="inspectionInspectedItems$ | async"></number-of-inspected-items-detail>
......
import { Component, OnInit } from '@angular/core';
import { DriversInspectionsFacade } from '@teis/features/drivers-inspections/drivers-inspections-facade.service';
import { DriversInspectionPermission, DriversInspectionType, InspectedItem } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { DriversInspectionInspectedItemsDto, DriversInspectionPermission, InspectedItem, NumberOfInspectedItemsDto } from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { PermissionDataObjectType } from '@teis/services/permissions/permissions.model';
import { ModalService } from '@teis/widgets/teis-modal/modal.service';
import { Observable } from 'rxjs';
import { map, shareReplay, take } from 'rxjs/operators';
import { AddOrEditNumberOfInspectedItemsComponent } from '../add-or-edit-number-of-inspected-items/add-or-edit-number-of-inspected-items.component';
import { EditInspectionDataComponent } from '../edit-inspection-data/edit-inspection-data.component';
import { calculateTotalSum } from '../number-of-inspected-items-table/utils';
@Component({
......@@ -16,21 +18,28 @@ export class NumberOfInspectedItemsComponent implements OnInit {
constructor(public facade: DriversInspectionsFacade, private modal: ModalService) { }
numberOfDriversItems$ = this.facade.numberOfDriversItems.pipe(shareReplay({ refCount: true }));
totalSumOfDriversItems$ = this.facade.numberOfDriversItems.pipe(map(calculateTotalSum), shareReplay({ refCount: true }));
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;
numberOfDriversItems$: Observable<NumberOfInspectedItemsDto[]> = this.facade.numberOfDriversItems.pipe(shareReplay({ refCount: true }));
totalSumOfDriversItems$: Observable<number> = this.facade.numberOfDriversItems.pipe(map(calculateTotalSum), shareReplay({ refCount: true }));
numberOfWorkDaysItems$: Observable<NumberOfInspectedItemsDto[]> = this.facade.numberOfWorkingDaysItems.pipe(shareReplay({ refCount: true }));
totalSumOfWorkDaysItems$: Observable<number> = this.facade.numberOfWorkingDaysItems.pipe(map(calculateTotalSum), shareReplay({ refCount: true }));
inspectionType$: Observable<string> = this.facade.driversInspectionInspectedItems.pipe(map(items => items.inspectionType?.code), shareReplay({ refCount: true }));
inspectionInspectedItems$: Observable<DriversInspectionInspectedItemsDto> = this.facade.driversInspectionInspectedItems;
inspectionId$: Observable<string> = this.facade.driversInspectionId.pipe(shareReplay({ refCount: true }));
readonly addItemPermission = DriversInspectionPermission.ADD_DRIVERS_NUMBER_OF_INSPECTED_ITEM;
readonly editInspectionPermission = DriversInspectionPermission.ENTER_INSPECTION_DATA;
readonly permissionType = PermissionDataObjectType.DRIVERS_INSPECTION;
ngOnInit(): void {
this.facade.getNumberOfInspectedItems();
}
openEditInspectionDataModal() {
this.inspectionInspectedItems$.pipe(take(1)).subscribe((inspectionData) => {
this.modal.openWithComponent(EditInspectionDataComponent, { inspectionData });
});
}
openAddInspectedItemsModal(item: InspectedItem) {
this.inspectionType$.pipe(take(1)).subscribe((inspectionType) => {
this.modal.openWithComponent(AddOrEditNumberOfInspectedItemsComponent, { item, inspectionType });
......
......@@ -8,6 +8,8 @@ import { NumberOfInspectedItemsTableComponent } from './containers/number-of-ins
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';
import { EditInspectionDataComponent } from './containers/edit-inspection-data/edit-inspection-data.component';
import { EditMisdemeanorDataComponent } from './containers/edit-misdemeanor-data/edit-misdemeanor-data.component';
@NgModule({
declarations: [
......@@ -18,6 +20,8 @@ import { NumberOfInspectedItemsDetailComponent } from './containers/number-of-in
AddFileComponent,
AddOrEditNumberOfInspectedItemsComponent,
NumberOfInspectedItemsDetailComponent,
EditInspectionDataComponent,
EditMisdemeanorDataComponent,
],
exports: [],
imports: [DriversInspectionsRoutingModule, DriversInspectionsSharedModule],
......
......@@ -1174,5 +1174,12 @@
"number_of_vehicles": "Sõidukite arv kontrollitud ettevõttes EN",
"inspection_type": "Kontrolli tüüp EN",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber EN",
"controlled_period_start": "Kontrollitud ajavahemiku algus EN",
"controlled_period_end": "Kontrollitud ajavahemiku lõpp EN",
"edit_inspection_data_success": "Kontrolli üldandmed edukalt muudetud EN",
"natural_person": "Füüsiline isik EN",
"employer_under_proceedings": "Menetlusalune tööandja EN",
"convicted_person": "Karistatud isik EN",
"edit_inspection_misdemeanor_data_success": "Väärteomenetluse andmed edukalt muudetud EN",
"edit_infringement_status_error": "Kõvalekalde staatuse muutmine ebaõnnestus EN"
}
\ No newline at end of file
......@@ -1174,5 +1174,12 @@
"number_of_vehicles": "Sõidukite arv ettevõttes",
"inspection_type": "Kontrolli tüüp",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber",
"controlled_period_start": "Kontrollitud ajavahemiku algus",
"controlled_period_end": "Kontrollitud ajavahemiku lõpp",
"edit_inspection_data_success": "Kontrolli üldandmed edukalt muudetud",
"natural_person": "Füüsiline isik",
"employer_under_proceedings": "Menetlusalune tööandja",
"convicted_person": "Karistatud isik",
"edit_inspection_misdemeanor_data_success": "Väärteomenetluse andmed edukalt muudetud",
"edit_infringement_status_error": "Kõrvalekalde staatuse muutmine ebaõnnestus"
}
\ No newline at end of file
......@@ -1174,5 +1174,12 @@
"number_of_vehicles": "Sõidukite arv kontrollitud ettevõttes RU",
"inspection_type": "Kontrolli tüüp RU",
"misdemeanor_ref_number": "Väärteomenetluse viitenumber RU",
"controlled_period_start": "Kontrollitud ajavahemiku algus RU",
"controlled_period_end": "Kontrollitud ajavahemiku lõpp RU",
"edit_inspection_data_success": "Kontrolli üldandmed edukalt muudetud RU",
"natural_person": "Füüsiline isik RU",
"employer_under_proceedings": "Menetlusalune tööandja RU",
"convicted_person": "Karistatud isik RU",
"edit_inspection_misdemeanor_data_success": "Väärteomenetluse andmed edukalt muudetud RU",
"edit_infringement_status_error": "Kõvalekalde staatuse muutmine ebaõnnestus RU"
}
\ No newline at end of file
......@@ -22,6 +22,8 @@ import {
DriversInfringementStatus,
CreateOrEditNumberOfInspectedItemsDto,
DriversInspectionInspectedItemsDto,
EditDriversInspectionInspectedItemsDto,
EditMisdemeanorDataDto,
DriversInfringementExtendedDto,
} from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
......@@ -392,6 +394,24 @@ export class DriversInspectionsFacade implements OnDestroy {
});
}
editDriversInspectionData(inspectionData: EditDriversInspectionInspectedItemsDto) {
const { id } = this.driversInspection$.getValue();
this.driversInspectionOfficeApi.patchDriversInspectionData(id, inspectionData).subscribe(() => {
this.getNumberOfInspectedItems();
this.modal.close();
this.message.addToastSuccess(this.translate.instant('edit_inspection_data_success'), 3000);
});
}
editDriversInspectionMisdemeanorData(misdemeanorData: EditMisdemeanorDataDto) {
const { id } = this.driversInspection$.getValue();
this.driversInspectionOfficeApi.patchDriversInspectionMisdemeanorData(id, misdemeanorData).subscribe(() => {
this.getNumberOfInspectedItems();
this.modal.close();
this.message.addToastSuccess(this.translate.instant('edit_inspection_misdemeanor_data_success'), 3000);
});
}
postDriversInspectionFiles(file: File) {
const { id } = this.driversInspection$.getValue();
const formData: FormData = new FormData();
......
......@@ -9,6 +9,8 @@ import {
DriversInfringementStatus,
CreateOrEditNumberOfInspectedItemsDto,
DriversInspectionInspectedItemsDto,
EditDriversInspectionInspectedItemsDto,
EditMisdemeanorDataDto,
DriversInfringementExtendedDto,
} from '@teis/features/drivers-inspections/services/drivers-inspections.model';
import { ApiOffice } from '@teis/services/api-office';
......@@ -68,4 +70,12 @@ export class DriversInspectionsOfficeApi extends ApiOffice {
deleteNumberOfInspectedItems(id: string) {
return this.http.delete(`${this.url}/number-of-inspected-items/${id}`);
}
patchDriversInspectionData(id: string, body: EditDriversInspectionInspectedItemsDto) {
return this.http.patch(`${this.url}/${id}/inspection-data`, body);
}
patchDriversInspectionMisdemeanorData(id: string, body: EditMisdemeanorDataDto) {
return this.http.patch(`${this.url}/${id}/misdemeanor-data`, body);
}
}
......@@ -194,6 +194,20 @@ export interface DriversInspectionInspectedItemsDto {
permissions: PermissionDto[];
}
export interface EditDriversInspectionInspectedItemsDto {
controlledPeriodBeginning: string;
controlledPeriodEnd: string;
inspectionType: ClassifierItemDto;
numberOfDrivers: number;
numberOfVehicles: number;
}
export interface EditMisdemeanorDataDto {
convictedPersonCode: string;
convictedPersonName: string;
misdemeanorRefNumber: string;
}
export interface NumberOfInspectedItemsDto {
createdAt: string;
driversInspectionFileId: string;
......@@ -297,4 +311,6 @@ export enum DriversInspectionPermission {
ENTER_JUSTIFICATION = 'ENTER_JUSTIFICATION',
ADD_DRIVERS_VIOLATION_FILE = 'ADD_DRIVERS_VIOLATION_FILE',
DELETE_DRIVERS_VIOLATION_FILE = 'DELETE_DRIVERS_VIOLATION_FILE',
ENTER_INSPECTION_DATA = 'ENTER_INSPECTION_DATA',
ENTER_MISDEMEANOR_DATA = 'ENTER_MISDEMEANOR_DATA'
}
......@@ -105,4 +105,5 @@ export enum ClassifierItemDefinitionId {
ViolationLegislation = 'VIOLATION_LEGISLATION',
ViolationStatus = 'VIOLATION_STATUS',
Vocabulary = 'VOCABULARY',