parent
624d121006
commit
9e7b91e117
@ -20,7 +20,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<label class="terminal-list-label">Пункты самовывоза</label>
|
<label class="terminal-list-label">Пункты самовывоза</label>
|
||||||
<div *ngIf="deliverData.deliveryType?.title === 'Самовывоз'" class="terminal-list-container">
|
<div *ngIf="deliverData.deliveryType?.name === 'Самовывоз'" class="terminal-list-container">
|
||||||
<div *ngFor="let terminal of terminalList" [ngClass]="{
|
<div *ngFor="let terminal of terminalList" [ngClass]="{
|
||||||
'terminal-container': true,
|
'terminal-container': true,
|
||||||
'selected': terminal.label === selectedTerminal.label
|
'selected': terminal.label === selectedTerminal.label
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<div formGroupName="deliveryDataForm">
|
<div formGroupName="deliveryDataForm">
|
||||||
<p сlass="form-row form-row-wide">
|
<p сlass="form-row form-row-wide">
|
||||||
<p-dropdown [options]="deliveryTypes" formControlName="deliveryType" placeholder="Доставка"
|
<p-dropdown [options]="deliveryTypes" formControlName="deliveryType" placeholder="Доставка"
|
||||||
optionLabel="title" (onChange)="changeDeliveryType($event)"></p-dropdown>
|
optionLabel="name" (onChange)="changeDeliveryType($event)"></p-dropdown>
|
||||||
</p>
|
</p>
|
||||||
<p сlass="form-row form-row-wide">
|
<p сlass="form-row form-row-wide">
|
||||||
<label id="deliveryDate">Время выдачи</label>
|
<label id="deliveryDate">Время выдачи</label>
|
||||||
|
|||||||
@ -109,6 +109,11 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// this.wpJsonService.getTerminalList().subscribe({
|
||||||
|
// next: (value) => {
|
||||||
|
// this.terminalList = value
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAuthorization(showAuthoriztion: boolean, forced = false) {
|
checkAuthorization(showAuthoriztion: boolean, forced = false) {
|
||||||
@ -241,8 +246,8 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _createDeliveryDataForm(): Promise<FormGroup> {
|
private async _createDeliveryDataForm(): Promise<FormGroup> {
|
||||||
this.deliveryTypes = this.checkoutConfig.delivery.values;
|
this.deliveryTypes = this.checkoutConfig.delivery.filter((value: any) => value.isPickUp);
|
||||||
this.deliverData.deliveryType = this.deliveryTypes[this.checkoutConfig.delivery.default];
|
this.deliverData.deliveryType = this.deliveryTypes[0];
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
deliveryDate: [{ value: this.deliverData.deliveryDate, disabled: this.checkoutConfig.timeDelivery.changeTime.disabled }, []],
|
deliveryDate: [{ value: this.deliverData.deliveryDate, disabled: this.checkoutConfig.timeDelivery.changeTime.disabled }, []],
|
||||||
deliveryType: [{ value: this.deliverData.deliveryType, disabled: this.checkoutConfig.delivery.disabled }, [Validators.required]],
|
deliveryType: [{ value: this.deliverData.deliveryType, disabled: this.checkoutConfig.delivery.disabled }, [Validators.required]],
|
||||||
|
|||||||
@ -86,6 +86,7 @@ export interface DeliveryType {
|
|||||||
title: string;
|
title: string;
|
||||||
id: number;
|
id: number;
|
||||||
type: string;
|
type: string;
|
||||||
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AcceptedOrder {
|
export interface AcceptedOrder {
|
||||||
|
|||||||
@ -62,6 +62,10 @@ export class WpJsonService {
|
|||||||
return this._request(`/assets/site-config.json`, 'GET', null, false)
|
return this._request(`/assets/site-config.json`, 'GET', null, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSiteConfigFromIiko(): Observable<any> {
|
||||||
|
return this._request(`/static/settings.json`, 'GET', null, false)
|
||||||
|
}
|
||||||
|
|
||||||
_request(path: string, method: string, body?: any, auth = false, baseUrl?: string): Observable<any> {
|
_request(path: string, method: string, body?: any, auth = false, baseUrl?: string): Observable<any> {
|
||||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
|
|||||||
@ -1,31 +1,45 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from '@angular/core';
|
||||||
import { Actions, createEffect, ofType } from "@ngrx/effects";
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
import { catchError, of, exhaustMap, map, tap } from "rxjs";
|
import {
|
||||||
import { WpJsonService } from "src/app/services/wp-json.service";
|
catchError,
|
||||||
|
of,
|
||||||
|
exhaustMap,
|
||||||
|
map,
|
||||||
|
combineLatest,
|
||||||
|
} from 'rxjs';
|
||||||
|
import { WpJsonService } from 'src/app/services/wp-json.service';
|
||||||
import * as ConfigActions from './config.actions';
|
import * as ConfigActions from './config.actions';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ConfigEffects {
|
export class ConfigEffects {
|
||||||
getConfig$ = createEffect(() =>
|
getConfig$ = createEffect(() =>
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(ConfigActions.getConfig),
|
ofType(ConfigActions.getConfig),
|
||||||
exhaustMap((action) =>
|
exhaustMap((action) =>
|
||||||
this.wpJsonService.getSiteConfig()
|
combineLatest([
|
||||||
.pipe(
|
this.wpJsonService.getSiteConfig(),
|
||||||
map((getSuccessResponse) => {
|
this.wpJsonService.getSiteConfigFromIiko(),
|
||||||
return ConfigActions.getSuccess({ getSuccessResponse })
|
]).pipe(
|
||||||
}
|
map(([config, configFromIiko]) => {
|
||||||
),
|
const allConfig = Object.assign(config.checkout, configFromIiko);
|
||||||
catchError((error) => of(ConfigActions.getFailure({ error })))
|
return allConfig;
|
||||||
)
|
}),
|
||||||
)
|
map((allConfig) => {
|
||||||
|
return {
|
||||||
|
getSuccessResponse: {
|
||||||
|
checkout: allConfig,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
map((value) => ConfigActions.getSuccess(value)),
|
||||||
|
catchError((error) => of(ConfigActions.getFailure({ error })))
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private wpJsonService: WpJsonService,
|
private wpJsonService: WpJsonService
|
||||||
) { }
|
) {}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"label": "Не основная группа",
|
"label": "Терминал1",
|
||||||
"id": "5613101b-e9bf-3e26-0175-88c7ab7e00cf",
|
"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",
|
"image": "https://idei.club/uploads/posts/2022-03/1647392267_5-idei-club-p-supermarket-interer-interer-krasivo-foto-6.jpg",
|
||||||
"address": "ул. Ленина 16"
|
"address": "ул. Ленина 16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Основная группа",
|
"label": "Терминал2",
|
||||||
"id": "5613101b-e9bf-3e26-0175-88c7ab7e00cf",
|
"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",
|
"image": "https://idei.club/uploads/posts/2022-03/1647392267_5-idei-club-p-supermarket-interer-interer-krasivo-foto-6.jpg",
|
||||||
"address": "ул. Ленина 18"
|
"address": "ул. Ленина 18"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user