@asdp/ferryui 0.1.22-dev.8578 → 0.1.22-dev.8583
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.
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +106 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4707,17 +4707,19 @@ var ModalTotalPassengers = ({
|
|
|
4707
4707
|
const defaultInfoMessage = `Anda dapat menambahkan hingga ${maxPassengers} penumpang pada golongan kendaraan ini.`;
|
|
4708
4708
|
useEffect(() => {
|
|
4709
4709
|
if (passengerTypes.length === 0) return;
|
|
4710
|
-
const defaultPassengers = passengerTypes.map(
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4710
|
+
const defaultPassengers = passengerTypes.map(
|
|
4711
|
+
(passengerType) => ({
|
|
4712
|
+
passengerTypeId: passengerType.id,
|
|
4713
|
+
passengerTypeCode: passengerType.passengerTypeCode,
|
|
4714
|
+
passengerTypeName: passengerType.passengerTypeName,
|
|
4715
|
+
services: serviceClasses.map((sc) => ({
|
|
4716
|
+
serviceId: sc.id,
|
|
4717
|
+
serviceName: sc.serviceName,
|
|
4718
|
+
count: 0,
|
|
4719
|
+
passengers: []
|
|
4720
|
+
}))
|
|
4721
|
+
})
|
|
4722
|
+
);
|
|
4721
4723
|
if (selectedPassengers && selectedPassengers.length > 0) {
|
|
4722
4724
|
const mergedPassengers = defaultPassengers.map((defaultP) => {
|
|
4723
4725
|
const selectedP = selectedPassengers.find(
|
|
@@ -4725,8 +4727,14 @@ var ModalTotalPassengers = ({
|
|
|
4725
4727
|
);
|
|
4726
4728
|
if (selectedP) {
|
|
4727
4729
|
const mergedServices = defaultP.services.map((defaultS) => {
|
|
4728
|
-
const selectedS = selectedP.services.find(
|
|
4729
|
-
|
|
4730
|
+
const selectedS = selectedP.services.find(
|
|
4731
|
+
(s) => s.serviceName === defaultS.serviceName
|
|
4732
|
+
);
|
|
4733
|
+
return selectedS ? {
|
|
4734
|
+
...defaultS,
|
|
4735
|
+
count: selectedS.count,
|
|
4736
|
+
passengers: selectedS.passengers || []
|
|
4737
|
+
} : defaultS;
|
|
4730
4738
|
});
|
|
4731
4739
|
return { ...defaultP, services: mergedServices };
|
|
4732
4740
|
}
|
|
@@ -4746,18 +4754,26 @@ var ModalTotalPassengers = ({
|
|
|
4746
4754
|
}
|
|
4747
4755
|
}, [open, passengerTypes, serviceClasses, selectedPassengers]);
|
|
4748
4756
|
const getServiceCount = (passengerTypeCode, serviceName) => {
|
|
4749
|
-
const passenger = passengers.find(
|
|
4757
|
+
const passenger = passengers.find(
|
|
4758
|
+
(p) => p.passengerTypeCode === passengerTypeCode
|
|
4759
|
+
);
|
|
4750
4760
|
if (!passenger) return 0;
|
|
4751
|
-
const service = passenger.services.find(
|
|
4761
|
+
const service = passenger.services.find(
|
|
4762
|
+
(s) => s.serviceName === serviceName
|
|
4763
|
+
);
|
|
4752
4764
|
return service?.count || 0;
|
|
4753
4765
|
};
|
|
4754
4766
|
const getTotalForType = (passengerTypeCode) => {
|
|
4755
|
-
const passenger = passengers.find(
|
|
4767
|
+
const passenger = passengers.find(
|
|
4768
|
+
(p) => p.passengerTypeCode === passengerTypeCode
|
|
4769
|
+
);
|
|
4756
4770
|
if (!passenger) return "0";
|
|
4757
4771
|
const parts = [];
|
|
4758
4772
|
passenger.services.forEach((service) => {
|
|
4759
4773
|
if (service.count > 0) {
|
|
4760
|
-
const serviceClass = serviceClasses.find(
|
|
4774
|
+
const serviceClass = serviceClasses.find(
|
|
4775
|
+
(sc) => sc.serviceName === service.serviceName
|
|
4776
|
+
);
|
|
4761
4777
|
const serviceName = serviceClass?.name || service.serviceName;
|
|
4762
4778
|
parts.push(`${service.count} ${serviceName}`);
|
|
4763
4779
|
}
|
|
@@ -4800,7 +4816,10 @@ var ModalTotalPassengers = ({
|
|
|
4800
4816
|
services: passenger.services.map((service) => {
|
|
4801
4817
|
if (service.serviceName === serviceName && service.count > 0) {
|
|
4802
4818
|
const newCount = service.count - 1;
|
|
4803
|
-
const newPassengers = (service.passengers || []).slice(
|
|
4819
|
+
const newPassengers = (service.passengers || []).slice(
|
|
4820
|
+
0,
|
|
4821
|
+
newCount
|
|
4822
|
+
);
|
|
4804
4823
|
return {
|
|
4805
4824
|
...service,
|
|
4806
4825
|
count: newCount,
|
|
@@ -4822,52 +4841,58 @@ var ModalTotalPassengers = ({
|
|
|
4822
4841
|
})).filter((passenger) => passenger.services.length > 0);
|
|
4823
4842
|
onSave(filteredPassengers);
|
|
4824
4843
|
};
|
|
4825
|
-
return /* @__PURE__ */ jsx(
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
/* @__PURE__ */ jsx(
|
|
4832
|
-
DialogTitle,
|
|
4844
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (_, data) => !data.open && onClose(), children: /* @__PURE__ */ jsx(DialogSurface, { children: /* @__PURE__ */ jsxs(DialogBody, { children: [
|
|
4845
|
+
/* @__PURE__ */ jsx(
|
|
4846
|
+
DialogTitle,
|
|
4847
|
+
{
|
|
4848
|
+
action: /* @__PURE__ */ jsx(
|
|
4849
|
+
Button,
|
|
4833
4850
|
{
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
"aria-label": "close",
|
|
4839
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-12-regular" }),
|
|
4840
|
-
onClick: onClose
|
|
4841
|
-
}
|
|
4842
|
-
),
|
|
4843
|
-
children: title
|
|
4851
|
+
appearance: "subtle",
|
|
4852
|
+
"aria-label": "close",
|
|
4853
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-12-regular" }),
|
|
4854
|
+
onClick: onClose
|
|
4844
4855
|
}
|
|
4845
4856
|
),
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4857
|
+
children: title
|
|
4858
|
+
}
|
|
4859
|
+
),
|
|
4860
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
4861
|
+
/* @__PURE__ */ jsx(MessageBar, { shape: "rounded", children: /* @__PURE__ */ jsx(MessageBarBody, { children: infoMessage || defaultInfoMessage }) }),
|
|
4862
|
+
isLoading ? /* @__PURE__ */ jsx(Body1, { children: "Loading..." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4863
|
+
/* @__PURE__ */ jsx(
|
|
4864
|
+
Accordion,
|
|
4865
|
+
{
|
|
4866
|
+
collapsible: true,
|
|
4867
|
+
multiple: true,
|
|
4868
|
+
openItems,
|
|
4869
|
+
onToggle: (_, data) => setOpenItems(data.openItems),
|
|
4870
|
+
className: styles.passengerSection,
|
|
4871
|
+
children: passengerTypes.map((passengerType) => {
|
|
4872
|
+
return /* @__PURE__ */ jsxs(
|
|
4873
|
+
AccordionItem,
|
|
4874
|
+
{
|
|
4875
|
+
value: String(passengerType.id),
|
|
4876
|
+
className: styles.accordionItem,
|
|
4877
|
+
children: [
|
|
4878
|
+
/* @__PURE__ */ jsxs(
|
|
4879
|
+
AccordionHeader,
|
|
4880
|
+
{
|
|
4881
|
+
className: styles.accordionHeader,
|
|
4882
|
+
expandIconPosition: "end",
|
|
4883
|
+
children: [
|
|
4865
4884
|
passengerType.passengerTypeName,
|
|
4866
4885
|
" (",
|
|
4867
4886
|
getTotalForType(passengerType.passengerTypeCode),
|
|
4868
4887
|
")"
|
|
4869
|
-
]
|
|
4870
|
-
|
|
4888
|
+
]
|
|
4889
|
+
}
|
|
4890
|
+
),
|
|
4891
|
+
/* @__PURE__ */ jsx(AccordionPanel, { className: styles.accordionPanel, children: /* @__PURE__ */ jsx("div", { className: styles.nestedSection, children: serviceClasses.map((service) => /* @__PURE__ */ jsxs(
|
|
4892
|
+
"div",
|
|
4893
|
+
{
|
|
4894
|
+
className: styles.nestedRow,
|
|
4895
|
+
children: [
|
|
4871
4896
|
/* @__PURE__ */ jsx(Body1, { children: service.name }),
|
|
4872
4897
|
/* @__PURE__ */ jsxs("div", { className: styles.passengerCount, children: [
|
|
4873
4898
|
/* @__PURE__ */ jsx(
|
|
@@ -4911,29 +4936,30 @@ var ModalTotalPassengers = ({
|
|
|
4911
4936
|
}
|
|
4912
4937
|
)
|
|
4913
4938
|
] })
|
|
4914
|
-
]
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
}
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4939
|
+
]
|
|
4940
|
+
},
|
|
4941
|
+
service.key
|
|
4942
|
+
)) }) })
|
|
4943
|
+
]
|
|
4944
|
+
},
|
|
4945
|
+
passengerType.id
|
|
4946
|
+
);
|
|
4947
|
+
})
|
|
4948
|
+
}
|
|
4949
|
+
),
|
|
4950
|
+
/* @__PURE__ */ jsx(
|
|
4951
|
+
Button,
|
|
4952
|
+
{
|
|
4953
|
+
appearance: "primary",
|
|
4954
|
+
size: "medium",
|
|
4955
|
+
className: styles.submitButton,
|
|
4956
|
+
onClick: handleSave,
|
|
4957
|
+
children: "Simpan"
|
|
4958
|
+
}
|
|
4959
|
+
)
|
|
4960
|
+
] })
|
|
4961
|
+
] })
|
|
4962
|
+
] }) }) });
|
|
4937
4963
|
};
|
|
4938
4964
|
var useStyles13 = makeStyles({
|
|
4939
4965
|
dialogSurface: {
|