Skip to content

Commit

Permalink
Back Browser Button & Modals
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytakis committed Jun 23, 2020
1 parent f8325a1 commit 8b97e39
Show file tree
Hide file tree
Showing 82 changed files with 1,734 additions and 962 deletions.
2 changes: 1 addition & 1 deletion src/app/a-members/new-member/new-member.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NewMemberComponent implements OnInit, OnDestroy {
private unsubscribe: Subject<any>;

/**
* Component constructor
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param fb: FormBuilder
Expand Down
5 changes: 4 additions & 1 deletion src/app/a-partners/new-partner/new-partner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import { PartnerPayment } from 'src/app/core/models/partner_payment.model';
})
export class NewPartnerComponent implements OnInit, OnDestroy {

/**
* Configuration and Static Data
*/
public subAccessConfig: Boolean[] = environment.subAccess;
public paymentsList: PaymentList[];

Expand All @@ -45,7 +48,7 @@ export class NewPartnerComponent implements OnInit, OnDestroy {
private unsubscribe: Subject<any>;

/**
* Component constructor
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param fb: FormBuilder
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class AppComponent implements OnInit, OnDestroy {

// Public properties
loader: boolean;
private unsubscribe: Subscription[] = [];
private unsubscribe: Subscription[] = [];
// Read more: => https://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/

language: LanguageFlag;
Expand All @@ -44,7 +44,7 @@ export class AppComponent implements OnInit, OnDestroy {
},
];
/**
* Component constructor
* Component Constructor
*
* @param translationService: TranslationService
* @param router: Router
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/auth.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class AuthComponent implements OnInit {
public version = `${environment.version}`;

/**
* Component constructor
* Component Constructor
*
* @param el: ElementRef
* @param renderr: Renderer2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class EmailVerificationComponent implements OnInit, OnDestroy {
// Read more: => https://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/forgot_password/forgot_password.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ForgotPasswordComponent implements OnInit, OnDestroy {
loading: boolean = false;

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class LoginComponent implements OnInit, OnDestroy {
// Read more: => https://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class NeedVerificationComponent implements OnInit, OnDestroy {
loading: boolean = false;

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class PasswordRestorationComponent implements OnInit, OnDestroy {
// Read more: => https://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class PasswordVerificationComponent implements OnInit, OnDestroy {
loading: boolean = false;

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder
Expand Down
5 changes: 4 additions & 1 deletion src/app/auth/register-partner/register-partner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import { GeneralList } from 'src/app/core/interfaces/general-list.interface';
})
export class RegisterPartnerComponent implements OnInit, OnDestroy {

/**
* Configuration and Static Data
*/
public paymentsList: PaymentList[];
public sectorList: GeneralList[];

Expand All @@ -47,7 +50,7 @@ export class RegisterPartnerComponent implements OnInit, OnDestroy {
loading: boolean = false;

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/register/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
loading: boolean = false;

/**
* Component constructor
* Component Constructor
*
* @param router: Router
* @param fb: FormBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/terms/synergy_terms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MatDialog } from '@angular/material';
export class TermsComponent implements OnInit, OnDestroy {

/**
* Component constructor
* Component Constructor
*
* @param dialog: MatDialog
*/
Expand Down
2 changes: 1 addition & 1 deletion src/app/content/create-content/create-content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class CreateContentComponent implements OnInit, OnDestroy {
private unsubscribe: Subject<any>;

/**
* Component constructor
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param fb: FormBuilder
Expand Down
2 changes: 1 addition & 1 deletion src/app/content/edit-content/edit-content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class EditContentComponent implements OnInit {
private unsubscribe: Subject<any>;

/**
* Component constructor
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param fb: FormBuilder
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/config/i18n/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ export const locale = {
SUB_OFFER_FORM: {
HEADING_MAIN: 'Λεπτομέρειες Προσφοράς',
HEADING: 'Ποσό Συναλλαγής',
OFFER: 'Προσφορά',
TITLE: 'Ποσότητα',
HINT: 'Παρακαλούμε εισάγετε το ποσό συναλλαγής.',
ALERT: 'Δε φτάνουν οι πόντοι.',
Expand All @@ -845,6 +846,7 @@ export const locale = {
},
SUB_MICROCREDIT_FORM: {
HEADING: 'Τεμάχια Συναλλαγής',
CAMPAIGN: 'Καμπάνια',
CAMPAIGN_ID: 'Ταυτότητα Καμπάνιας',
HEADING_2: 'Πόντοι',
SUPPORT_ID: 'Ταυτότητα Συναλλαγής',
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/config/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ export const locale = {
DRAFT: 'Draft',
EXPECTED: 'Is Expected',
EXPIRED: 'Expired',
REDEEM_TO: 'Redeem To'
REDEEM_TO: 'redeem until'
}
},
SUPPORT: {
Expand Down Expand Up @@ -823,6 +823,7 @@ export const locale = {
SUB_OFFER_FORM: {
HEADING_MAIN: 'Offer Transaction Details',
HEADING: 'Transaction quantity',
OFFER: 'Offer',
TITLE: 'Quantity',
HINT: 'Please enter transaction quantity.',
ALERT: 'Not enough points',
Expand All @@ -844,6 +845,7 @@ export const locale = {
},
SUB_MICROCREDIT_FORM: {
HEADING: 'Support items',
CAMPAIGN: 'Campaign',
CAMPAIGN_ID: 'Campaign ID',
HEADING_2: 'Tokens',
SUPPORT_ID: 'Support ID',
Expand Down
6 changes: 4 additions & 2 deletions src/app/core/helpers/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';

import { AuthenticationService } from '../services/authentication.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

@Injectable({ providedIn: 'root' })
export class AuthGuard implements CanActivate {
Expand All @@ -12,10 +13,11 @@ export class AuthGuard implements CanActivate {

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const currentUser = this.authenticationService.currentUserValue;

if (currentUser) {
return true;
return true;
}
// not logged in so redirect to login page with the return url

this.router.navigate(['/auth/login']);//, { queryParams: { returnUrl: state.url }});
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/helpers/config.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Router, CanActivate, ActivatedRouteSnapshot } from '@angular/router';

import { AuthenticationService } from '../services/authentication.service';
import { environment } from '../../../environments/environment';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

@Injectable({ providedIn: 'root' })
export class ConfigGuard implements CanActivate {
Expand All @@ -15,10 +16,11 @@ export class ConfigGuard implements CanActivate {

// on the data property
const accessIndex = route.data.accessIndex;
console.log(route.data.redirectURL)

if (environment.access[accessIndex] === true) {
return true;
}

this.router.navigate([route.data.redirectURL || '/']);
return false;

Expand Down
23 changes: 17 additions & 6 deletions src/app/history/history.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { NavigationEnd, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { StaticDataService } from '../core/services/static-data.service';

interface Menu {
title?: string,
link?: string,
icon?: string
}
import { Menu } from '../core/interfaces/menu.interface';
// interface Menu {
// title?: string,
// link?: string,
// icon?: string
// }

@Component({
selector: 'app-history',
Expand All @@ -18,14 +19,24 @@ export class HistoryComponent implements OnInit {
currentRouteUrl: string = '';
public menu: Menu[];

/**
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param router: Router
* @param staticDataService: StaticDataService
*/
constructor(
private router: Router,
private cdr: ChangeDetectorRef,
private router: Router,
private staticDataService: StaticDataService
) {
this.menu = this.staticDataService.getHistorySubMenu;
}

/**
* On Init
*/
ngOnInit() {
this.currentRouteUrl = this.router.url.split(/[?#]/)[0];
this.router.events
Expand Down
48 changes: 40 additions & 8 deletions src/app/history/loyalty/loyalty.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Component, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { tap, takeUntil, finalize } from 'rxjs/operators';
import { Subject } from 'rxjs';
// Services

/**
* Services
*/
import { AuthenticationService } from 'src/app/core/services/authentication.service';
import { LoyaltyService } from '../../core/services/loyalty.service';
// Models

/**
* Models & Interfaces
*/
import { LoyaltyTransaction } from '../../core/models/loyalty_transaction.model';

@Component({
Expand All @@ -14,12 +20,24 @@ import { LoyaltyTransaction } from '../../core/models/loyalty_transaction.model'
})
export class LoyaltyHistoryComponent implements OnInit, OnDestroy {

access: string = '';
/**
* Content Variables
*/
public transactions: LoyaltyTransaction[];

access: string = '';

p: number = 1;
loading: boolean = false;
private unsubscribe: Subject<any>;

/**
* Component Constructor
*
* @param cdRef: ChangeDetectorRef
* @param authenticationService: AuthenticationService
* @param loyaltyService: LoyaltyService
*/
constructor(
private cdRef: ChangeDetectorRef,
private authenticationService: AuthenticationService,
Expand All @@ -28,9 +46,27 @@ export class LoyaltyHistoryComponent implements OnInit, OnDestroy {
this.unsubscribe = new Subject();
}

/**
* On Init
*/
ngOnInit() {
this.access = this.authenticationService.currentUserValue.user["access"];
this.fetchTransactions();
}

/**
* On Destroy
*/
ngOnDestroy() {
this.unsubscribe.next();
this.unsubscribe.complete();
this.loading = false;
}

/**
* Fetch Transactions List (for One User)
*/
fetchTransactions() {
this.loyaltyService.readTransactions('0-0-0')
.pipe(
tap(
Expand All @@ -50,9 +86,5 @@ export class LoyaltyHistoryComponent implements OnInit, OnDestroy {
.subscribe();
}

ngOnDestroy() {
this.unsubscribe.next();
this.unsubscribe.complete();
this.loading = false;
}

}
Loading

0 comments on commit 8b97e39

Please sign in to comment.