80 lines
2.7 KiB
TypeScript
80 lines
2.7 KiB
TypeScript
import { Component, inject } from '@angular/core';
|
|
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
import { AngularMaterialModule } from '../../shared/module/angular-material.module';
|
|
import { CommonModule } from '@angular/common';
|
|
import { StepperSelectionEvent } from '@angular/cdk/stepper';
|
|
import { ApplicationComponent } from "../application/application.component";
|
|
import { HolderComponent } from '../holder/holder.component';
|
|
import { GoodsComponent } from '../goods/goods.component';
|
|
import { TravelPlanComponent } from '../travel-plan/travel-plan.component';
|
|
import { InsuranceComponent } from '../insurance/insurance.component';
|
|
import { PaymentComponent } from '../payment/payment.component';
|
|
import { ShippingComponent } from '../shipping/shipping.component';
|
|
import { DeliveryComponent } from '../delivery/delivery.component';
|
|
|
|
@Component({
|
|
selector: 'app-add-carnet',
|
|
imports: [AngularMaterialModule, CommonModule, ReactiveFormsModule,
|
|
ApplicationComponent, HolderComponent, GoodsComponent, TravelPlanComponent, InsuranceComponent,
|
|
ShippingComponent, DeliveryComponent, PaymentComponent],
|
|
templateUrl: './add-carnet.component.html',
|
|
styleUrl: './add-carnet.component.scss'
|
|
})
|
|
export class AddCarnetComponent {
|
|
currentStep = 0;
|
|
isLinear = true;
|
|
applicationType: 'new' | 'additional' | 'duplicate' | 'extend' | null = 'new';
|
|
isEditMode = false;
|
|
headerid: number = 0;
|
|
|
|
// Track completion of each step
|
|
stepsCompleted = {
|
|
applicationDetail: false,
|
|
holderSelection: false,
|
|
goodsSection: false,
|
|
travelPlan: false,
|
|
insurance: false,
|
|
shipping: false,
|
|
deliveryMethod: false,
|
|
payment: false
|
|
};
|
|
|
|
onStepChange(event: StepperSelectionEvent): void {
|
|
this.currentStep = event.selectedIndex;
|
|
}
|
|
|
|
onApplicationDetailCreated(headerid: number): void {
|
|
this.headerid = this.headerid;
|
|
this.stepsCompleted.applicationDetail = true;
|
|
this.isLinear = false; // Disable linear mode after application detail is created
|
|
}
|
|
|
|
onHolderSelectionSaved(completed: boolean): void {
|
|
this.stepsCompleted.holderSelection = completed;
|
|
}
|
|
|
|
onGoodsSectionSaved(completed: boolean): void {
|
|
this.stepsCompleted.goodsSection = completed;
|
|
}
|
|
|
|
onTravelPlanSaved(completed: boolean): void {
|
|
this.stepsCompleted.travelPlan = completed;
|
|
}
|
|
|
|
onInsuranceSaved(completed: boolean): void {
|
|
this.stepsCompleted.insurance = completed;
|
|
}
|
|
|
|
onShippingSaved(completed: boolean): void {
|
|
this.stepsCompleted.shipping = completed;
|
|
}
|
|
|
|
onDeliveryMethodSaved(completed: boolean): void {
|
|
this.stepsCompleted.deliveryMethod = completed;
|
|
}
|
|
|
|
onPaymentSaved(completed: boolean): void {
|
|
this.stepsCompleted.payment = completed;
|
|
}
|
|
}
|