Commit 02f95fef authored by RAHUL RATHORE's avatar RAHUL RATHORE
Browse files

fix: next & previous button visibility

parent 401aee01
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -10,13 +10,14 @@
<form-wizard
	class="form-horizontal"
	[formGroup]="form"
	[doneText]="buttonDone"
	[nextText]="buttonNext"
	[previousText]="buttonPrevious"
	[doneText]="'BUTTON_DONE' | translate"
	[nextText]="'BUTTON_NEXT' | translate"
	[previousText]="'BUTTON_PREV' | translate"
>
	<wizard-step
		[title]="'WAREHOUSE_VIEW.MUTATION.WIZARD_TITLES.BASIC_INFO' | translate"
		[isValid]="basicInfo.valid && password.valid"
		[showPrev]="false"
	>
		<div class="pt-5"></div>
		<ea-warehouse-basic-info-form
@@ -68,6 +69,7 @@
		[title]="'Payment'"
		[isValid]="paymentsSettingsForm.isPaymentValid"
		(onComplete)="createWarehouse()"
		[showNext]="false"
	>
		<div class="pt-4"></div>

+1 −29
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ import { ToasterService } from 'angular2-toaster';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { BasicInfoFormComponent, ContactInfoFormComponent } from '../forms';
import { LocationFormComponent } from '../../forms/location';
import { TranslateService } from '@ngx-translate/core';
import { PaymentsSettingsFormComponent } from '../forms/payments-settings/payments-settings-form.component';

@Component({
@@ -21,10 +20,6 @@ import { PaymentsSettingsFormComponent } from '../forms/payments-settings/paymen
export class WarehouseMutationComponent implements AfterViewInit {
	loading: boolean;

	public BUTTON_DONE: string = 'BUTTON_DONE';
	public BUTTON_NEXT: string = 'BUTTON_NEXT';
	public BUTTON_PREV: string = 'BUTTON_PREV';

	@ViewChild('basicInfoForm')
	basicInfoForm: BasicInfoFormComponent;

@@ -56,22 +51,9 @@ export class WarehouseMutationComponent implements AfterViewInit {
		private readonly activeModal: NgbActiveModal,
		private readonly formBuilder: FormBuilder,
		private readonly toasterService: ToasterService,
		private readonly warehouseRouter: WarehouseRouter,
		private readonly _translateService: TranslateService
		private readonly warehouseRouter: WarehouseRouter
	) {}

	get buttonDone() {
		return this._translate(this.BUTTON_DONE);
	}

	get buttonNext() {
		return this._translate(this.BUTTON_NEXT);
	}

	get buttonPrevious() {
		return this._translate(this.BUTTON_PREV);
	}

	get isValidContactInfo() {
		return this.contactInfoForm.validForm !== undefined
			? this.contactInfoForm.validForm
@@ -144,14 +126,4 @@ export class WarehouseMutationComponent implements AfterViewInit {
	cancel() {
		this.activeModal.dismiss('canceled');
	}

	private _translate(key: string): string {
		let translationResult = '';

		this._translateService.get(key).subscribe((res) => {
			translationResult = res;
		});

		return translationResult;
	}
}
+12 −6
Original line number Diff line number Diff line
@@ -213,9 +213,15 @@
	</nb-card-body>
</nb-card>

<ng-container *ngIf="showPrev">
	<button nbButton disabled (click)="previousStep.emit()">
		{{ 'FAKE_DATA.SETUP_MERCHANTS.PREV' | translate }}
	</button>
</ng-container>
<ng-container *ngIf="showNext">
	<button nbButton (click)="nextStep.emit()" [disabled]="!formValid">
		{{ 'FAKE_DATA.SETUP_MERCHANTS.NEXT' | translate }}
	</button>
</ng-container>

+5 −1
Original line number Diff line number Diff line
import { Component, ViewChild, Output, EventEmitter } from '@angular/core';
import { Component, ViewChild, Output, EventEmitter, Input } from '@angular/core';
import { NgForm } from '@angular/forms';

@Component({
@@ -12,9 +12,13 @@ export class SetupMerchantAccountComponent {

	@Output()
	previousStep: EventEmitter<boolean> = new EventEmitter<boolean>();

	@Output()
	nextStep: EventEmitter<boolean> = new EventEmitter<boolean>();

	@Input() showNext: boolean = true;
  	@Input() showPrev: boolean = true;

	accountModel = {
		email: '',
		username: '',
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
								#account
								(previousStep)="nbStepper.previous()"
								(nextStep)="nbStepper.next()"
								[showPrev]="false"
							></ea-merchants-setup-account>
						</nb-step>
						<nb-step