Merge branch 'samandar' into 'dev'
real-boxing See merge request azizziy/cpost!2
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
"safe_warehouse": "安全仓库",
|
"safe_warehouse": "安全仓库",
|
||||||
"we_proud_to_serve_global": "我们以为全球提供最佳的货运和运输解决方案感到自豪。",
|
"we_proud_to_serve_global": "我们以为全球提供最佳的货运和运输解决方案感到自豪。",
|
||||||
"our_services": "我们的服务",
|
"our_services": "我们的服务",
|
||||||
|
|
||||||
"air_transport": "空运",
|
"air_transport": "空运",
|
||||||
"air_transport__subtitle": "CPost提供各类大型和重型货物的空运服务。",
|
"air_transport__subtitle": "CPost提供各类大型和重型货物的空运服务。",
|
||||||
"car_transport": "汽车运输",
|
"car_transport": "汽车运输",
|
||||||
@@ -28,13 +27,11 @@
|
|||||||
"warehouse_yivu_and_guanchjou__subtitle": "CPost在中国提供仓储物流服务,与从中国运输的车辆同时进行。",
|
"warehouse_yivu_and_guanchjou__subtitle": "CPost在中国提供仓储物流服务,与从中国运输的车辆同时进行。",
|
||||||
"customs_office_service": "海关清关服务",
|
"customs_office_service": "海关清关服务",
|
||||||
"customs_office_service__subtitle": "CPost重视客户的时间,并提供货物的海关申报服务。按照HS和TN编码对货物进行分类。",
|
"customs_office_service__subtitle": "CPost重视客户的时间,并提供货物的海关申报服务。按照HS和TN编码对货物进行分类。",
|
||||||
|
|
||||||
"pricing": {
|
"pricing": {
|
||||||
"title": "价格",
|
"title": "价格",
|
||||||
"limit": "交货时间:",
|
"limit": "交货时间:",
|
||||||
"min_weight": "最小重量",
|
"min_weight": "最小重量",
|
||||||
"more": "更多详情",
|
"more": "更多详情",
|
||||||
|
|
||||||
"pricing1": {
|
"pricing1": {
|
||||||
"title": "空运",
|
"title": "空运",
|
||||||
"price": "每千克从$10起",
|
"price": "每千克从$10起",
|
||||||
@@ -60,7 +57,6 @@
|
|||||||
"min_weight": "1立方米"
|
"min_weight": "1立方米"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"our_partners": "我们的合作伙伴",
|
"our_partners": "我们的合作伙伴",
|
||||||
"news_subtitle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
"news_subtitle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||||
"contacts_subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
"contacts_subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
||||||
@@ -70,7 +66,6 @@
|
|||||||
"telegram": "Telegram",
|
"telegram": "Telegram",
|
||||||
"instagram": "Instagram",
|
"instagram": "Instagram",
|
||||||
"real_address": "塔什干市,奥尔马佐尔区,_______街",
|
"real_address": "塔什干市,奥尔马佐尔区,_______街",
|
||||||
|
|
||||||
"faq": {
|
"faq": {
|
||||||
"title": "常见问题",
|
"title": "常见问题",
|
||||||
"subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
"subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
||||||
@@ -79,7 +74,6 @@
|
|||||||
"answer": "大多数物流公司通过其网站或移动应用提供在线追踪服务。您可以输入跟踪号以获取货物的实时位置和状态更新。"
|
"answer": "大多数物流公司通过其网站或移动应用提供在线追踪服务。您可以输入跟踪号以获取货物的实时位置和状态更新。"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"footer_site_info_text": "可靠且快速的物流服务提供商",
|
"footer_site_info_text": "可靠且快速的物流服务提供商",
|
||||||
"privacy_policy": "隐私政策",
|
"privacy_policy": "隐私政策",
|
||||||
"terms_of_use": "使用条款",
|
"terms_of_use": "使用条款",
|
||||||
@@ -89,7 +83,6 @@
|
|||||||
"info": "信息",
|
"info": "信息",
|
||||||
"join_tg": "加入我们的Telegram",
|
"join_tg": "加入我们的Telegram",
|
||||||
"all_rights_reserved": "版权所有",
|
"all_rights_reserved": "版权所有",
|
||||||
|
|
||||||
"calc_obj": {
|
"calc_obj": {
|
||||||
"title": "计算器",
|
"title": "计算器",
|
||||||
"subtitle": "选择您的订单的运输类型和重量,以了解运费。",
|
"subtitle": "选择您的订单的运输类型和重量,以了解运费。",
|
||||||
@@ -107,7 +100,6 @@
|
|||||||
"delivery_type_car": "汽车"
|
"delivery_type_car": "汽车"
|
||||||
},
|
},
|
||||||
"price": "价格",
|
"price": "价格",
|
||||||
|
|
||||||
"__dash": "------------------------------------DASHBOARD------------------------------------------------------",
|
"__dash": "------------------------------------DASHBOARD------------------------------------------------------",
|
||||||
"dashboard": "仪表板",
|
"dashboard": "仪表板",
|
||||||
"parties": "派对",
|
"parties": "派对",
|
||||||
@@ -179,13 +171,10 @@
|
|||||||
"count_of_boxes": "箱子数量",
|
"count_of_boxes": "箱子数量",
|
||||||
"count_of_items": "物品数量",
|
"count_of_items": "物品数量",
|
||||||
"download_excel": "下载Excel",
|
"download_excel": "下载Excel",
|
||||||
|
|
||||||
"enter_party_name_to_find": "输入要查找的派对名称...",
|
"enter_party_name_to_find": "输入要查找的派对名称...",
|
||||||
"enter_box_name_to_find": "输入要查找的箱子名称...",
|
"enter_box_name_to_find": "输入要查找的箱子名称...",
|
||||||
"enter_client_name_to_find": "输入要查找的客户名称...",
|
"enter_client_name_to_find": "输入要查找的客户名称...",
|
||||||
|
|
||||||
"filter_packet_name": "封包名稱過濾器",
|
"filter_packet_name": "封包名稱過濾器",
|
||||||
|
|
||||||
"filter_party_name": "派对名称过滤器",
|
"filter_party_name": "派对名称过滤器",
|
||||||
"filter_box_name": "箱子名称过滤器",
|
"filter_box_name": "箱子名称过滤器",
|
||||||
"filter_track_id": "跟踪ID过滤器",
|
"filter_track_id": "跟踪ID过滤器",
|
||||||
@@ -193,7 +182,6 @@
|
|||||||
"filter_item_name": "产品名称过滤器",
|
"filter_item_name": "产品名称过滤器",
|
||||||
"filter_by_box_status": "箱子状态过滤器",
|
"filter_by_box_status": "箱子状态过滤器",
|
||||||
"filter_by_party_status": "派对状态过滤器",
|
"filter_by_party_status": "派对状态过滤器",
|
||||||
|
|
||||||
"COLLECTING": "收集中",
|
"COLLECTING": "收集中",
|
||||||
"ON_THE_WAY": "在路上",
|
"ON_THE_WAY": "在路上",
|
||||||
"ARRIVED": "已到达",
|
"ARRIVED": "已到达",
|
||||||
@@ -202,7 +190,6 @@
|
|||||||
"IN_CUSTOMS": "在海關",
|
"IN_CUSTOMS": "在海關",
|
||||||
"IN_WAREHOUSE": "接觸客戶",
|
"IN_WAREHOUSE": "接觸客戶",
|
||||||
"DELIVERED": "發表",
|
"DELIVERED": "發表",
|
||||||
|
|
||||||
"add_photo_to_item": "將照片加入項目",
|
"add_photo_to_item": "將照片加入項目",
|
||||||
"photo": "照片",
|
"photo": "照片",
|
||||||
"summa": "總結",
|
"summa": "總結",
|
||||||
@@ -221,5 +208,7 @@
|
|||||||
"passport": "護照",
|
"passport": "護照",
|
||||||
"weight_of_items": "產品重量",
|
"weight_of_items": "產品重量",
|
||||||
"update_packet": "編輯套件",
|
"update_packet": "編輯套件",
|
||||||
"party_weight": "大量重量"
|
"party_weight": "大量重量",
|
||||||
|
"qr_code": "二维码",
|
||||||
|
"created_at": "添加日期"
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
"safe_warehouse": "Secure Warehouse",
|
"safe_warehouse": "Secure Warehouse",
|
||||||
"we_proud_to_serve_global": "We take pride in providing the best freight and transportation solutions worldwide.",
|
"we_proud_to_serve_global": "We take pride in providing the best freight and transportation solutions worldwide.",
|
||||||
"our_services": "Our Services",
|
"our_services": "Our Services",
|
||||||
|
|
||||||
"air_transport": "Air Transport",
|
"air_transport": "Air Transport",
|
||||||
"air_transport__subtitle": "CPost offers air transportation for a wide range of large-sized and heavy goods.",
|
"air_transport__subtitle": "CPost offers air transportation for a wide range of large-sized and heavy goods.",
|
||||||
"car_transport": "Car Transport",
|
"car_transport": "Car Transport",
|
||||||
@@ -28,13 +27,11 @@
|
|||||||
"warehouse_yivu_and_guanchjou__subtitle": "CPost offers the use of warehouse logistics services in China simultaneously with transporting vehicles from China.",
|
"warehouse_yivu_and_guanchjou__subtitle": "CPost offers the use of warehouse logistics services in China simultaneously with transporting vehicles from China.",
|
||||||
"customs_office_service": "Customs Clearance Services",
|
"customs_office_service": "Customs Clearance Services",
|
||||||
"customs_office_service__subtitle": "CPost values its customers' time and offers customs declaration services for goods. Classification of goods by HS and TN codes.",
|
"customs_office_service__subtitle": "CPost values its customers' time and offers customs declaration services for goods. Classification of goods by HS and TN codes.",
|
||||||
|
|
||||||
"pricing": {
|
"pricing": {
|
||||||
"title": "Pricing",
|
"title": "Pricing",
|
||||||
"limit": "Delivery time:",
|
"limit": "Delivery time:",
|
||||||
"min_weight": "Minimum Weight",
|
"min_weight": "Minimum Weight",
|
||||||
"more": "More Details",
|
"more": "More Details",
|
||||||
|
|
||||||
"pricing1": {
|
"pricing1": {
|
||||||
"title": "Air Transport",
|
"title": "Air Transport",
|
||||||
"price": "From $10/KG",
|
"price": "From $10/KG",
|
||||||
@@ -60,7 +57,6 @@
|
|||||||
"min_weight": "1m3"
|
"min_weight": "1m3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"our_partners": "Our Partners",
|
"our_partners": "Our Partners",
|
||||||
"news_subtitle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
"news_subtitle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||||
"contacts_subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
"contacts_subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
||||||
@@ -70,7 +66,6 @@
|
|||||||
"telegram": "Telegram",
|
"telegram": "Telegram",
|
||||||
"instagram": "Instagram",
|
"instagram": "Instagram",
|
||||||
"real_address": "Tashkent city, Olmazor district, _______ street",
|
"real_address": "Tashkent city, Olmazor district, _______ street",
|
||||||
|
|
||||||
"faq": {
|
"faq": {
|
||||||
"title": "Frequently Asked Questions",
|
"title": "Frequently Asked Questions",
|
||||||
"subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
"subtitle": "Creative mouse is here for you to make sure you can build a more resilient portfolio. We curate bespoke offerings across alternative.",
|
||||||
@@ -79,7 +74,6 @@
|
|||||||
"answer": "Most logistics companies provide online tracking services through their websites or mobile apps. You can enter your tracking number to get real-time updates on the delivery location and status."
|
"answer": "Most logistics companies provide online tracking services through their websites or mobile apps. You can enter your tracking number to get real-time updates on the delivery location and status."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"footer_site_info_text": "Reliable and Fast Logistics Service Provider",
|
"footer_site_info_text": "Reliable and Fast Logistics Service Provider",
|
||||||
"privacy_policy": "Privacy Policy",
|
"privacy_policy": "Privacy Policy",
|
||||||
"terms_of_use": "Terms of Use",
|
"terms_of_use": "Terms of Use",
|
||||||
@@ -89,7 +83,6 @@
|
|||||||
"info": "Information",
|
"info": "Information",
|
||||||
"join_tg": "Join our telegram",
|
"join_tg": "Join our telegram",
|
||||||
"all_rights_reserved": "All Rights Reserved",
|
"all_rights_reserved": "All Rights Reserved",
|
||||||
|
|
||||||
"calc_obj": {
|
"calc_obj": {
|
||||||
"title": "Calculator",
|
"title": "Calculator",
|
||||||
"subtitle": "Select the delivery type and weight of your order to find out the delivery cost",
|
"subtitle": "Select the delivery type and weight of your order to find out the delivery cost",
|
||||||
@@ -107,7 +100,6 @@
|
|||||||
"delivery_type_car": "Auto"
|
"delivery_type_car": "Auto"
|
||||||
},
|
},
|
||||||
"price": "Price",
|
"price": "Price",
|
||||||
|
|
||||||
"__dash": "------------------------------------DASHBOARD------------------------------------------------------",
|
"__dash": "------------------------------------DASHBOARD------------------------------------------------------",
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
"parties": "Parties",
|
"parties": "Parties",
|
||||||
@@ -179,12 +171,10 @@
|
|||||||
"count_of_boxes": "Count of boxes",
|
"count_of_boxes": "Count of boxes",
|
||||||
"count_of_items": "Count of items",
|
"count_of_items": "Count of items",
|
||||||
"download_excel": "Download excel",
|
"download_excel": "Download excel",
|
||||||
|
|
||||||
"enter_party_name_to_find": "Enter party name to find...",
|
"enter_party_name_to_find": "Enter party name to find...",
|
||||||
"enter_box_name_to_find": "Enter box name to find...",
|
"enter_box_name_to_find": "Enter box name to find...",
|
||||||
"enter_client_name_to_find": "Enter client name to find...",
|
"enter_client_name_to_find": "Enter client name to find...",
|
||||||
"filter_packet_name": "Packet name filter",
|
"filter_packet_name": "Packet name filter",
|
||||||
|
|
||||||
"filter_party_name": "Party name filter",
|
"filter_party_name": "Party name filter",
|
||||||
"filter_box_name": "Box name filter",
|
"filter_box_name": "Box name filter",
|
||||||
"filter_track_id": "Track id filter",
|
"filter_track_id": "Track id filter",
|
||||||
@@ -192,7 +182,6 @@
|
|||||||
"filter_item_name": "Product name filter",
|
"filter_item_name": "Product name filter",
|
||||||
"filter_by_box_status": "Box Status filter",
|
"filter_by_box_status": "Box Status filter",
|
||||||
"filter_by_party_status": "Party Status filter",
|
"filter_by_party_status": "Party Status filter",
|
||||||
|
|
||||||
"COLLECTING": "Collecting",
|
"COLLECTING": "Collecting",
|
||||||
"ON_THE_WAY": "On the way",
|
"ON_THE_WAY": "On the way",
|
||||||
"ARRIVED": "Arrived",
|
"ARRIVED": "Arrived",
|
||||||
@@ -201,7 +190,6 @@
|
|||||||
"IN_CUSTOMS": "At customs",
|
"IN_CUSTOMS": "At customs",
|
||||||
"IN_WAREHOUSE": "Reaching out to customers",
|
"IN_WAREHOUSE": "Reaching out to customers",
|
||||||
"DELIVERED": "Delivered",
|
"DELIVERED": "Delivered",
|
||||||
|
|
||||||
"add_photo_to_item": "Add photo to item",
|
"add_photo_to_item": "Add photo to item",
|
||||||
"photo": "photo",
|
"photo": "photo",
|
||||||
"summa": "summa",
|
"summa": "summa",
|
||||||
@@ -220,5 +208,8 @@
|
|||||||
"passport": "Passport",
|
"passport": "Passport",
|
||||||
"weight_of_items": "Products weight",
|
"weight_of_items": "Products weight",
|
||||||
"update_packet": "Edit Paket",
|
"update_packet": "Edit Paket",
|
||||||
"party_weight": "Batch weight"
|
"party_weight": "Batch weight",
|
||||||
|
|
||||||
|
"qr_code": "QR Code",
|
||||||
|
"created_at": "Date of joining"
|
||||||
}
|
}
|
||||||
@@ -221,5 +221,8 @@
|
|||||||
"passport": "Паспорт",
|
"passport": "Паспорт",
|
||||||
"weight_of_items": "Вес продукта",
|
"weight_of_items": "Вес продукта",
|
||||||
"update_packet": "Редактировать пакет",
|
"update_packet": "Редактировать пакет",
|
||||||
"party_weight": "Вес партии"
|
"party_weight": "Вес партии",
|
||||||
|
|
||||||
|
"qr_code": "QR код",
|
||||||
|
"created_at": "Дата добавления"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
"parties": "Partiyalar",
|
"parties": "Partiyalar",
|
||||||
"create_party": "Partiya yaratish",
|
"create_party": "Partiya yaratish",
|
||||||
"update_party": "Partiyani yangilash",
|
"update_party": "Partiyani yangilash",
|
||||||
"create_box": "Qutni yaratish",
|
"create_box": "Qutini yaratish",
|
||||||
"create_packet": "Paket yaratish",
|
"create_packet": "Paket yaratish",
|
||||||
"update_box": "Qutni yangilash",
|
"update_box": "Qutni yangilash",
|
||||||
"update_package": "Paketni yangilash",
|
"update_package": "Paketni yangilash",
|
||||||
@@ -220,5 +220,8 @@
|
|||||||
"are_you_sure_delete_party": "{name} yuk partiyasini o'chirishga ishonchingiz komilmi?",
|
"are_you_sure_delete_party": "{name} yuk partiyasini o'chirishga ishonchingiz komilmi?",
|
||||||
"passport": "Pasport",
|
"passport": "Pasport",
|
||||||
"update_packet": "Paketni Tahrirlash",
|
"update_packet": "Paketni Tahrirlash",
|
||||||
"party_weight": "Partiya og'irligi"
|
"party_weight": "Partiya og'irligi",
|
||||||
|
|
||||||
|
"qr_code": "QR kod",
|
||||||
|
"created_at": "Qo‘shilgan sana"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ export const routes = [
|
|||||||
roles: [UserRoleEnum.ADMIN, UserRoleEnum.CHINA_WORKER],
|
roles: [UserRoleEnum.ADMIN, UserRoleEnum.CHINA_WORKER],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'boxes',
|
title: 'packet',
|
||||||
path: pageLinks.dashboard.real_boxes.index,
|
path: pageLinks.dashboard.boxes.index,
|
||||||
icon: (
|
icon: (
|
||||||
<SvgIcon fontSize='small'>
|
<SvgIcon fontSize='small'>
|
||||||
<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>
|
<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'>
|
||||||
<path
|
<path
|
||||||
d='M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 14H15.44C15.08 14 14.76 14.19 14.58 14.5C14.06 15.4 13.11 16 12 16C10.89 16 9.94 15.4 9.42 14.5C9.24 14.19 8.91 14 8.56 14H5V5H19V14ZM14.79 10H13V7C13 6.45 12.55 6 12 6C11.45 6 11 6.45 11 7V10H9.21C8.76 10 8.54 10.54 8.86 10.85L11.65 13.64C11.85 13.84 12.16 13.84 12.36 13.64L15.15 10.85C15.46 10.54 15.24 10 14.79 10Z'
|
d='M17.578 4.432L15.578 3.382C13.822 2.461 12.944 2 12 2C11.056 2 10.178 2.46 8.422 3.382L8.101 3.551L17.024 8.65L21.04 6.64C20.394 5.908 19.352 5.361 17.578 4.43M21.748 7.964L17.75 9.964V13C17.75 13.1989 17.671 13.3897 17.5303 13.5303C17.3897 13.671 17.1989 13.75 17 13.75C16.8011 13.75 16.6103 13.671 16.4697 13.5303C16.329 13.3897 16.25 13.1989 16.25 13V10.714L12.75 12.464V21.904C13.468 21.725 14.285 21.297 15.578 20.618L17.578 19.568C19.729 18.439 20.805 17.875 21.403 16.86C22 15.846 22 14.583 22 12.06V11.943C22 10.05 22 8.866 21.748 7.964ZM11.25 21.904V12.464L2.252 7.964C2 8.866 2 10.05 2 11.941V12.058C2 14.583 2 15.846 2.597 16.86C3.195 17.875 4.271 18.44 6.422 19.569L8.422 20.618C9.715 21.297 10.532 21.725 11.25 21.904ZM2.96 6.641L12 11.161L15.411 9.456L6.525 4.378L6.422 4.432C4.649 5.362 3.606 5.909 2.96 6.642'
|
||||||
fill='currentColor'
|
fill='currentColor'
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
@@ -49,13 +49,13 @@ export const routes = [
|
|||||||
roles: [UserRoleEnum.ADMIN, UserRoleEnum.CHINA_WORKER],
|
roles: [UserRoleEnum.ADMIN, UserRoleEnum.CHINA_WORKER],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'packet',
|
title: 'boxes',
|
||||||
path: pageLinks.dashboard.boxes.index,
|
path: pageLinks.dashboard.real_boxes.index,
|
||||||
icon: (
|
icon: (
|
||||||
<SvgIcon fontSize='small'>
|
<SvgIcon fontSize='small'>
|
||||||
<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'>
|
<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>
|
||||||
<path
|
<path
|
||||||
d='M17.578 4.432L15.578 3.382C13.822 2.461 12.944 2 12 2C11.056 2 10.178 2.46 8.422 3.382L8.101 3.551L17.024 8.65L21.04 6.64C20.394 5.908 19.352 5.361 17.578 4.43M21.748 7.964L17.75 9.964V13C17.75 13.1989 17.671 13.3897 17.5303 13.5303C17.3897 13.671 17.1989 13.75 17 13.75C16.8011 13.75 16.6103 13.671 16.4697 13.5303C16.329 13.3897 16.25 13.1989 16.25 13V10.714L12.75 12.464V21.904C13.468 21.725 14.285 21.297 15.578 20.618L17.578 19.568C19.729 18.439 20.805 17.875 21.403 16.86C22 15.846 22 14.583 22 12.06V11.943C22 10.05 22 8.866 21.748 7.964ZM11.25 21.904V12.464L2.252 7.964C2 8.866 2 10.05 2 11.941V12.058C2 14.583 2 15.846 2.597 16.86C3.195 17.875 4.271 18.44 6.422 19.569L8.422 20.618C9.715 21.297 10.532 21.725 11.25 21.904ZM2.96 6.641L12 11.161L15.411 9.456L6.525 4.378L6.422 4.432C4.649 5.362 3.606 5.909 2.96 6.642'
|
d='M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 14H15.44C15.08 14 14.76 14.19 14.58 14.5C14.06 15.4 13.11 16 12 16C10.89 16 9.94 15.4 9.42 14.5C9.24 14.19 8.91 14 8.56 14H5V5H19V14ZM14.79 10H13V7C13 6.45 12.55 6 12 6C11.45 6 11 6.45 11 7V10H9.21C8.76 10 8.54 10.54 8.86 10.85L11.65 13.64C11.85 13.84 12.16 13.84 12.36 13.64L15.15 10.85C15.46 10.54 15.24 10 14.79 10Z'
|
||||||
fill='currentColor'
|
fill='currentColor'
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
74
src/data/real-box/real-box.model.ts
Normal file
74
src/data/real-box/real-box.model.ts
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
export type BoxStatus = 'READY_TO_INVOICE' | 'READY';
|
||||||
|
export const BoxStatusList: BoxStatus[] = ['READY_TO_INVOICE', 'READY'];
|
||||||
|
|
||||||
|
export interface IBox {
|
||||||
|
packetNetWeight: string;
|
||||||
|
totalNetWeight: string;
|
||||||
|
cargoId: string;
|
||||||
|
passportName: string;
|
||||||
|
id: number;
|
||||||
|
partyName: string;
|
||||||
|
boxType: string;
|
||||||
|
name: string;
|
||||||
|
volume: string;
|
||||||
|
boxWeight: number;
|
||||||
|
brutto: number;
|
||||||
|
hasInvoice: boolean;
|
||||||
|
totalItems: number;
|
||||||
|
status: BoxStatus;
|
||||||
|
totalBrutto: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBoxDetail {
|
||||||
|
packet: {
|
||||||
|
id: number;
|
||||||
|
cargoId: string;
|
||||||
|
packetNetWeight: number;
|
||||||
|
passportName: string;
|
||||||
|
totalItems: number;
|
||||||
|
totalNetWeight: number;
|
||||||
|
partyName: string;
|
||||||
|
partyId: string;
|
||||||
|
boxType: string;
|
||||||
|
name: string;
|
||||||
|
volume: string;
|
||||||
|
boxWeight: number;
|
||||||
|
brutto: number;
|
||||||
|
hasInvoice: boolean;
|
||||||
|
status: BoxStatus;
|
||||||
|
};
|
||||||
|
client: {
|
||||||
|
passportId: number;
|
||||||
|
passportName: string;
|
||||||
|
};
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
id: number;
|
||||||
|
partyName: string;
|
||||||
|
boxName: string;
|
||||||
|
cargoId: string;
|
||||||
|
trekId: string;
|
||||||
|
name: string;
|
||||||
|
nameRu: string;
|
||||||
|
amount: number;
|
||||||
|
weight: number;
|
||||||
|
price: number;
|
||||||
|
totalPrice: number;
|
||||||
|
hasImage: boolean;
|
||||||
|
imageUrl: string | null;
|
||||||
|
packetName: string;
|
||||||
|
status: BoxStatus;
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RealCreateBoxBodyType = {
|
||||||
|
partyName: string,
|
||||||
|
packetDtos: number[]
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateRealBoxBodyType = {
|
||||||
|
boxId: string,
|
||||||
|
partyName: string,
|
||||||
|
packetDtos: number[]
|
||||||
|
};
|
||||||
63
src/data/real-box/real-box.requests.ts
Normal file
63
src/data/real-box/real-box.requests.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import { IBox, UpdateBoxBodyType, IBoxDetail, BoxStatus } from '@/data/box/box.model';
|
||||||
|
import { CommonResponseType, PageAble } from '@/helpers/types';
|
||||||
|
import { request } from '@/services/request';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { RealCreateBoxBodyType, UpdateRealBoxBodyType } from './real-box.model';
|
||||||
|
|
||||||
|
export const real_box_requests = {
|
||||||
|
async getAll(params?: {
|
||||||
|
page?: number;
|
||||||
|
sort?: string;
|
||||||
|
direction?: string;
|
||||||
|
cargoId?: string;
|
||||||
|
partyId?: string | number;
|
||||||
|
status?: BoxStatus;
|
||||||
|
}) {
|
||||||
|
return request.get<CommonResponseType<PageAble<IBox>>>('/boxes/list', { params });
|
||||||
|
},
|
||||||
|
async create({ ...body }: RealCreateBoxBodyType) {
|
||||||
|
return request.post<CommonResponseType>('/boxes/create', body);
|
||||||
|
},
|
||||||
|
async update({ boxId, ...body }: UpdateRealBoxBodyType) {
|
||||||
|
return request.put<CommonResponseType>('/packets/update', body, {
|
||||||
|
params: { boxId },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async find(params: { packetId?: number | string }) {
|
||||||
|
return request.get<CommonResponseType<IBoxDetail>>('/packets/find', { params });
|
||||||
|
},
|
||||||
|
async delete(params: { packetId: number | string }) {
|
||||||
|
return request.delete<CommonResponseType>('/packets/delete', { params });
|
||||||
|
},
|
||||||
|
async downloadExcel(params: { packetId: number | string }) {
|
||||||
|
return request.get<Blob>('/packets/download', { params, responseType: 'blob' });
|
||||||
|
},
|
||||||
|
async translateWithGoogleApi(params: { text: string }): Promise<string> {
|
||||||
|
const response = await axios.post('https://translation.googleapis.com/language/translate/v2', undefined, {
|
||||||
|
params: {
|
||||||
|
q: params.text,
|
||||||
|
target: 'ru',
|
||||||
|
source: 'zh',
|
||||||
|
key: 'AIzaSyA5uAPZyjF_yo1hYOWWJ2uP7XgcmohZc8o',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return response.data.data.translations?.[0]?.translatedText ?? '';
|
||||||
|
},
|
||||||
|
async translateWithMemoryApi(params: { text: string }): Promise<string> {
|
||||||
|
const response = await axios.get<{
|
||||||
|
responseData: {
|
||||||
|
translatedText: string;
|
||||||
|
match: number;
|
||||||
|
};
|
||||||
|
}>('https://api.mymemory.translated.net/get', {
|
||||||
|
params: {
|
||||||
|
q: params.text,
|
||||||
|
langpair: 'zh|ru',
|
||||||
|
// key: '7a4ac2e07cde1ff1e9de',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return response.data.responseData.translatedText;
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -193,7 +193,7 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue('passportId', '');
|
setValue('passportId', 'AA1234567');
|
||||||
}, [cargoId]);
|
}, [cargoId]);
|
||||||
|
|
||||||
const { data: defaultParties, status: defaultPartiesStatus } = useRequest(() => party_requests.getAll({ status: 'COLLECTING' }), {
|
const { data: defaultParties, status: defaultPartiesStatus } = useRequest(() => party_requests.getAll({ status: 'COLLECTING' }), {
|
||||||
|
|||||||
@@ -1,34 +1,25 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import BaseButton from '@/components/ui-kit/BaseButton';
|
import BaseButton from '@/components/ui-kit/BaseButton';
|
||||||
import BaseInput from '@/components/ui-kit/BaseInput';
|
|
||||||
import { party_requests } from '@/data/party/party.requests';
|
import { party_requests } from '@/data/party/party.requests';
|
||||||
import { pageLinks } from '@/helpers/constants';
|
import { pageLinks } from '@/helpers/constants';
|
||||||
import { notifyError, notifyUnknownError } from '@/services/notification';
|
import { notifyUnknownError } from '@/services/notification';
|
||||||
import { Box, Divider, FormHelperText, Grid, Stack, Typography, styled } from '@mui/material';
|
import { Box, FormHelperText, Grid, Stack, Typography, styled } from '@mui/material';
|
||||||
import { useParams, useRouter, useSearchParams } from 'next/navigation';
|
import { useSearchParams } from 'next/navigation';
|
||||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useLocale } from 'use-intl';
|
|
||||||
import { Controller, useFieldArray, useForm } from 'react-hook-form';
|
import { Controller, useFieldArray, useForm } from 'react-hook-form';
|
||||||
import BaseIconButton from '@/components/ui-kit/BaseIconButton';
|
import BaseIconButton from '@/components/ui-kit/BaseIconButton';
|
||||||
import { AddCircleRounded, Close } from '@mui/icons-material';
|
import { AddCircleRounded, Close } from '@mui/icons-material';
|
||||||
import { box_requests } from '@/data/box/box.requests';
|
|
||||||
import useRequest from '@/hooks/useRequest';
|
import useRequest from '@/hooks/useRequest';
|
||||||
import { useMyTranslation } from '@/hooks/useMyTranslation';
|
import { useMyTranslation } from '@/hooks/useMyTranslation';
|
||||||
import { BoxStatus, CreateBoxBodyType, UpdateBoxBodyType } from '@/data/box/box.model';
|
import { selectDefaultStyles } from '@/components/ui-kit/BaseReactSelect';
|
||||||
import BaseReactSelect, { selectDefaultStyles } from '@/components/ui-kit/BaseReactSelect';
|
|
||||||
import { customer_requests } from '@/data/customers/customer.requests';
|
|
||||||
import { useAuthContext } from '@/context/auth-context';
|
import { useAuthContext } from '@/context/auth-context';
|
||||||
import { useMyNavigation } from '@/hooks/useMyNavigation';
|
import { useMyNavigation } from '@/hooks/useMyNavigation';
|
||||||
import AsyncSelect from 'react-select/async';
|
import AsyncSelect from 'react-select/async';
|
||||||
import { Party } from '@/data/party/party.model';
|
import { box_requests } from '@/data/box/box.requests';
|
||||||
import cloneDeep from 'lodash.clonedeep';
|
import { real_box_requests } from '@/data/real-box/real-box.requests';
|
||||||
import { item_requests } from '@/data/item/item.requests';
|
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import Loader from '@/components/common/Loader';
|
|
||||||
import { Customer } from '@/data/customers/customer.model';
|
|
||||||
import { Passport } from '@/data/passport/passport.model';
|
|
||||||
import { passport_requests } from '@/data/passport/passport.request';
|
|
||||||
|
|
||||||
const StyledCreateBox = styled(Box)`
|
const StyledCreateBox = styled(Box)`
|
||||||
.item-row {
|
.item-row {
|
||||||
@@ -38,9 +29,6 @@ const StyledCreateBox = styled(Box)`
|
|||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-row-field {
|
|
||||||
}
|
|
||||||
|
|
||||||
& > * {
|
& > * {
|
||||||
flex: 1 1 1;
|
flex: 1 1 1;
|
||||||
}
|
}
|
||||||
@@ -50,27 +38,14 @@ type Props = {
|
|||||||
partiesData?: { value: number; label: string }[];
|
partiesData?: { value: number; label: string }[];
|
||||||
initialValues?: {
|
initialValues?: {
|
||||||
id: number;
|
id: number;
|
||||||
|
boxId: string;
|
||||||
box_name: string;
|
box_name: string;
|
||||||
net_weight: number;
|
|
||||||
box_weight: number;
|
|
||||||
box_type: string;
|
|
||||||
box_size: string;
|
|
||||||
status: BoxStatus;
|
|
||||||
packetId: string;
|
|
||||||
|
|
||||||
passportName: string;
|
|
||||||
passportId: number;
|
|
||||||
partyId: number;
|
partyId: number;
|
||||||
partyName: string;
|
partyName: string;
|
||||||
|
packetId: string;
|
||||||
clientId: number;
|
|
||||||
client_id: string;
|
|
||||||
clientName: string;
|
|
||||||
|
|
||||||
products_list: {
|
products_list: {
|
||||||
id: number;
|
id: number;
|
||||||
price: number | string;
|
price: number | string;
|
||||||
|
|
||||||
cargoId: string;
|
cargoId: string;
|
||||||
trekId: string;
|
trekId: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -82,121 +57,80 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
||||||
const [cargoIdValue, setCargoIdValue] = useState<string>('');
|
|
||||||
const { user, isAdmin: isAdminUser } = useAuthContext();
|
const { user, isAdmin: isAdminUser } = useAuthContext();
|
||||||
const editMode = !!initialValues && !!initialValues.id;
|
const editMode = !!initialValues && !!initialValues.id;
|
||||||
const isAdmin = isAdminUser && editMode;
|
const isAdmin = isAdminUser && editMode;
|
||||||
const t = useMyTranslation();
|
const t = useMyTranslation();
|
||||||
const params = useSearchParams();
|
const params = useSearchParams();
|
||||||
const navigation = useMyNavigation();
|
const navigation = useMyNavigation();
|
||||||
|
const [partyId, setPartyId] = useState<number | string>("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const helperRef = useRef<{
|
const helperRef = useRef<{
|
||||||
finished: boolean;
|
finished: boolean;
|
||||||
partyFinished: boolean;
|
partyFinished: boolean;
|
||||||
clientFinished: boolean;
|
clientFinished: boolean;
|
||||||
settedDefaultParty: Party | null;
|
settedDefaultParty: any;
|
||||||
settedDefaultClient: Customer | null;
|
|
||||||
// settedDefaultPartyValue: { value: number; label: string }[] | null;
|
|
||||||
}>({
|
}>({
|
||||||
settedDefaultParty: null,
|
settedDefaultParty: null,
|
||||||
settedDefaultClient: null,
|
|
||||||
partyFinished: false,
|
partyFinished: false,
|
||||||
clientFinished: false,
|
clientFinished: false,
|
||||||
finished: false,
|
finished: false,
|
||||||
// settedDefaultPartyValue: partiesData?.[0] || null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
control,
|
control,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
watch,
|
|
||||||
setValue,
|
setValue,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<any>({
|
} = useForm<any>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
partyId: params.get('party_id') ? +params.get('party_id')! : '',
|
partyId: params.get('party_id') ? +params.get('party_id')! : '',
|
||||||
box_weight: 0.9,
|
paketIds: editMode
|
||||||
box_type: 'KG',
|
? [{ id: initialValues?.partyId }]
|
||||||
box_size: '50x40x40',
|
: params.get('party_id')
|
||||||
status: 'READY_TO_INVOICE',
|
? [{ id: +params.get('party_id')! }]
|
||||||
cargoId: initialValues?.client_id,
|
: [{ id: '' }],
|
||||||
// passportId: {value: initialValues?.passportId},
|
|
||||||
...(editMode
|
|
||||||
? {}
|
|
||||||
: {
|
|
||||||
products_list: [
|
|
||||||
{
|
|
||||||
id: '',
|
|
||||||
cargoId: '',
|
|
||||||
trekId: '',
|
|
||||||
name: '',
|
|
||||||
nameRu: '',
|
|
||||||
amount: '',
|
|
||||||
weight: '',
|
|
||||||
price: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
...initialValues,
|
...initialValues,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const pakets = useFieldArray({
|
||||||
const products = useFieldArray({
|
|
||||||
control,
|
control,
|
||||||
name: 'products_list',
|
name: 'paketIds',
|
||||||
keyName: 'key',
|
keyName: 'key',
|
||||||
});
|
});
|
||||||
const controlledProductFields = watch('products_list');
|
|
||||||
const partyIdValue = watch('partyId');
|
|
||||||
const clientIdValue = watch('client_id');
|
|
||||||
const cargoId = watch('cargoId');
|
|
||||||
const requiredText = t('required');
|
const requiredText = t('required');
|
||||||
const [selectedPassport, setSelectedPassport] = useState<Passport | null>(null); // Tanlangan passportni saqlash uchun state (tipi Passport yoki null)
|
|
||||||
|
|
||||||
const passportOptionsInitial = initialValues?.passportId &&
|
const getBoxesQuery = useRequest(
|
||||||
initialValues?.passportName && [
|
() =>
|
||||||
|
box_requests.getAll({
|
||||||
|
partyId: partyId,
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
value: initialValues?.passportId,
|
selectData(data) {
|
||||||
label: initialValues?.passportName,
|
return data?.data?.data;
|
||||||
},
|
},
|
||||||
];
|
|
||||||
const n = "123ds"
|
|
||||||
n.toUpperCase()
|
|
||||||
const { data: passportOptions } = useRequest(() => passport_requests.getAll({ cargoId: cargoId?.toUpperCase() }), {
|
|
||||||
enabled: !!cargoId,
|
|
||||||
selectData: data => {
|
|
||||||
// Ma'lumotlarni BaseReactSelect uchun mos formatga o'tkazish
|
|
||||||
const passportOptions = data.data.data.map((passport: Passport) => ({
|
|
||||||
// data.data endi Passport[]
|
|
||||||
value: passport.id, // passport id sini value sifatida
|
|
||||||
label: passport.fullName, // fullName ni label sifatida
|
|
||||||
}));
|
|
||||||
|
|
||||||
const passportId = watch('passportId');
|
|
||||||
|
|
||||||
if (!passportId && initialValues?.passportId && cargoId === initialValues?.client_id) {
|
|
||||||
const currentOption = passportOptions?.find((item: { value: number }) => item.value === initialValues?.passportId);
|
|
||||||
setValue('passportId', currentOption);
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return passportOptions;
|
const { data: list } = useMemo(() => {
|
||||||
},
|
if (getBoxesQuery.data?.data) {
|
||||||
dependencies: [cargoId],
|
return {
|
||||||
placeholderData: [], // Kerak emas, chunki server PageAble qaytarmayapti
|
data: getBoxesQuery.data.data.filter((box: any) => box.status === 'READY_TO_INVOICE'),
|
||||||
onSuccess(data) {
|
};
|
||||||
// if (data?.data.data?.[0]?.id) {
|
}
|
||||||
// setValue("passportId", initialValues?.passportId)
|
return { data: [] };
|
||||||
// setValue('passport_id', data.data.data[0].id);
|
}, [getBoxesQuery, partyId]);
|
||||||
// setSelectedPassport(data.data.data[0]); // Birinchi elementni tanlash
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue('passportId', '');
|
if (partyId) {
|
||||||
}, [cargoId]);
|
getBoxesQuery.refetch();
|
||||||
|
}
|
||||||
|
}, [partyId]);
|
||||||
|
|
||||||
const { data: defaultParties, status: defaultPartiesStatus } = useRequest(() => party_requests.getAll({ status: 'COLLECTING' }), {
|
const { data: defaultParties } = useRequest(() => party_requests.getAll({ status: 'COLLECTING' }), {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
selectData(data) {
|
selectData(data) {
|
||||||
return data.data.data.data.map(p => ({ value: p.id, label: p.name }));
|
return data.data.data.data.map(p => ({ value: p.id, label: p.name }));
|
||||||
@@ -205,6 +139,7 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
if (!editMode && data?.data?.data?.data?.[0]) {
|
if (!editMode && data?.data?.data?.data?.[0]) {
|
||||||
helperRef.current.settedDefaultParty = data.data.data.data[0];
|
helperRef.current.settedDefaultParty = data.data.data.data[0];
|
||||||
setValue('partyId', data.data.data.data[0].id);
|
setValue('partyId', data.data.data.data[0].id);
|
||||||
|
setValue('paketIds[0].id', data.data.data.data[0].id);
|
||||||
}
|
}
|
||||||
helperRef.current.partyFinished = true;
|
helperRef.current.partyFinished = true;
|
||||||
if (helperRef.current.clientFinished) {
|
if (helperRef.current.clientFinished) {
|
||||||
@@ -214,104 +149,24 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
placeholderData: [],
|
placeholderData: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: defaultClients } = useRequest(
|
|
||||||
() =>
|
|
||||||
customer_requests.getAll({
|
|
||||||
page: 1,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
enabled: !!partyIdValue,
|
|
||||||
selectData(data) {
|
|
||||||
return data.data.data.data.map(p => ({ value: p.aviaCargoId, label: p.fullName }));
|
|
||||||
// return data.data.data.map(p => ({ value: p.id, label: p.fullName }));
|
|
||||||
},
|
|
||||||
dependencies: [partyIdValue],
|
|
||||||
onSuccess(data) {
|
|
||||||
if (!editMode && !clientIdValue && data?.data?.data?.data?.[0]) {
|
|
||||||
helperRef.current.settedDefaultClient = data.data.data?.data?.[0];
|
|
||||||
setValue('client_id', data.data.data.data[0].aviaCargoId);
|
|
||||||
}
|
|
||||||
helperRef.current.clientFinished = true;
|
|
||||||
if (helperRef.current.partyFinished) {
|
|
||||||
helperRef.current.finished = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
placeholderData: [],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const onPassportChange = (newValue: Passport | null) => {
|
|
||||||
// Tipi Passport | null
|
|
||||||
setSelectedPassport(newValue);
|
|
||||||
if (newValue) {
|
|
||||||
setValue('passport_id', newValue.id || null);
|
|
||||||
} else {
|
|
||||||
setValue('passport_id', null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSubmit = handleSubmit(async values => {
|
const onSubmit = handleSubmit(async values => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
const packetDtos = values.paketIds.map((paket: any) => paket.id).filter((id: any) => id);
|
||||||
|
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
const updateBody: UpdateBoxBodyType = {
|
const updateBody: UpdateRealBoxBodyType = {
|
||||||
cargoId: values.client_id,
|
boxId: initialValues?.boxId,
|
||||||
passportId: values.passportId.value,
|
partyName: values.partyName,
|
||||||
status: values.status,
|
packetDtos,
|
||||||
packetId: initialValues?.packetId,
|
|
||||||
|
|
||||||
items: values.products_list.map((item: any) => {
|
|
||||||
const _price = +item.price ? +item.price : 0;
|
|
||||||
const _amount = +item.amount ? +item.amount : 0;
|
|
||||||
const _total_price = _price ? _price * _amount : 0;
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: item.id,
|
|
||||||
// cargoId: item.cargoId,
|
|
||||||
trekId: item.trekId,
|
|
||||||
// name: item.name + (item.nameRu ? ` / ${item.nameRu}` : ''),
|
|
||||||
name: item.name,
|
|
||||||
nameRu: item?.nameRu,
|
|
||||||
weight: +item.weight,
|
|
||||||
amount: +item.amount,
|
|
||||||
price: _price,
|
|
||||||
totalPrice: _total_price,
|
|
||||||
};
|
};
|
||||||
}),
|
await real_box_requests.update(updateBody);
|
||||||
};
|
|
||||||
|
|
||||||
const item_delete_promises = initialValues.products_list
|
|
||||||
.filter(item => {
|
|
||||||
if (!updateBody.items.find(i => String(i.id) === String(item.id))) {
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
const createBody: RealCreateBoxBodyType = {
|
||||||
}
|
partyName: values.partyName,
|
||||||
})
|
packetDtos,
|
||||||
.map(item => {
|
|
||||||
return item_requests.delete({ itemId: item.id });
|
|
||||||
});
|
|
||||||
|
|
||||||
await box_requests.update(updateBody);
|
|
||||||
await Promise.all(item_delete_promises);
|
|
||||||
} else {
|
|
||||||
const createBody: CreateBoxBodyType = {
|
|
||||||
status: values.status,
|
|
||||||
cargoId: values.cargoId,
|
|
||||||
passportId: values.passportId.value,
|
|
||||||
partyId: values.partyId,
|
|
||||||
items: values.products_list.map((item: any) => {
|
|
||||||
return {
|
|
||||||
trekId: item.trekId,
|
|
||||||
name: item.name,
|
|
||||||
weight: +item.weight,
|
|
||||||
amount: +item.amount,
|
|
||||||
};
|
};
|
||||||
}),
|
await real_box_requests.create(createBody);
|
||||||
};
|
|
||||||
await box_requests.create(createBody);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigation.push(pageLinks.dashboard.boxes.index);
|
navigation.push(pageLinks.dashboard.boxes.index);
|
||||||
@@ -328,74 +183,14 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// const clientOptions = (inputValue: string) => {
|
const appendPaket = () => {
|
||||||
// return customer_requests.getAll({ clientName: inputValue, page: 1 }).then(res => {
|
pakets.append({ id: '' });
|
||||||
// return res.data.data.data.map(p => ({ label: p.fullName, value: p.id }));
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
const appendProduct = () => {
|
|
||||||
products.append({
|
|
||||||
id: '',
|
|
||||||
cargoId: '',
|
|
||||||
trekId: '',
|
|
||||||
name: '',
|
|
||||||
amount: '',
|
|
||||||
weight: '',
|
|
||||||
price: '',
|
|
||||||
totalPrice: '',
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeProduct = (index: number) => {
|
const removePaket = (index: number) => {
|
||||||
products.remove(index);
|
pakets.remove(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
const translateAndUpdateRussianName = async (text: string, index: number) => {
|
|
||||||
if (!text) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// const responseText = await box_requests.translateWithGoogleApi({ text });
|
|
||||||
const responseText = await box_requests.translateWithMemoryApi({ text });
|
|
||||||
setValue(`products_list.${index}.nameRu`, responseText || '');
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notifyError('Translation api error');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const boxTypes = [
|
|
||||||
{
|
|
||||||
label: 'KG',
|
|
||||||
value: 'KG',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'GABARIT',
|
|
||||||
value: 'GABARIT',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const boxStatuses = useMemo(() => {
|
|
||||||
const p: {
|
|
||||||
label: string;
|
|
||||||
value: BoxStatus;
|
|
||||||
}[] = [
|
|
||||||
{
|
|
||||||
label: t('READY_TO_INVOICE'),
|
|
||||||
value: 'READY_TO_INVOICE',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isAdmin) {
|
|
||||||
p.push({
|
|
||||||
label: t('READY'),
|
|
||||||
value: 'READY',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}, [isAdmin]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledCreateBox
|
<StyledCreateBox
|
||||||
width={1}
|
width={1}
|
||||||
@@ -408,11 +203,11 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
>
|
>
|
||||||
<Box component={'form'} onSubmit={onSubmit}>
|
<Box component={'form'} onSubmit={onSubmit}>
|
||||||
<Typography variant='h5' mb={3.5}>
|
<Typography variant='h5' mb={3.5}>
|
||||||
{editMode ? t('update_packet') : t('create_packet')}
|
{editMode ? t('update_box') : t('create_box')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Grid container columnSpacing={2.5} rowSpacing={3} mb={3.5}>
|
<Grid container columnSpacing={2.5} rowSpacing={3} mb={3.5}>
|
||||||
<Grid item xs={5}>
|
<Grid item xs={12}>
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
||||||
{t('party_name')}
|
{t('party_name')}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -420,11 +215,11 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
name='partyId'
|
name='partyId'
|
||||||
control={control}
|
control={control}
|
||||||
rules={{ required: requiredText }}
|
rules={{ required: requiredText }}
|
||||||
render={({ field, fieldState, formState }) => {
|
render={({ field }) => (
|
||||||
return (
|
|
||||||
<AsyncSelect
|
<AsyncSelect
|
||||||
onChange={(newValue: any) => {
|
onChange={(newValue: any) => {
|
||||||
field.onChange(newValue.value);
|
field.onChange(newValue.value);
|
||||||
|
setPartyId(newValue.value);
|
||||||
}}
|
}}
|
||||||
defaultValue={
|
defaultValue={
|
||||||
editMode
|
editMode
|
||||||
@@ -448,90 +243,7 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
loadOptions={partyOptions}
|
loadOptions={partyOptions}
|
||||||
placeholder={t('enter_party_name_to_find')}
|
placeholder={t('enter_party_name_to_find')}
|
||||||
/>
|
/>
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/* @ts-expect-error */}
|
|
||||||
{!!errors.partyId?.message && <FormHelperText sx={{ color: 'red' }}>{errors.partyId?.message}</FormHelperText>}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={5}>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('status')}
|
|
||||||
</Typography>
|
|
||||||
<Controller
|
|
||||||
name='status'
|
|
||||||
control={control}
|
|
||||||
rules={{ required: requiredText }}
|
|
||||||
render={({ field, fieldState, formState }) => {
|
|
||||||
return (
|
|
||||||
<BaseReactSelect
|
|
||||||
value={boxStatuses?.find(p => p.value === field.value)}
|
|
||||||
onChange={(newValue: any) => {
|
|
||||||
field.onChange(newValue.value);
|
|
||||||
}}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
options={boxStatuses}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/* @ts-expect-error */}
|
|
||||||
{!!errors.box_type?.message && <FormHelperText sx={{ color: 'red' }}>{errors.box_type?.message}</FormHelperText>}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={5}>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('cargo_id')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
disabled={!!initialValues}
|
|
||||||
type='text'
|
|
||||||
fullWidth
|
|
||||||
inputProps={{
|
|
||||||
step: 0.1,
|
|
||||||
}}
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('cargo_id')}
|
|
||||||
{...register('cargoId')}
|
|
||||||
/>
|
|
||||||
{!!errors.net_weight?.message && (
|
|
||||||
// @ts-expect-error
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{errors.net_weight?.message}</FormHelperText>
|
|
||||||
)}
|
)}
|
||||||
</Grid>
|
|
||||||
<Grid item xs={5}>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('passport')}
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Controller
|
|
||||||
name='passportId'
|
|
||||||
control={control}
|
|
||||||
rules={{ required: requiredText }}
|
|
||||||
render={({ field, fieldState, formState }) => {
|
|
||||||
return (
|
|
||||||
<BaseReactSelect
|
|
||||||
// value={selectedPassport}
|
|
||||||
// onChange={onPassportChange}
|
|
||||||
|
|
||||||
// value={field.value}
|
|
||||||
{...field}
|
|
||||||
onChange={(newValue: any) => {
|
|
||||||
onPassportChange(newValue);
|
|
||||||
field.onChange(newValue);
|
|
||||||
}}
|
|
||||||
// options={passportOptions || passportOptionsInitial || []}
|
|
||||||
options={passportOptions || passportOptionsInitial || []}
|
|
||||||
// isLoading={passportLoading}
|
|
||||||
placeholder={t('passport')}
|
|
||||||
isDisabled={!clientIdValue || !!initialValues}
|
|
||||||
noOptionsMessage={() => t('not_found')}
|
|
||||||
loadingMessage={() => t('loading')}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -544,196 +256,85 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
padding: '24px',
|
padding: '24px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{controlledProductFields.map((product: any, index: number) => {
|
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
||||||
//
|
{t('packet')}
|
||||||
|
</Typography>
|
||||||
//
|
{pakets.fields.map((field, index) => (
|
||||||
let totalPrice = 0;
|
<Box key={field.key} className="item-row" mb={2}>
|
||||||
|
<Box className="item-row-field" flex={1}>
|
||||||
try {
|
<Controller
|
||||||
const p = +product.price * +product.amount;
|
name={`paketIds.${index}.id`}
|
||||||
if (!Number.isNaN(p)) {
|
control={control}
|
||||||
totalPrice = p;
|
rules={{ required: requiredText }}
|
||||||
|
render={({ field: paketField }) => (
|
||||||
|
<AsyncSelect
|
||||||
|
onChange={(newValue: any) => {
|
||||||
|
paketField.onChange(newValue?.value);
|
||||||
|
}}
|
||||||
|
defaultValue={
|
||||||
|
editMode && index === 0 && initialValues.packetId
|
||||||
|
? {
|
||||||
|
value: initialValues.packetId,
|
||||||
|
label: initialValues.box_name || `Box ${initialValues.packetId}`,
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
styles={selectDefaultStyles}
|
||||||
|
noOptionsMessage={() => t('not_found')}
|
||||||
|
loadingMessage={() => t('loading')}
|
||||||
|
onBlur={paketField.onBlur}
|
||||||
|
name={paketField.name}
|
||||||
|
defaultOptions={
|
||||||
|
list.length > 0
|
||||||
|
? list.map((box: any) => ({
|
||||||
|
value: box.id,
|
||||||
|
label: box.box_name || box.name || `Box ${box.id}`,
|
||||||
|
}))
|
||||||
|
: []
|
||||||
|
}
|
||||||
|
loadOptions={async (inputValue: string) => {
|
||||||
|
if (!partyId || partyId === '') return [];
|
||||||
|
try {
|
||||||
|
const res = await box_requests.getAll({
|
||||||
|
partyId: partyId,
|
||||||
|
});
|
||||||
|
return res.data.data.data.map((box: any) => ({
|
||||||
|
label: box.box_name || box.name || `Box ${box.id}`,
|
||||||
|
value: box.id,
|
||||||
|
}));
|
||||||
|
} catch (error) {
|
||||||
|
notifyUnknownError(error);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box key={product.key} mb={1.5}>
|
|
||||||
<Box className='item-row' mb={1.5}>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('track_id')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
InputProps={{
|
|
||||||
startAdornment: (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
backgroundColor: '#EBEFF5',
|
|
||||||
color: '#929191',
|
|
||||||
alignSelf: 'stretch',
|
|
||||||
height: 'auto',
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
pl: '10px',
|
|
||||||
pr: '10px',
|
|
||||||
borderRadius: '8px 0 0 8px',
|
|
||||||
}}
|
}}
|
||||||
>
|
placeholder={t('enter_box_name_to_find')}
|
||||||
<span>ID</span>
|
|
||||||
</Box>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
fullWidth
|
|
||||||
placeholder={t('id')}
|
|
||||||
sx={{
|
|
||||||
'.MuiInputBase-root': {
|
|
||||||
paddingLeft: 0,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
{...register(`products_list.${index}.trekId`, { required: requiredText })}
|
|
||||||
/>
|
/>
|
||||||
{!!get(errors, `products_list.${index}.trekId`) && (
|
)}
|
||||||
|
/>
|
||||||
|
{!!get(errors, `paketIds.${index}.id`) && (
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Box className='item-row-field'>
|
{pakets.fields.length > 1 && (
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
<Box className="item-row-field">
|
||||||
{t('name')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('name')}
|
|
||||||
{...register(`products_list.${index}.name`, { required: requiredText })}
|
|
||||||
onBlur={event => {
|
|
||||||
translateAndUpdateRussianName(event.target.value, index);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{!!get(errors, `products_list.${index}.name`) && (
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{'NAME_RU'}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
// disabled
|
|
||||||
fullWidth
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('name')}
|
|
||||||
{...register(`products_list.${index}.nameRu`)}
|
|
||||||
/>
|
|
||||||
{!!get(errors, `products_list.${index}.name`) && (
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('quantity')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
type='number'
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('quantity')}
|
|
||||||
{...register(`products_list.${index}.amount`, { required: requiredText })}
|
|
||||||
/>
|
|
||||||
{!!get(errors, `products_list.${index}.amount`) && (
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('weight')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
type='number'
|
|
||||||
inputProps={{ step: 'any', min: 0, type: 'number' }}
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('weight')}
|
|
||||||
{...register(`products_list.${index}.weight`, { required: requiredText })}
|
|
||||||
/>
|
|
||||||
{!!get(errors, `products_list.${index}.amount`) && (
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
{isAdmin && (
|
|
||||||
<React.Fragment>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('weight')}
|
|
||||||
</Typography>
|
|
||||||
<Stack direction={'row'} alignItems={'center'} spacing={2.5}>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
type='text'
|
|
||||||
inputProps={{
|
|
||||||
step: 0.1,
|
|
||||||
}}
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('weight')}
|
|
||||||
{...register(`products_list.${index}.weight`)}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('price')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
type='text'
|
|
||||||
inputProps={{
|
|
||||||
step: 0.1,
|
|
||||||
}}
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('price')}
|
|
||||||
{...register(`products_list.${index}.price`, { required: requiredText })}
|
|
||||||
/>
|
|
||||||
{!!get(errors, `products_list.${index}.price`) && (
|
|
||||||
<FormHelperText sx={{ color: 'red' }}>{requiredText}</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<Typography fontSize={'18px'} fontWeight={500} color='#5D5850' mb={2}>
|
|
||||||
{t('total_price')}
|
|
||||||
</Typography>
|
|
||||||
<BaseInput
|
|
||||||
fullWidth
|
|
||||||
type='number'
|
|
||||||
inputProps={{
|
|
||||||
step: 0.001,
|
|
||||||
}}
|
|
||||||
value={totalPrice}
|
|
||||||
mainBorderColor='#D8D8D8'
|
|
||||||
placeholder={t('total_price')}
|
|
||||||
// {...register(`products_list.${index}.totalPrice`, { required: requiredText })}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</React.Fragment>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Box className='item-row-field'>
|
|
||||||
<BaseIconButton
|
<BaseIconButton
|
||||||
size='small'
|
size="small"
|
||||||
colorVariant='icon-error'
|
colorVariant="icon-error"
|
||||||
sx={{ flexShrink: 0, height: 'auto', marginTop: 4.5 }}
|
sx={{ flexShrink: 0, height: 'auto', marginTop: 1 }}
|
||||||
onClick={() => removeProduct(index)}
|
onClick={() => removePaket(index)}
|
||||||
>
|
>
|
||||||
<Close />
|
<Close />
|
||||||
</BaseIconButton>
|
</BaseIconButton>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Divider color='#EBEFF6' />
|
))}
|
||||||
</Box>
|
<Stack alignItems={'center'} mt={2}>
|
||||||
);
|
<BaseButton
|
||||||
})}
|
sx={{ backgroundColor: '#239D5F' }}
|
||||||
|
startIcon={<AddCircleRounded />}
|
||||||
<Stack alignItems={'center'}>
|
onClick={appendPaket}
|
||||||
<BaseButton sx={{ backgroundColor: '#239D5F' }} startIcon={<AddCircleRounded />} onClick={appendProduct}>
|
>
|
||||||
{t('add_more')}
|
{t('add_more')}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -750,3 +351,14 @@ const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default DashboardCreateRealBoxPage;
|
export default DashboardCreateRealBoxPage;
|
||||||
|
|
||||||
|
export type RealCreateBoxBodyType = {
|
||||||
|
partyName: string;
|
||||||
|
packetDtos: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateRealBoxBodyType = {
|
||||||
|
boxId: string;
|
||||||
|
partyName: string;
|
||||||
|
packetDtos: number[];
|
||||||
|
};
|
||||||
@@ -6,6 +6,7 @@ import useRequest from '@/hooks/useRequest';
|
|||||||
import DashboardCreateBoxPage from '@/routes/private/boxes-create/DashboardCreateBox';
|
import DashboardCreateBoxPage from '@/routes/private/boxes-create/DashboardCreateBox';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import DashboardCreateRealBoxPage from './DashboardCreateRealBox';
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ const DashboardEditRealBoxPage = (props: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DashboardCreateBoxPage initialValues={getOneBox.data} />
|
<DashboardCreateRealBoxPage />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import BasePagination from '@/components/ui-kit/BasePagination';
|
|||||||
import { useAuthContext } from '@/context/auth-context';
|
import { useAuthContext } from '@/context/auth-context';
|
||||||
import { BoxStatus, BoxStatusList, IBox } from '@/data/box/box.model';
|
import { BoxStatus, BoxStatusList, IBox } from '@/data/box/box.model';
|
||||||
import { box_requests } from '@/data/box/box.requests';
|
import { box_requests } from '@/data/box/box.requests';
|
||||||
|
import { real_box_requests } from '@/data/real-box/real-box.requests';
|
||||||
import { DEFAULT_PAGE_SIZE, pageLinks } from '@/helpers/constants';
|
import { DEFAULT_PAGE_SIZE, pageLinks } from '@/helpers/constants';
|
||||||
import useDebouncedInput from '@/hooks/useDebouncedInput';
|
import useDebouncedInput from '@/hooks/useDebouncedInput';
|
||||||
import useInput from '@/hooks/useInput';
|
import useInput from '@/hooks/useInput';
|
||||||
@@ -19,7 +20,7 @@ import useRequest from '@/hooks/useRequest';
|
|||||||
import { file_service } from '@/services/file-service';
|
import { file_service } from '@/services/file-service';
|
||||||
import { notifyUnknownError } from '@/services/notification';
|
import { notifyUnknownError } from '@/services/notification';
|
||||||
import { getBoxStatusStyles, getStatusColor } from '@/theme/getStatusBoxStyles';
|
import { getBoxStatusStyles, getStatusColor } from '@/theme/getStatusBoxStyles';
|
||||||
import { Add, AddCircleOutline, Circle, Delete, Download, Edit, FilterList, FilterListOff, Search, PlusOne } from '@mui/icons-material';
|
import { Add, QrCode, AddCircleOutline, Circle, Delete, Download, Edit, FilterList, FilterListOff, Search, PlusOne } from '@mui/icons-material';
|
||||||
import { Box, Button, Stack, Tooltip, Typography } from '@mui/material';
|
import { Box, Button, Stack, Tooltip, Typography } from '@mui/material';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
@@ -49,7 +50,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
|
|
||||||
const getBoxesQuery = useRequest(
|
const getBoxesQuery = useRequest(
|
||||||
() =>
|
() =>
|
||||||
box_requests.getAll({
|
real_box_requests.getAll({
|
||||||
page: page,
|
page: page,
|
||||||
cargoId: keyword,
|
cargoId: keyword,
|
||||||
status: boxStatusFilter,
|
status: boxStatusFilter,
|
||||||
@@ -84,7 +85,6 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
}
|
}
|
||||||
}, [getBoxesQuery]);
|
}, [getBoxesQuery]);
|
||||||
const loading = getBoxesQuery.loading;
|
const loading = getBoxesQuery.loading;
|
||||||
|
|
||||||
const handleChange = (newPage: number) => {
|
const handleChange = (newPage: number) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
@@ -158,39 +158,23 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataKey: 'id',
|
label: t("qr_code"),
|
||||||
label: "Qo'shish",
|
|
||||||
width: 120,
|
width: 120,
|
||||||
renderCell: data => {
|
renderCell: data => {
|
||||||
return <Button onClick={() => navigation.push(pageLinks.dashboard.boxes.edit(data.id))}>
|
return <Button>
|
||||||
<Add />
|
<QrCode />
|
||||||
</Button>;
|
</Button>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataKey: 'partyName',
|
dataKey: 'id',
|
||||||
label: t('party_name'),
|
label: t("add_more"),
|
||||||
width: 120,
|
width: 120,
|
||||||
|
renderCell: data => {
|
||||||
|
return <Button onClick={() => navigation.push(pageLinks.dashboard.real_boxes.edit(data.id))}>
|
||||||
|
<Add />
|
||||||
|
</Button>;
|
||||||
},
|
},
|
||||||
{
|
|
||||||
dataKey: 'name',
|
|
||||||
label: t('name'),
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dataKey: 'packetNetWeight',
|
|
||||||
label: t("weight"),
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dataKey: 'totalItems',
|
|
||||||
label: t('count_of_items'),
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dataKey: 'totalNetWeight',
|
|
||||||
label: t("party_weight"),
|
|
||||||
width: 120,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataKey: 'cargoId',
|
dataKey: 'cargoId',
|
||||||
@@ -198,73 +182,98 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataKey: 'passportName',
|
dataKey: 'partyName',
|
||||||
label: t('client'),
|
label: t('party_name'),
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// dataKey: 'name',
|
||||||
|
// label: t('name'),
|
||||||
|
// width: 120,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dataKey: 'packetNetWeight',
|
||||||
|
// label: t("weight"),
|
||||||
|
// width: 120,
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
dataKey: 'status',
|
dataKey: 'totalItems',
|
||||||
label: t('status'),
|
label: t('count_of_items'),
|
||||||
width: 240,
|
width: 120,
|
||||||
renderHeaderCell(rowIndex) {
|
|
||||||
return (
|
|
||||||
<Stack direction={'row'} alignItems={'center'}>
|
|
||||||
<span>{t('box_status')}</span>
|
|
||||||
<ActionPopMenu
|
|
||||||
buttons={BoxStatusList.map(stat => {
|
|
||||||
return {
|
|
||||||
icon: <Circle sx={{ path: { color: getStatusColor(stat) } }} />,
|
|
||||||
label: t(stat),
|
|
||||||
onClick() {
|
|
||||||
setBoxStatusFilter(stat);
|
|
||||||
setPage(1);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
})}
|
|
||||||
mainIcon={<FilterList />}
|
|
||||||
placement={{
|
|
||||||
anchorOrigin: {
|
|
||||||
vertical: 'bottom',
|
|
||||||
horizontal: 'center',
|
|
||||||
},
|
|
||||||
transformOrigin: {
|
|
||||||
horizontal: 'center',
|
|
||||||
vertical: 'top',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
renderCell(data) {
|
|
||||||
return (
|
|
||||||
<StatusChangePopup
|
|
||||||
anchor={{
|
|
||||||
status: data.status,
|
|
||||||
text: t(data.status),
|
|
||||||
}}
|
|
||||||
loading={changeStatusIds.includes(data.id)}
|
|
||||||
buttons={boxStatusOptions.map(stat => {
|
|
||||||
return {
|
|
||||||
icon: (
|
|
||||||
<Circle
|
|
||||||
sx={{
|
|
||||||
path: {
|
|
||||||
color: getStatusColor(stat),
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
label: t(stat),
|
|
||||||
onClick: () => {
|
|
||||||
onChangeStatus(data.id, stat);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// dataKey: 'totalNetWeight',
|
||||||
|
// label: t("party_weight"),
|
||||||
|
// width: 120,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dataKey: 'passportName',
|
||||||
|
// label: t('client'),
|
||||||
|
// width: 120,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dataKey: 'status',
|
||||||
|
// label: t('status'),
|
||||||
|
// width: 240,
|
||||||
|
// renderHeaderCell(rowIndex) {
|
||||||
|
// return (
|
||||||
|
// <Stack direction={'row'} alignItems={'center'}>
|
||||||
|
// <span>{t('box_status')}</span>
|
||||||
|
// <ActionPopMenu
|
||||||
|
// buttons={BoxStatusList.map(stat => {
|
||||||
|
// return {
|
||||||
|
// icon: <Circle sx={{ path: { color: getStatusColor(stat) } }} />,
|
||||||
|
// label: t(stat),
|
||||||
|
// onClick() {
|
||||||
|
// setBoxStatusFilter(stat);
|
||||||
|
// setPage(1);
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// })}
|
||||||
|
// mainIcon={<FilterList />}
|
||||||
|
// placement={{
|
||||||
|
// anchorOrigin: {
|
||||||
|
// vertical: 'bottom',
|
||||||
|
// horizontal: 'center',
|
||||||
|
// },
|
||||||
|
// transformOrigin: {
|
||||||
|
// horizontal: 'center',
|
||||||
|
// vertical: 'top',
|
||||||
|
// },
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// </Stack>
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// renderCell(data) {
|
||||||
|
// return (
|
||||||
|
// <StatusChangePopup
|
||||||
|
// anchor={{
|
||||||
|
// status: data.status,
|
||||||
|
// text: t(data.status),
|
||||||
|
// }}
|
||||||
|
// loading={changeStatusIds.includes(data.id)}
|
||||||
|
// buttons={boxStatusOptions.map(stat => {
|
||||||
|
// return {
|
||||||
|
// icon: (
|
||||||
|
// <Circle
|
||||||
|
// sx={{
|
||||||
|
// path: {
|
||||||
|
// color: getStatusColor(stat),
|
||||||
|
// },
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// ),
|
||||||
|
// label: t(stat),
|
||||||
|
// onClick: () => {
|
||||||
|
// onChangeStatus(data.id, stat);
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// })}
|
||||||
|
// />
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
label: '',
|
label: '',
|
||||||
width: 100,
|
width: 100,
|
||||||
@@ -277,7 +286,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
icon: <Edit sx={{ path: { color: '#3489E4' } }} />,
|
icon: <Edit sx={{ path: { color: '#3489E4' } }} />,
|
||||||
label: t('edit'),
|
label: t('edit'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
navigation.push(pageLinks.dashboard.boxes.edit(data.id));
|
navigation.push(pageLinks.dashboard.real_boxes.edit(data.id));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -289,8 +298,6 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
dontCloseOnClick: true,
|
dontCloseOnClick: true,
|
||||||
loading: deleteIds.includes(data.id),
|
loading: deleteIds.includes(data.id),
|
||||||
},
|
},
|
||||||
...(data.status === 'READY'
|
|
||||||
? [
|
|
||||||
{
|
{
|
||||||
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
||||||
label: t('download_excel'),
|
label: t('download_excel'),
|
||||||
@@ -300,8 +307,6 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
loading: downloadIds.includes(data.id),
|
loading: downloadIds.includes(data.id),
|
||||||
dontCloseOnClick: true,
|
dontCloseOnClick: true,
|
||||||
},
|
},
|
||||||
]
|
|
||||||
: []),
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -312,8 +317,8 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Stack direction={'row'} mb={3} spacing={3}>
|
<Stack direction={'row'} mb={3} spacing={3}>
|
||||||
<BaseButton colorVariant='blue' startIcon={<Add />} href={pageLinks.dashboard.boxes.create}>
|
<BaseButton colorVariant='blue' startIcon={<Add />} href={pageLinks.dashboard.real_boxes.create}>
|
||||||
{t('create_packet')}
|
{t('create_box')}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box
|
<Box
|
||||||
@@ -335,7 +340,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
color: '#000',
|
color: '#000',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('packet')}
|
{t('boxes')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
||||||
<BaseInput
|
<BaseInput
|
||||||
|
|||||||
23
yarn.lock
23
yarn.lock
@@ -330,10 +330,10 @@
|
|||||||
resolved "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz"
|
resolved "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz"
|
||||||
integrity sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==
|
integrity sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==
|
||||||
|
|
||||||
"@esbuild/darwin-x64@0.21.5":
|
"@esbuild/win32-x64@0.21.5":
|
||||||
version "0.21.5"
|
version "0.21.5"
|
||||||
resolved "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz"
|
resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz"
|
||||||
integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==
|
integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==
|
||||||
|
|
||||||
"@eslint-community/eslint-utils@^4.2.0":
|
"@eslint-community/eslint-utils@^4.2.0":
|
||||||
version "4.4.0"
|
version "4.4.0"
|
||||||
@@ -592,10 +592,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
glob "7.1.7"
|
glob "7.1.7"
|
||||||
|
|
||||||
"@next/swc-darwin-x64@14.0.4":
|
"@next/swc-win32-x64-msvc@14.0.4":
|
||||||
version "14.0.4"
|
version "14.0.4"
|
||||||
resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.4.tgz"
|
resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.4.tgz"
|
||||||
integrity sha512-IZQ3C7Bx0k2rYtrZZxKKiusMTM9WWcK5ajyhOZkYYTCc8xytmwSzR1skU7qLgVT/EY9xtXDG0WhY6fyujnI3rw==
|
integrity sha512-yEh2+R8qDlDCjxVpzOTEpBLQTEFAcP2A8fUFLaWNap9GitYKkKv1//y2S6XY6zsR4rCOPRpU7plYDR+az2n30A==
|
||||||
|
|
||||||
"@nodelib/fs.scandir@2.1.5":
|
"@nodelib/fs.scandir@2.1.5":
|
||||||
version "2.1.5"
|
version "2.1.5"
|
||||||
@@ -623,10 +623,10 @@
|
|||||||
resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz"
|
resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz"
|
||||||
integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==
|
integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==
|
||||||
|
|
||||||
"@rollup/rollup-darwin-x64@4.34.8":
|
"@rollup/rollup-win32-x64-msvc@4.34.8":
|
||||||
version "4.34.8"
|
version "4.34.8"
|
||||||
resolved "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz"
|
resolved "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz"
|
||||||
integrity sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==
|
integrity sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==
|
||||||
|
|
||||||
"@rushstack/eslint-patch@^1.3.3":
|
"@rushstack/eslint-patch@^1.3.3":
|
||||||
version "1.6.1"
|
version "1.6.1"
|
||||||
@@ -2085,11 +2085,6 @@ fs.realpath@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
||||||
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
||||||
|
|
||||||
fsevents@~2.3.2, fsevents@~2.3.3:
|
|
||||||
version "2.3.3"
|
|
||||||
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
|
|
||||||
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
|
|
||||||
|
|
||||||
function-bind@^1.1.1, function-bind@^1.1.2:
|
function-bind@^1.1.1, function-bind@^1.1.2:
|
||||||
version "1.1.2"
|
version "1.1.2"
|
||||||
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
|
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user