Skip to content

Commit

Permalink
microcredit single
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtsar committed Jan 25, 2021
1 parent 20ed43f commit 0638094
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 33 deletions.
5 changes: 4 additions & 1 deletion src/app/core/models/microcredit-campaign.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ export interface MicrocreditCampaign {
//partner_payment: Payments[];
partner_payments: PartnerPayment[];
partner_address: PartnerAddress;
partner_slug: string,
partner_phone:string,
partner_email:string,

campaign_id: string,
campaign_imageURL: string,
title: string,
subtitle:string,
subtitle: string,
terms: string,
description: string,
category: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="single-event s_item container" *ngIf="post_event;">
<div class="row">
<div class="offset-lg-2 offset-md-1 col-md-10 col-lg-8">
<div class="offset-md-1 col-md-10">
<div class="row">
<div class="col-md-12 s_item-img">
<img [src]="img" [alt]="post_event.title" />
Expand Down
127 changes: 107 additions & 20 deletions src/app/views/pages/microcredit-single/microcredit-single.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
<div class="single single-campaign s_item container" *ngIf="campaign">
<div class="row">
<div class="offset-md-1 col-md-10">
<div class="row">
<div class="col-md-12 s_item-img">
<img [src]="campaign.campaign_imageURL" [alt]="campaign.title" />
</div>
</div>
<div class="row">
<div class="col-md-12 s_item-info-container">
<h1 class="s_item-title">{{ campaign.title }}</h1>
<div class="s_item-info single-campaign-info row">
<div class="col-md-7">
<div class="data">
<label>{{'CAMPAIGN.Expires' | translate}}:</label> {{campaign.expiresAt | date: 'd.M'}}
</div>
<div class="data">
<label>{{'CAMPAIGN.RedeemDates' | translate}}:</label> {{campaign.redeemStarts | date: 'd.M.y'}} -
{{campaign.redeemEnds | date: 'd.M.y'}}
</div>
<div class="data terms">
<label>
{{'CAMPAIGN.Terms' | translate}}
</label>
<p [innerHTML]="campaign.terms"></p>
</div>
</div>
<div class="col-md-5">
<div class="data price">
<label *ngIf="campaign.quantitative==true&&campaign.stepAmount>1">
{{'CAMPAIGN.Price' | translate}}
</label>
<label *ngIf="campaign.quantitative!=true">
{{'CAMPAIGN.Price' | translate}}
</label>
<label *ngIf="campaign.quantitative==true&&campaign.stepAmount<=1">
{{'CAMPAIGN.PriceFrom' | translate}}
</label>
<br>
<span *ngIf="campaign.quantitative==true&&campaign.stepAmount>1">
{{campaign.stepAmount | currency:'EUR' }}
</span>
<span *ngIf="campaign.quantitative!=true">
{{campaign.minAllowed | currency:'EUR' }}
</span>
<span *ngIf="campaign.quantitative==true&&campaign.stepAmount<=1">
{{campaign.minAllowed | currency:'EUR' }}
</span>
</div>
<div class="support-button">
<!-- Μεγαλο μπλε κουμπι που ανοίγει modal -->
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 s_item-partner ">
<a [routerLink]="['/partner/'+campaign.partner_slug]" title="{{campaign.partner_name}}">
<h5>{{campaign.partner_name}}</h5>
</a>
<a [routerLink]="['/partner/'+campaign.partner_slug]" title="{{campaign.partner_name}}">
<img src="{{campaign.partner_imageURL}}" alt="{{campaign.partner_name}}">
</a>
<div *ngIf="campaign.partner_address">
<span class="mdi mdi-pin"></span> {{campaign.partner_address.street}}, {{campaign.partner_address.city}}
</div>
<div *ngIf="campaign.partner_phone">
<span class="mdi mdi-phone"></span>{{campaign.partner_phone}}
</div>
<div>
<span class="mdi mdi-email"></span>{{campaign.partner_email}}
</div>
</div>
<div class="col-md-9 s_item-content" [innerHTML]="campaign.description">
</div>
</div>
<div class="row">
<div class="col-md-12 archive-link">
<a [routerLink]="['/support']">{{ 'SECTIONS.campaigns-link-to-all' | translate }}</a>
</div>
</div>
</div>
</div>
</div>
<!--
<div *ngIf="campaign" class="campaign-wrapper single">
<div class="fullwidth-title">
<div class="container">
Expand Down Expand Up @@ -61,7 +147,6 @@ <h4>{{ 'SINGLE.CAMPAIGN.Support-title' | translate }}</h4>
<div class="col-md-6 campaign-support">
<p>{{ 'SINGLE.CAMPAIGN.Form-title' | translate }}</p>
<!--start::StepA-Email-->
<form *ngIf="!step" class="kt-form" [formGroup]="registrationForm" autocomplete="off">
<div class="col-md-12 form-group">
<mat-form-field class="col-md-12">
Expand All @@ -83,18 +168,18 @@ <h4>{{ 'SINGLE.CAMPAIGN.Support-title' | translate }}</h4>
</mat-form-field>
</div>
<!--begin::Action-->
<div class="col-md-12 kt-login__actions" style="padding: 0 0 0 0">
<button (click)="onSubmitRegistration()" (keyup.enter)="onSubmitRegistration()" id="kt_login_signin_submit"
class="col-md-12 btn btn-primary"
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{ 'AUTH.GENERAL.SUBMIT_BUTTON' | translate }}</button>
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{ 'AUTH.GENERAL.SUBMIT_BUTTON'
| translate }}</button>
</div>
<!--end::Action-->
</form>
<!--end::StepA-Email-->
<!--start::StepB-Amount&Method-->
<form *ngIf="step" class="kt-form" [formGroup]="supportingForm" autocomplete="off">
<div class="form-group">
<label>{{'SUPPORT.AMOUNT' | translate}}</label>
Expand All @@ -107,13 +192,13 @@ <h4>{{ 'SINGLE.CAMPAIGN.Support-title' | translate }}</h4>
<button [disabled]="!showSubStep" mat-mini-fab class="sub" (click)="onChangeAmount(false)"> - </button>
</div>
</div>
<span *ngIf="isSupportingControlHasError('amount','required')"
class="error text-danger">{{ 'AUTH.VALIDATION.REQUIRED_FIELD' | translate }}</span>
<span *ngIf="isSupportingControlHasError('amount','min')"
class="error text-danger">{{ 'AUTH.VALIDATION.MIN_VALUE_FIELD' | translate }}
<span *ngIf="isSupportingControlHasError('amount','required')" class="error text-danger">{{
'AUTH.VALIDATION.REQUIRED_FIELD' | translate }}</span>
<span *ngIf="isSupportingControlHasError('amount','min')" class="error text-danger">{{
'AUTH.VALIDATION.MIN_VALUE_FIELD' | translate }}
{{ campaign.minAllowed | currency: 'EUR'}}</span>
<span *ngIf="isSupportingControlHasError('amount','max')"
class="error text-danger">{{ 'AUTH.VALIDATION.MAX_VALUE_FIELD' | translate }}
<span *ngIf="isSupportingControlHasError('amount','max')" class="error text-danger">{{
'AUTH.VALIDATION.MAX_VALUE_FIELD' | translate }}
{{ campaign.maxAllowed | currency: 'EUR'}}</span>
</div>
<div class="form-group">
Expand All @@ -123,31 +208,33 @@ <h4>{{ 'SINGLE.CAMPAIGN.Support-title' | translate }}</h4>
<option *ngFor="let payment of paymentsList" value="{{payment.bic}}">
{{payment.title | translate}}</option>
</select>
<span *ngIf="isSupportingControlHasError('method','required')"
class="error text-danger">{{ 'AUTH.VALIDATION.REQUIRED_FIELD' | translate }}</span>
<span *ngIf="isSupportingControlHasError('method','required')" class="error text-danger">{{
'AUTH.VALIDATION.REQUIRED_FIELD' | translate }}</span>
</div>
<!--begin::Action-->
<div class="col-md-12 kt-login__actions" style="padding: 0 0 0 0">
<button (click)="onPreviousStep()" (keyup.enter)="onPreviousStep()" id="kt_login_signin_submit"
class="col-md-12 btn btn-danger"
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{ 'AUTH.GENERAL.PREVIOUS_BUTTON' | translate }}</button>
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{
'AUTH.GENERAL.PREVIOUS_BUTTON' | translate }}</button>
</div>
<div *ngIf="!showPaypalButton" class="col-md-12 kt-login__actions" style="padding: 0 0 0 0">
<button (click)="onSubmitSupporting()" (keyup.enter)="onSubmitSupporting()" id="kt_login_signin_submit"
class="col-md-12 btn btn-primary"
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{ 'AUTH.GENERAL.SUBMIT_BUTTON' | translate }}</button>
[ngClass]="{'spinner spinner--right spinner--md spinner--light': loading}">{{ 'AUTH.GENERAL.SUBMIT_BUTTON'
| translate }}</button>
</div>
<ngx-paypal *ngIf="showPaypalButton" [config]="payPalConfig"></ngx-paypal>
<!--end::Action-->
</form>
<!--end::StepB-Amount&Method-->
</div>
<div class="col-md-6 campaign-terms">
<p>{{campaign.terms}}</p>
</div>
</div>
</div>
</div>
</div>
-->
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@ input::-webkit-inner-spin-button {
}

/* Firefox */
input[type=number] {
input[type="number"] {
-moz-appearance: textfield;
}

.single-campaign {
&-info {
margin-top: 20px;
.data {
label {
font-weight: bold;
}
&.terms {
margin-left: 20px;
margin-top: 20px;
padding-left: 15px;
border-left: 2px solid var(--tertiary);
}
&.price {
text-align: right;
label {
font-size: 18px;
}
span {
font-size: 40px;
line-height: 40px;
color: var(--primary);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class MicrocreditSingleComponent implements OnInit {
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);
});
}
Expand All @@ -82,21 +81,20 @@ export class MicrocreditSingleComponent implements OnInit {
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.titleService.setTitle(this.campaign.title+this.staticDataService.getSiteTitle);
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');
console.log("Can't load campaign");
console.log(error);
}),
takeUntil(this.unsubscribe),
finalize(() => {
Expand All @@ -113,7 +111,7 @@ export class MicrocreditSingleComponent implements OnInit {
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
Validators.maxLength(320)
])
],
});
Expand All @@ -125,7 +123,6 @@ export class MicrocreditSingleComponent implements OnInit {
return currentMethodsArray.includes(el.bic);
});
this.paymentsList = validatePaymentList;

this.supportingForm = this.fb.group({
amount: ['', Validators.compose([
Validators.required,
Expand All @@ -138,7 +135,6 @@ export class MicrocreditSingleComponent implements OnInit {
])
]
});

const controls = this.supportingForm.controls;
controls['amount'].setValue(this.campaign.minAllowed);
this.showSubStep = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="single single-offer s_item container" *ngIf="offer;">
<div class="row">
<div class="offset-lg-2 offset-md-1 col-md-10 col-lg-8">
<div class="offset-md-1 col-md-10">
<div class="row">
<div class="col-md-12 s_item-img">
<img [src]="offer.offer_imageURL" [alt]="offer.title" />
Expand Down
7 changes: 7 additions & 0 deletions src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"EXPIRED": "Έχει Λήξει"
}
},
"CAMPAIGN":{
"Expires":"Ημερομηνία Λήξης",
"RedeemDates":"Περίοδος Εξαργύρωσης",
"Terms":"Τι παίρνω;",
"Price":"Τιμή",
"PriceFrom":"Από"
},
"AUTH": {
"INPUT": {
"EMAIL": "E-mail"
Expand Down
2 changes: 1 addition & 1 deletion src/assets/styles/myassets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
margin-bottom: 40px;
text-align: center;
img{
width: 80%;
width: 90%;
border-radius:6px;
}
}
Expand Down

0 comments on commit 0638094

Please sign in to comment.