From 926046552a7207367fa28e0a39ed1256a947ce3e Mon Sep 17 00:00:00 2001 From: Emil Momchilov Date: Fri, 19 Apr 2019 17:06:53 +0300 Subject: [PATCH 01/26] feat(ever-admin): added new page and track button --- .../warehouse-track.component.html | 1 + .../warehouse-track.component.scss | 0 .../warehouse-track.component.ts | 9 +++++++ .../warehouse-track.module.ts | 27 +++++++++++++++++++ .../+warehouses/warehouses-routing.module.ts | 5 ++++ .../+warehouses/warehouses.component.html | 7 +++++ .../pages/+warehouses/warehouses.module.ts | 2 ++ 7 files changed, 51 insertions(+) create mode 100644 admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html create mode 100644 admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss create mode 100644 admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts create mode 100644 admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.module.ts diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html new file mode 100644 index 000000000..94e71347b --- /dev/null +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html @@ -0,0 +1 @@ +Hello I'm a tracker diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts new file mode 100644 index 000000000..aa490e8ea --- /dev/null +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + templateUrl: './warehouse-track.component.html', + styleUrls: ['./warehouse-track.component.scss'] +}) +export class WarehouseTrackComponent { + constructor() {} +} diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.module.ts b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.module.ts new file mode 100644 index 000000000..5de4f540f --- /dev/null +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { FormWizardModule } from 'angular2-wizard'; +import { Ng2SmartTableModule } from 'ng2-smart-table'; +import { FileUploadModule } from 'ng2-file-upload'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemeModule } from 'app/@theme'; +import { NgSelectModule } from '@ng-select/ng-select'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { WarehouseTrackComponent } from './warehouse-track.component'; + +@NgModule({ + imports: [ + FormWizardModule, + Ng2SmartTableModule, + FileUploadModule, + FormsModule, + ReactiveFormsModule, + TranslateModule.forChild(), + ThemeModule, + NgSelectModule + ], + entryComponents: [WarehouseTrackComponent], + declarations: [WarehouseTrackComponent], + providers: [NgbActiveModal] +}) +export class WarehouseTrackModule {} diff --git a/admin/website-angular/src/app/pages/+warehouses/warehouses-routing.module.ts b/admin/website-angular/src/app/pages/+warehouses/warehouses-routing.module.ts index 10384602b..04990a5f5 100644 --- a/admin/website-angular/src/app/pages/+warehouses/warehouses-routing.module.ts +++ b/admin/website-angular/src/app/pages/+warehouses/warehouses-routing.module.ts @@ -1,12 +1,17 @@ import { RouterModule, Routes } from '@angular/router'; import { WarehousesComponent } from './warehouses.component'; import { NgModule } from '@angular/core'; +import { WarehouseTrackComponent } from './+warehouse-track/warehouse-track.component'; const routes: Routes = [ { path: '', component: WarehousesComponent }, + { + path: 'track', + component: WarehouseTrackComponent + }, { path: ':id', loadChildren: './+warehouse/warehouse.module#WarehouseModule' diff --git a/admin/website-angular/src/app/pages/+warehouses/warehouses.component.html b/admin/website-angular/src/app/pages/+warehouses/warehouses.component.html index dcb068e58..03a562748 100644 --- a/admin/website-angular/src/app/pages/+warehouses/warehouses.component.html +++ b/admin/website-angular/src/app/pages/+warehouses/warehouses.component.html @@ -21,6 +21,13 @@ 'WAREHOUSES_VIEW.DELETE' | translate }} + diff --git a/admin/website-angular/src/app/pages/+warehouses/warehouses.module.ts b/admin/website-angular/src/app/pages/+warehouses/warehouses.module.ts index 13ef6a23b..b51efd133 100644 --- a/admin/website-angular/src/app/pages/+warehouses/warehouses.module.ts +++ b/admin/website-angular/src/app/pages/+warehouses/warehouses.module.ts @@ -15,6 +15,7 @@ import { RenderComponentsModule } from '../../@shared/render-component/render-co import { WarehouseTableModule } from '../../@shared/render-component/warehouse-table/warehouse-table.module'; import { NbSpinnerModule } from '@nebular/theme'; import { ConfirmationModalModule } from 'app/@shared/confirmation-modal/confirmation-modal.module'; +import { WarehouseTrackModule } from './+warehouse-track/warehouse-track.module'; @NgModule({ imports: [ @@ -25,6 +26,7 @@ import { ConfirmationModalModule } from 'app/@shared/confirmation-modal/confirma Ng2SmartTableModule, FormWizardModule, ConfirmationModalModule, + WarehouseTrackModule, ToasterModule.forRoot(), TranslateModule.forChild({ loader: { From a5c94b2fb12e61eddc236bf94d475b82d91c6bfb Mon Sep 17 00:00:00 2001 From: Emil Momchilov Date: Fri, 17 May 2019 08:23:10 +0300 Subject: [PATCH 02/26] feat(ever-admin): added map --- .../src/app/@core/data/warehouses.service.ts | 5 + .../warehouse-track.component.html | 156 +++++++++++++++++- .../warehouse-track.component.scss | 3 + .../warehouse-track.component.ts | 28 +++- 4 files changed, 188 insertions(+), 4 deletions(-) diff --git a/admin/website-angular/src/app/@core/data/warehouses.service.ts b/admin/website-angular/src/app/@core/data/warehouses.service.ts index 62e47467c..6653e3238 100644 --- a/admin/website-angular/src/app/@core/data/warehouses.service.ts +++ b/admin/website-angular/src/app/@core/data/warehouses.service.ts @@ -77,6 +77,11 @@ export class WarehousesService { getAllStores { id _createdAt + geoLocation { + loc { + coordinates + } + } } } ` diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html index 94e71347b..63850718f 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html @@ -1 +1,155 @@ -Hello I'm a tracker +
+
+
+
+ + + Track all working carriers + + +
+
+
+
+ +
+ + + Filter Carriers + + +
+ + + + {{ item.name }} + + +
+ + {{ item.name }} +
+
+
+ + + + {{ item.fullName }} + + +
+ + {{ item.fullName }} +
+
+
+
+ +
+
+
+ {{ selectedStore.name }} +
+
    +
  • + Phone: + {{ selectedStore.contactPhone }} +
  • +
  • + Email: + {{ selectedStore.contactEmail }} +
  • +
  • + Address: + {{ + selectedStore.geoLocation + .streetAddress + }} +
  • +
+
+
+
+ {{ selectedCarrier.fullName }} +
+
    +
  • + Delivery Count: + {{ + selectedCarrier.numberOfDeliveries + }} +
  • +
  • + Phone: {{ selectedCarrier.phone }} +
  • +
  • + Address: + {{ + selectedCarrier.geoLocation + .streetAddress + }} +
  • +
+
+
+
+
+
+
+
+
+
diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss index e69de29bb..aba87115b 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.scss @@ -0,0 +1,3 @@ +.googleMap { + height: 700px; +} diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts index aa490e8ea..1e25fcbc7 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts @@ -1,9 +1,31 @@ -import { Component } from '@angular/core'; +import { Component, ViewChild, OnInit } from '@angular/core'; +import { WarehousesService } from 'app/@core/data/warehouses.service'; @Component({ templateUrl: './warehouse-track.component.html', styleUrls: ['./warehouse-track.component.scss'] }) -export class WarehouseTrackComponent { - constructor() {} +export class WarehouseTrackComponent implements OnInit { + @ViewChild('gmap') + gmapElement: any; + map: google.maps.Map; + + constructor(private warehouseService: WarehousesService) { + this.warehouseService.getAllStores().subscribe((store) => { + console.log(store); + }); + } + + ngOnInit(): void { + this.showMap(); + } + + showMap() { + const mapProp = { + center: new google.maps.LatLng(42.642941, 23.334149), + zoom: 15, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + this.map = new google.maps.Map(this.gmapElement.nativeElement, mapProp); + } } From b411073431a6d8877e3b42a6ffd15109e3e9ad9f Mon Sep 17 00:00:00 2001 From: Emil Momchilov Date: Fri, 17 May 2019 10:04:18 +0300 Subject: [PATCH 03/26] feat(ever-admin): added merchant markers on map --- .../warehouse-track.component.html | 4 +-- .../warehouse-track.component.ts | 29 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html index 63850718f..a9b275e4b 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html @@ -4,7 +4,7 @@
- Track all working carriers + Track all merchants
@@ -15,7 +15,7 @@
- Filter Carriers + Filter Merchants
diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts index 1e25fcbc7..a01e7a50b 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts @@ -1,5 +1,7 @@ import { Component, ViewChild, OnInit } from '@angular/core'; import { WarehousesService } from 'app/@core/data/warehouses.service'; +import { environment } from 'environments/environment'; +import { Marker } from '@agm/core/services/google-maps-types'; @Component({ templateUrl: './warehouse-track.component.html', @@ -10,14 +12,23 @@ export class WarehouseTrackComponent implements OnInit { gmapElement: any; map: google.maps.Map; - constructor(private warehouseService: WarehousesService) { - this.warehouseService.getAllStores().subscribe((store) => { - console.log(store); - }); - } + merchantMarkers: any[] = []; + + constructor(private warehouseService: WarehousesService) {} ngOnInit(): void { this.showMap(); + this.warehouseService.getAllStores().subscribe((store) => { + store.forEach((mer) => { + const coords = new google.maps.LatLng( + mer.geoLocation.loc.coordinates[1], + mer.geoLocation.loc.coordinates[0] + ); + const storeIcon = environment.MAP_MERCHANT_ICON_LINK; + const marker = this.addMarker(coords, this.map, storeIcon); + this.merchantMarkers.push(marker); + }); + }); } showMap() { @@ -28,4 +39,12 @@ export class WarehouseTrackComponent implements OnInit { }; this.map = new google.maps.Map(this.gmapElement.nativeElement, mapProp); } + + addMarker(position, map, icon) { + return new google.maps.Marker({ + position, + map, + icon + }); + } } From edb0c4deb4b03b84ff839966a5a9b66459ed6f7e Mon Sep 17 00:00:00 2001 From: alish Date: Mon, 20 May 2019 10:17:02 +0300 Subject: [PATCH 04/26] feat: add PaymentGateways enum EV-1192 --- .../payments/payments.component.html | 2 +- shared/core/enums/PaymentGateways.ts | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 shared/core/enums/PaymentGateways.ts diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html index 45c0d37a4..b185e1e71 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html @@ -4,7 +4,7 @@
-
+
{{ 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.ALLOW_ONLINE_PAYMENT' diff --git a/shared/core/enums/PaymentGateways.ts b/shared/core/enums/PaymentGateways.ts new file mode 100644 index 000000000..5757d35d4 --- /dev/null +++ b/shared/core/enums/PaymentGateways.ts @@ -0,0 +1,24 @@ +/** + * Payment Gateways + * + * @enum {number} + */ +enum PaymentGateways { + Stripe, + PayPal +} + +export function paymentGatewaysToString( + paymentGateway: PaymentGateways +): string { + switch (paymentGateway) { + case PaymentGateways.Stripe: + return 'Stripe'; + case PaymentGateways.PayPal: + return 'PayPal'; + default: + return 'BAD_PAYMENT_GATEWAY'; + } +} + +export default PaymentGateways; From 58cf2d2173c7c9c7780795b9fa43b880cbf93ef2 Mon Sep 17 00:00:00 2001 From: alish Date: Mon, 20 May 2019 11:35:36 +0300 Subject: [PATCH 05/26] feat(ever-admin): initialize payment gateways components - Stripe and PayPal EV-1192 --- .../components/components.module.ts | 2 -- .../payPal-gateway.component.html | 1 + .../payPal-gateway.component.ts | 13 ++++++++++++ .../payment-gateways.component.html | 2 ++ .../payment-gateways.component.ts | 7 +++++++ .../payment-gateways.module.ts | 18 +++++++++++++++++ .../stripe-gateway.component.html | 1 + .../stripe-gateway.component.ts | 14 +++++++++++++ .../payments/payments.component.html | 7 ++++++- .../components/payments/payments.module.ts | 20 +++++++++++++++++++ .../+setup/+merchants/merchants.module.ts | 2 ++ 11 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts create mode 100644 admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.module.ts diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/components.module.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/components.module.ts index c8c5fcc45..f24be1345 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/components.module.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/components.module.ts @@ -8,7 +8,6 @@ import { MerchantsSetupInstructionsComponent } from './instructions/instructions import { SetupMerchantAccountComponent } from './account/account.component'; import { SetupMerchantBasicInfoComponent } from './basic-info/basic-info.component'; import { SetupMerchantContactInfoComponent } from './contact-info/contact-info.component'; -import { SetupMerchantPaymentsComponent } from './payments/payments.component'; import { SetupMerchantManufacturingComponent } from './manufacturing/manufacturing.component'; import { SetupMerchantOrdersSettingsComponent } from './settings/orders/orders.component'; import { NbRadioModule } from '@nebular/theme'; @@ -22,7 +21,6 @@ const COMPONENTS = [ SetupMerchantBasicInfoComponent, SetupMerchantContactInfoComponent, MerchantsSetupInstructionsComponent, - SetupMerchantPaymentsComponent, SetupMerchantManufacturingComponent, SetupMerchantOrdersSettingsComponent, SetupMerchantProductCategoriesComponent diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html new file mode 100644 index 000000000..6ede57c9a --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html @@ -0,0 +1 @@ +

{{ name }} payment gateway

diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts new file mode 100644 index 000000000..25122b760 --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import PaymentGateways, { + paymentGatewaysToString +} from '@modules/server.common/enums/PaymentGateways'; + +@Component({ + selector: 'ea-payPal-gateway', + templateUrl: './payPal-gateway.component.html' +}) +export class PayPalGatewayComponent { + name = paymentGatewaysToString(PaymentGateways.PayPal); + logo: 'https://www.worldlandtrust.org/wp-content/uploads/2019/03/PayPal_logo-385.jpg'; +} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html new file mode 100644 index 000000000..e23c62aaf --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html @@ -0,0 +1,2 @@ + + diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts new file mode 100644 index 000000000..5e0da5497 --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ea-payment-gateways', + templateUrl: './payment-gateways.component.html' +}) +export class PaymentGatewaysComponent {} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts new file mode 100644 index 000000000..d762136a5 --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { ThemeModule } from 'app/@theme'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { PaymentGatewaysComponent } from './payment-gateways.component'; +import { StripeGatewayComponent } from './stripe-gateway/stripe-gateway.component'; +import { PayPalGatewayComponent } from './payPal-gateway/payPal-gateway.component'; + +@NgModule({ + imports: [CommonModule, ThemeModule, TranslateModule.forChild()], + declarations: [ + PaymentGatewaysComponent, + StripeGatewayComponent, + PayPalGatewayComponent + ], + exports: [PaymentGatewaysComponent] +}) +export class PaymentGatewaysModule {} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html new file mode 100644 index 000000000..6ede57c9a --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html @@ -0,0 +1 @@ +

{{ name }} payment gateway

diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts new file mode 100644 index 000000000..8bf6a8abe --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import PaymentGateways, { + paymentGatewaysToString +} from '@modules/server.common/enums/PaymentGateways'; + +@Component({ + selector: 'ea-stripe-gateway', + templateUrl: './stripe-gateway.component.html' +}) +export class StripeGatewayComponent { + name = paymentGatewaysToString(PaymentGateways.Stripe); + logo = + 'https://www.chargekeep.com/wp-content/uploads/2018/02/stripe-logo.png'; +} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html index b185e1e71..32abe0211 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html @@ -4,7 +4,7 @@
-
+
{{ 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.ALLOW_ONLINE_PAYMENT' @@ -13,6 +13,11 @@
+
+
+ +
+
diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.module.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.module.ts new file mode 100644 index 000000000..022d68afa --- /dev/null +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.module.ts @@ -0,0 +1,20 @@ +import { CommonModule } from '@angular/common'; +import { ThemeModule } from 'app/@theme'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; +import { SetupMerchantPaymentsComponent } from './payments.component'; +import { NgModule } from '@angular/core'; +import { PaymentGatewaysModule } from './payment-gateways/payment-gateways.module'; + +@NgModule({ + imports: [ + CommonModule, + ThemeModule, + FormsModule, + TranslateModule.forChild(), + PaymentGatewaysModule + ], + declarations: [SetupMerchantPaymentsComponent], + exports: [SetupMerchantPaymentsComponent] +}) +export class SetupMerchantsPaymentsModule {} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/merchants.module.ts b/admin/website-angular/src/app/pages/+setup/+merchants/merchants.module.ts index 6bba671d0..5153f4632 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/merchants.module.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/merchants.module.ts @@ -10,6 +10,7 @@ import { SetupMerchantsLocationModule } from './components/location/location.mod import { SetupMerchantsDeliveryAndTakeawayModule } from './components/settings/delivery-takeaway/delivery-takeaway.module'; import { ToasterModule } from 'angular2-toaster'; import { SetupMerchantsProductsModule } from './components/products/products.module'; +import { SetupMerchantsPaymentsModule } from './components/payments/payments.module'; const routes: Routes = [ { @@ -29,6 +30,7 @@ const routes: Routes = [ SetupMerchantsLocationModule, SetupMerchantsDeliveryAndTakeawayModule, SetupMerchantsProductsModule, + SetupMerchantsPaymentsModule, ToasterModule.forRoot() ], declarations: [SetupMerchantsComponent] From d5d6a1843b77f2a3ef440992c71beb45005746f4 Mon Sep 17 00:00:00 2001 From: alish Date: Mon, 20 May 2019 16:52:16 +0300 Subject: [PATCH 06/26] feat(ever-admin): add form for config Stripe gateway EV-1192 --- .../src/app/@theme/styles/styles.scss | 21 ++ .../basic-info/basic-info.component.ts | 2 +- .../payPal-gateway.component.html | 9 +- .../payPal-gateway.component.ts | 3 +- .../payment-gateways.component.html | 2 +- .../payment-gateways.component.ts | 7 +- .../payment-gateways.module.ts | 8 +- .../stripe-gateway.component.html | 182 +++++++++++++++++- .../stripe-gateway.component.ts | 23 ++- .../payments/payments.component.html | 4 +- .../components/payments/payments.component.ts | 5 +- .../+merchants/merchants.component.html | 1 + 12 files changed, 254 insertions(+), 13 deletions(-) diff --git a/admin/website-angular/src/app/@theme/styles/styles.scss b/admin/website-angular/src/app/@theme/styles/styles.scss index d5b727bc6..3e66b02a8 100644 --- a/admin/website-angular/src/app/@theme/styles/styles.scss +++ b/admin/website-angular/src/app/@theme/styles/styles.scss @@ -206,3 +206,24 @@ nb-card.no-box-shadow { box-shadow: none; margin-bottom: 0; } + +.preview-img-container { + .preview-img { + padding-right: 16px; + } + + .img-rounded { + margin-top: 3px; + max-height: 70px !important; + } + + .remove-icon { + cursor: pointer; + + span { + padding-right: 7px; + position: absolute; + font-size: 1.1em; + } + } +} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/basic-info/basic-info.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/basic-info/basic-info.component.ts index c541cff89..fe9b21a34 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/basic-info/basic-info.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/basic-info/basic-info.component.ts @@ -36,7 +36,7 @@ export class SetupMerchantBasicInfoComponent implements OnInit, OnDestroy { uploaderPlaceholder: string = 'Photo (optional)'; barcodetDataUrl: string; invalidUrl: boolean; - private basicInfoModel = { + basicInfoModel = { name: '', logo: '', barcodeData: '' diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html index 6ede57c9a..c2c4d8369 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html @@ -1 +1,8 @@ -

{{ name }} payment gateway

+
+
+ + + {{ name }} + +
+
diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts index 25122b760..b98e9f17d 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts @@ -8,6 +8,7 @@ import PaymentGateways, { templateUrl: './payPal-gateway.component.html' }) export class PayPalGatewayComponent { + isPayPalEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.PayPal); - logo: 'https://www.worldlandtrust.org/wp-content/uploads/2019/03/PayPal_logo-385.jpg'; + logo = 'https://avatars1.githubusercontent.com/u/476675?s=200&v=4'; } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html index e23c62aaf..84063230b 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html @@ -1,2 +1,2 @@ - + diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts index 5e0da5497..c6e237d48 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts @@ -1,7 +1,10 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; @Component({ selector: 'ea-payment-gateways', templateUrl: './payment-gateways.component.html' }) -export class PaymentGatewaysComponent {} +export class PaymentGatewaysComponent { + @Input() + warehouseLogo: string; +} diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts index d762136a5..e457a832e 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.module.ts @@ -5,9 +5,15 @@ import { TranslateModule } from '@ngx-translate/core'; import { PaymentGatewaysComponent } from './payment-gateways.component'; import { StripeGatewayComponent } from './stripe-gateway/stripe-gateway.component'; import { PayPalGatewayComponent } from './payPal-gateway/payPal-gateway.component'; +import { FileUploaderModule } from 'app/@shared/file-uploader/file-uploader.module'; @NgModule({ - imports: [CommonModule, ThemeModule, TranslateModule.forChild()], + imports: [ + CommonModule, + ThemeModule, + TranslateModule.forChild(), + FileUploaderModule + ], declarations: [ PaymentGatewaysComponent, StripeGatewayComponent, diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html index 6ede57c9a..86fb95038 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html @@ -1 +1,181 @@ -

{{ name }} payment gateway

+
+
+ + + {{ name }} + +
+
+ +
+
+
+ + + + + Pay Button text is required + + +
+ +
+ + + + + Currency text is required + + +
+
+ +
+
+ + + + + + Invalid logo url + + +
+ +
+
+
+ Invalid logo +
+ +
+
+
+
+
+ +
+
+ + + + + Publishable key is required + + +
+
+ +
+
+ + Allow remember me? + +
+
+
diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts index 8bf6a8abe..828a6a791 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import PaymentGateways, { paymentGatewaysToString } from '@modules/server.common/enums/PaymentGateways'; @@ -8,7 +8,24 @@ import PaymentGateways, { templateUrl: './stripe-gateway.component.html' }) export class StripeGatewayComponent { + isStripeEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.Stripe); - logo = - 'https://www.chargekeep.com/wp-content/uploads/2018/02/stripe-logo.png'; + logo = 'https://stripe.com/img/v3/home/twitter.png'; + invalidUrl: boolean; + + @Input() + set companyBrandLogo(logo: string) { + this.configModel.companyBrandLogo = logo; + } + + configModel = { + payButtontext: '', + currency: '', + companyBrandLogo: '', + allowRememberMe: true + }; + + deleteImg() { + this.configModel.companyBrandLogo = ''; + } } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html index 32abe0211..b8ff74a58 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html @@ -15,7 +15,9 @@
- +
diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts index 95db3be6a..e771b86f6 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Output } from '@angular/core'; +import { Component, EventEmitter, Output, Input } from '@angular/core'; @Component({ selector: 'ea-merchants-setup-payments', @@ -11,5 +11,8 @@ export class SetupMerchantPaymentsComponent { @Output() nextStep: EventEmitter = new EventEmitter(); + @Input() + warehouseLogo: string; + isPaymentEnabled: boolean; } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/merchants.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/merchants.component.html index e6a2ffb8e..ef255e214 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/merchants.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/merchants.component.html @@ -62,6 +62,7 @@ > From ad11c53fe903914c88c1fc7bafeca5790385caf8 Mon Sep 17 00:00:00 2001 From: alish Date: Mon, 20 May 2019 17:22:11 +0300 Subject: [PATCH 07/26] feat(ever-admin): add Currency entity and interface EV-1192 --- .../stripe-gateway.component.html | 2 +- shared/core/entities/Currency.ts | 25 +++++++++++++++++++ shared/core/interfaces/ICurrency.ts | 11 ++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 shared/core/entities/Currency.ts create mode 100644 shared/core/interfaces/ICurrency.ts diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html index 86fb95038..60a1b50e4 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html @@ -132,7 +132,7 @@
-
-
+
- + + Company brand logo is required + + + Invalid logo url diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts index 5692cd69a..16b15d73c 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges } from '@angular/core'; +import { Component, Input, OnChanges, ViewChild } from '@angular/core'; import PaymentGateways, { paymentGatewaysToString } from '@modules/server.common/enums/PaymentGateways'; @@ -6,12 +6,16 @@ import { CurrenciesService } from 'app/@core/data/currencies.service'; import { first } from 'rxjs/operators'; import { Country } from '@modules/server.common/entities'; import { countriesDefaultCurrencies } from '@modules/server.common/entities/Currency'; +import { NgForm } from '@angular/forms'; @Component({ selector: 'ea-stripe-gateway', templateUrl: './stripe-gateway.component.html' }) export class StripeGatewayComponent implements OnChanges { + @ViewChild('stripeConfigForm') + stripeConfigForm: NgForm; + isStripeEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.Stripe); logo = 'https://stripe.com/img/v3/home/twitter.png'; @@ -36,13 +40,28 @@ export class StripeGatewayComponent implements OnChanges { this.loadCurrenciesCodes(); } + get isFormValid(): boolean { + let isValid = false; + + if (this.stripeConfigForm) { + isValid = + this.stripeConfigForm.touched && + this.stripeConfigForm.dirty && + this.stripeConfigForm.valid && + !this.invalidUrl && + this.configModel.companyBrandLogo !== ''; + } + + return isValid; + } + ngOnChanges(): void { - const cefaultCurrency = + const defaultCurrency = countriesDefaultCurrencies[ Country[this.warehouseCountry].toString() ] || ''; - this.configModel.currency = cefaultCurrency; + this.configModel.currency = defaultCurrency; } deleteImg() { diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html index a041ed346..922af8698 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.html @@ -16,6 +16,7 @@
@@ -27,6 +28,6 @@ - diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts index a6380cb62..2c96735b1 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payments.component.ts @@ -1,5 +1,12 @@ -import { Component, EventEmitter, Output, Input } from '@angular/core'; +import { + Component, + EventEmitter, + Output, + Input, + ViewChild +} from '@angular/core'; import { LocationFormComponent } from 'app/@shared/forms/location'; +import { PaymentGatewaysComponent } from './payment-gateways/payment-gateways.component'; @Component({ selector: 'ea-merchants-setup-payments', @@ -7,6 +14,8 @@ import { LocationFormComponent } from 'app/@shared/forms/location'; styleUrls: ['./payments.component.scss'] }) export class SetupMerchantPaymentsComponent { + @ViewChild('paymentGateways') + paymentGateways: PaymentGatewaysComponent; @Output() previousStep: EventEmitter = new EventEmitter(); @Output() @@ -18,4 +27,8 @@ export class SetupMerchantPaymentsComponent { locationForm: LocationFormComponent; isPaymentEnabled: boolean; + + get isPaymentValid() { + return !this.isPaymentEnabled || this.paymentGateways.isValid; + } } From fc7ac71c3d936aeb97ce9482b0f0872e60f91e1e Mon Sep 17 00:00:00 2001 From: alish Date: Wed, 22 May 2019 17:21:56 +0300 Subject: [PATCH 16/26] feat(ever-admin): improved validation on the Payments step EV-1192 --- .../payPal-gateway.component.ts | 6 ++++++ .../payment-gateways.component.html | 2 +- .../payment-gateways.component.ts | 21 ++++++++++++++++++- .../stripe-gateway.component.html | 5 +++-- .../stripe-gateway.component.ts | 4 ++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts index b98e9f17d..15931cd80 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts @@ -11,4 +11,10 @@ export class PayPalGatewayComponent { isPayPalEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.PayPal); logo = 'https://avatars1.githubusercontent.com/u/476675?s=200&v=4'; + + get isFormValid(): boolean { + let isValid = false; + + return isValid; + } } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html index a72757612..c0cbdae57 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html @@ -3,4 +3,4 @@ [companyBrandLogo]="warehouseLogo" [warehouseCountry]="warehouseCountry" > - + diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts index df9292352..3679ab296 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts @@ -1,6 +1,7 @@ import { Component, Input, ViewChild } from '@angular/core'; import { Country } from '@modules/server.common/entities'; import { StripeGatewayComponent } from './stripe-gateway/stripe-gateway.component'; +import { PayPalGatewayComponent } from './payPal-gateway/payPal-gateway.component'; @Component({ selector: 'ea-payment-gateways', @@ -10,6 +11,9 @@ export class PaymentGatewaysComponent { @ViewChild('stripeGateway') stripeGateway: StripeGatewayComponent; + @ViewChild('payPalGateway') + payPalGateway: PayPalGatewayComponent; + @Input() warehouseLogo: string; @Input() @@ -17,9 +21,24 @@ export class PaymentGatewaysComponent { get isValid(): boolean { let valid = false; - if (this.stripeGateway.isStripeEnabled) { + if ( + this.stripeGateway.isStripeEnabled || + this.payPalGateway.isPayPalEnabled + ) { if (this.stripeGateway.isStripeEnabled) { valid = this.stripeGateway.isFormValid; + + if (!valid) { + return; + } + } + + if (this.payPalGateway.isPayPalEnabled) { + valid = this.payPalGateway.isFormValid; + + if (!valid) { + return; + } } } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html index fd46087f9..74303d003 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html @@ -7,7 +7,7 @@
- +
+ + +
+
+ + +
+ +
+ + + + + Currency text is required + + +
+
+ +
+
+ + + + + Publishable key is required + + +
+
+ +
+
+ + + + + Secret key is required + + +
+
+ +
+
+ + + + + Payment description is required + + +
+
+ diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts index 15931cd80..12826812c 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts @@ -1,20 +1,46 @@ -import { Component } from '@angular/core'; +import { Component, Input, OnChanges } from '@angular/core'; import PaymentGateways, { paymentGatewaysToString } from '@modules/server.common/enums/PaymentGateways'; +import { Country } from '@modules/server.common/entities'; +import { countriesDefaultCurrencies } from '@modules/server.common/entities/Currency'; @Component({ selector: 'ea-payPal-gateway', templateUrl: './payPal-gateway.component.html' }) -export class PayPalGatewayComponent { +export class PayPalGatewayComponent implements OnChanges { isPayPalEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.PayPal); logo = 'https://avatars1.githubusercontent.com/u/476675?s=200&v=4'; + @Input() + currenciesCodes: string[] = []; + @Input() + warehouseCountry: Country; + + configModel = { + currency: '', + mode: '', + publishableKey: '', + secretKey: '', + description: '' + }; + + payPalTypes = ['sandbox', 'live']; + get isFormValid(): boolean { let isValid = false; return isValid; } + + ngOnChanges(): void { + const defaultCurrency = + countriesDefaultCurrencies[ + Country[this.warehouseCountry].toString() + ] || ''; + + this.configModel.currency = defaultCurrency; + } } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html index c0cbdae57..8af8675ad 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.html @@ -1,6 +1,11 @@ - + diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts index e485f2c39..120feae57 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts @@ -3,6 +3,8 @@ import { Country } from '@modules/server.common/entities'; import { StripeGatewayComponent } from './stripe-gateway/stripe-gateway.component'; import { PayPalGatewayComponent } from './payPal-gateway/payPal-gateway.component'; import IPaymentGatewayCreateObject from '@modules/server.common/interfaces/IPaymentGateway'; +import { CurrenciesService } from 'app/@core/data/currencies.service'; +import { first } from 'rxjs/operators'; @Component({ selector: 'ea-payment-gateways', @@ -20,6 +22,12 @@ export class PaymentGatewaysComponent { @Input() warehouseCountry: Country; + currenciesCodes: string[] = []; + + constructor(private currenciesService: CurrenciesService) { + this.loadCurrenciesCodes(); + } + get isValid(): boolean { let valid = false; if ( @@ -57,4 +65,15 @@ export class PaymentGatewaysComponent { return paymentsGateways; } + + private async loadCurrenciesCodes() { + const res = await this.currenciesService + .getCurrencies() + .pipe(first()) + .toPromise(); + + if (res) { + this.currenciesCodes = res.map((r) => r.currencyCode); + } + } } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts index 91a0b8ebe..1dd0a42c1 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -2,8 +2,6 @@ import { Component, Input, OnChanges, ViewChild } from '@angular/core'; import PaymentGateways, { paymentGatewaysToString } from '@modules/server.common/enums/PaymentGateways'; -import { CurrenciesService } from 'app/@core/data/currencies.service'; -import { first } from 'rxjs/operators'; import { Country } from '@modules/server.common/entities'; import { countriesDefaultCurrencies } from '@modules/server.common/entities/Currency'; import { NgForm } from '@angular/forms'; @@ -21,8 +19,9 @@ export class StripeGatewayComponent implements OnChanges { name = paymentGatewaysToString(PaymentGateways.Stripe); logo = 'https://stripe.com/img/v3/home/twitter.png'; invalidUrl: boolean; - currenciesCodes: string[] = []; + @Input() + currenciesCodes: string[] = []; @Input() warehouseCountry: Country; @Input() @@ -37,10 +36,6 @@ export class StripeGatewayComponent implements OnChanges { allowRememberMe: true }; - constructor(private currenciesService: CurrenciesService) { - this.loadCurrenciesCodes(); - } - get isFormValid(): boolean { let isValid = false; @@ -79,15 +74,4 @@ export class StripeGatewayComponent implements OnChanges { deleteImg() { this.configModel.companyBrandLogo = ''; } - - private async loadCurrenciesCodes() { - const res = await this.currenciesService - .getCurrencies() - .pipe(first()) - .toPromise(); - - if (res) { - this.currenciesCodes = res.map((r) => r.currencyCode); - } - } } From 6d7f70b914b59bd409e965c766522e2a74a721f3 Mon Sep 17 00:00:00 2001 From: Emil Momchilov Date: Mon, 27 May 2019 15:31:35 +0300 Subject: [PATCH 20/26] feat(ever-admin): fix filtering bugs --- .../warehouse-track.component.html | 4 +- .../warehouse-track.component.ts | 79 +++++++++++-------- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html index 77dc80feb..860a67b93 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.html @@ -20,7 +20,7 @@
- {{ item.name }} + {{ item }} { - if ( - !( - this.merchantName || - this.merchantCity || - this.merchantCountry - ) - ) { - this.merchants = store; + this.merchants = store; + + if (this.merchantMarkers.length === 0) { this.listOfCities = Array.from( new Set(store.map((mer) => mer.geoLocation.city)) ).sort(); @@ -52,22 +47,28 @@ export class WarehouseTrackComponent implements OnInit { ) ) ).sort(); - } - - if (this.merchantMarkers.length === 0) { + this.listOfMerchants = this.setSort( + store.map((mer) => mer.name) + ); this.populateMarkers(store, this.merchantMarkers); } else if (store.length === this.merchantMarkers.length) { this.updateMarkers(store, this.merchantMarkers); } else { - this.merchantMarkers.forEach((marker) => { - marker.setMap(null); - }); - this.merchantMarkers = []; - this.populateMarkers(store, this.merchantMarkers); + console.log(this.merchantMarkers); + this.updateMarkers( + store.filter((mer) => + this.listOfMerchants.includes(mer.name) + ), + this.merchantMarkers + ); } }); } + setSort(arr: any): any[] { + return Array.from(new Set(arr)).sort(); + } + showMap() { const mapProp = { center: new google.maps.LatLng(42.642941, 23.334149), @@ -80,21 +81,14 @@ export class WarehouseTrackComponent implements OnInit { filterByName(event) { if (event) { this.merchantName = event; - this.merchantCity = undefined; - this.merchantCountry = undefined; this.deleteMarkerStorage(this.merchantMarkers); - - const coords = new google.maps.LatLng( - event.geoLocation.loc.coordinates[1], - event.geoLocation.loc.coordinates[0] + const filteredMerchants = this.merchants.filter( + (mer) => mer.name === this.merchantName ); - const storeIcon = environment.MAP_MERCHANT_ICON_LINK; - const marker = this.addMarker(coords, this.map, storeIcon); - this.merchantMarkers.push(marker); + this.populateMarkers(filteredMerchants, this.merchantMarkers); } else { this.deleteMarkerStorage(this.merchantMarkers); - this.populateMarkers(this.merchants, this.merchantMarkers); } } @@ -102,14 +96,15 @@ export class WarehouseTrackComponent implements OnInit { filterByCity(event) { if (event) { this.merchantCity = event; - this.merchantCountry = undefined; this.merchantName = undefined; - this.deleteMarkerStorage(this.merchantMarkers); const filteredMerchants = this.merchants.filter( (mer) => mer.geoLocation.city === this.merchantCity ); this.populateMarkers(filteredMerchants, this.merchantMarkers); + this.listOfMerchants = this.setSort( + filteredMerchants.map((mer) => mer.name) + ); } else { this.deleteMarkerStorage(this.merchantMarkers); this.populateMarkers(this.merchants, this.merchantMarkers); @@ -128,6 +123,12 @@ export class WarehouseTrackComponent implements OnInit { getCountryName(mer.geoLocation.countryId) === this.merchantCountry ); + this.listOfCities = this.setSort( + filteredMerchants.map((mer) => mer.geoLocation.city) + ); + this.listOfMerchants = this.setSort( + filteredMerchants.map((mer) => mer.name) + ); this.populateMarkers(filteredMerchants, this.merchantMarkers); } else { this.deleteMarkerStorage(this.merchantMarkers); @@ -143,7 +144,7 @@ export class WarehouseTrackComponent implements OnInit { ); const storeIcon = environment.MAP_MERCHANT_ICON_LINK; const marker = this.addMarker(coords, this.map, storeIcon); - markerStorage.push(marker); + markerStorage.push({ marker, id: mer.id }); }); } @@ -153,17 +154,25 @@ export class WarehouseTrackComponent implements OnInit { mer.geoLocation.loc.coordinates[1], mer.geoLocation.loc.coordinates[0] ); - - const oldCoords = markerStorage[index].position; - if (!newCoords.equals(oldCoords)) { - markerStorage[index].setPosition(newCoords); + let markerIndex; + const oldCoords = markerStorage.find((marker, i) => { + if (marker.id === mer.id) { + markerIndex = i; + return true; + } else { + return false; + } + }); + console.log(markerIndex); + if (!newCoords.equals(oldCoords.marker.position)) { + markerStorage[index].marker.setPosition(newCoords); } }); } deleteMarkerStorage(markerStorage) { markerStorage.forEach((mar) => { - mar.setMap(null); + mar.marker.setMap(null); }); markerStorage = []; } From 8d502d07cc151a9992b28e98d85a04a9877e39b2 Mon Sep 17 00:00:00 2001 From: alish Date: Mon, 27 May 2019 16:39:14 +0300 Subject: [PATCH 21/26] feat(ever-admin): improved Payments step, save data for "PayPal" payment gateway as part of field "paymentGateways" in DB on Warehouse EV-1192 --- .../payPal-gateway.component.ts | 25 ++++++++++++++++++- .../payment-gateways.component.ts | 5 ++++ .../stripe-gateway.component.ts | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts index 12826812c..c2d80d60a 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.ts @@ -1,15 +1,20 @@ -import { Component, Input, OnChanges } from '@angular/core'; +import { Component, Input, OnChanges, ViewChild } from '@angular/core'; import PaymentGateways, { paymentGatewaysToString } from '@modules/server.common/enums/PaymentGateways'; import { Country } from '@modules/server.common/entities'; import { countriesDefaultCurrencies } from '@modules/server.common/entities/Currency'; +import { NgForm } from '@angular/forms'; +import IPaymentGatewayCreateObject from '@modules/server.common/interfaces/IPaymentGateway'; @Component({ selector: 'ea-payPal-gateway', templateUrl: './payPal-gateway.component.html' }) export class PayPalGatewayComponent implements OnChanges { + @ViewChild('payPalConfigForm') + payPalConfigForm: NgForm; + isPayPalEnabled: boolean; name = paymentGatewaysToString(PaymentGateways.PayPal); logo = 'https://avatars1.githubusercontent.com/u/476675?s=200&v=4'; @@ -32,9 +37,27 @@ export class PayPalGatewayComponent implements OnChanges { get isFormValid(): boolean { let isValid = false; + if (this.payPalConfigForm) { + isValid = + (this.payPalConfigForm.touched || + this.payPalConfigForm.dirty) && + this.payPalConfigForm.valid; + } + return isValid; } + get createObject(): IPaymentGatewayCreateObject | null { + if (!this.isFormValid || !this.isPayPalEnabled) { + return null; + } + + return { + paymentGateway: PaymentGateways.PayPal, + configureObject: this.configModel + }; + } + ngOnChanges(): void { const defaultCurrency = countriesDefaultCurrencies[ diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts index 120feae57..07d34bdc5 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payment-gateways.component.ts @@ -58,11 +58,16 @@ export class PaymentGatewaysComponent { const paymentsGateways = []; const stripeGatewayCreateObject = this.stripeGateway.createObject; + const payPalGatewayCreateObject = this.payPalGateway.createObject; if (stripeGatewayCreateObject) { paymentsGateways.push(stripeGatewayCreateObject); } + if (payPalGatewayCreateObject) { + paymentsGateways.push(payPalGatewayCreateObject); + } + return paymentsGateways; } diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts index 1dd0a42c1..4c86bae0d 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -52,7 +52,7 @@ export class StripeGatewayComponent implements OnChanges { } get createObject(): IPaymentGatewayCreateObject | null { - if (!this.isFormValid) { + if (!this.isFormValid || !this.isStripeEnabled) { return null; } From 0c72ac2ab136920dff5e8171c40170b5a39aa61e Mon Sep 17 00:00:00 2001 From: blagovest Date: Tue, 28 May 2019 09:57:33 +0300 Subject: [PATCH 22/26] feat(ever-admin): tr store mutation form --- .../contact-info/contact-info-form.component.html | 12 ++++++++++-- admin/website-angular/src/assets/i18n/bg.json | 4 ++++ admin/website-angular/src/assets/i18n/en.json | 4 ++++ admin/website-angular/src/assets/i18n/he.json | 4 ++++ admin/website-angular/src/assets/i18n/ru.json | 4 ++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/admin/website-angular/src/app/@shared/warehouse/forms/contact-info/contact-info-form.component.html b/admin/website-angular/src/app/@shared/warehouse/forms/contact-info/contact-info-form.component.html index c9b54114f..1dbbfbb59 100644 --- a/admin/website-angular/src/app/@shared/warehouse/forms/contact-info/contact-info-form.component.html +++ b/admin/website-angular/src/app/@shared/warehouse/forms/contact-info/contact-info-form.component.html @@ -68,8 +68,12 @@ Order Forwarding Email + {{ + 'WAREHOUSE_VIEW.MUTATION.CONTACT_INFO_TAB.ORDER_FORWARDING_EMAIL' + | translate + }} + Order Forwarding Phone + {{ + 'WAREHOUSE_VIEW.MUTATION.CONTACT_INFO_TAB.ORDER_FORWARDING_PHONE' + | translate + }} + Date: Tue, 28 May 2019 12:05:38 +0300 Subject: [PATCH 23/26] feat(ever-admin): finished map filtering --- .../warehouse-track.component.ts | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts index 4793ae391..03dd344c5 100644 --- a/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts +++ b/admin/website-angular/src/app/pages/+warehouses/+warehouse-track/warehouse-track.component.ts @@ -52,15 +52,9 @@ export class WarehouseTrackComponent implements OnInit { ); this.populateMarkers(store, this.merchantMarkers); } else if (store.length === this.merchantMarkers.length) { - this.updateMarkers(store, this.merchantMarkers); + this.updateMarkers(store); } else { - console.log(this.merchantMarkers); - this.updateMarkers( - store.filter((mer) => - this.listOfMerchants.includes(mer.name) - ), - this.merchantMarkers - ); + this.updateMarkers(store); } }); } @@ -82,13 +76,13 @@ export class WarehouseTrackComponent implements OnInit { if (event) { this.merchantName = event; - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); const filteredMerchants = this.merchants.filter( (mer) => mer.name === this.merchantName ); this.populateMarkers(filteredMerchants, this.merchantMarkers); } else { - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); this.populateMarkers(this.merchants, this.merchantMarkers); } } @@ -97,7 +91,7 @@ export class WarehouseTrackComponent implements OnInit { if (event) { this.merchantCity = event; this.merchantName = undefined; - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); const filteredMerchants = this.merchants.filter( (mer) => mer.geoLocation.city === this.merchantCity ); @@ -106,7 +100,7 @@ export class WarehouseTrackComponent implements OnInit { filteredMerchants.map((mer) => mer.name) ); } else { - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); this.populateMarkers(this.merchants, this.merchantMarkers); } } @@ -116,8 +110,7 @@ export class WarehouseTrackComponent implements OnInit { this.merchantCountry = event; this.merchantCity = undefined; this.merchantName = undefined; - - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); const filteredMerchants = this.merchants.filter( (mer) => getCountryName(mer.geoLocation.countryId) === @@ -131,7 +124,7 @@ export class WarehouseTrackComponent implements OnInit { ); this.populateMarkers(filteredMerchants, this.merchantMarkers); } else { - this.deleteMarkerStorage(this.merchantMarkers); + this.deleteMarkerStorage(); this.populateMarkers(this.merchants, this.merchantMarkers); } } @@ -148,33 +141,36 @@ export class WarehouseTrackComponent implements OnInit { }); } - updateMarkers(merchantArray: Warehouse[], markerStorage: any[]) { + updateMarkers(merchantArray: Warehouse[]) { merchantArray.forEach((mer, index) => { const newCoords = new google.maps.LatLng( mer.geoLocation.loc.coordinates[1], mer.geoLocation.loc.coordinates[0] ); let markerIndex; - const oldCoords = markerStorage.find((marker, i) => { - if (marker.id === mer.id) { + const marker = this.merchantMarkers.find((markerItem, i) => { + if (markerItem.id === mer.id) { markerIndex = i; return true; } else { return false; } }); - console.log(markerIndex); - if (!newCoords.equals(oldCoords.marker.position)) { - markerStorage[index].marker.setPosition(newCoords); + if (marker) { + if (!newCoords.equals(marker.marker.getPosition())) { + this.merchantMarkers[markerIndex].marker.setPosition( + newCoords + ); + } } }); } - deleteMarkerStorage(markerStorage) { - markerStorage.forEach((mar) => { + deleteMarkerStorage() { + this.merchantMarkers.forEach((mar) => { mar.marker.setMap(null); }); - markerStorage = []; + this.merchantMarkers = []; } addMarker(position, map, icon) { From 8ce41bd6bf46720471939f7f9161d523e0b5eb44 Mon Sep 17 00:00:00 2001 From: blagovest Date: Tue, 28 May 2019 12:19:31 +0300 Subject: [PATCH 24/26] feat(ever-admin): tr setup merchant payment stripe EV-1198 --- .../stripe-gateway.component.html | 74 +++++++++++++++---- .../stripe-gateway.component.ts | 25 +++++++ admin/website-angular/src/assets/i18n/bg.json | 17 ++++- admin/website-angular/src/assets/i18n/en.json | 17 ++++- admin/website-angular/src/assets/i18n/he.json | 17 ++++- admin/website-angular/src/assets/i18n/ru.json | 17 ++++- 6 files changed, 147 insertions(+), 20 deletions(-) diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html index 74303d003..d398d093a 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.html @@ -11,7 +11,10 @@
- Pay Button text is required + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.STRIPE.PAY_BUTTON_TEXT_IS_REQUIRED' + | translate + }}
- Publishable key is required + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.STRIPE.PUBLISHABLE_KEY_IS_REQUIRED' + | translate + }}
@@ -182,7 +221,10 @@ name="remember-me" [(ngModel)]="configModel.allowRememberMe" > - Allow remember me? + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.STRIPE.ALLOW_REMEMBER_ME' + | translate + }}
diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts index 4c86bae0d..8927088b7 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/stripe-gateway/stripe-gateway.component.ts @@ -6,6 +6,9 @@ import { Country } from '@modules/server.common/entities'; import { countriesDefaultCurrencies } from '@modules/server.common/entities/Currency'; import { NgForm } from '@angular/forms'; import IPaymentGatewayCreateObject from '@modules/server.common/interfaces/IPaymentGateway'; +import { TranslateService } from '@ngx-translate/core'; +import { takeUntil } from 'rxjs/operators'; +import { Subject } from 'rxjs'; @Component({ selector: 'ea-stripe-gateway', @@ -20,6 +23,11 @@ export class StripeGatewayComponent implements OnChanges { logo = 'https://stripe.com/img/v3/home/twitter.png'; invalidUrl: boolean; + private _ngDestroy$ = new Subject(); + + COMPANY_BRAND_LOGO = + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.STRIPE.COMPANY_BRAND_LOGO'; + @Input() currenciesCodes: string[] = []; @Input() @@ -29,6 +37,18 @@ export class StripeGatewayComponent implements OnChanges { this.configModel.companyBrandLogo = logo; } + constructor(private translateService: TranslateService) { + // https://github.com/ngx-translate/core/issues/835 + // see how to translate words in the component(.ts) file + + translateService + .stream(this.COMPANY_BRAND_LOGO) + .pipe(takeUntil(this._ngDestroy$)) + .subscribe((text: string) => { + this.COMPANY_BRAND_LOGO = text; + }); + } + configModel = { payButtontext: '', currency: '', @@ -74,4 +94,9 @@ export class StripeGatewayComponent implements OnChanges { deleteImg() { this.configModel.companyBrandLogo = ''; } + + ngOnDestroy() { + this._ngDestroy$.next(); + this._ngDestroy$.complete(); + } } diff --git a/admin/website-angular/src/assets/i18n/bg.json b/admin/website-angular/src/assets/i18n/bg.json index ab327cd95..1d96c26f4 100644 --- a/admin/website-angular/src/assets/i18n/bg.json +++ b/admin/website-angular/src/assets/i18n/bg.json @@ -277,7 +277,22 @@ }, "PAYMENTS": { "PAYMENTS": "Плащания", - "ALLOW_ONLINE_PAYMENT": "Разрешаване на онлайн плащания?" + "ALLOW_ONLINE_PAYMENT": "Разрешаване на онлайн плащания?", + "STRIPE": { + "PAY_BUTTON_TEXT": "Текст на бутона за плащане", + "CURRENCY": "Валута", + "PAY_BUTTON_TEXT_IS_REQUIRED": "Изисква се текст на бутон за плащане", + "CHOOSE_CURRENCY_CODE": "Изберете кода на валутата", + "CURRENCY_TEXT_IS_REQUIRED": "Изберете кода на валутата", + "COMPANY_BRAND_LOGO": "Лого на фирмената марка", + "COMPANY_BRAND_LOGO_IS_REQUIRED": "Изисква се лого на фирмената марка", + "INVALID_LOGO_URL": "Невалиден URL адрес на логото", + "INVALID_LOGO": "Невалидно лого", + "PUBLISHABLE_KEY": "Публикуван ключ", + "PUBLISHABLE_KEY_IS_REQUIRED": "Изисква се издателски ключ", + "ALLOW_REMEMBER_ME": "Нека ме запамети?", + "REMOVE": "Премахни" + } }, "MANUFACTURING": { "MANUFACTURING": "Производство", diff --git a/admin/website-angular/src/assets/i18n/en.json b/admin/website-angular/src/assets/i18n/en.json index 4cb6c2488..4f5d8cbd2 100644 --- a/admin/website-angular/src/assets/i18n/en.json +++ b/admin/website-angular/src/assets/i18n/en.json @@ -276,7 +276,22 @@ }, "PAYMENTS": { "PAYMENTS": "Payments", - "ALLOW_ONLINE_PAYMENT": "Allow online payments?" + "ALLOW_ONLINE_PAYMENT": "Allow online payments?", + "STRIPE": { + "PAY_BUTTON_TEXT": "Pay Button text", + "CURRENCY": "Currency", + "PAY_BUTTON_TEXT_IS_REQUIRED": "Pay Button text is required", + "CHOOSE_CURRENCY_CODE": "Choose currency code", + "CURRENCY_TEXT_IS_REQUIRED": "Currency text is required", + "COMPANY_BRAND_LOGO": "Company brand logo", + "COMPANY_BRAND_LOGO_IS_REQUIRED": "Company brand logo is required", + "INVALID_LOGO_URL": "Invalid logo url", + "INVALID_LOGO": "Invalid logo", + "PUBLISHABLE_KEY": "Publishable key", + "PUBLISHABLE_KEY_IS_REQUIRED": "Publishable key is required", + "ALLOW_REMEMBER_ME": "Allow remember me?", + "REMOVE": "Remove" + } }, "MANUFACTURING": { "MANUFACTURING": "Manufacturing", diff --git a/admin/website-angular/src/assets/i18n/he.json b/admin/website-angular/src/assets/i18n/he.json index 41d6770c9..b45a2744a 100644 --- a/admin/website-angular/src/assets/i18n/he.json +++ b/admin/website-angular/src/assets/i18n/he.json @@ -276,7 +276,22 @@ }, "PAYMENTS": { "PAYMENTS": "תשלומים", - "ALLOW_ONLINE_PAYMENT": "האם לאפשר תשלומים מקוונים?" + "ALLOW_ONLINE_PAYMENT": "האם לאפשר תשלומים מקוונים?", + "STRIPE": { + "PAY_BUTTON_TEXT": "טקסט של לחצן 'תשלום'", + "CURRENCY": "מטבע", + "PAY_BUTTON_TEXT_IS_REQUIRED": "יש צורך בטקסט של לחצן שלם", + "CHOOSE_CURRENCY_CODE": "בחר קוד מטבע", + "CURRENCY_TEXT_IS_REQUIRED": "טקסט מטבע נדרש", + "COMPANY_BRAND_LOGO": "לוגו מותג החברה", + "COMPANY_BRAND_LOGO_IS_REQUIRED": "הלוגו של מותג החברה נדרש", + "INVALID_LOGO_URL": "כתובת אתר של לוגו לא חוקית", + "INVALID_LOGO": "לוגו לא חוקי", + "PUBLISHABLE_KEY": "מפתח ניתן לפרסום", + "PUBLISHABLE_KEY_IS_REQUIRED": "נדרש מפתח לפרסום", + "ALLOW_REMEMBER_ME": "אתה זוכר אותי?", + "REMOVE": "הסר" + } }, "MANUFACTURING": { "MANUFACTURING": "ייצור", diff --git a/admin/website-angular/src/assets/i18n/ru.json b/admin/website-angular/src/assets/i18n/ru.json index 62138a9e7..cdb310758 100644 --- a/admin/website-angular/src/assets/i18n/ru.json +++ b/admin/website-angular/src/assets/i18n/ru.json @@ -276,7 +276,22 @@ }, "PAYMENTS": { "PAYMENTS": "Плащания", - "ALLOW_ONLINE_PAYMENT": "Разрешаване на онлайн плащания?" + "ALLOW_ONLINE_PAYMENT": "Разрешаване на онлайн плащания?", + "STRIPE": { + "PAY_BUTTON_TEXT": "Текст кнопки оплаты", + "CURRENCY": "валюта", + "PAY_BUTTON_TEXT_IS_REQUIRED": "Текст кнопки оплаты требуется", + "CHOOSE_CURRENCY_CODE": "Выберите код валюты", + "CURRENCY_TEXT_IS_REQUIRED": "Текст валюты требуется", + "COMPANY_BRAND_LOGO": "Логотип бренда компании", + "COMPANY_BRAND_LOGO_IS_REQUIRED": "Требуется логотип компании", + "INVALID_LOGO_URL": "Неверный URL-адрес логотипа", + "INVALID_LOGO": "Неверный логотип", + "PUBLISHABLE_KEY": "Публикуемый ключ", + "PUBLISHABLE_KEY_IS_REQUIRED": "Требуется публикуемый ключ", + "ALLOW_REMEMBER_ME": "Разрешить запомнить меня?", + "REMOVE": "Удалить" + } }, "MANUFACTURING": { "MANUFACTURING": "Производство", From 61d0a22d050b174a04bbd30bb0a4ea6b0332a2a2 Mon Sep 17 00:00:00 2001 From: blagovest Date: Tue, 28 May 2019 13:28:55 +0300 Subject: [PATCH 25/26] feat(ever-admin): tr setup merchant payment PayPal EV-1198 --- .../payPal-gateway.component.html | 80 ++++++++++++++----- admin/website-angular/src/assets/i18n/bg.json | 14 ++++ admin/website-angular/src/assets/i18n/en.json | 14 ++++ admin/website-angular/src/assets/i18n/he.json | 14 ++++ admin/website-angular/src/assets/i18n/ru.json | 14 ++++ 5 files changed, 116 insertions(+), 20 deletions(-) diff --git a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html index b106a6e53..ed7cf47fb 100644 --- a/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html +++ b/admin/website-angular/src/app/pages/+setup/+merchants/components/payments/payment-gateways/payPal-gateway/payPal-gateway.component.html @@ -11,7 +11,9 @@
- Publishable key is required + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.PAYPAL.PUBLISHABLE_KEY_IS_REQUIRED' + | translate + }}
@@ -101,7 +123,10 @@
- Secret key is required + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.PAYPAL.SECRET_KEY_IS_REQUIRED' + | translate + }}
@@ -138,7 +169,10 @@
- Payment description is required + {{ + 'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.PAYPAL.PAYMENT_DESCRIPTION_IS_REQUIRED' + | translate + }}
diff --git a/admin/website-angular/src/assets/i18n/bg.json b/admin/website-angular/src/assets/i18n/bg.json index 1d96c26f4..3a98a35a5 100644 --- a/admin/website-angular/src/assets/i18n/bg.json +++ b/admin/website-angular/src/assets/i18n/bg.json @@ -292,6 +292,20 @@ "PUBLISHABLE_KEY_IS_REQUIRED": "Изисква се издателски ключ", "ALLOW_REMEMBER_ME": "Нека ме запамети?", "REMOVE": "Премахни" + }, + "PAYPAL": { + "MODE": "Метод", + "CHOOSE_PAYPAL_MODE": "Избери PayPal метод", + "TYPE": "тип", + "CURRENCY": "Валута", + "CHOOSE_CURRENCY_CODE": "Изберете кода на валутата", + "CURRENCY_TEXT_IS_REQUIRED": "Необходим е текст на валутата", + "PUBLISHABLE_KEY": "Публикуван ключ", + "PUBLISHABLE_KEY_IS_REQUIRED": "Изисква се публичен ключ", + "SECRET_KEY": "Тайният ключ", + "SECRET_KEY_IS_REQUIRED": "Изисква се секретен ключ", + "PAYMENT_DESCRIPTION": "Описание на плащането", + "PAYMENT_DESCRIPTION_IS_REQUIRED": "Изисква се описание на плащането" } }, "MANUFACTURING": { diff --git a/admin/website-angular/src/assets/i18n/en.json b/admin/website-angular/src/assets/i18n/en.json index 4f5d8cbd2..ea7d0f3f7 100644 --- a/admin/website-angular/src/assets/i18n/en.json +++ b/admin/website-angular/src/assets/i18n/en.json @@ -291,6 +291,20 @@ "PUBLISHABLE_KEY_IS_REQUIRED": "Publishable key is required", "ALLOW_REMEMBER_ME": "Allow remember me?", "REMOVE": "Remove" + }, + "PAYPAL": { + "MODE": "Mode", + "CHOOSE_PAYPAL_MODE": "Choose PayPal mode", + "TYPE": "type", + "CURRENCY": "Currency", + "CHOOSE_CURRENCY_CODE": "Choose currency code", + "CURRENCY_TEXT_IS_REQUIRED": "Currency text is required", + "PUBLISHABLE_KEY": "Publishable key", + "PUBLISHABLE_KEY_IS_REQUIRED": "Publishable key is required", + "SECRET_KEY": "Secret key", + "SECRET_KEY_IS_REQUIRED": "Secret key is required", + "PAYMENT_DESCRIPTION": "Payment description", + "PAYMENT_DESCRIPTION_IS_REQUIRED": "Payment description is required" } }, "MANUFACTURING": { diff --git a/admin/website-angular/src/assets/i18n/he.json b/admin/website-angular/src/assets/i18n/he.json index b45a2744a..84eb77b22 100644 --- a/admin/website-angular/src/assets/i18n/he.json +++ b/admin/website-angular/src/assets/i18n/he.json @@ -291,6 +291,20 @@ "PUBLISHABLE_KEY_IS_REQUIRED": "נדרש מפתח לפרסום", "ALLOW_REMEMBER_ME": "אתה זוכר אותי?", "REMOVE": "הסר" + }, + "PAYPAL": { + "MODE": "מצב", + "CHOOSE_PAYPAL_MODE": "בחר במצב PayPal", + "TYPE": "הקלד", + "CURRENCY": "מטבע", + "CHOOSE_CURRENCY_CODE": "בחר קוד מטבע", + "CURRENCY_TEXT_IS_REQUIRED": "טקסט מטבע נדרש", + "PUBLISHABLE_KEY": "מפתח ניתן לפרסום", + "PUBLISHABLE_KEY_IS_REQUIRED": "נדרש מפתח לפרסום", + "SECRET_KEY": "מפתח סודי", + "SECRET_KEY_IS_REQUIRED": "נדרש מפתח סודי", + "PAYMENT_DESCRIPTION": "תיאור התשלום", + "PAYMENT_DESCRIPTION_IS_REQUIRED": "תיאור התשלום נדרש" } }, "MANUFACTURING": { diff --git a/admin/website-angular/src/assets/i18n/ru.json b/admin/website-angular/src/assets/i18n/ru.json index cdb310758..915a1e201 100644 --- a/admin/website-angular/src/assets/i18n/ru.json +++ b/admin/website-angular/src/assets/i18n/ru.json @@ -291,6 +291,20 @@ "PUBLISHABLE_KEY_IS_REQUIRED": "Требуется публикуемый ключ", "ALLOW_REMEMBER_ME": "Разрешить запомнить меня?", "REMOVE": "Удалить" + }, + "PAYPAL": { + "MODE": "Режим", + "CHOOSE_PAYPAL_MODE": "Выберите режим PayPal", + "TYPE": "тип", + "CURRENCY": "валюта", + "CHOOSE_CURRENCY_CODE": "Выберите код валюты", + "CURRENCY_TEXT_IS_REQUIRED": "Текст валюты требуется", + "PUBLISHABLE_KEY": "Публикуемый ключ", + "PUBLISHABLE_KEY_IS_REQUIRED": "Требуется публикуемый ключ", + "SECRET_KEY": "Секретный ключ", + "SECRET_KEY_IS_REQUIRED": "Требуется секретный ключ", + "PAYMENT_DESCRIPTION": "Описание оплаты", + "PAYMENT_DESCRIPTION_IS_REQUIRED": "Требуется описание платежа" } }, "MANUFACTURING": { From be48811a98a4e98a37ee2f61884f2e1485e2e34a Mon Sep 17 00:00:00 2001 From: blagovest Date: Tue, 28 May 2019 14:29:32 +0300 Subject: [PATCH 26/26] feat(ever-admin): tr track carrier page EV-1229 --- .../carrier-tracking.component.html | 30 +++++++++++++++---- admin/website-angular/src/assets/i18n/bg.json | 6 +++- admin/website-angular/src/assets/i18n/en.json | 6 +++- admin/website-angular/src/assets/i18n/he.json | 6 +++- admin/website-angular/src/assets/i18n/ru.json | 6 +++- 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/admin/website-angular/src/app/pages/+carriers/track/carrier-tracking/carrier-tracking.component.html b/admin/website-angular/src/app/pages/+carriers/track/carrier-tracking/carrier-tracking.component.html index 38c9ef094..439a54978 100644 --- a/admin/website-angular/src/app/pages/+carriers/track/carrier-tracking/carrier-tracking.component.html +++ b/admin/website-angular/src/app/pages/+carriers/track/carrier-tracking/carrier-tracking.component.html @@ -112,15 +112,24 @@
  • - Phone: + {{ + 'CARRIERS_VIEW.TRACK_PAGE.PHONE' + | translate + }}: {{ selectedStore.contactPhone }}
  • - Email: + {{ + 'CARRIERS_VIEW.TRACK_PAGE.EMAIL' + | translate + }}: {{ selectedStore.contactEmail }}
  • - Address: + {{ + 'CARRIERS_VIEW.TRACK_PAGE.ADDRESS' + | translate + }}: {{ selectedStore.geoLocation .streetAddress @@ -134,16 +143,25 @@
    • - Delivery Count: + {{ + 'CARRIERS_VIEW.TRACK_PAGE.DELIVERY_COUNT' + | translate + }}: {{ selectedCarrier.numberOfDeliveries }}
    • - Phone: {{ selectedCarrier.phone }} + {{ + 'CARRIERS_VIEW.TRACK_PAGE.PHONE' + | translate + }}: {{ selectedCarrier.phone }}
    • - Address: + {{ + 'CARRIERS_VIEW.TRACK_PAGE.ADDRESS' + | translate + }}: {{ selectedCarrier.geoLocation .streetAddress diff --git a/admin/website-angular/src/assets/i18n/bg.json b/admin/website-angular/src/assets/i18n/bg.json index 3a98a35a5..101cfc65e 100644 --- a/admin/website-angular/src/assets/i18n/bg.json +++ b/admin/website-angular/src/assets/i18n/bg.json @@ -885,7 +885,11 @@ }, "TRACK_PAGE": { "TRACK_ALL_WORKING_CARRIERS": "Проследете всички работещи превозвачи", - "FILTER_CARRIERS": "Филтрирай превозвачите" + "FILTER_CARRIERS": "Филтрирай превозвачите", + "PHONE": "Телефон", + "EMAIL": "Эл. адрес", + "ADDRESS": "Адрес", + "DELIVERY_COUNT": "Счетчик доставки" } }, "PRODUCT_TYPE_VIEW": { diff --git a/admin/website-angular/src/assets/i18n/en.json b/admin/website-angular/src/assets/i18n/en.json index ea7d0f3f7..781c30739 100644 --- a/admin/website-angular/src/assets/i18n/en.json +++ b/admin/website-angular/src/assets/i18n/en.json @@ -884,7 +884,11 @@ }, "TRACK_PAGE": { "TRACK_ALL_WORKING_CARRIERS": "Track all working carriers", - "FILTER_CARRIERS": "Filter Carriers" + "FILTER_CARRIERS": "Filter Carriers", + "PHONE": "Phone", + "EMAIL": "Email", + "ADDRESS": "Address", + "DELIVERY_COUNT": "Delivery Count" } }, "PRODUCT_TYPE_VIEW": { diff --git a/admin/website-angular/src/assets/i18n/he.json b/admin/website-angular/src/assets/i18n/he.json index 84eb77b22..dbb1efe59 100644 --- a/admin/website-angular/src/assets/i18n/he.json +++ b/admin/website-angular/src/assets/i18n/he.json @@ -884,7 +884,11 @@ }, "TRACK_PAGE": { "TRACK_ALL_WORKING_CARRIERS": "עקוב אחר כל ספקי השירות", - "FILTER_CARRIERS": "מסנני מסננים" + "FILTER_CARRIERS": "מסנני מסננים", + "PHONE": "מכשיר טלפון", + "EMAIL": "דוא'ל", + "ADDRESS": "כתובת", + "DELIVERY_COUNT": "ספירת משלוח" } }, "PRODUCT_TYPE_VIEW": { diff --git a/admin/website-angular/src/assets/i18n/ru.json b/admin/website-angular/src/assets/i18n/ru.json index 915a1e201..d05ed51bb 100644 --- a/admin/website-angular/src/assets/i18n/ru.json +++ b/admin/website-angular/src/assets/i18n/ru.json @@ -881,7 +881,11 @@ }, "TRACK_PAGE": { "TRACK_ALL_WORKING_CARRIERS": "Отслеживание всех работающих перевозчиков", - "FILTER_CARRIERS": "Фильтр-носители" + "FILTER_CARRIERS": "Фильтр-носители", + "PHONE": "Телефон", + "EMAIL": "Эл. адрес", + "ADDRESS": "Адрес", + "DELIVERY_COUNT": "Счетчик доставки" } }, "PRODUCT_TYPE_VIEW": {