Commit 00220b76 authored by alish's avatar alish
Browse files

feat: add order product comment

parent ccbd8db7
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -626,9 +626,16 @@ export class OrdersService extends DBService<Order>

		orderProduct.comment = comment;

		return this.update(orderId, {
		await this.update(orderId, {
			products: order.products,
		});

		return this.get(orderId, {
			populateWarehouse: true,
			populateCarrier: true,
		})
			.pipe(first())
			.toPromise();
	}

	@asyncListener()
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
			[inProcessing]="inProcessing"
			[orderId]="order.id"
			(remove)="removeProduct(order._id, $event)"
			(onAddComment)="onAddComment.emit($event)"
		></e-cu-order-product>
	</div>
</div>
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@ export class OrderComponent {
	@Output()
	orderChange = new EventEmitter<Order>();

	@Output()
	onAddComment = new EventEmitter<{ comment: string; productId: string }>();

	get id() {
		return this.order.id;
	}
+16 −8
Original line number Diff line number Diff line
@@ -23,22 +23,30 @@
			</div>

			<div *ngIf="inProcessing" class="comment">
				<span
					*ngIf="hasComment && !showAddComment"
					class="comment-text"
					>{{ orderProduct.comment }}</span
				>
				<span *ngIf="hasComment && !showAddComment" class="comment-text"
					>{{ orderProduct.comment }}
					<i
						class="fa fa-pencil-square-o"
						(click)="showCommentBox()"
					></i>
				</span>
				<span
					*ngIf="!hasComment && !showAddComment"
					(click)="toggleCommentBox()"
					(click)="showCommentBox()"
					class="comment-action comment-action-text"
					>Add Comment</span
				>
				<textarea
					*ngIf="showAddComment"
					(change)="addComment($event)"
					(change)="
						onAddComment.emit({
							comment: $event.target.value,
							productId: orderProduct.id
						})
					"
					placeholder="Comment"
				></textarea>
					>{{ orderProduct.comment }}</textarea
				>
			</div>
		</section>
	</div>
+12 −0
Original line number Diff line number Diff line
@@ -75,6 +75,18 @@
			}
		}

		&-text {
			display: flex;
			align-items: center;
			color: #000000;
			font-size: 13px;
			i {
				margin-left: 5px;
				color: #488aff;
				font-size: 18px;
			}
		}

		textarea {
			width: 200px;
		}
Loading