public btnClicked(e: any): void {
switch (e.target.id) { case 'searchNext': /* Validate the Source, Destination, Date and Class chosen and proceed only if all the fields are selected */ if (!isNOU(this.startPoint.value) && !isNOU(this.endPoint.value) && !isNOU(this.ticketType.value) && !isNOU(this.journeyDate.value)) { if (!isNOU(this.startPoint.value) && this.startPoint.value == this.endPoint.value) { document.getElementById('err1').innerText = '* Arrival point cannot be same as Departure'; } else { this.tab.enableTab(1, true); /* Enables the Second tab item*/ this.tab.enableTab(0, false); /* Disables the first tab item*/ this.filterTrains(e); document.getElementById('err1').innerText = ''; document.getElementById('err2').innerText = ''; } } else { document.getElementById('err1').innerText = '* Please fill all the details before proceeding'; } break; case 'bookTickets': /* Based on the selected station generate Grid content to display trains available */ if (this.availTrainGrid.getSelectedRecords() === undefined || this.availTrainGrid.getSelectedRecords().length === 0) { document.getElementById('err2').innerText = '* Select your convenient train'; } else { this.tab.enableTab(2, true); /* Enables the third tab item*/ this.tab.enableTab(1, false); /* Disables the second tab item*/ document.getElementById('err2').innerText = ''; } break; case 'confirmTickets': /* Get the Passenger details and validate the fields must not be left empty */ if (this.input1.nativeElement.value === '' || isNOU(this.passgender1.value) || isNOU(this.passage1.value)) { document.getElementById('err3').innerText = '* Please enter passenger details'; } else { this.tab.enableTab(3, true); /* Enables the fourth tab item*/ this.tab.enableTab(2, false); /* Disables the third tab item*/ document.getElementById('err3').innerText = ''; this.finalizeDetails(e); } break; case 'makePayment': this.alertDlg.show(); break; case 'goToSearch': /* Go back to change class, date or boarding places */ this.selectedTrain = []; this.tab.enableTab(0, true); /* Enables the first tab item*/ this.tab.select(0); this.tab.enableTab(1, false); /* Disables the second tab item*/ break; case 'goBackToBook': /* Change the preferred train chosen already */ this.tab.enableTab(1, true); /* Enables the second tab item*/ this.tab.select(1); this.tab.enableTab(2, false); /* Disables the third tab item*/ break; case 'goBackDetails': /* Update passenger detail before confirming the payment */ this.tab.enableTab(2, true); /* Enables the third tab item*/ this.tab.select(2); this.tab.enableTab(3, false); /* Disables the fourth tab item*/ break; } } |
public ngAfterViewInit(): void {
this.startTabs();
}
public startTabs(): void {
this.tabObj.items[0].disabled = false; /* Enables the First tab item*/
this.tabObj.items[1].disabled = true; /* Disables the Second tab item*/
this.tabObj.items[2].disabled = true; /* Disables the Third tab item*/
this.tabObj.selectedItem = 0; /* Selects the First tab item*/
}
public enableTabs(event): void {
this.tabObj.items[0].disabled = true; /* Disables the First tab item*/
this.tabObj.items[1].disabled = true; /* Disables the Second tab item*/
this.tabObj.items[2].disabled = true; /* Disables the Third tab item*/
this.tabObj.selectedItem = 1; /* Selects the Second tab item*/
} |