diff --git a/angular/angular.json b/angular/angular.json
index 55a8176..df5e2f1 100644
--- a/angular/angular.json
+++ b/angular/angular.json
@@ -20,6 +20,7 @@
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "/var/www/html/lk.crm4retail.ru/sakura",
+ "deleteOutputPath": false,
"baseHref": "/",
"index": "src/index.html",
"main": "src/main.ts",
@@ -30,11 +31,10 @@
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest",
- "src/firebase-messaging-sw.js",
- "src/static"
+ "src/firebase-messaging-sw.js"
],
"styles": [
- "node_modules/primeng/resources/themes/bootstrap4-light-blue/theme.css",
+ "node_modules/primeng/resources/themes/saga-blue/theme.css",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/ngx-sharebuttons/themes/modern.scss",
@@ -85,7 +85,8 @@
"browserTarget": "sakura:build:production"
},
"development": {
- "browserTarget": "sakura:build:development"
+ "browserTarget": "sakura:build:development",
+ "proxyConfig": "proxy.confi.json"
}
},
"defaultConfiguration": "development"
diff --git a/angular/src/app/app.constants.ts b/angular/src/app/app.constants.ts
index 8aff840..5b65726 100644
--- a/angular/src/app/app.constants.ts
+++ b/angular/src/app/app.constants.ts
@@ -36,20 +36,20 @@ export const PageListWithBonus: Page[] = [
resName: 'orders',
onSideBar: true,
},
- {
- code: PageCode.UserData,
- name: 'Заполнить анкету',
- description: '',
- resName: 'user-data',
- onSideBar: true
- },
- {
- code: PageCode.RefSystem,
- name: 'Пригласить друга',
- description: '',
- resName: 'ref-system',
- onSideBar: true,
- },
+ // {
+ // code: PageCode.UserData,
+ // name: 'Заполнить анкету',
+ // description: '',
+ // resName: 'user-data',
+ // onSideBar: true
+ // },
+ // {
+ // code: PageCode.RefSystem,
+ // name: 'Пригласить друга',
+ // description: '',
+ // resName: 'ref-system',
+ // onSideBar: true,
+ // },
];
export const PageListMain: Page[] = [
diff --git a/angular/src/app/interface/data.ts b/angular/src/app/interface/data.ts
index 5f9d104..fb5f529 100644
--- a/angular/src/app/interface/data.ts
+++ b/angular/src/app/interface/data.ts
@@ -32,29 +32,32 @@ export interface UserDataForm {
}
export interface BonusProgramAccount {
- BonusProgramName: string;
- BonusProgramTypeID: string;
+ // BonusProgramName: string;
+ // BonusProgramTypeID: string;
CardNumber: number;
Bonuses: number;
- HoldedBonuses: number;
- BonusProgramAccounts: BonusProgramAccount[];
- DateBonusBurn: string;
- _links: any[];
- _embedded: any;
+ // HoldedBonuses: number;
+ // BonusProgramAccounts: BonusProgramAccount[];
+ // DateBonusBurn: string;
+ // _links: any[];
+ // _embedded: any;
}
export interface Purchase {
- PurchaseId?: string;
- CustomerId?: string;
- PurchaseDate: string;
- PurchaseState?: number;
- CardNumber?: number;
- Address?: string
- CheckSummary?: number
- BonusSummary?: number
- ID: string;
- Transactions: Transaction[];
- IsSingleTransaction?: boolean;
+ // PurchaseId?: string;
+ // CustomerId?: string;
+ // PurchaseDate: string;
+ // PurchaseState?: number;
+ // CardNumber?: number;
+ // Address?: string
+ // CheckSummary?: number
+ // BonusSummary?: number
+ // ID: string;
+ // Transactions: Transaction[];
+ // IsSingleTransaction?: boolean;
+ transactionCreateDate: string;
+ orderSum: number;
+ transactionSum: number;
}
export interface Transaction {
diff --git a/angular/src/app/pages/account/account.component.html b/angular/src/app/pages/account/account.component.html
index 2e22bf7..c3225cd 100644
--- a/angular/src/app/pages/account/account.component.html
+++ b/angular/src/app/pages/account/account.component.html
@@ -32,7 +32,7 @@
-
+
diff --git a/angular/src/app/pages/account/auth/auth.component.ts b/angular/src/app/pages/account/auth/auth.component.ts
index b6eed35..f13a256 100644
--- a/angular/src/app/pages/account/auth/auth.component.ts
+++ b/angular/src/app/pages/account/auth/auth.component.ts
@@ -83,11 +83,11 @@ export class AuthComponent {
next: (result) => {
if (result.code === 0) {
this.cookiesService.setCookie('token', result?.data?.token);
- this.router.navigate(['/auth'], {
- queryParams: {
- token: result?.data?.token
- },
- });
+ // this.router.navigate(['/auth'], {
+ // queryParams: {
+ // token: result?.data?.token
+ // },
+ // });
this.phoneConfirmed.emit(null);
} else {
this.errorConfirmCode = true;
diff --git a/angular/src/app/pages/account/bonus-program/bonus-program.component.ts b/angular/src/app/pages/account/bonus-program/bonus-program.component.ts
index 61897fc..9a8c701 100644
--- a/angular/src/app/pages/account/bonus-program/bonus-program.component.ts
+++ b/angular/src/app/pages/account/bonus-program/bonus-program.component.ts
@@ -10,6 +10,7 @@ import { AppleWalletService } from 'src/app/services/apple-wallet.service';
import { CookiesService } from 'src/app/services/cookies.service';
import { DOCUMENT } from '@angular/common';
import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { WpJsonService } from 'src/app/services/wp-json.service';
@Component({
selector: 'app-bonus-program',
@@ -34,94 +35,47 @@ export class BonusProgramComponent implements OnInit {
private cookiesService: CookiesService,
@Inject(DOCUMENT) private document: Document,
private http: HttpClient,
+ private wpJsonService: WpJsonService,
) { }
ngOnInit(): void {
this.getAccountData();
- this.getTypeDevice()
+ this.getTypeDevice();
}
- getTypeDevice() {
- const userAgent = window.navigator.userAgent.toLowerCase()
- const ios = /iphone|ipod|ipad/.test( userAgent );
- this.deviceType = ios ? 'ios' : 'android'
- }
-
- async getAccountData(): Promise{
+ getAccountData() {
+ const token = this.cookiesService.getItem('token')
+ if (!token) {
+ this.cookiesService.deleteCookie('token')
+ this.deauthorization.emit(true)
+ return
+ }
this.loadingBonuses = true;
-
- this.jsonrpc.rpc({
- method: 'getAdditionalInfo',
- params: []
- }, RpcService.authService, true).subscribe({
+ this.wpJsonService.getCustomerInfo(environment.systemId, token, environment.icardProxy).subscribe({
next: (res) => {
- if (res.code == 334) {
- this.cookiesService.deleteCookie('token')
- this.deauthorization.emit(true)
- return
+ this.userName = res.customer_info.name
+ this.accountData = {
+ CardNumber: res.customer_info.cards[0].Number,
+ Bonuses: res.customer_info.walletBalances[0].balance
}
- this.userName = res.data.first_name
+ barcode("#barcode")
+ .options({ font: "OCR-B" }) // Will affect all barcodes
+ .EAN13(`${this.accountData.CardNumber}`.padStart(12, "0"), { fontSize: 18, textMargin: 0 })
+ .render();
+ this.loadingBonuses = false;
},
error: (err) => {
console.error('Error: ', err)
}
- });
+ })
+ }
- this.accountData = (await lastValueFrom(
- this.jsonrpc.rpc({
- method: 'GetAccounts',
- params: []
- },
- RpcService.bonusService
- )))['Cards'][0];
- this.loadingBonuses = false;
-
- barcode("#barcode")
- .options({font: "OCR-B"}) // Will affect all barcodes
- .EAN13(`${this.accountData.CardNumber}`.padStart(12, "0"), {fontSize: 18, textMargin: 0})
- .render();
- const transactions: Transaction[] = (await lastValueFrom(
- this.jsonrpc.rpc(
- {
- method: 'GetAccountTransactions',
- params: []
- },
- RpcService.bonusService
- )))['Transactions'];
-
- const purchases: Purchase[] = (await lastValueFrom(
- this.jsonrpc.rpc(
- {
- method: 'GetAccountPurchase',
- params: []
- },
- RpcService.bonusService
- )))['Purchases'];
-
- this.purchases = purchases.map((purchase) => {
- const id = purchase.ID.slice(0,36).toLowerCase();
- purchase.Transactions = transactions.filter((transaction) => {
- const same = transaction.Purchase === id;
- transaction.HasPurchase = same;
- return same;
- });
- return purchase;
- });
- transactions.forEach((transaction) => {
- if(!transaction.HasPurchase){
- this.purchases.push({
- ID: transaction.ID,
- PurchaseDate: transaction.Date,
- Transactions: [transaction],
- IsSingleTransaction: true,
- })
- }
- });
- this.purchases = this.purchases.sort((a,b) => {
- return moment(a.PurchaseDate).date() - moment(b.PurchaseDate).date();
- });
+ getTypeDevice() {
+ const userAgent = window.navigator.userAgent.toLowerCase()
+ const ios = /iphone|ipod|ipad/.test(userAgent);
+ this.deviceType = ios ? 'ios' : 'android'
}
@@ -146,11 +100,11 @@ export class BonusProgramComponent implements OnInit {
},
error: (err) => {
console.log('Error: ', err);
-
+
}
})
}
-
+
}
}
diff --git a/angular/src/app/pages/account/orders/orders.component.html b/angular/src/app/pages/account/orders/orders.component.html
index e467710..19ce809 100644
--- a/angular/src/app/pages/account/orders/orders.component.html
+++ b/angular/src/app/pages/account/orders/orders.component.html
@@ -9,11 +9,11 @@
>
Дата
-
+ -->