From 0c6819482278f11d391ab0f705b50e5e4028cdf8 Mon Sep 17 00:00:00 2001 From: Dimitris Mytakis Date: Wed, 23 Dec 2020 22:27:56 +0200 Subject: [PATCH] contact form, translate sector, dates in card --- src/app/core/interfaces/message.interface.ts | 4 + src/app/core/services/open-data.service.ts | 14 +- src/app/core/services/static-data.service.ts | 126 ++- .../community-list.component.html | 2 +- .../community-list.component.ts | 15 + .../microcredit-list.component.html | 3 +- .../microcredit-list.component.ts | 28 +- .../offer-list/offer-list.component.ts | 4 +- .../community-archive.component.html | 2 +- .../community-archive.component.ts | 13 +- .../community-single.component.html | 2 +- .../community-single.component.ts | 29 +- .../views/pages/contact/contact.component.css | 0 .../pages/contact/contact.component.html | 75 +- .../pages/contact/contact.component.scss | 15 + .../views/pages/contact/contact.component.ts | 113 ++- .../microcredit-archive.component.html | 3 +- .../microcredit-archive.component.ts | 26 +- .../microcredit-single.component.ts | 882 +++++++++--------- src/assets/i18n/el.json | 46 +- src/assets/i18n/en.json | 35 +- 21 files changed, 930 insertions(+), 507 deletions(-) create mode 100644 src/app/core/interfaces/message.interface.ts delete mode 100644 src/app/views/pages/contact/contact.component.css create mode 100644 src/app/views/pages/contact/contact.component.scss diff --git a/src/app/core/interfaces/message.interface.ts b/src/app/core/interfaces/message.interface.ts new file mode 100644 index 0000000..32384b9 --- /dev/null +++ b/src/app/core/interfaces/message.interface.ts @@ -0,0 +1,4 @@ +export interface Message { + message: string; + code: number; + } \ No newline at end of file diff --git a/src/app/core/services/open-data.service.ts b/src/app/core/services/open-data.service.ts index 7f59a06..064e505 100644 --- a/src/app/core/services/open-data.service.ts +++ b/src/app/core/services/open-data.service.ts @@ -19,6 +19,7 @@ import { MicrocreditCampaign } from '../models/microcredit-campaign.model'; import { OneClickToken } from '../models/one-click-token.model'; import { PaymentDetails } from '../models/payment-details.model'; import { MicrocreditBalance } from '../models/microcredit-balance.model'; +import { Message } from '../interfaces/message.interface'; @Injectable({ providedIn: 'root' @@ -32,7 +33,7 @@ export class OpenDataService { * Authentication */ oneClickRegistration(email: string): Observable { - return this.http.post(`${environment.apiUrl}/auth/one-click/register`, { email: email }) + return this.http.post(`${environment.apiUrl}/auth/register/one-click`, { email: email }) .pipe(map(response => { return response.data; })); @@ -157,4 +158,15 @@ export class OpenDataService { return response.data; })); }; + + /** + * Communicate + */ + communicate(sender: string, content: string): Observable { + return this.http.post(`${environment.apiUrl}/community/communicate`, { sender: sender, content: content }) + .pipe(map(response => { + return response; + })); + }; + } diff --git a/src/app/core/services/static-data.service.ts b/src/app/core/services/static-data.service.ts index fdd68aa..1aac617 100644 --- a/src/app/core/services/static-data.service.ts +++ b/src/app/core/services/static-data.service.ts @@ -6,13 +6,13 @@ import { ContactList } from '../interfaces/contact-list.interface'; import { GeneralList } from '../interfaces/general-list.interface'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class StaticDataService { - /** - * Payments List - */ + /** + * Payments List + */ paymentsList: PaymentList[] = [ { bic: 'ETHNGRAA', @@ -64,10 +64,44 @@ export class StaticDataService { } ]; - /** - * Contacts List + * Sectors List */ + sectorsList: GeneralList[] = [ + { + title: 'PARTNER.SECTOR_CHOICES._', + value: 'Other', + }, + { + title: 'PARTNER.SECTOR_CHOICES.A', + value: 'B2B Services & Other Goods and Services', + }, + { + title: 'PARTNER.SECTOR_CHOICES.B', + value: 'Durables', + }, + { + title: 'PARTNER.SECTOR_CHOICES.C', + value: 'Durables (Technology)', + }, + { + title: 'PARTNER.SECTOR_CHOICES.D', + value: 'Education', + }, + { + title: 'PARTNER.SECTOR_CHOICES.E', + value: 'Food', + }, + { + title: 'PARTNER.SECTOR_CHOICES.F', + value: 'Hotels, Cafés and Restaurants', + }, + { + title: 'PARTNER.SECTOR_CHOICES.G', + value: 'Recreation and Culture', + } + ]; + /** * Contacts List */ @@ -127,35 +161,59 @@ export class StaticDataService { }, ]; - public get getPaymentsList(): PaymentList[] { - return this.paymentsList; - }; + /** + * Form Validators + */ + validators = { + contact: { + sender: { + minLength: 4, + maxLength: 256 + }, + content: { + minLength: 6, + maxLength: 4096 + }, + } + }; - public get getContactsList(): ContactList[] { - return this.contactsList; - }; + public get getPaymentsList(): PaymentList[] { + return this.paymentsList; + }; - owlOptions = { - loop: true, - mouseDrag: true, - touchDrag: false, - pullDrag: false, - dots: true, - navSpeed: 700, - navText: ['', ''], - responsive: { - 0: { - items: 1 - }, - 940: { - items: 3 - } - }, - margin: 30, - nav: true - } + public get getSectorsList(): GeneralList[] { + return this.sectorsList; + }; + + public get getContactsList(): ContactList[] { + return this.contactsList; + }; + + public get getValidators() { + return this.validators; + } + + owlOptions = { + loop: true, + mouseDrag: true, + touchDrag: false, + pullDrag: false, + dots: true, + navSpeed: 700, + navText: ['', ''], + responsive: { + 0: { + items: 1 + }, + 940: { + items: 3 + } + }, + margin: 30, + nav: true + } - public get getOwlOprions() { - return this.owlOptions; - }; + public get getOwlOprions() { + return this.owlOptions; + }; } \ No newline at end of file diff --git a/src/app/views/content/community-list/community-list.component.html b/src/app/views/content/community-list/community-list.component.html index ce900ee..2ba8981 100644 --- a/src/app/views/content/community-list/community-list.component.html +++ b/src/app/views/content/community-list/community-list.component.html @@ -14,7 +14,7 @@
{{partner.name}}
-
{{partner.sector}} +
{{translateSector(partner) | translate}}
diff --git a/src/app/views/content/community-list/community-list.component.ts b/src/app/views/content/community-list/community-list.component.ts index 4ee2750..1be17c1 100644 --- a/src/app/views/content/community-list/community-list.component.ts +++ b/src/app/views/content/community-list/community-list.component.ts @@ -9,6 +9,7 @@ import { OwlOptions } from 'ngx-owl-carousel-o'; import { OpenDataService } from '../../../core/services/open-data.service'; import { StaticDataService } from 'src/app/core/services/static-data.service'; import { Partner } from '../../../core/models/partner.model'; +import { GeneralList } from '../../../core/interfaces/general-list.interface'; @Component({ selector: 'app-community-list', @@ -26,6 +27,7 @@ export class CommunityListComponent implements OnInit, OnDestroy { private unsubscribe: Subject; public partners: Partner[]; + public sectorsList: GeneralList[]; /* list = [ { @@ -64,6 +66,7 @@ export class CommunityListComponent implements OnInit, OnDestroy { private staticDataService: StaticDataService, // private loadData : LoadJsonService ) { + this.sectorsList = this.staticDataService.getSectorsList; this.customOptions = staticDataService.getOwlOprions; this.unsubscribe = new Subject(); } @@ -81,6 +84,18 @@ export class CommunityListComponent implements OnInit, OnDestroy { this.loading = false; } + translateSector(partner: Partner) { + console.log("Here") + console.log(partner); + console.log() + console.log(this.sectorsList.filter((el) => { + return el.value == partner.sector + })) + return this.sectorsList.filter((el) => { + return el.value == partner.sector + })[0].title; + } + shuffleArray(array: Partner[]) { var m = array.length, t, i; diff --git a/src/app/views/content/microcredit-list/microcredit-list.component.html b/src/app/views/content/microcredit-list/microcredit-list.component.html index 731e8fd..09aa230 100644 --- a/src/app/views/content/microcredit-list/microcredit-list.component.html +++ b/src/app/views/content/microcredit-list/microcredit-list.component.html @@ -15,7 +15,8 @@
{{item.title}} -
έως {{item.expiresAt | date: 'd.M'}}
+
{{filterCampaign(item)}} {{ _date | date: 'd.M'}}
+
diff --git a/src/app/views/content/microcredit-list/microcredit-list.component.ts b/src/app/views/content/microcredit-list/microcredit-list.component.ts index ddabacf..2005c92 100644 --- a/src/app/views/content/microcredit-list/microcredit-list.component.ts +++ b/src/app/views/content/microcredit-list/microcredit-list.component.ts @@ -8,6 +8,7 @@ import { OwlOptions } from 'ngx-owl-carousel-o'; import { OpenDataService } from '../../../core/services/open-data.service'; import { StaticDataService } from 'src/app/core/services/static-data.service'; import { MicrocreditCampaign } from '../../../core/models/microcredit-campaign.model'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-microcredit-list', @@ -20,6 +21,9 @@ export class MicrocreditListComponent implements OnInit { moved: boolean; customOptions: OwlOptions; + public _text: string = ''; + public _date: number = 0; + loading: boolean = false; private unsubscribe: Subject; @@ -28,6 +32,7 @@ export class MicrocreditListComponent implements OnInit { constructor( private cdRef: ChangeDetectorRef, private openDataService: OpenDataService, + private translate: TranslateService, private router: Router, private staticDataService: StaticDataService, ) { @@ -61,8 +66,27 @@ export class MicrocreditListComponent implements OnInit { return array; } + filterCampaign(campaign: MicrocreditCampaign) { + const now = new Date(); + const seconds = parseInt(now.getTime().toString()); + + if (campaign.startsAt > seconds) { + this._date = campaign.startsAt; + return this.translate.instant('CAMPAIGN.STATUS.EXPECTED'); + // this._text = this.translate.instant('CAMPAIGN.STATUS.EXPECTED'); + } else if ((campaign.expiresAt > seconds) && (seconds > campaign.startsAt)) { + this._date = campaign.expiresAt; + return this.translate.instant('GENERAL.TO'); + // this._text = this.translate.instant('GENERAL.TO'); + } else if (seconds > campaign.expiresAt) { + this._date = campaign.redeemEnds; + return this.translate.instant('CAMPAIGN.STATUS.REDEEM_TO'); + // this._text = this.translate.instant('CAMPAIGN.STATUS.REDEEM_TO'); + } + } + fetchCampaignsData() { - this.openDataService.readAllPublicMicrocreditCampaigns(`0-0-0`) + this.openDataService.readAllPublicMicrocreditCampaigns(`0-0-1`) .pipe( tap( data => { @@ -81,7 +105,7 @@ export class MicrocreditListComponent implements OnInit { } fetchPartnerCampaignsData(partner_id: string) { - this.openDataService.readAllMicrocreditCampaignsByStore(partner_id, `0-0-0`) + this.openDataService.readAllMicrocreditCampaignsByStore(partner_id, `0-0-1`) .pipe( tap( data => { diff --git a/src/app/views/content/offer-list/offer-list.component.ts b/src/app/views/content/offer-list/offer-list.component.ts index b4396cd..694730d 100644 --- a/src/app/views/content/offer-list/offer-list.component.ts +++ b/src/app/views/content/offer-list/offer-list.component.ts @@ -68,7 +68,7 @@ export class OfferListComponent implements OnInit { } fetchOffersData() { - this.openDataService.readAllOffers(`0-0-0`) + this.openDataService.readAllOffers(`0-0-1`) .pipe( tap( data => { @@ -87,7 +87,7 @@ export class OfferListComponent implements OnInit { } fetchPartnerOffersData(partner_id: string) { - this.openDataService.readOffersByStore(partner_id, `0-0-0`) + this.openDataService.readOffersByStore(partner_id, `0-0-1`) .pipe( tap( data => { diff --git a/src/app/views/pages/community-archive/community-archive.component.html b/src/app/views/pages/community-archive/community-archive.component.html index cabe1ca..128288b 100644 --- a/src/app/views/pages/community-archive/community-archive.component.html +++ b/src/app/views/pages/community-archive/community-archive.component.html @@ -23,7 +23,7 @@

{{ 'SECTIONS.partners-title' | translate }}

{{item.name}}
-
{{item.sector}}
+
{{translateSector(item) | translate}}
diff --git a/src/app/views/pages/community-archive/community-archive.component.ts b/src/app/views/pages/community-archive/community-archive.component.ts index 177082f..c9c5804 100644 --- a/src/app/views/pages/community-archive/community-archive.component.ts +++ b/src/app/views/pages/community-archive/community-archive.component.ts @@ -4,7 +4,9 @@ import { tap, takeUntil, finalize } from 'rxjs/operators'; // Services & Models import { OpenDataService } from '../../../core/services/open-data.service'; +import { StaticDataService } from '../../../core/services/static-data.service'; import { Partner } from '../../../core/models/partner.model'; +import { GeneralList } from '../../../core/interfaces/general-list.interface'; @Component({ selector: 'app-community-archive', @@ -14,6 +16,7 @@ import { Partner } from '../../../core/models/partner.model'; export class CommunityArchiveComponent implements OnInit { p: number = 1; public partners: Partner[]; + public sectorsList: GeneralList[]; loading: boolean = false; private unsubscribe: Subject; @@ -21,7 +24,9 @@ export class CommunityArchiveComponent implements OnInit { constructor( private cdRef: ChangeDetectorRef, private openDataService: OpenDataService, - ) { + private staticDataService: StaticDataService + ) { + this.sectorsList = this.staticDataService.getSectorsList; this.unsubscribe = new Subject(); } @@ -35,6 +40,12 @@ export class CommunityArchiveComponent implements OnInit { this.loading = false; } + translateSector(partner: Partner) { + return this.sectorsList.filter((el) => { + return el.value == partner.sector + })[0].title; + } + fetchPartnersData() { this.openDataService.readPartners(`0-0-0`) .pipe( diff --git a/src/app/views/pages/community-single/community-single.component.html b/src/app/views/pages/community-single/community-single.component.html index 7ccc0f6..28ffa46 100644 --- a/src/app/views/pages/community-single/community-single.component.html +++ b/src/app/views/pages/community-single/community-single.component.html @@ -11,7 +11,7 @@

{{partner.name}}

-
{{partner.sector}}
+
{{translateSector(partner) | translate}}
{{partner.email}}
+
+ + +
+ + {{'CONTACT.SENDER.TITLE' | translate}} + + + {{ 'AUTH.VALIDATION.REQUIRED_FIELD' | translate }} + + + {{ 'AUTH.VALIDATION.INVALID_FIELD' | translate }} + + + {{ 'AUTH.VALIDATION.MIN_LENGTH_FIELD' | translate }}: {{validator.sender.minLength}} + + + {{ 'AUTH.VALIDATION.MAX_LENGTH_FIELD' | translate }}: {{validator.sender.maxLength}} + + {{'CONTACT.SENDER.DESC' | translate}} + +
+ + + +
+ + {{'CONTACT.CONTENT.TITLE' | translate}} + + + {{ 'AUTH.VALIDATION.REQUIRED_FIELD' | translate }} + + + {{ 'AUTH.VALIDATION.MIN_LENGTH_FIELD' | translate }}: {{validator.content.minLength}} + + + {{ 'AUTH.VALIDATION.MAX_LENGTH_FIELD' | translate }}: {{validator.content.maxLength}} + + + {{'CONTACT.CONTENT.DESC' | translate}} + + +
+ + + +
+ +
+ +
+ + + diff --git a/src/app/views/pages/contact/contact.component.scss b/src/app/views/pages/contact/contact.component.scss new file mode 100644 index 0000000..f252c0c --- /dev/null +++ b/src/app/views/pages/contact/contact.component.scss @@ -0,0 +1,15 @@ +.single-form { +padding-left: 30px; +padding-right: 30px; + +.form-group { + width: 100%; + + mat-form-field { + width: 100%; + + } +} + +} + diff --git a/src/app/views/pages/contact/contact.component.ts b/src/app/views/pages/contact/contact.component.ts index 2126220..d0dc2d5 100644 --- a/src/app/views/pages/contact/contact.component.ts +++ b/src/app/views/pages/contact/contact.component.ts @@ -1,15 +1,122 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Subject } from 'rxjs'; +import { finalize, takeUntil, tap } from 'rxjs/operators'; +import { OpenDataService } from '../../../core/services/open-data.service'; +import { StaticDataService } from '../../../core/services/static-data.service'; +import Swal from 'sweetalert2'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-contact', templateUrl: './contact.component.html', - styleUrls: ['./contact.component.css'] + styleUrls: ['./contact.component.scss'] }) export class ContactComponent implements OnInit { - constructor() { } + /** + * Forms + */ + submitForm: FormGroup; + submitted: boolean = false; + validator: any; + + loading: boolean = false; + private unsubscribe: Subject; + + constructor( + private router: Router, + private cdRef: ChangeDetectorRef, + private fb: FormBuilder, + private translate: TranslateService, + private openDataService: OpenDataService, + private staticDataService: StaticDataService, + ) { + this.validator = this.staticDataService.getValidators.contact; + this.unsubscribe = new Subject(); + } ngOnInit() { + this.initForm(); + } + + ngOnDestroy() { + this.unsubscribe.next(); + this.unsubscribe.complete(); + this.loading = false; + } + + initForm() { + this.submitForm = this.fb.group({ + sender: ['', Validators.compose([ + Validators.required, + Validators.email, + Validators.minLength(this.validator.sender.minLength), + Validators.maxLength(this.validator.sender.maxLength) + ]) + ], + content: ['', Validators.compose([ + Validators.required, + Validators.minLength(this.validator.content.minLength), + Validators.maxLength(this.validator.content.maxLength) + ]) + ], + }); } + /** + * On Submit Form + */ + onSubmit() { + if (this.loading) return; + + const controls = this.submitForm.controls; + /** check form */ + if (this.submitForm.invalid) { + Object.keys(controls).forEach(controlName => + controls[controlName].markAsTouched() + ); + return; + } + + this.loading = true; + + this.openDataService.communicate(controls.sender.value, controls.content.value) + .pipe( + tap( + data => { + Swal.fire({ + title: this.translate.instant('CONTACT.SUCCESS.TITLE'), + html: this.translate.instant('CONTACT.SUCCESS.MESSAGE'), + icon: 'success' + }) + setTimeout(() => { + this.router.navigateByUrl('/'); + }, 2500); + }, error => { + }), + takeUntil(this.unsubscribe), + finalize(() => { + this.loading = false; + this.cdRef.markForCheck(); + }) + ).subscribe(); + } + + /** + * Checking control validation + * + * @param controlName: string => Equals to formControlName + * @param validationType: string => Equals to valitors name + */ + isControlHasError(controlName: string, validationType: string): boolean { + const control = this.submitForm.controls[controlName]; + if (!control) { + return false; + } + + const result = control.hasError(validationType) && (control.dirty || control.touched); + return result; + } } diff --git a/src/app/views/pages/microcredit-archive/microcredit-archive.component.html b/src/app/views/pages/microcredit-archive/microcredit-archive.component.html index 79d2b17..8e0d0f1 100644 --- a/src/app/views/pages/microcredit-archive/microcredit-archive.component.html +++ b/src/app/views/pages/microcredit-archive/microcredit-archive.component.html @@ -16,7 +16,8 @@

{{ 'PAGE_TITLES.campaigns-title' | translate }}

{{item.title}} -
έως {{item.expiresAt | date: 'd.M'}}
+
{{filterCampaign(item)}} {{ _date | date: 'd.M'}}
+
diff --git a/src/app/views/pages/microcredit-archive/microcredit-archive.component.ts b/src/app/views/pages/microcredit-archive/microcredit-archive.component.ts index 97604cc..734927c 100644 --- a/src/app/views/pages/microcredit-archive/microcredit-archive.component.ts +++ b/src/app/views/pages/microcredit-archive/microcredit-archive.component.ts @@ -5,6 +5,7 @@ import { tap, takeUntil, finalize } from 'rxjs/operators'; // Services & Models import { OpenDataService } from '../../../core/services/open-data.service'; import { MicrocreditCampaign } from '../../../core/models/microcredit-campaign.model'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-microcredit-archive', @@ -15,12 +16,16 @@ export class MicrocreditArchiveComponent implements OnInit { p: number = 1; public campaigns: MicrocreditCampaign[]; + public _text: string = ''; + public _date: number = 0; + loading: boolean = false; private unsubscribe: Subject; constructor( private cdRef: ChangeDetectorRef, - private openDataService: OpenDataService, + private translate: TranslateService, + private openDataService: OpenDataService, ) { this.unsubscribe = new Subject(); } @@ -35,6 +40,25 @@ export class MicrocreditArchiveComponent implements OnInit { this.loading = false; } + filterCampaign(campaign: MicrocreditCampaign) { + const now = new Date(); + const seconds = parseInt(now.getTime().toString()); + + if (campaign.startsAt > seconds) { + this._date = campaign.startsAt; + return this.translate.instant('CAMPAIGN.STATUS.EXPECTED'); + // this._text = this.translate.instant('CAMPAIGN.STATUS.EXPECTED'); + } else if ((campaign.expiresAt > seconds) && (seconds > campaign.startsAt)) { + this._date = campaign.expiresAt; + return this.translate.instant('GENERAL.TO'); + // this._text = this.translate.instant('GENERAL.TO'); + } else if (seconds > campaign.expiresAt) { + this._date = campaign.redeemEnds; + return this.translate.instant('CAMPAIGN.STATUS.REDEEM_TO'); + // this._text = this.translate.instant('CAMPAIGN.STATUS.REDEEM_TO'); + } + } + fetchCampaignsData() { this.openDataService.readAllPublicMicrocreditCampaigns(`0-0-1`) .pipe( diff --git a/src/app/views/pages/microcredit-single/microcredit-single.component.ts b/src/app/views/pages/microcredit-single/microcredit-single.component.ts index 132206e..690a707 100644 --- a/src/app/views/pages/microcredit-single/microcredit-single.component.ts +++ b/src/app/views/pages/microcredit-single/microcredit-single.component.ts @@ -15,432 +15,432 @@ import Swal from 'sweetalert2'; import { PaymentDetails } from 'src/app/core/models/payment-details.model'; import { - IPayPalConfig, - ICreateOrderRequest + IPayPalConfig, + ICreateOrderRequest } from 'ngx-paypal'; import { Title } from '@angular/platform-browser'; @Component({ - selector: 'app-microcredit-single', - templateUrl: './microcredit-single.component.html', - styleUrls: ['./microcredit-single.component.scss'] + selector: 'app-microcredit-single', + templateUrl: './microcredit-single.component.html', + styleUrls: ['./microcredit-single.component.scss'] }) export class MicrocreditSingleComponent implements OnInit { - public paymentsList: any[]; - paymentDetails: PaymentDetails; - - public canSupport: boolean = false; - - oneClickToken: any; - showPaypalButton: boolean = false; - showAddStep: boolean = true; - showSubStep: boolean = true; - - public step: boolean = false; - tempAmount: number = 0; - - partner_id: string; - campaign_id: string; - registrationForm: FormGroup; - supportingForm: FormGroup; - private routeSubscription: any; - campaign: MicrocreditCampaign; - loading: boolean = false; - private unsubscribe: Subject; - - constructor( - private route: ActivatedRoute, - private cdRef: ChangeDetectorRef, - private translate: TranslateService, - private fb: FormBuilder, - private titleService: Title, - private openDataService: OpenDataService, - private staticDataService: StaticDataService, - ) { - this.paymentsList = this.staticDataService.getPaymentsList; - this.unsubscribe = new Subject(); - } - - - - ngOnInit() { - this.routeSubscription = this.route.params.subscribe(params => { - this.partner_id = params['partner_id']; - this.campaign_id = params['campaign_id']; - console.log(this.campaign_id); - this.fetchCampaignData(this.partner_id, this.campaign_id); - }); - } - - ngOnDestroy() { - this.unsubscribe.next(); - this.unsubscribe.complete(); - this.loading = false; - } - - fetchCampaignData(partner_id: string, campaign_id: string) { - const now = new Date(); - const seconds = parseInt(now.getTime().toString()); - - this.openDataService.readMicrocreditCampaign(partner_id, campaign_id) - .pipe( - tap( - data => { - this.campaign = data; - this.titleService.setTitle(this.campaign.title); - this.canSupport = (this.campaign.startsAt < seconds) && (this.campaign.expiresAt > seconds); - //this.canSupport = true; - console.log(this.campaign); - this.initRegistrationForm(); - this.initSupportingForm(); - }, - error => { - console.log('error'); - }), - takeUntil(this.unsubscribe), - finalize(() => { - this.loading = false; - this.cdRef.markForCheck(); - }) - ) - .subscribe(); - } - - initRegistrationForm() { - this.registrationForm = this.fb.group({ - email: ['', Validators.compose([ - Validators.required, - Validators.email, - Validators.minLength(3), - Validators.maxLength(320) // https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address - ]) - ], - }); - } - - initSupportingForm() { - const currentMethodsArray = (this.campaign.partner_payments).map(a => a.bic); - const validatePaymentList = this.paymentsList.filter(function (el) { - return currentMethodsArray.includes(el.bic); - }); - this.paymentsList = validatePaymentList; - - this.supportingForm = this.fb.group({ - amount: ['', Validators.compose([ - Validators.required, - (control: AbstractControl) => Validators.min(this.campaign.minAllowed)(control), - (control: AbstractControl) => Validators.max((this.campaign.maxAllowed) > 0 ? this.campaign.maxAllowed : this.campaign.maxAmount)(control) - ]) - ], - method: ['', Validators.compose([ - Validators.required, - ]) - ] - }); - - const controls = this.supportingForm.controls; - controls['amount'].setValue(this.campaign.minAllowed); - this.showSubStep = false; - controls['method'].setValue(this.paymentsList[0].bic); - this.tempAmount = this.campaign.minAllowed; - this.onPaymentChange(this.paymentsList[0].bic) - } - - oneClickRegistration() { - this.openDataService.oneClickRegistration(this.registrationForm.controls.email.value) - .pipe( - tap( - data => { - console.log(data); - this.oneClickToken = data; - this.oneClickBalance(); - }, - error => { - Swal.fire( - this.translate.instant('SUPPORT.ERROR.REGISTRATION'), - this.translate.instant(error), - 'error' - ); - console.log('error'); - }), - takeUntil(this.unsubscribe), - finalize(() => { - this.loading = false; - this.cdRef.markForCheck(); - }) - ) - .subscribe(); - } - - oneClickBalance() { - this.openDataService.oneClickBalance(this.campaign.partner_id, this.campaign.campaign_id, this.oneClickToken.oneClickToken) - .pipe( - tap( - data => { - console.log(data); - if (parseInt(data.initialTokens) + this.campaign.minAllowed >= this.campaign.maxAmount) { - let message = 'SUPPORT.ERROR.OVER_MAX_AMOUNT'; - Swal.fire( - this.translate.instant('SUPPORT.ERROR.TITLE'), - this.translate.instant(message), - 'error' - ); - } else if (this.campaign.maxAmount - parseInt(data.initialTokens) < this.campaign.maxAllowed) { - this.step = true; - const controls = this.supportingForm.controls; - controls["amount"].setValidators([ - Validators.required, - (control: AbstractControl) => Validators.min(this.campaign.minAllowed)(control), - (control: AbstractControl) => Validators.max(this.campaign.maxAmount - parseInt(data.initialTokens))(control) - ]); - controls['amount'].updateValueAndValidity() - } else { - this.step = true; - } - }, - error => { - }), - takeUntil(this.unsubscribe), - finalize(() => { - this.loading = false; - this.cdRef.markForCheck(); - }) - ) - .subscribe(); - } - - oneClickSupport(controls: { [x: string]: AbstractControl; amount?: any; method?: any; }) { - this.openDataService.oneClickSupport(this.campaign.partner_id, this.campaign.campaign_id, this.oneClickToken.oneClickToken, - controls.amount.value, controls.method.value) - .pipe( - tap( - data => { - (data); - this.paymentDetails = data; - //this.support.how = data.how; - - this.paymentDetails['how'] = (this.paymentDetails.method == 'store') ? { title: '', value: '' } : { - title: this.paymentsList.filter((el) => { - return el.bic == this.paymentDetails.method - })[0].title, - value: this.campaign.partner_payments.filter((el) => { - return el.bic == this.paymentDetails.method - })[0].value - } - - if (this.paymentDetails.method == 'store') { - Swal.fire({ - title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), - html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + - this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.STORE') + "
" + - this.campaign.partner_address.street + ", " + this.campaign.partner_address.postCode + " " + this.campaign.partner_address.city, - icon: 'success' - }) - } else if (this.paymentDetails.method == 'PAYPAL') { - Swal.fire({ - title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), - html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + - this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.PAYPAL') + "
" + - this.translate.instant(this.paymentDetails.how['title']) + ": " + this.paymentDetails.how['value'], - icon: 'success' - }) - } else { - Swal.fire({ - title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), - html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + - this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.BANK') + "
" + - this.translate.instant(this.paymentDetails.how['title']) + ": " + this.paymentDetails.how['value'], - icon: 'success' - }) - } - - }, - error => { - let message = 'SUPPORT.ERROR.SUPPORTING'; - if (error.status === 404) message = 'SUPPORT.ERROR.' + error.error.message.split('Not Found: ')[1]; - Swal.fire( - this.translate.instant('SUPPORT.ERROR.TITLE'), - this.translate.instant(message), - 'error' - ); - console.log('error'); - }), - takeUntil(this.unsubscribe), - finalize(() => { - this.loading = false; - this.cdRef.markForCheck(); - }) - ) - .subscribe(); - } - - onSubmitRegistration() { - if (this.loading) return; - this.loading = true; - - const controls = this.registrationForm.controls; - /** check form */ - if (this.registrationForm.invalid) { - Object.keys(controls).forEach(controlName => - controls[controlName].markAsTouched() - ); - this.loading = false; - return; - } - - this.oneClickRegistration(); - } - - onSubmitSupporting() { - - if (this.loading) return; - this.loading = true; - - const controls = this.supportingForm.controls; - /** check form */ - if (this.supportingForm.invalid) { - Object.keys(controls).forEach(controlName => - controls[controlName].markAsTouched() - ); - this.loading = false; - return; - } - - this.oneClickSupport(controls); - - } - - onChangeAmount(action: boolean) { - const controls = this.supportingForm.controls; - this.tempAmount = (action) ? (controls.amount.value + this.campaign.stepAmount) : (controls.amount.value - this.campaign.stepAmount); - - this.showAddStep = (this.tempAmount >= this.campaign.maxAllowed) ? false : true; - this.showSubStep = (this.tempAmount <= this.campaign.minAllowed) ? false : true; - - controls['amount'].setValue(this.tempAmount); - this.onPaymentChange(controls.method.value) - } - - // addStep() { - // const controls = this.supportingForm.controls; - // this.tempAmount = controls.amount.value + this.campaign.stepAmount; - // if (this.tempAmount <= this.campaign.maxAllowed) { - // controls['amount'].setValue(this.tempAmount); - // } - // this.onPaymentChange(controls.method.value) - // } - - // subStep() { - // const controls = this.supportingForm.controls; - // this.tempAmount = controls.amount.value - this.campaign.stepAmount; - // if (this.tempAmount >= this.campaign.minAllowed) { - // controls['amount'].setValue(this.tempAmount); - // } - // this.onPaymentChange(controls.method.value) - // } - - onPreviousStep() { - this.step = false; - } - - onPaymentChange(payment: string) { - if (payment === 'PAYPAL') { - this.showPaypalButton = true; - this.initConfig(this.tempAmount, this.campaign.partner_payments.filter((el) => { - return el.bic == payment - })[0].value); - } else { - this.showPaypalButton = false; - } - } - - public payPalConfig?: IPayPalConfig; - - private initConfig(amount: number, payee: string): void { - - const controls = this.supportingForm.controls; - if (this.supportingForm.invalid) { - Object.keys(controls).forEach(controlName => - controls[controlName].markAsTouched() - ); - return; - } - - const paymentDetails = { - amount: amount.toString(), - payee: 'member@synergy.io', //payee, - item_name: this.campaign.title, - item_quantity: (this.campaign.quantitative) ? amount.toString() : '1' - } - this.payPalConfig = { - currency: 'EUR', - clientId: 'AZTnZ-SdPrcXmAIWdQHEtOuCk1u8Y9CSAerEDxwkokKydC68Si2MdDk1kKzBkij0T1R8C78896SeCEKV', - createOrderOnClient: (data) => { - intent: 'CAPTURE', - purchase_units: [ - { - amount: { - currency_code: 'EUR', - value: paymentDetails.amount, - breakdown: { - item_total: { - currency_code: 'EUR', - value: paymentDetails.amount, - } - } - }, - payee: { - //merchant_id: 'JCE5DLUCP5L38', - email_address: paymentDetails.payee//'partner@synergy.io' - }, - items: [ - { - name: paymentDetails.item_name, - quantity: '1', - category: 'DIGITAL_GOODS', - unit_amount: { - currency_code: 'EUR', - value: paymentDetails.amount, - }, - } - ] - } - ] - }, - advanced: { - commit: 'true' - }, - style: { - label: 'paypal', - layout: 'horizontal', - size: 'responsive', - }, - onApprove: (data, actions) => { - console.log('onApprove - transaction was approved, but not authorized', data, actions); - actions.order.get().then((details: any) => { - console.log('onApprove - you can get full order details inside onApprove: ', details); - }); - }, - onClientAuthorization: (data) => { - console.log('onClientAuthorization - you should probably inform your server about completed transaction at this point', data); - this.onSubmitSupporting(); - // this.showSuccess = true; - }, - onCancel: (data, actions) => { - console.log('OnCancel', data, actions); - }, - onError: err => { - console.log('OnError', err); - }, - onClick: (data, actions) => { - - console.log('onClick', data, actions); - - - }, - }; - } + public paymentsList: any[]; + paymentDetails: PaymentDetails; + + public canSupport: boolean = false; + + oneClickToken: any; + showPaypalButton: boolean = false; + showAddStep: boolean = true; + showSubStep: boolean = true; + + public step: boolean = false; + tempAmount: number = 0; + + partner_id: string; + campaign_id: string; + registrationForm: FormGroup; + supportingForm: FormGroup; + private routeSubscription: any; + campaign: MicrocreditCampaign; + loading: boolean = false; + private unsubscribe: Subject; + + constructor( + private route: ActivatedRoute, + private cdRef: ChangeDetectorRef, + private translate: TranslateService, + private fb: FormBuilder, + private titleService: Title, + private openDataService: OpenDataService, + private staticDataService: StaticDataService, + ) { + this.paymentsList = this.staticDataService.getPaymentsList; + this.unsubscribe = new Subject(); + } + + + + ngOnInit() { + this.routeSubscription = this.route.params.subscribe(params => { + this.partner_id = params['partner_id']; + this.campaign_id = params['campaign_id']; + console.log(this.campaign_id); + this.fetchCampaignData(this.partner_id, this.campaign_id); + }); + } + + ngOnDestroy() { + this.unsubscribe.next(); + this.unsubscribe.complete(); + this.loading = false; + } + + fetchCampaignData(partner_id: string, campaign_id: string) { + const now = new Date(); + const seconds = parseInt(now.getTime().toString()); + + this.openDataService.readMicrocreditCampaign(partner_id, campaign_id) + .pipe( + tap( + data => { + this.campaign = data; + this.titleService.setTitle(this.campaign.title); + this.canSupport = (this.campaign.startsAt < seconds) && (this.campaign.expiresAt > seconds); + //this.canSupport = true; + console.log(this.campaign); + this.initRegistrationForm(); + this.initSupportingForm(); + }, + error => { + console.log('error'); + }), + takeUntil(this.unsubscribe), + finalize(() => { + this.loading = false; + this.cdRef.markForCheck(); + }) + ) + .subscribe(); + } + + initRegistrationForm() { + this.registrationForm = this.fb.group({ + email: ['', Validators.compose([ + Validators.required, + Validators.email, + Validators.minLength(3), + Validators.maxLength(320) // https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address + ]) + ], + }); + } + + initSupportingForm() { + const currentMethodsArray = (this.campaign.partner_payments).map(a => a.bic); + const validatePaymentList = this.paymentsList.filter(function(el) { + return currentMethodsArray.includes(el.bic); + }); + this.paymentsList = validatePaymentList; + + this.supportingForm = this.fb.group({ + amount: ['', Validators.compose([ + Validators.required, + (control: AbstractControl) => Validators.min(this.campaign.minAllowed)(control), + (control: AbstractControl) => Validators.max((this.campaign.maxAllowed) > 0 ? this.campaign.maxAllowed : this.campaign.maxAmount)(control) + ]) + ], + method: ['', Validators.compose([ + Validators.required, + ]) + ] + }); + + const controls = this.supportingForm.controls; + controls['amount'].setValue(this.campaign.minAllowed); + this.showSubStep = false; + controls['method'].setValue(this.paymentsList[0].bic); + this.tempAmount = this.campaign.minAllowed; + this.onPaymentChange(this.paymentsList[0].bic) + } + + oneClickRegistration() { + this.openDataService.oneClickRegistration(this.registrationForm.controls.email.value) + .pipe( + tap( + data => { + console.log(data); + this.oneClickToken = data; + this.oneClickBalance(); + }, + error => { + Swal.fire( + this.translate.instant('SUPPORT.ERROR.REGISTRATION'), + this.translate.instant(error), + 'error' + ); + console.log('error'); + }), + takeUntil(this.unsubscribe), + finalize(() => { + this.loading = false; + this.cdRef.markForCheck(); + }) + ) + .subscribe(); + } + + oneClickBalance() { + this.openDataService.oneClickBalance(this.campaign.partner_id, this.campaign.campaign_id, this.oneClickToken.oneClickToken) + .pipe( + tap( + data => { + console.log(data); + if (parseInt(data.initialTokens) + this.campaign.minAllowed >= this.campaign.maxAmount) { + let message = 'SUPPORT.ERROR.OVER_MAX_AMOUNT'; + Swal.fire( + this.translate.instant('SUPPORT.ERROR.TITLE'), + this.translate.instant(message), + 'error' + ); + } else if (this.campaign.maxAmount - parseInt(data.initialTokens) < this.campaign.maxAllowed) { + this.step = true; + const controls = this.supportingForm.controls; + controls["amount"].setValidators([ + Validators.required, + (control: AbstractControl) => Validators.min(this.campaign.minAllowed)(control), + (control: AbstractControl) => Validators.max(this.campaign.maxAmount - parseInt(data.initialTokens))(control) + ]); + controls['amount'].updateValueAndValidity() + } else { + this.step = true; + } + }, + error => { + }), + takeUntil(this.unsubscribe), + finalize(() => { + this.loading = false; + this.cdRef.markForCheck(); + }) + ) + .subscribe(); + } + + oneClickSupport(controls: { [x: string]: AbstractControl; amount?: any; method?: any; }) { + this.openDataService.oneClickSupport(this.campaign.partner_id, this.campaign.campaign_id, this.oneClickToken.oneClickToken, + controls.amount.value, controls.method.value) + .pipe( + tap( + data => { + (data); + this.paymentDetails = data; + //this.support.how = data.how; + + this.paymentDetails['how'] = (this.paymentDetails.method == 'store') ? { title: '', value: '' } : { + title: this.paymentsList.filter((el) => { + return el.bic == this.paymentDetails.method + })[0].title, + value: this.campaign.partner_payments.filter((el) => { + return el.bic == this.paymentDetails.method + })[0].value + } + + if (this.paymentDetails.method == 'store') { + Swal.fire({ + title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), + html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + + this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.STORE') + "
" + + this.campaign.partner_address.street + ", " + this.campaign.partner_address.postCode + " " + this.campaign.partner_address.city, + icon: 'success' + }) + } else if (this.paymentDetails.method == 'PAYPAL.ME') { + Swal.fire({ + title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), + html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + + this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.PAYPAL_ME') + "
" + + this.translate.instant(this.paymentDetails.how['title']) + ": " + this.paymentDetails.how['value'], + icon: 'success' + }) + } else { + Swal.fire({ + title: this.translate.instant('SUPPORT.SUCCESS.TITLE'), + html: this.translate.instant('SUPPORT.SUCCESS.PAYMENT_ID') + ": " + this.paymentDetails.payment_id + "

" + + this.translate.instant('SUPPORT.SUCCESS.INSTRUCTIONS') + ": " + this.translate.instant('SUPPORT.BANK') + "
" + + this.translate.instant(this.paymentDetails.how['title']) + ": " + this.paymentDetails.how['value'], + icon: 'success' + }) + } + + }, + error => { + let message = 'SUPPORT.ERROR.SUPPORTING'; + if (error.status === 404) message = 'SUPPORT.ERROR.' + error.error.message.split('Not Found: ')[1]; + Swal.fire( + this.translate.instant('SUPPORT.ERROR.TITLE'), + this.translate.instant(message), + 'error' + ); + console.log('error'); + }), + takeUntil(this.unsubscribe), + finalize(() => { + this.loading = false; + this.cdRef.markForCheck(); + }) + ) + .subscribe(); + } + + onSubmitRegistration() { + if (this.loading) return; + this.loading = true; + + const controls = this.registrationForm.controls; + /** check form */ + if (this.registrationForm.invalid) { + Object.keys(controls).forEach(controlName => + controls[controlName].markAsTouched() + ); + this.loading = false; + return; + } + + this.oneClickRegistration(); + } + + onSubmitSupporting() { + + if (this.loading) return; + this.loading = true; + + const controls = this.supportingForm.controls; + /** check form */ + if (this.supportingForm.invalid) { + Object.keys(controls).forEach(controlName => + controls[controlName].markAsTouched() + ); + this.loading = false; + return; + } + + this.oneClickSupport(controls); + + } + + onChangeAmount(action: boolean) { + const controls = this.supportingForm.controls; + this.tempAmount = (action) ? (controls.amount.value + this.campaign.stepAmount) : (controls.amount.value - this.campaign.stepAmount); + + this.showAddStep = (this.tempAmount >= this.campaign.maxAllowed) ? false : true; + this.showSubStep = (this.tempAmount <= this.campaign.minAllowed) ? false : true; + + controls['amount'].setValue(this.tempAmount); + this.onPaymentChange(controls.method.value) + } + + // addStep() { + // const controls = this.supportingForm.controls; + // this.tempAmount = controls.amount.value + this.campaign.stepAmount; + // if (this.tempAmount <= this.campaign.maxAllowed) { + // controls['amount'].setValue(this.tempAmount); + // } + // this.onPaymentChange(controls.method.value) + // } + + // subStep() { + // const controls = this.supportingForm.controls; + // this.tempAmount = controls.amount.value - this.campaign.stepAmount; + // if (this.tempAmount >= this.campaign.minAllowed) { + // controls['amount'].setValue(this.tempAmount); + // } + // this.onPaymentChange(controls.method.value) + // } + + onPreviousStep() { + this.step = false; + } + + onPaymentChange(payment: string) { + if (payment === 'PAYPAL') { + this.showPaypalButton = true; + this.initConfig(this.tempAmount, this.campaign.partner_payments.filter((el) => { + return el.bic == payment + })[0].value); + } else { + this.showPaypalButton = false; + } + } + + public payPalConfig?: IPayPalConfig; + + private initConfig(amount: number, payee: string): void { + + const controls = this.supportingForm.controls; + if (this.supportingForm.invalid) { + Object.keys(controls).forEach(controlName => + controls[controlName].markAsTouched() + ); + return; + } + + const paymentDetails = { + amount: amount.toString(), + payee: 'member@synergy.io', //payee, + item_name: this.campaign.title, + item_quantity: (this.campaign.quantitative) ? amount.toString() : '1' + } + this.payPalConfig = { + currency: 'EUR', + clientId: 'AZTnZ-SdPrcXmAIWdQHEtOuCk1u8Y9CSAerEDxwkokKydC68Si2MdDk1kKzBkij0T1R8C78896SeCEKV', + createOrderOnClient: (data) => { + intent: 'CAPTURE', + purchase_units: [ + { + amount: { + currency_code: 'EUR', + value: paymentDetails.amount, + breakdown: { + item_total: { + currency_code: 'EUR', + value: paymentDetails.amount, + } + } + }, + payee: { + //merchant_id: 'JCE5DLUCP5L38', + email_address: paymentDetails.payee//'partner@synergy.io' + }, + items: [ + { + name: paymentDetails.item_name, + quantity: '1', + category: 'DIGITAL_GOODS', + unit_amount: { + currency_code: 'EUR', + value: paymentDetails.amount, + }, + } + ] + } + ] + }, + advanced: { + commit: 'true' + }, + style: { + label: 'paypal', + layout: 'horizontal', + size: 'responsive', + }, + onApprove: (data, actions) => { + console.log('onApprove - transaction was approved, but not authorized', data, actions); + actions.order.get().then((details: any) => { + console.log('onApprove - you can get full order details inside onApprove: ', details); + }); + }, + onClientAuthorization: (data) => { + console.log('onClientAuthorization - you should probably inform your server about completed transaction at this point', data); + this.onSubmitSupporting(); + // this.showSuccess = true; + }, + onCancel: (data, actions) => { + console.log('OnCancel', data, actions); + }, + onError: err => { + console.log('OnError', err); + }, + onClick: (data, actions) => { + + console.log('onClick', data, actions); + + + }, + }; + } @@ -451,17 +451,17 @@ export class MicrocreditSingleComponent implements OnInit { * @param controlName: string => Equals to formControlName * @param validationType: string => Equals to valitors name */ - isRegistrationControlHasError(controlName: string, validationType: string): boolean { - const control = this.registrationForm.controls[controlName]; - if (!control) { - return false; - } - - const result = - control.hasError(validationType) && - (control.dirty || control.touched); - return result; - } + isRegistrationControlHasError(controlName: string, validationType: string): boolean { + const control = this.registrationForm.controls[controlName]; + if (!control) { + return false; + } + + const result = + control.hasError(validationType) && + (control.dirty || control.touched); + return result; + } /** * Checking control validation @@ -469,16 +469,16 @@ export class MicrocreditSingleComponent implements OnInit { * @param controlName: string => Equals to formControlName * @param validationType: string => Equals to valitors name */ - isSupportingControlHasError(controlName: string, validationType: string): boolean { - const control = this.supportingForm.controls[controlName]; - if (!control) { - return false; - } - - const result = - control.hasError(validationType) && - (control.dirty || control.touched); - return result; - } + isSupportingControlHasError(controlName: string, validationType: string): boolean { + const control = this.supportingForm.controls[controlName]; + if (!control) { + return false; + } + + const result = + control.hasError(validationType) && + (control.dirty || control.touched); + return result; + } } diff --git a/src/assets/i18n/el.json b/src/assets/i18n/el.json index dd2ddb7..9d626e9 100644 --- a/src/assets/i18n/el.json +++ b/src/assets/i18n/el.json @@ -2,19 +2,61 @@ "HOME": { "community-title": "Κοινότητα" }, + "GENERAL": { + "TO": "εώς" + }, + "CAMPAIGN": { + "STATUS": { + "DRAFT": "Πρόχειρη", + "EXPECTED": "αναμένεται", + "EXPIRED": "Έχει Λήξει", + "REDEEM_TO": "Εξαργύρωση εώς" + } + }, + "CONTACT": { + "TITLE": "Επικοινωνήστε μαζί μας", + "SENDER": { + "TITLE": "Email", + "PLACEHOLDER": "", + "DESC": "" + }, + "CONTENT": { + "TITLE": "Το μήνυμα σας", + "PLACEHOLDER": "", + "DESC": "" + }, + "SUCCESS": { + "TITLE": "OK", + "MESSAGE": "Το μήνυμα σας στάλθηκε επιτυχώς" + } + }, + "PARTNER": { + "SECTOR_CHOICES": { + "_": "Άλλο", + "A": "Υπηρεσίες B2B και άλλα αγαθά και υπηρεσίες", + "B": "Αναλώσιμα", + "C": "Αναλώσιμα (Τεχνολογία)", + "D": "Εκπαίδευση", + "E": "Τρόφιμα", + "F": "Ξενοδοχεία, καφέ και εστιατόρια", + "G": "Αναψυχή και Πολιτισμός" + } + }, "SUPPORT": { "PAYMENT_CHOICES": { "A": "Εθνική Τράπεζα", "B": "Τράπεζα Πειραιώς", "C": "Eurobank Ergasias", "D": "Alpha Bank", - "E": "PayPal" + "E": "PayPal", + "F": "PayPal.Me" }, "AMOUNT": "Ποσό", "PAYMENT": "Μέθοδος Πληρωμής", "STORE": "Στο Κατάστημα", "BANK": "Τραπεζική Κατάθεση", "PAYPAL": "Μέσω Paypal", + "PAYPAL_ME": "Μέσω Paypal.me", "CANNOT_SUPPORT": "Η Υποστήριξη δεν είναι δυνατή αυτή την περίοδο", "SUCCESS": { "TITLE": "Support is ok", @@ -101,4 +143,4 @@ "Form-title": "Παρακαλούμε συμπληρώστε τα στοιχεία σας" } } -} \ No newline at end of file +} diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4257d2a..48a2395 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2,19 +2,50 @@ "HOME": { "community-title": "Community" }, + "CONTACT": { + "TITLE": "Communicate with us", + "SENDER": { + "TITLE": "Email", + "PLACEHOLDER": "", + "DESC": "" + }, + "CONTENT": { + "TITLE": "Your message", + "PLACEHOLDER": "", + "DESC": "" + }, + "SUCCESS": { + "TITLE": "OK", + "MESSAGE": "Your message has been successfully sent" + } + }, + "PARTNER": { + "SECTOR_CHOICES": { + "_": "Other", + "A": "Β2Β Services", + "B": "Durables", + "C": "Durables (Technology)", + "D": "Education", + "E": "Food", + "F": "Hotels, Cafés and Restaurants", + "G": "Recreation and Culture" + } + }, "SUPPORT": { "PAYMENT_CHOICES": { "A": "National Bank of Greece", "B": "Pireaus Bank", "C": "Eurobank Ergasias", "D": "Alpha Bank", - "E": "PayPal" + "E": "PayPal", + "F": "PayPal.Me" }, "AMOUNT": "Amount", "PAYMENT": "Payment Method", "STORE": "At Store", "BANK": "Bank Deposit", "PAYPAL": "Paypal", + "PAYPAL_ME": "Paypal.me", "CANNOT_SUPPORT": "Cannot Support as Supporting Period is over", "SUCCESS": { "TITLE": "Support is ok", @@ -101,4 +132,4 @@ "Form-title": "Please complete the info" } } -} \ No newline at end of file +}