Loading packages/admin-web-angular/src/app/@shared/carrier/carrier-mutation/carrier-mutation.component.html +3 −3 Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ <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]="'CARRIERS_VIEW.CREATE.BASIC_INFO' | translate" Loading packages/admin-web-angular/src/app/@shared/carrier/carrier-mutation/carrier-mutation.component.ts +1 −29 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ import { BasicInfoFormComponent } from '../forms'; import { LocationFormComponent } from '../../forms/location'; import { getDummyImage } from '@modules/server.common/utils'; import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'ea-carrier-mutation', Loading Loading @@ -47,30 +46,13 @@ export class CarrierMutationComponent implements AfterViewInit { google.maps.places.PlaceGeometry | google.maps.GeocoderGeometry >(); public BUTTON_DONE: string = 'BUTTON_DONE'; public BUTTON_NEXT: string = 'BUTTON_NEXT'; public BUTTON_PREV: string = 'BUTTON_PREV'; constructor( private toasterService: ToasterService, private readonly activeModal: NgbActiveModal, private readonly formBuilder: FormBuilder, protected carrierRouter: CarrierRouter, private readonly _translateService: TranslateService protected carrierRouter: CarrierRouter ) {} get buttonDone() { return this._translate(this.BUTTON_DONE); } get buttonNext() { return this._translate(this.BUTTON_NEXT); } get buttonPrevious() { return this._translate(this.BUTTON_PREV); } ngAfterViewInit(): void { if (this.locationForm) { this.locationForm.setDefaultCoords(); Loading Loading @@ -135,14 +117,4 @@ export class CarrierMutationComponent implements AfterViewInit { cancel() { this.activeModal.dismiss('canceled'); } private _translate(key: string): string { let translationResult = ''; this._translateService.get(key).subscribe((res) => { translationResult = res; }); return translationResult; } } packages/admin-web-angular/src/app/@shared/product/product-create/product-create.component.html +3 −3 Original line number Diff line number Diff line Loading @@ -7,9 +7,9 @@ <div> <form-wizard [formGroup]="form" [doneText]="buttonDone" [nextText]="buttonNext" [previousText]="buttonPrevious" [doneText]="'BUTTON_DONE' | translate" [nextText]="'BUTTON_NEXT' | translate" [previousText]="'BUTTON_PREV' | translate" [nbSpinner]="loading" #formWizard class="form-horizontal" Loading packages/admin-web-angular/src/app/@shared/product/product-create/product-create.component.ts +7 −32 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { BasicInfoFormComponent } from '../forms'; import { IProductCreateObject } from '@modules/server.common/interfaces/IProduct'; import { ProductsService } from '../../../@core/data/products.service'; import { firstValueFrom } from 'rxjs'; import { first } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; import { NotifyService } from '@app/@core/services/notify/notify.service'; Loading @@ -19,9 +20,6 @@ export class ProductCreateComponent implements OnInit { public loading: boolean; public productsCategories: any; public BUTTON_DONE: string = 'BUTTON_DONE'; public BUTTON_NEXT: string = 'BUTTON_NEXT'; public BUTTON_PREVIOUS: string = 'BUTTON_PREVIOUS'; readonly form: FormGroup = this._formBuilder.group({ basicInfo: BasicInfoFormComponent.buildForm(this._formBuilder), Loading @@ -41,31 +39,18 @@ export class ProductCreateComponent implements OnInit { this.basicInfoForm.productCategories = this.productsCategories; } get buttonDone() { return this._translate(this.BUTTON_DONE); } get buttonNext() { return this._translate(this.BUTTON_NEXT); } get buttonPrevious() { return this._translate(this.BUTTON_PREVIOUS); } async createProduct() { if (this.basicInfo.valid) { const productCreateObject: IProductCreateObject = await this.basicInfoForm.setupProductCreateObject(); try { this.loading = true; await this._productsService .create(productCreateObject) .pipe(first()) .toPromise(); await firstValueFrom( this._productsService.create(productCreateObject).pipe(first()) ).finally(() => { this.loading = false; const message = `Product ${productCreateObject.title[0].value} is created`; }) const message = `Product ${productCreateObject.title[0].value} is created`; this._notifyService.success(message); this.cancelModal(); } catch (error) { Loading @@ -77,16 +62,6 @@ export class ProductCreateComponent implements OnInit { } } private _translate(key: string): string { let translationResult = ''; this._translateService.get(key).subscribe((res) => { translationResult = res; }); return translationResult; } public cancelModal() { this._activeModal.dismiss('canceled'); } Loading packages/admin-web-angular/src/app/@shared/product/product-create/product-create.module.ts +3 −5 Original line number Diff line number Diff line import { NgModule } from '@angular/core'; import { ThemeModule } from '../../../@theme/theme.module'; import { TranslateModule } from '@ngx-translate/core'; import { FormWizardModule } from '@ever-co/angular2-wizard'; import { ProductCreateComponent } from './product-create.component'; import { ProductFormsModule } from '../forms'; import { NbSpinnerModule } from '@nebular/theme'; import { TranslateModule } from '@app/@shared/translate/translate.module'; @NgModule({ imports: [ ThemeModule, FormWizardModule, TranslateModule.forChild(), TranslateModule, ProductFormsModule, NbSpinnerModule, ], exports: [ProductCreateComponent], declarations: [ProductCreateComponent], entryComponents: [ProductCreateComponent], declarations: [ProductCreateComponent] }) export class ProductCreateModule {} Loading
packages/admin-web-angular/src/app/@shared/carrier/carrier-mutation/carrier-mutation.component.html +3 −3 Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ <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]="'CARRIERS_VIEW.CREATE.BASIC_INFO' | translate" Loading
packages/admin-web-angular/src/app/@shared/carrier/carrier-mutation/carrier-mutation.component.ts +1 −29 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ import { BasicInfoFormComponent } from '../forms'; import { LocationFormComponent } from '../../forms/location'; import { getDummyImage } from '@modules/server.common/utils'; import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'ea-carrier-mutation', Loading Loading @@ -47,30 +46,13 @@ export class CarrierMutationComponent implements AfterViewInit { google.maps.places.PlaceGeometry | google.maps.GeocoderGeometry >(); public BUTTON_DONE: string = 'BUTTON_DONE'; public BUTTON_NEXT: string = 'BUTTON_NEXT'; public BUTTON_PREV: string = 'BUTTON_PREV'; constructor( private toasterService: ToasterService, private readonly activeModal: NgbActiveModal, private readonly formBuilder: FormBuilder, protected carrierRouter: CarrierRouter, private readonly _translateService: TranslateService protected carrierRouter: CarrierRouter ) {} get buttonDone() { return this._translate(this.BUTTON_DONE); } get buttonNext() { return this._translate(this.BUTTON_NEXT); } get buttonPrevious() { return this._translate(this.BUTTON_PREV); } ngAfterViewInit(): void { if (this.locationForm) { this.locationForm.setDefaultCoords(); Loading Loading @@ -135,14 +117,4 @@ export class CarrierMutationComponent implements AfterViewInit { cancel() { this.activeModal.dismiss('canceled'); } private _translate(key: string): string { let translationResult = ''; this._translateService.get(key).subscribe((res) => { translationResult = res; }); return translationResult; } }
packages/admin-web-angular/src/app/@shared/product/product-create/product-create.component.html +3 −3 Original line number Diff line number Diff line Loading @@ -7,9 +7,9 @@ <div> <form-wizard [formGroup]="form" [doneText]="buttonDone" [nextText]="buttonNext" [previousText]="buttonPrevious" [doneText]="'BUTTON_DONE' | translate" [nextText]="'BUTTON_NEXT' | translate" [previousText]="'BUTTON_PREV' | translate" [nbSpinner]="loading" #formWizard class="form-horizontal" Loading
packages/admin-web-angular/src/app/@shared/product/product-create/product-create.component.ts +7 −32 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { BasicInfoFormComponent } from '../forms'; import { IProductCreateObject } from '@modules/server.common/interfaces/IProduct'; import { ProductsService } from '../../../@core/data/products.service'; import { firstValueFrom } from 'rxjs'; import { first } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; import { NotifyService } from '@app/@core/services/notify/notify.service'; Loading @@ -19,9 +20,6 @@ export class ProductCreateComponent implements OnInit { public loading: boolean; public productsCategories: any; public BUTTON_DONE: string = 'BUTTON_DONE'; public BUTTON_NEXT: string = 'BUTTON_NEXT'; public BUTTON_PREVIOUS: string = 'BUTTON_PREVIOUS'; readonly form: FormGroup = this._formBuilder.group({ basicInfo: BasicInfoFormComponent.buildForm(this._formBuilder), Loading @@ -41,31 +39,18 @@ export class ProductCreateComponent implements OnInit { this.basicInfoForm.productCategories = this.productsCategories; } get buttonDone() { return this._translate(this.BUTTON_DONE); } get buttonNext() { return this._translate(this.BUTTON_NEXT); } get buttonPrevious() { return this._translate(this.BUTTON_PREVIOUS); } async createProduct() { if (this.basicInfo.valid) { const productCreateObject: IProductCreateObject = await this.basicInfoForm.setupProductCreateObject(); try { this.loading = true; await this._productsService .create(productCreateObject) .pipe(first()) .toPromise(); await firstValueFrom( this._productsService.create(productCreateObject).pipe(first()) ).finally(() => { this.loading = false; const message = `Product ${productCreateObject.title[0].value} is created`; }) const message = `Product ${productCreateObject.title[0].value} is created`; this._notifyService.success(message); this.cancelModal(); } catch (error) { Loading @@ -77,16 +62,6 @@ export class ProductCreateComponent implements OnInit { } } private _translate(key: string): string { let translationResult = ''; this._translateService.get(key).subscribe((res) => { translationResult = res; }); return translationResult; } public cancelModal() { this._activeModal.dismiss('canceled'); } Loading
packages/admin-web-angular/src/app/@shared/product/product-create/product-create.module.ts +3 −5 Original line number Diff line number Diff line import { NgModule } from '@angular/core'; import { ThemeModule } from '../../../@theme/theme.module'; import { TranslateModule } from '@ngx-translate/core'; import { FormWizardModule } from '@ever-co/angular2-wizard'; import { ProductCreateComponent } from './product-create.component'; import { ProductFormsModule } from '../forms'; import { NbSpinnerModule } from '@nebular/theme'; import { TranslateModule } from '@app/@shared/translate/translate.module'; @NgModule({ imports: [ ThemeModule, FormWizardModule, TranslateModule.forChild(), TranslateModule, ProductFormsModule, NbSpinnerModule, ], exports: [ProductCreateComponent], declarations: [ProductCreateComponent], entryComponents: [ProductCreateComponent], declarations: [ProductCreateComponent] }) export class ProductCreateModule {}