Commit 0cb98d3e authored by alish's avatar alish
Browse files

feat: add more product

parent 22d8b534
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,8 +51,8 @@ export class WarehouseOrdersRouter implements IWarehouseOrdersRouter {
	): Promise<Order> {
		const order = await this.router.run<IOrder>(
			'addMore',
			userId,
			warehouseId,
			userId,
			orderId,
			products
		);
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@

<div class="hr"></div>

<div class="order-body">
<div (click)="goToOrder()" class="order-body">
	<div class="product-container" *ngFor="let product of order.products">
		<e-cu-order-product
			[orderProduct]="product"
+16 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ import {
	trigger,
} from '@angular/animations';
import { DOCUMENT } from '@angular/common';
import DeliveryType from '@modules/server.common/enums/DeliveryType';
import { NavController } from '@ionic/angular';

@Component({
	selector: 'e-cu-order',
@@ -116,9 +118,22 @@ export class OrderComponent {

	constructor(
		@Inject(DOCUMENT) public document: Document,
		private readonly store: Store
		private readonly store: Store,
		public navCtrl: NavController
	) {}

	goToOrder() {
		if (this.inProcessing) {
			this.navCtrl.navigateRoot(
				`${
					this.store.deliveryType === DeliveryType.Delivery
						? '/order-info'
						: '/order-info-takeaway'
				}`
			);
		}
	}

	private _millisToMinutes(ms) {
		const minutes = Math.floor(ms / 60000);
		const seconds = ((ms % 60000) / 1000).toFixed(0);
+2 −3
Original line number Diff line number Diff line
@@ -297,10 +297,9 @@ export class OrderInfoPage implements OnInit, OnDestroy {
	}

	async closePopup() {
		if (this.clearOrder) {
			localStorage.removeItem('startDate');
			localStorage.removeItem('endTime');

		if (this.clearOrder) {
			this.store.orderId = null;
			this.router.navigate(['/products']);
		}
+16 −5
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ export class ProductsPage implements OnInit, OnDestroy {
			};

			try {
				if (!this.store.orderId) {
					const order = await this.warehouseOrdersRouter.create(
						orderCreateInput
					);
@@ -129,6 +130,14 @@ export class ProductsPage implements OnInit, OnDestroy {
					this.store.orderId = order.id;

					this.store.orderWarehouseId = order.warehouseId;
				} else {
					await this.warehouseOrdersRouter.addMore(
						orderCreateInput.warehouseId,
						orderCreateInput.userId,
						this.store.orderId,
						orderCreateInput.products
					);
				}

				if (environment.ORDER_INFO_TYPE === 'popup') {
					this.showOrderInfoModal();
@@ -267,6 +276,8 @@ export class ProductsPage implements OnInit, OnDestroy {
			if (status < OrderStatus.Delivered) {
				merchantIds = [this.store.orderWarehouseId];
			} else {
				localStorage.removeItem('startDate');
				localStorage.removeItem('endTime');
				this.store.orderId = null;
			}
		}