+ optionLabel="name" (onChange)="changeDeliveryType($event)">
diff --git a/angular/src/app/components/user-data-order/user-data-order.component.ts b/angular/src/app/components/user-data-order/user-data-order.component.ts
index f043439..5e7bbe6 100644
--- a/angular/src/app/components/user-data-order/user-data-order.component.ts
+++ b/angular/src/app/components/user-data-order/user-data-order.component.ts
@@ -109,6 +109,11 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
}
})
+ // this.wpJsonService.getTerminalList().subscribe({
+ // next: (value) => {
+ // this.terminalList = value
+ // }
+ // })
}
checkAuthorization(showAuthoriztion: boolean, forced = false) {
@@ -241,8 +246,8 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
}
private async _createDeliveryDataForm(): Promise {
- this.deliveryTypes = this.checkoutConfig.delivery.values;
- this.deliverData.deliveryType = this.deliveryTypes[this.checkoutConfig.delivery.default];
+ this.deliveryTypes = this.checkoutConfig.delivery.filter((value: any) => value.isPickUp);
+ this.deliverData.deliveryType = this.deliveryTypes[0];
return this.fb.group({
deliveryDate: [{ value: this.deliverData.deliveryDate, disabled: this.checkoutConfig.timeDelivery.changeTime.disabled }, []],
deliveryType: [{ value: this.deliverData.deliveryType, disabled: this.checkoutConfig.delivery.disabled }, [Validators.required]],
diff --git a/angular/src/app/interface/data.ts b/angular/src/app/interface/data.ts
index 4744aa7..c766072 100644
--- a/angular/src/app/interface/data.ts
+++ b/angular/src/app/interface/data.ts
@@ -86,6 +86,7 @@ export interface DeliveryType {
title: string;
id: number;
type: string;
+ name: string;
}
export interface AcceptedOrder {
diff --git a/angular/src/app/services/wp-json.service.ts b/angular/src/app/services/wp-json.service.ts
index 0b3166a..5e579dc 100644
--- a/angular/src/app/services/wp-json.service.ts
+++ b/angular/src/app/services/wp-json.service.ts
@@ -62,6 +62,10 @@ export class WpJsonService {
return this._request(`/assets/site-config.json`, 'GET', null, false)
}
+ getSiteConfigFromIiko(): Observable {
+ return this._request(`/static/settings.json`, 'GET', null, false)
+ }
+
_request(path: string, method: string, body?: any, auth = false, baseUrl?: string): Observable {
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
let headers = new HttpHeaders();
diff --git a/angular/src/app/state/config/config.effects.ts b/angular/src/app/state/config/config.effects.ts
index e3f7d40..e742646 100644
--- a/angular/src/app/state/config/config.effects.ts
+++ b/angular/src/app/state/config/config.effects.ts
@@ -1,31 +1,45 @@
-import { Injectable } from "@angular/core";
-import { Actions, createEffect, ofType } from "@ngrx/effects";
-import { catchError, of, exhaustMap, map, tap } from "rxjs";
-import { WpJsonService } from "src/app/services/wp-json.service";
+import { Injectable } from '@angular/core';
+import { Actions, createEffect, ofType } from '@ngrx/effects';
+import {
+ catchError,
+ of,
+ exhaustMap,
+ map,
+ combineLatest,
+} from 'rxjs';
+import { WpJsonService } from 'src/app/services/wp-json.service';
import * as ConfigActions from './config.actions';
-
@Injectable()
export class ConfigEffects {
- getConfig$ = createEffect(() =>
- this.actions$.pipe(
- ofType(ConfigActions.getConfig),
- exhaustMap((action) =>
- this.wpJsonService.getSiteConfig()
- .pipe(
- map((getSuccessResponse) => {
- return ConfigActions.getSuccess({ getSuccessResponse })
- }
- ),
- catchError((error) => of(ConfigActions.getFailure({ error })))
- )
- )
+ getConfig$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(ConfigActions.getConfig),
+ exhaustMap((action) =>
+ combineLatest([
+ this.wpJsonService.getSiteConfig(),
+ this.wpJsonService.getSiteConfigFromIiko(),
+ ]).pipe(
+ map(([config, configFromIiko]) => {
+ const allConfig = Object.assign(config.checkout, configFromIiko);
+ return allConfig;
+ }),
+ map((allConfig) => {
+ return {
+ getSuccessResponse: {
+ checkout: allConfig,
+ },
+ };
+ }),
+ map((value) => ConfigActions.getSuccess(value)),
+ catchError((error) => of(ConfigActions.getFailure({ error })))
)
+ )
)
+ );
- constructor(
- private actions$: Actions,
- private wpJsonService: WpJsonService,
- ) { }
-
-}
\ No newline at end of file
+ constructor(
+ private actions$: Actions,
+ private wpJsonService: WpJsonService
+ ) {}
+}
diff --git a/angular/src/assets/terminal_list1.json b/angular/src/assets/terminal_list1.json
index bcee5f6..dbe8d19 100644
--- a/angular/src/assets/terminal_list1.json
+++ b/angular/src/assets/terminal_list1.json
@@ -1,12 +1,12 @@
[
{
- "label": "Не основная группа",
+ "label": "Терминал1",
"id": "5613101b-e9bf-3e26-0175-88c7ab7e00cf",
"image": "https://idei.club/uploads/posts/2022-03/1647392267_5-idei-club-p-supermarket-interer-interer-krasivo-foto-6.jpg",
"address": "ул. Ленина 16"
},
{
- "label": "Основная группа",
+ "label": "Терминал2",
"id": "5613101b-e9bf-3e26-0175-88c7ab7e00cf",
"image": "https://idei.club/uploads/posts/2022-03/1647392267_5-idei-club-p-supermarket-interer-interer-krasivo-foto-6.jpg",
"address": "ул. Ленина 18"