extend carnet updates
This commit is contained in:
parent
6a628b9dc7
commit
5d140b0171
@ -5,7 +5,7 @@
|
||||
|
||||
<!-- Replacement Application Step -->
|
||||
<mat-step *ngIf="applicationType === 'extend'" [completed]="stepsCompleted.extension"
|
||||
[editable]="stepsCompleted.extension">
|
||||
[editable]="stepsCompleted.applicationDetail">
|
||||
<ng-template matStepLabel>Extension Application</ng-template>
|
||||
<app-replacement-set (completed)="onExtensionApplicationSaved($event)" [headerid]="headerid"
|
||||
[isEditMode]="isEditMode && applicationType === 'extend'">
|
||||
@ -42,7 +42,7 @@
|
||||
<ng-template matStepLabel>Travel Plan</ng-template>
|
||||
<app-travel-plan (completed)="onTravelPlanSaved($event)" [headerid]="headerid"
|
||||
[applicationType]="applicationType" (needsInsurance)="onNeedsInsurance($event)"
|
||||
[isViewMode]="applicationType !== 'edit' && applicationType !== 'additional'">
|
||||
[isViewMode]="applicationType !== 'edit' && applicationType !== 'additional' && applicationType !== 'extend'">
|
||||
</app-travel-plan>
|
||||
</mat-step>
|
||||
|
||||
|
||||
@ -36,25 +36,25 @@
|
||||
<div class="form-row">
|
||||
<mat-form-field appearance="outline" class="current-port">
|
||||
<mat-label>Current port where the goods are located</mat-label>
|
||||
<input matInput formControlName="portName" required>
|
||||
<mat-error *ngIf="f['portName'].errors?.['required']">
|
||||
<input matInput formControlName="portName">
|
||||
<!-- <mat-error *ngIf="f['portName'].errors?.['required']">
|
||||
Port location is required
|
||||
</mat-error>
|
||||
<mat-error *ngIf="f['portName'].errors?.['maxlength']">
|
||||
Maximum 100 characters allowed
|
||||
</mat-error>
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="country">
|
||||
<mat-label>Country</mat-label>
|
||||
<mat-select formControlName="portCountry" required>
|
||||
<mat-select formControlName="portCountry">
|
||||
<mat-option *ngFor="let country of countries" [value]="country.value">
|
||||
{{ country.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="f['portCountry'].errors?.['required']">
|
||||
<!-- <mat-error *ngIf="f['portCountry'].errors?.['required']">
|
||||
Port Country is required
|
||||
</mat-error>
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@ -73,16 +73,16 @@
|
||||
|
||||
<mat-form-field appearance="outline" class="duration">
|
||||
<mat-label>Duration</mat-label>
|
||||
<input matInput type="number" formControlName="duration" required>
|
||||
<input matInput type="number" formControlName="duration">
|
||||
<span matTextSuffix>Month(s)</span>
|
||||
<mat-error *ngIf="f['duration'].errors?.['required']">
|
||||
<!-- <mat-error *ngIf="f['duration'].errors?.['required']">
|
||||
Duration is required
|
||||
</mat-error>
|
||||
<mat-error *ngIf="f['duration'].errors?.['min']">
|
||||
</mat-error> -->
|
||||
<!-- <mat-error *ngIf="f['duration'].errors?.['min']">
|
||||
Minimum 1 month required
|
||||
</mat-error>
|
||||
</mat-error> -->
|
||||
<mat-error *ngIf="f['duration'].errors?.['max']">
|
||||
Maximum 24 months allowed
|
||||
Maximum 12 months allowed
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@ -60,7 +60,6 @@ export class ReplacementSetComponent {
|
||||
this.patchFormData(replacementData);
|
||||
this.replacementDetails = replacementData;
|
||||
this.completed.emit(this.extensionForm.valid || this.extensionForm.disabled);
|
||||
this.completed.emit(true);
|
||||
}
|
||||
},
|
||||
error: (error: any) => {
|
||||
@ -92,10 +91,10 @@ export class ReplacementSetComponent {
|
||||
|
||||
createForm(): FormGroup {
|
||||
return this.fb.group({
|
||||
portName: ['', [Validators.required, Validators.maxLength(100)]],
|
||||
portCountry: ['', Validators.required],
|
||||
portName: [''],
|
||||
portCountry: [''],
|
||||
reasonForExtension: ['', Validators.required],
|
||||
duration: [1, [Validators.required, Validators.min(1), Validators.max(24)]]
|
||||
duration: ['', [Validators.max(12)]]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ export class TravelPlanComponent {
|
||||
visits: this.visitsCount
|
||||
});
|
||||
|
||||
if (this.applicationType === 'additional') {
|
||||
if (this.applicationType === 'additional' || this.applicationType === 'extend') {
|
||||
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ export class TravelPlanComponent {
|
||||
c => c.value !== this.selectedVisitCountry!.value
|
||||
);
|
||||
|
||||
if (this.applicationType === 'additional') {
|
||||
if (this.applicationType === 'additional' || this.applicationType === 'extend') {
|
||||
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ export class TravelPlanComponent {
|
||||
this.selectedVisitCountries = plan?.entries;
|
||||
this.selectedTransitCountries = plan?.transits;
|
||||
|
||||
if (this.applicationType === 'additional') {
|
||||
if (this.applicationType === 'additional' || this.applicationType === 'extend') {
|
||||
this.needsInsurance.emit(this.selectedVisitCountries.length > 0)
|
||||
}
|
||||
|
||||
@ -302,14 +302,15 @@ export class TravelPlanComponent {
|
||||
this.travelForm.disable();
|
||||
}
|
||||
|
||||
if (this.applicationType === 'additional') {
|
||||
if (this.applicationType === 'additional' || this.applicationType === 'extend') {
|
||||
const usentriesControl = this.travelForm.get('usaEntries');
|
||||
usentriesControl?.setValidators([Validators.min(1), Validators.max(99)]);
|
||||
usentriesControl?.updateValueAndValidity();
|
||||
}
|
||||
|
||||
this.completed.emit(this.travelForm.valid || this.travelForm.disabled
|
||||
|| (this.applicationType === 'additional' && (this.travelForm.value.usaEntries
|
||||
|| ((this.applicationType === 'additional' || this.applicationType === 'extend')
|
||||
&& (this.travelForm.value.usaEntries
|
||||
|| this.selectedVisitCountries.length > 0 || this.selectedTransitCountries.length > 0)));
|
||||
}
|
||||
|
||||
@ -320,7 +321,8 @@ export class TravelPlanComponent {
|
||||
}
|
||||
|
||||
this.showAdditionalSetsValidationMessage = false;
|
||||
if (this.applicationType === 'additional' && (!this.travelForm.value.usaEntries &&
|
||||
if ((this.applicationType === 'additional' || this.applicationType === 'extend')
|
||||
&& (!this.travelForm.value.usaEntries &&
|
||||
this.selectedVisitCountries.length === 0 &&
|
||||
this.selectedTransitCountries.length === 0
|
||||
)) {
|
||||
|
||||
@ -54,6 +54,6 @@ export class ReplacementService {
|
||||
P_SPID: this.userService.getUserSpid()
|
||||
}
|
||||
|
||||
return this.http.patch(`${this.apiUrl}/${this.apiDb}/SaveExtensionApplication`, extensionDetails);
|
||||
return this.http.post(`${this.apiUrl}/${this.apiDb}/SaveExtensionApplication`, extensionDetails);
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ export class CommonService {
|
||||
}
|
||||
|
||||
getExtensionReasons(): Observable<ExtensionReason[]> {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetParamValues?P_PARAMTYPE=008&P_SPID=${this.userService.getUserSpid()}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetParamValues?P_PARAMTYPE=015&P_SPID=${this.userService.getUserSpid()}`).pipe(
|
||||
map((response) =>
|
||||
response.map((item) => ({
|
||||
name: item.PARAMDESC,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user