Skip to content

Commit

Permalink
feat(com-pwa): car count
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed May 24, 2023
1 parent b87f60e commit d2ea9c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/type/src/customer-order-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const carTypeCS = [
] as const;
export type CarType = (typeof carTypeCS)[number];

export const timePeriodCS = ['auto', '1_2w', '2_3w', '3_4w'] as const;
export const timePeriodCS = ['auto', '3_4w', '2_3w', '1_2w'] as const;
export type TimePeriod = (typeof timePeriodCS)[number];

export const discountTypeCS = ['number', 'percent'] as const;
Expand Down Expand Up @@ -199,7 +199,7 @@ export const orderInfoSchema = {
carType: String,
ladingType: String,
timePeriod: String,
description: String,
// description: String,
},
// discount: Number,
// discountType: String,
Expand Down
12 changes: 8 additions & 4 deletions uniquely/com-pwa/src/content/l18e-fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@
"order_shipping_lading_type_title": "نحوه بارگیری",
"order_shipping_lading_type_key_hand": "دستی",
"order_shipping_lading_type_key_pallet": "پالتی",
"order_shipping_car_type_key_trailer_truck": "تریلی",
"order_shipping_car_type_key_camion_dual": "کامیون جفت",
"order_shipping_car_type_key_camion_solo": "کامیون تک",
"order_shipping_car_type_key_camion_911": "کامیون ۹۱۱",
"order_shipping_car_type_key_camion_800": "کامیون ۸۰۰",
"order_shipping_car_type_key_camion_600": "کامیون ۶۰۰",
"order_shipping_car_type_key_camion_mini": "کامیون مینی",
"order_shipping_car_type_key_nissan": "نیسان",
"order_shipping_car_type_key_one": "تک",
"order_shipping_car_type_key_ten_wheel": "ده چرخ",
"order_shipping_car_type_key_trolley": "تریلی",
"order_shipping_car_type_title": "نوع ماشین",
"order_shipping_time_period_title": "بازه زمانی",
"order_shipping_time_period_key_auto": "در اسرع وقت",
"order_shipping_time_period_key_auto": "مناسب‌ترین زمان",
"order_shipping_time_period_key_1_2w": "یک تا دو هفته",
"order_shipping_time_period_key_2_3w": "دو تا سه هفته",
"order_shipping_time_period_key_3_4w": "سه تا چهار هفته",
Expand Down
4 changes: 2 additions & 2 deletions uniquely/com-pwa/src/manager/controller/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ finiteStateMachineProvider.defineActions<OrderFsm>('order_fsm', {
if (!order.itemList?.length) throw new Error('invalid_type');
// else
fsmInstance.setContext({
newOrder: validator<OrderDraft>(orderInfoSchema, order),
newOrder: validator<OrderDraft>(orderInfoSchema, order, true),
});
return true;
}
Expand All @@ -270,7 +270,7 @@ finiteStateMachineProvider.defineActions<OrderFsm>('order_fsm', {

validate_shipping_info: (fsmInstance): boolean => {
try {
validator(orderShippingInfoSchema, fsmInstance.getContext().newOrder.shippingInfo);
validator(orderShippingInfoSchema, fsmInstance.getContext().newOrder.shippingInfo, true);
return true;
}
catch (err) {
Expand Down
6 changes: 4 additions & 2 deletions uniquely/com-pwa/src/ui/page/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,15 @@ export class AlwatrPageNewOrder extends UnresolvedMixin(LocalizeMixin(SignalMixi
</span>
</div>
<div ?hidden=${order.ladingFee === 0}>
<span>${message('order_summary_lading_price')}:</span>
<span>${message('order_summary_lading_price').replace('${paletteCount}',
number(order.ladingFee / (config.order.lading[order.shippingInfo.carType!]?.fee ?? order.ladingFee)))}:
</span>
<span>${number(order.ladingFee)}<alwatr-icon .name=${'toman'}></alwatr-icon></span>
</div>
<div ?hidden=${order.palletCost === 0}>
<span>
${message('order_summary_palette_price')
.replace('${paletteCount}', (order.palletCost / config.order.pallet.price) + '')}:
.replace('${paletteCount}', number(order.palletCost / config.order.pallet.price))}:
</span>
<span>${number(order.palletCost)}<alwatr-icon .name=${'toman'}></alwatr-icon></span>
</div>
Expand Down

0 comments on commit d2ea9c1

Please sign in to comment.