@lodashventure/medusa-parcel-shipping 0.4.23 → 0.4.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,13 +192,31 @@ const OrderShippingQuoteWidget = ({ data }) => {
192
192
  )
193
193
  ] })
194
194
  ] }),
195
+ option.price_breakdown.base_shipping_cost !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-ui-fg-subtle", children: [
196
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "ค่าฐานตามระยะทาง:" }),
197
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
198
+ "฿",
199
+ option.price_breakdown.base_shipping_cost.toFixed(2)
200
+ ] })
201
+ ] }),
195
202
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-ui-fg-subtle", children: [
196
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "ค่าจัดส่ง:" }),
203
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
204
+ "ค่าจัดส่ง",
205
+ option.price_breakdown.base_shipping_cost !== void 0 ? " (รวมฐาน)" : "",
206
+ ":"
207
+ ] }),
197
208
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
198
209
  "฿",
199
210
  option.price_breakdown.shipping_cost.toFixed(2)
200
211
  ] })
201
212
  ] }),
213
+ option.price_breakdown.distance_km !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-ui-fg-subtle", children: [
214
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "ระยะทางโดยประมาณ:" }),
215
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
216
+ option.price_breakdown.distance_km.toFixed(2),
217
+ " กม."
218
+ ] })
219
+ ] }),
202
220
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between font-semibold pt-1 border-t", children: [
203
221
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "รวมทั้งหมด:" }),
204
222
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
@@ -653,10 +671,354 @@ const AreasPage = () => {
653
671
  /* @__PURE__ */ jsxRuntime.jsx(ServiceAreasTable, {})
654
672
  ] }) });
655
673
  };
656
- const config$3 = adminSdk.defineRouteConfig({
674
+ const config$4 = adminSdk.defineRouteConfig({
657
675
  icon: icons.MapPin,
658
676
  label: "พื้นที่บริการ"
659
677
  });
678
+ const MessengerBaseRateModal = ({
679
+ rate,
680
+ onClose
681
+ }) => {
682
+ const [formData, setFormData] = react.useState({
683
+ min_distance_km: "0",
684
+ max_distance_km: "",
685
+ price: "",
686
+ priority: "0",
687
+ active: true
688
+ });
689
+ const [isSaving, setIsSaving] = react.useState(false);
690
+ react.useEffect(() => {
691
+ var _a, _b;
692
+ if (rate) {
693
+ setFormData({
694
+ min_distance_km: ((_a = rate.min_distance_km) == null ? void 0 : _a.toString()) ?? "0",
695
+ max_distance_km: ((_b = rate.max_distance_km) == null ? void 0 : _b.toString()) || "",
696
+ price: rate.price.toString(),
697
+ priority: (rate.priority ?? 0).toString(),
698
+ active: rate.active
699
+ });
700
+ }
701
+ }, [rate]);
702
+ const handleSubmit = async (e) => {
703
+ e.preventDefault();
704
+ const errors = [];
705
+ const minDistance = parseFloat(formData.min_distance_km || "0");
706
+ const hasMaxDistance = formData.max_distance_km !== "";
707
+ const maxDistance = hasMaxDistance ? parseFloat(formData.max_distance_km) : void 0;
708
+ const price = parseFloat(formData.price);
709
+ const priority = parseInt(formData.priority || "0", 10);
710
+ if (isNaN(minDistance) || minDistance < 0) {
711
+ errors.push("ระยะทางเริ่มต้นต้องไม่ติดลบ");
712
+ }
713
+ if (hasMaxDistance && (maxDistance === void 0 || isNaN(maxDistance) || (maxDistance ?? 0) < minDistance)) {
714
+ errors.push("ระยะทางสูงสุดต้องมากกว่าหรือเท่ากับระยะทางเริ่มต้น");
715
+ }
716
+ if (isNaN(price) || price < 0) {
717
+ errors.push("ราคาต้องเป็นตัวเลขไม่ติดลบ");
718
+ }
719
+ if (isNaN(priority)) {
720
+ errors.push("ลำดับความสำคัญต้องเป็นตัวเลข");
721
+ }
722
+ if (errors.length > 0) {
723
+ ui.toast.error("ข้อมูลไม่ถูกต้อง", {
724
+ description: errors.join(", ")
725
+ });
726
+ return;
727
+ }
728
+ setIsSaving(true);
729
+ try {
730
+ const payload = {
731
+ carrier_type: "COMPANY_FLEET",
732
+ carrier: "COMPANY_FLEET",
733
+ service_code: "MESSENGER_3H",
734
+ min_distance_km: minDistance,
735
+ max_distance_km: maxDistance === void 0 || isNaN(maxDistance) ? null : maxDistance,
736
+ price,
737
+ currency: "THB",
738
+ priority,
739
+ active: formData.active
740
+ };
741
+ const url = rate ? `/admin/base-shipping-prices/${rate.id}` : "/admin/base-shipping-prices";
742
+ const method = rate ? "PUT" : "POST";
743
+ const response = await fetch(url, {
744
+ method,
745
+ headers: { "Content-Type": "application/json" },
746
+ credentials: "include",
747
+ body: JSON.stringify(payload)
748
+ });
749
+ if (!response.ok) {
750
+ const error = await response.json().catch(() => ({}));
751
+ throw new Error(error.message || "ไม่สามารถบันทึกข้อมูลได้");
752
+ }
753
+ ui.toast.success("สำเร็จ", {
754
+ description: rate ? "แก้ไขฐานราคาตามระยะทางแล้ว" : "สร้างฐานราคาตามระยะทางใหม่แล้ว"
755
+ });
756
+ onClose();
757
+ } catch (error) {
758
+ ui.toast.error("ข้อผิดพลาด", {
759
+ description: error instanceof Error ? error.message : "ไม่สามารถบันทึกข้อมูลได้"
760
+ });
761
+ } finally {
762
+ setIsSaving(false);
763
+ }
764
+ };
765
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Drawer, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Drawer.Content, { children: [
766
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Title, { children: rate ? "แก้ไขฐานราคาตามระยะทาง" : "สร้างฐานราคาตามระยะทาง" }) }),
767
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
768
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-4", children: [
769
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
770
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "min_distance_km", children: "ระยะทางเริ่มต้น (กม.) *" }),
771
+ /* @__PURE__ */ jsxRuntime.jsx(
772
+ ui.Input,
773
+ {
774
+ id: "min_distance_km",
775
+ type: "number",
776
+ min: "0",
777
+ step: "0.1",
778
+ value: formData.min_distance_km,
779
+ onChange: (e) => setFormData({ ...formData, min_distance_km: e.target.value }),
780
+ required: true
781
+ }
782
+ )
783
+ ] }),
784
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
785
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "max_distance_km", children: "ระยะทางสูงสุด (กม.)" }),
786
+ /* @__PURE__ */ jsxRuntime.jsx(
787
+ ui.Input,
788
+ {
789
+ id: "max_distance_km",
790
+ type: "number",
791
+ min: "0",
792
+ step: "0.1",
793
+ placeholder: "ปล่อยว่างหากไม่มีที่สิ้นสุด",
794
+ value: formData.max_distance_km,
795
+ onChange: (e) => setFormData({ ...formData, max_distance_km: e.target.value })
796
+ }
797
+ ),
798
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-subtle mt-1", children: "เว้นว่างเพื่อกำหนดช่วงราคาแบบ 30+ กม." })
799
+ ] })
800
+ ] }),
801
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
802
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "price", children: "ราคา (THB) *" }),
803
+ /* @__PURE__ */ jsxRuntime.jsx(
804
+ ui.Input,
805
+ {
806
+ id: "price",
807
+ type: "number",
808
+ min: "0",
809
+ step: "0.01",
810
+ value: formData.price,
811
+ onChange: (e) => setFormData({ ...formData, price: e.target.value }),
812
+ required: true
813
+ }
814
+ )
815
+ ] }),
816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
817
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "priority", children: "ลำดับความสำคัญ" }),
818
+ /* @__PURE__ */ jsxRuntime.jsx(
819
+ ui.Input,
820
+ {
821
+ id: "priority",
822
+ type: "number",
823
+ value: formData.priority,
824
+ onChange: (e) => setFormData({ ...formData, priority: e.target.value }),
825
+ placeholder: "0"
826
+ }
827
+ ),
828
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-subtle mt-1", children: "ใช้สำหรับจัดลำดับเมื่อมีช่วงราคาทับกัน (ค่าเริ่มต้น 0)" })
829
+ ] }),
830
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
831
+ /* @__PURE__ */ jsxRuntime.jsx(
832
+ ui.Switch,
833
+ {
834
+ id: "active",
835
+ checked: formData.active,
836
+ onCheckedChange: (checked) => setFormData({ ...formData, active: checked })
837
+ }
838
+ ),
839
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "active", children: "เปิดใช้งาน" })
840
+ ] }),
841
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Drawer.Footer, { children: [
842
+ /* @__PURE__ */ jsxRuntime.jsx(
843
+ ui.Button,
844
+ {
845
+ type: "button",
846
+ variant: "secondary",
847
+ onClick: onClose,
848
+ disabled: isSaving,
849
+ children: "ยกเลิก"
850
+ }
851
+ ),
852
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { type: "submit", disabled: isSaving, children: isSaving ? "กำลังบันทึก..." : "บันทึก" })
853
+ ] })
854
+ ] }) })
855
+ ] }) });
856
+ };
857
+ const MessengerBasePricingTable = () => {
858
+ const [rates, setRates] = react.useState([]);
859
+ const [isLoading, setIsLoading] = react.useState(false);
860
+ const [isModalOpen, setIsModalOpen] = react.useState(false);
861
+ const [editingRate, setEditingRate] = react.useState(null);
862
+ const [deleteId, setDeleteId] = react.useState(null);
863
+ react.useEffect(() => {
864
+ fetchRates();
865
+ }, []);
866
+ const orderedRates = react.useMemo(() => {
867
+ return [...rates].sort((a, b) => {
868
+ if (a.min_distance_km !== b.min_distance_km) {
869
+ return a.min_distance_km - b.min_distance_km;
870
+ }
871
+ const aMax = a.max_distance_km ?? Number.POSITIVE_INFINITY;
872
+ const bMax = b.max_distance_km ?? Number.POSITIVE_INFINITY;
873
+ return aMax - bMax;
874
+ });
875
+ }, [rates]);
876
+ const fetchRates = async () => {
877
+ setIsLoading(true);
878
+ try {
879
+ const response = await fetch(
880
+ "/admin/base-shipping-prices?carrier_type=COMPANY_FLEET&service_code=MESSENGER_3H",
881
+ {
882
+ credentials: "include"
883
+ }
884
+ );
885
+ if (!response.ok) {
886
+ throw new Error("failed_to_load_base_rates");
887
+ }
888
+ const data = await response.json();
889
+ setRates(data.base_rates || []);
890
+ } catch (error) {
891
+ ui.toast.error("ข้อผิดพลาด", {
892
+ description: "ไม่สามารถโหลดฐานราคาตามระยะทางได้"
893
+ });
894
+ } finally {
895
+ setIsLoading(false);
896
+ }
897
+ };
898
+ const handleDelete = async () => {
899
+ if (!deleteId) return;
900
+ try {
901
+ const response = await fetch(
902
+ `/admin/base-shipping-prices/${deleteId}`,
903
+ {
904
+ method: "DELETE",
905
+ credentials: "include"
906
+ }
907
+ );
908
+ if (!response.ok) {
909
+ throw new Error("failed_to_delete");
910
+ }
911
+ ui.toast.success("สำเร็จ", {
912
+ description: "ลบฐานราคาสำเร็จ"
913
+ });
914
+ fetchRates();
915
+ } catch (error) {
916
+ ui.toast.error("ข้อผิดพลาด", {
917
+ description: "ไม่สามารถลบฐานราคาได้"
918
+ });
919
+ } finally {
920
+ setDeleteId(null);
921
+ }
922
+ };
923
+ const handleModalClose = () => {
924
+ setIsModalOpen(false);
925
+ setEditingRate(null);
926
+ fetchRates();
927
+ };
928
+ const formatDistanceRange = (rate) => {
929
+ const min = rate.min_distance_km ?? 0;
930
+ const max = rate.max_distance_km;
931
+ if (max === void 0 || max === null) {
932
+ return `${min}+ กม.`;
933
+ }
934
+ return `${min}-${max} กม.`;
935
+ };
936
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
937
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-4", children: [
938
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
939
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: "ฐานราคาตามระยะทาง (Messenger 3H)" }),
940
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-fg-subtle text-sm", children: "กำหนดราคาเริ่มต้นตามระยะทาง เช่น 0-5, 5-20, 20-30, 30+ กม." })
941
+ ] }),
942
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: () => setIsModalOpen(true), children: [
943
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}),
944
+ "เพิ่มช่วงราคา"
945
+ ] })
946
+ ] }),
947
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { className: "mt-4", children: [
948
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
949
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "ช่วงระยะทาง" }),
950
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "ราคา (THB)" }),
951
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "ลำดับ" }),
952
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "สถานะ" }),
953
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { className: "text-right", children: "การจัดการ" })
954
+ ] }) }),
955
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Body, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "text-center", children: "กำลังโหลด..." }) }) : orderedRates.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "text-center", children: "ยังไม่ได้ตั้งค่าฐานราคาตามระยะทาง" }) }) : orderedRates.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
956
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: formatDistanceRange(rate) }),
957
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Cell, { children: [
958
+ "฿",
959
+ rate.price.toFixed(2)
960
+ ] }),
961
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: rate.priority ?? 0 }),
962
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: rate.active ? "green" : "grey", children: rate.active ? "เปิดใช้งาน" : "ปิดใช้งาน" }) }),
963
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "text-right", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
964
+ /* @__PURE__ */ jsxRuntime.jsx(
965
+ ui.Button,
966
+ {
967
+ variant: "transparent",
968
+ size: "small",
969
+ onClick: () => {
970
+ setEditingRate(rate);
971
+ setIsModalOpen(true);
972
+ },
973
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, {})
974
+ }
975
+ ),
976
+ /* @__PURE__ */ jsxRuntime.jsx(
977
+ ui.Button,
978
+ {
979
+ variant: "transparent",
980
+ size: "small",
981
+ onClick: () => setDeleteId(rate.id),
982
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash, {})
983
+ }
984
+ )
985
+ ] }) })
986
+ ] }, rate.id)) })
987
+ ] }),
988
+ isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(MessengerBaseRateModal, { rate: editingRate, onClose: handleModalClose }),
989
+ /* @__PURE__ */ jsxRuntime.jsx(
990
+ ui.Prompt,
991
+ {
992
+ variant: "confirmation",
993
+ open: !!deleteId,
994
+ onOpenChange: () => setDeleteId(null),
995
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Prompt.Content, { children: [
996
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Prompt.Header, { children: [
997
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Prompt.Title, { children: "ลบฐานราคา" }),
998
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Prompt.Description, { children: "คุณต้องการลบช่วงราคานี้ใช่หรือไม่? การดำเนินการนี้ไม่สามารถย้อนกลับได้" })
999
+ ] }),
1000
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Prompt.Footer, { children: [
1001
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Prompt.Cancel, { children: "ยกเลิก" }),
1002
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Prompt.Action, { onClick: handleDelete, children: "ลบ" })
1003
+ ] })
1004
+ ] })
1005
+ }
1006
+ )
1007
+ ] });
1008
+ };
1009
+ const BasePricingPage = () => {
1010
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6", children: [
1011
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-1", children: [
1012
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "ฐานราคาตามระยะทาง (Messenger)" }),
1013
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "ตั้งราคาฐานสำหรับบริการ Messenger 3 ชั่วโมงตามช่วงระยะทาง เช่น 0-5, 5-20, 20-30, 30+ กม." })
1014
+ ] }),
1015
+ /* @__PURE__ */ jsxRuntime.jsx(MessengerBasePricingTable, {})
1016
+ ] }) });
1017
+ };
1018
+ const config$3 = adminSdk.defineRouteConfig({
1019
+ icon: icons.Route,
1020
+ label: "ฐานราคาตามระยะทาง"
1021
+ });
660
1022
  const ParcelBoxModal = ({ box, onClose }) => {
661
1023
  const [formData, setFormData] = react.useState({
662
1024
  name: "",
@@ -1536,6 +1898,7 @@ const ShippingRateModal = ({ rate, onClose }) => {
1536
1898
  const [isSaving, setIsSaving] = react.useState(false);
1537
1899
  const selectedService = SERVICE_CODES$1.find((s) => s.value === formData.service_code);
1538
1900
  const usesHours = (selectedService == null ? void 0 : selectedService.usesHours) ?? false;
1901
+ const isMessenger = formData.carrier_type === "COMPANY_FLEET" && formData.service_code === "MESSENGER_3H";
1539
1902
  react.useEffect(() => {
1540
1903
  var _a, _b, _c, _d;
1541
1904
  if (rate) {
@@ -1677,6 +2040,14 @@ const ShippingRateModal = ({ rate, onClose }) => {
1677
2040
  }
1678
2041
  )
1679
2042
  ] }),
2043
+ isMessenger && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 text-sm space-y-1", children: [
2044
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-ui-fg-base", children: "ฐานราคาตามระยะทาง (Messenger)" }),
2045
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "ตั้งช่วงราคาตามระยะทาง เช่น 0-5, 5-20, 20-30, 30+ กม. สำหรับบริการส่งด่วน 3 ชม." }),
2046
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { asChild: true, size: "small", variant: "secondary", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: "/base-pricing", target: "_blank", rel: "noreferrer", children: [
2047
+ "จัดการฐานราคา",
2048
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "ml-1 h-4 w-4" })
2049
+ ] }) }) })
2050
+ ] }),
1680
2051
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-4", children: [
1681
2052
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1682
2053
  /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "maxWeight", children: "น้ำหนักสูงสุด (kg) *" }),
@@ -1986,9 +2357,13 @@ const ShippingRatesTable = () => {
1986
2357
  ] });
1987
2358
  };
1988
2359
  const RatesPage = () => {
1989
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
2360
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-8", children: [
1990
2361
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "อัตราค่าขนส่ง" }) }),
1991
- /* @__PURE__ */ jsxRuntime.jsx(ShippingRatesTable, {})
2362
+ /* @__PURE__ */ jsxRuntime.jsx(ShippingRatesTable, {}),
2363
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t pt-4", children: [
2364
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-2 text-lg", children: "ฐานราคาตามระยะทาง (Messenger)" }),
2365
+ /* @__PURE__ */ jsxRuntime.jsx(MessengerBasePricingTable, {})
2366
+ ] })
1992
2367
  ] }) });
1993
2368
  };
1994
2369
  const config = adminSdk.defineRouteConfig({
@@ -2007,6 +2382,10 @@ const routeModule = {
2007
2382
  Component: AreasPage,
2008
2383
  path: "/areas"
2009
2384
  },
2385
+ {
2386
+ Component: BasePricingPage,
2387
+ path: "/base-pricing"
2388
+ },
2010
2389
  {
2011
2390
  Component: BoxesPage,
2012
2391
  path: "/boxes"
@@ -2024,8 +2403,8 @@ const routeModule = {
2024
2403
  const menuItemModule = {
2025
2404
  menuItems: [
2026
2405
  {
2027
- label: config$3.label,
2028
- icon: config$3.icon,
2406
+ label: config$4.label,
2407
+ icon: config$4.icon,
2029
2408
  path: "/areas",
2030
2409
  nested: void 0
2031
2410
  },
@@ -2046,6 +2425,12 @@ const menuItemModule = {
2046
2425
  icon: config.icon,
2047
2426
  path: "/rates",
2048
2427
  nested: void 0
2428
+ },
2429
+ {
2430
+ label: config$3.label,
2431
+ icon: config$3.icon,
2432
+ path: "/base-pricing",
2433
+ nested: void 0
2049
2434
  }
2050
2435
  ]
2051
2436
  };