Commit 2b119181 authored by alish's avatar alish
Browse files

feat: show products in popup order info

parent 3d3f473a
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ export class OrderCardComponent {
	@Input()
	user: IUser;

	@Input()
	showAll = false;

	private _order: Order;

	get order() {
@@ -23,6 +26,8 @@ export class OrderCardComponent {
	set order(order: Order) {
		// use type annotation
		this._order = { ...order } as Order;

		if (!this.showAll) {
			this._order.products = order.products.slice(
				0,
				OrderCardComponent.NOT_EXPANDED_MAX_PRODUCTS_AMOUNT
@@ -30,6 +35,7 @@ export class OrderCardComponent {
			this.notDisplayedProductsAmount =
				order.products.length - this._order.products.length;
		}
	}

	notDisplayedProductsAmount: number;
}
+5 −1
Original line number Diff line number Diff line
@@ -14,5 +14,9 @@
</ion-header>

<ion-content class="order-info-modal-wrap">
	<e-cu-order-card class="order-info-modal" [order]="order"></e-cu-order-card>
	<e-cu-order-card
		class="order-info-modal"
		[showAll]="true"
		[order]="order"
	></e-cu-order-card>
</ion-content>
+3 −2
Original line number Diff line number Diff line
import { Component, OnInit, EventEmitter, OnDestroy } from '@angular/core';
import { NavParams, ModalController } from '@ionic/angular';
import { NavParams, ModalController, NavController } from '@ionic/angular';
import { OrderRouter } from '@modules/client.common.angular2/routers/order-router.service';
import { WarehouseOrdersRouter } from '@modules/client.common.angular2/routers/warehouse-orders-router.service';
import Order from '@modules/server.common/entities/Order';
@@ -23,6 +23,7 @@ export class IssuePage implements OnInit {
		private readonly warehouseOrdersRouter: WarehouseOrdersRouter,
		private readonly store: Store,
		private router: Router,
		public navCtrl: NavController,
		public modalController: ModalController
	) {
		this.modalChange = this.navParams.get('modalChange');
@@ -47,7 +48,7 @@ export class IssuePage implements OnInit {
		localStorage.removeItem('endTime');
		this.store.orderId = null;

		this.router.navigate(['/products']);
		this.navCtrl.navigateRoot('/products');
		await this.modalController.dismiss();
	}
}
+10 −0
Original line number Diff line number Diff line
@@ -11,6 +11,16 @@
			<div style="font-size: 80%;" ng-if="!order?.isPaid">
				{{ byPopupStatuses.NOT_PAID_NOTE }}
			</div>

			<div style="font-size: 80%;">
				<i class="fa fa-shopping-basket"></i>
				<!-- TODO add translate -->
				<span
					(click)="showProductsModal()"
					style="text-decoration: underline; margin-left: 3px;"
					>View products</span
				>
			</div>
		</div>

		<div class="box box-brand-light box-small-padding">
+12 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import { Store } from '../../../services/store.service';
import { CancelPage } from './+cancel/cancel.page';
import { ElapsedTimeComponent } from '../../../components/elapsed-time/elapsed-time.component';
import OrderWarehouseStatus from '@modules/server.common/enums/OrderWarehouseStatus';
import { OrderInfoModalComponent } from './common/order-info-modal/order-info-modal.component';

export enum DeliveryStatus {
	Warehouse,
@@ -205,6 +206,17 @@ export class OrderPage implements OnInit, OnDestroy {
		return 30 + '-' + 60;
	}

	async showProductsModal(): Promise<void> {
		const modal = await this.modalController.create({
			component: OrderInfoModalComponent,
			cssClass: 'products-info-modal',
			componentProps: {
				order: this.order,
			},
		});
		return modal.present();
	}

	public get byPopupStatuses() {
		// this is workaround for access language assets from array.
		const popupStatuses = `BUY_POPUP.${
Loading