@asdp/ferryui 0.1.22-dev.10832 → 0.1.22-dev.10844

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.js CHANGED
@@ -12818,10 +12818,9 @@ var DEFAULT_LABELS26 = {
12818
12818
  industryTypeOthersLabel: "Jenis Industri Lainnya",
12819
12819
  industryTypeOthersPlaceholder: "Masukkan Jenis Industri",
12820
12820
  cargoCategoryLabel: "Kategori Muatan",
12821
- estimatedLooseCargoLabel: "Estimasi Berat Barang Lepas",
12822
- estimatedLooseCargoWeightPlaceholder: "Masukkan Berat (Ton)",
12823
- estimatedLooseCargoQuantityLabel: "Jumlah Karung",
12824
- estimatedLooseCargoUnitLabel: "Karung",
12821
+ cargoLabel: "Estimasi Berat Barang Lepas",
12822
+ cargoWeightPlaceholder: "Masukkan Berat (Ton)",
12823
+ cargoUnitLabel: "Karung",
12825
12824
  deleteCargoButton: "Hapus Muatan",
12826
12825
  addCargoButton: "Tambah Muatan",
12827
12826
  loadTypeOptions: {
@@ -12878,10 +12877,9 @@ var DEFAULT_LABELS26 = {
12878
12877
  industryTypeOthersLabel: "Other Industry Type",
12879
12878
  industryTypeOthersPlaceholder: "Enter Industry Type",
12880
12879
  cargoCategoryLabel: "Cargo Category",
12881
- estimatedLooseCargoLabel: "Estimated Loose Cargo Weight",
12882
- estimatedLooseCargoWeightPlaceholder: "Enter Weight (Ton)",
12883
- estimatedLooseCargoQuantityLabel: "Number of Bags",
12884
- estimatedLooseCargoUnitLabel: "Bags",
12880
+ cargoLabel: "Estimated Loose Cargo Weight",
12881
+ cargoWeightPlaceholder: "Enter Weight (Ton)",
12882
+ cargoUnitLabel: "Bags",
12885
12883
  deleteCargoButton: "Delete Cargo",
12886
12884
  addCargoButton: "Add Cargo",
12887
12885
  loadTypeOptions: {
@@ -12969,7 +12967,7 @@ var CardVehicleOwnerForm = ({
12969
12967
  }) => {
12970
12968
  const styles = useStyles27();
12971
12969
  const mergedLabels = { ...DEFAULT_LABELS26[language], ...labels };
12972
- const formValues = watch();
12970
+ watch();
12973
12971
  const [defaultOpenCargoItems, setOpenCargoItems] = React__default.default.useState(/* @__PURE__ */ new Set());
12974
12972
  React.useEffect(() => {
12975
12973
  const allOpenItems = /* @__PURE__ */ new Set();
@@ -12982,9 +12980,38 @@ var CardVehicleOwnerForm = ({
12982
12980
  });
12983
12981
  setOpenCargoItems(allOpenItems);
12984
12982
  }, [owners]);
12985
- React.useEffect(() => {
12986
- console.log("[CardVehicleOwnerForm] Form values changed:", formValues);
12987
- }, [formValues]);
12983
+ function OwnerWeightSync({
12984
+ owner,
12985
+ ownerIndex
12986
+ }) {
12987
+ const { fields } = reactHookForm.useFieldArray({
12988
+ control,
12989
+ name: `owners.${ownerIndex}.cargoItems`
12990
+ });
12991
+ console.log(140, fields);
12992
+ const cargoWeights = reactHookForm.useWatch({
12993
+ control,
12994
+ name: fields.map(
12995
+ (_, cargoIndex) => `owners.${ownerIndex}.cargoItems.${cargoIndex}.cargoWeight`
12996
+ )
12997
+ });
12998
+ console.log(149, cargoWeights);
12999
+ React.useEffect(() => {
13000
+ const total = cargoWeights?.reduce(
13001
+ (sum, w) => sum + (Number(w) || 0),
13002
+ 0
13003
+ ) ?? 0;
13004
+ const current = Number(getValues(`owners.${ownerIndex}.estimatedWeight`)) || 0;
13005
+ console.log(160, current, total);
13006
+ if (current !== total) {
13007
+ setValue(`owners.${ownerIndex}.estimatedWeight`, total);
13008
+ onUpdateOwner(owner.id, {
13009
+ estimatedWeight: total
13010
+ });
13011
+ }
13012
+ }, [cargoWeights, ownerIndex, setValue, getValues]);
13013
+ return null;
13014
+ }
12988
13015
  return /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Card, { className: styles.card, children: [
12989
13016
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
12990
13017
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", flex: 1 }, children: [
@@ -13008,165 +13035,59 @@ var CardVehicleOwnerForm = ({
13008
13035
  collapsible: true,
13009
13036
  defaultOpenItems: owners.map((o) => String(o.id)),
13010
13037
  multiple: true,
13011
- children: owners.map((owner, index) => /* @__PURE__ */ jsxRuntime.jsxs(
13012
- reactComponents.AccordionItem,
13013
- {
13014
- value: String(owner.id),
13015
- className: styles.accordion,
13016
- children: [
13017
- /* @__PURE__ */ jsxRuntime.jsx(
13018
- reactComponents.AccordionHeader,
13019
- {
13020
- className: styles.accordionHeader,
13021
- expandIconPosition: "end",
13022
- children: /* @__PURE__ */ jsxRuntime.jsxs(
13023
- "div",
13024
- {
13025
- style: {
13026
- display: "flex",
13027
- justifyContent: "space-between",
13028
- alignItems: "center",
13029
- width: "100%"
13030
- },
13031
- children: [
13032
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.ownerInfoTitle.replace(
13033
- "{index}",
13034
- (index + 1).toString()
13035
- ) }),
13036
- owners.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
13037
- reactComponents.Button,
13038
- {
13039
- appearance: "transparent",
13040
- "aria-label": mergedLabels.deleteOwnerAriaLabel,
13041
- disabled,
13042
- icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:delete-24-regular" }),
13043
- onClick: (e) => {
13044
- e.stopPropagation();
13045
- onDeleteOwner(owner.id);
13046
- },
13047
- style: { color: reactComponents.tokens.colorPaletteRedForeground1 }
13048
- }
13049
- )
13050
- ]
13051
- }
13052
- )
13053
- }
13054
- ),
13055
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.AccordionPanel, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.form, children: [
13056
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13057
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13058
- mergedLabels.cargoOwnerTitle,
13059
- " ",
13060
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13061
- ] }) }),
13062
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13063
- /* @__PURE__ */ jsxRuntime.jsx(
13038
+ children: owners.map((owner, ownerIndex) => /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
13039
+ /* @__PURE__ */ jsxRuntime.jsx(OwnerWeightSync, { owner, ownerIndex }),
13040
+ /* @__PURE__ */ jsxRuntime.jsxs(
13041
+ reactComponents.AccordionItem,
13042
+ {
13043
+ value: String(owner.id),
13044
+ className: styles.accordion,
13045
+ children: [
13046
+ /* @__PURE__ */ jsxRuntime.jsx(
13047
+ reactComponents.AccordionHeader,
13048
+ {
13049
+ className: styles.accordionHeader,
13050
+ expandIconPosition: "end",
13051
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
13064
13052
  "div",
13065
13053
  {
13066
13054
  style: {
13067
13055
  display: "flex",
13068
- gap: "2rem",
13069
- marginBottom: "0.5rem"
13056
+ justifyContent: "space-between",
13057
+ alignItems: "center",
13058
+ width: "100%"
13070
13059
  },
13071
- children: /* @__PURE__ */ jsxRuntime.jsxs(
13072
- reactComponents.RadioGroup,
13073
- {
13074
- disabled,
13075
- layout: "horizontal",
13076
- onChange: (_, data) => {
13077
- onUpdateOwner(owner.id, {
13078
- cargoOwnerEntityType: data.value,
13079
- cargoOwnerEntity: "",
13080
- cargoOwnerEntityOther: ""
13081
- });
13082
- setValue(`owners.${index}.cargoOwnerEntity`, "");
13083
- setValue(`owners.${index}.cargoOwnerEntityOther`, "");
13084
- },
13085
- required: true,
13086
- value: owner.cargoOwnerEntityType || MANIFEST_ENTITY.COMPANY,
13087
- children: [
13088
- /* @__PURE__ */ jsxRuntime.jsx(
13089
- reactComponents.Radio,
13090
- {
13091
- value: MANIFEST_ENTITY.COMPANY,
13092
- label: mergedLabels.entityTypeCompany
13093
- }
13094
- ),
13095
- /* @__PURE__ */ jsxRuntime.jsx(
13096
- reactComponents.Radio,
13097
- {
13098
- value: MANIFEST_ENTITY.INDIVIDUAL,
13099
- label: mergedLabels.entityTypeIndividual
13100
- }
13101
- )
13102
- ]
13103
- }
13104
- )
13105
- }
13106
- ),
13107
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13108
- /* @__PURE__ */ jsxRuntime.jsx(
13109
- reactGridSystem.Col,
13110
- {
13111
- lg: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13112
- children: /* @__PURE__ */ jsxRuntime.jsx(
13113
- InputDynamic_default,
13060
+ children: [
13061
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.ownerInfoTitle.replace(
13062
+ "{index}",
13063
+ (ownerIndex + 1).toString()
13064
+ ) }),
13065
+ owners.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
13066
+ reactComponents.Button,
13114
13067
  {
13068
+ appearance: "transparent",
13069
+ "aria-label": mergedLabels.deleteOwnerAriaLabel,
13115
13070
  disabled,
13116
- control,
13117
- name: `owners.${index}.cargoOwnerEntity`,
13118
- options: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? companyOwnerOptions : [],
13119
- onChange: (val) => {
13120
- setValue(`owners.${index}.cargoOwnerEntity`, val);
13121
- onUpdateOwner(owner.id, {
13122
- cargoOwnerEntity: val
13123
- });
13071
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:delete-24-regular" }),
13072
+ onClick: (e) => {
13073
+ e.stopPropagation();
13074
+ onDeleteOwner(owner.id);
13124
13075
  },
13125
- placeholder: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.cargoOwnerCompanyPlaceholder : mergedLabels.cargoOwnerIndividualPlaceholder,
13126
- required: true,
13127
- size: "large",
13128
- type: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text"
13076
+ style: { color: reactComponents.tokens.colorPaletteRedForeground1 }
13129
13077
  }
13130
13078
  )
13131
- }
13132
- ),
13133
- owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13134
- InputDynamic_default,
13135
- {
13136
- control,
13137
- disabled,
13138
- name: `owners.${index}.cargoOwnerEntityOther`,
13139
- placeholder: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13140
- required: true,
13141
- size: "large",
13142
- type: "text",
13143
- onChange: (val) => {
13144
- setValue(
13145
- `owners.${index}.cargoOwnerEntityOther`,
13146
- val
13147
- );
13148
- onUpdateOwner(owner.id, {
13149
- cargoOwnerEntityOther: val
13150
- });
13151
- }
13152
- }
13153
- ) })
13154
- ] }),
13155
- /* @__PURE__ */ jsxRuntime.jsx(
13156
- reactComponents.Caption1,
13157
- {
13158
- style: {
13159
- color: reactComponents.tokens.colorNeutralForeground3,
13160
- marginTop: "0.25rem"
13161
- },
13162
- children: mergedLabels.otherCompanyHelperText
13079
+ ]
13163
13080
  }
13164
13081
  )
13165
- ] })
13166
- ] }),
13167
- hasLoad && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13168
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, children: [
13169
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoReceiverTitle }) }),
13082
+ }
13083
+ ),
13084
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.AccordionPanel, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.form, children: [
13085
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13086
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13087
+ mergedLabels.cargoOwnerTitle,
13088
+ " ",
13089
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13090
+ ] }) }),
13170
13091
  /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13171
13092
  /* @__PURE__ */ jsxRuntime.jsx(
13172
13093
  "div",
@@ -13183,21 +13104,21 @@ var CardVehicleOwnerForm = ({
13183
13104
  layout: "horizontal",
13184
13105
  onChange: (_, data) => {
13185
13106
  onUpdateOwner(owner.id, {
13186
- cargoReceiverEntityType: data.value,
13187
- cargoReceiverEntity: "",
13188
- cargoReceiverEntityOther: ""
13107
+ cargoOwnerEntityType: data.value,
13108
+ cargoOwnerEntity: "",
13109
+ cargoOwnerEntityOther: ""
13189
13110
  });
13190
13111
  setValue(
13191
- `owners.${index}.cargoReceiverEntity`,
13112
+ `owners.${ownerIndex}.cargoOwnerEntity`,
13192
13113
  ""
13193
13114
  );
13194
13115
  setValue(
13195
- `owners.${index}.cargoReceiverEntityOther`,
13116
+ `owners.${ownerIndex}.cargoOwnerEntityOther`,
13196
13117
  ""
13197
13118
  );
13198
13119
  },
13199
13120
  required: true,
13200
- value: owner.cargoReceiverEntityType || MANIFEST_ENTITY.COMPANY,
13121
+ value: owner.cargoOwnerEntityType || MANIFEST_ENTITY.COMPANY,
13201
13122
  children: [
13202
13123
  /* @__PURE__ */ jsxRuntime.jsx(
13203
13124
  reactComponents.Radio,
@@ -13222,48 +13143,48 @@ var CardVehicleOwnerForm = ({
13222
13143
  /* @__PURE__ */ jsxRuntime.jsx(
13223
13144
  reactGridSystem.Col,
13224
13145
  {
13225
- lg: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13146
+ lg: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13226
13147
  children: /* @__PURE__ */ jsxRuntime.jsx(
13227
13148
  InputDynamic_default,
13228
13149
  {
13229
- control,
13230
13150
  disabled,
13231
- name: `owners.${index}.cargoReceiverEntity`,
13232
- placeholder: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.cargoReceiverCompanyPlaceholder : mergedLabels.cargoReceiverIndividualPlaceholder,
13233
- required: true,
13234
- size: "large",
13235
- type: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text",
13236
- options: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? companyReceiverOptions : [],
13151
+ control,
13152
+ name: `owners.${ownerIndex}.cargoOwnerEntity`,
13153
+ options: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? companyOwnerOptions : [],
13237
13154
  onChange: (val) => {
13238
13155
  setValue(
13239
- `owners.${index}.cargoReceiverEntity`,
13156
+ `owners.${ownerIndex}.cargoOwnerEntity`,
13240
13157
  val
13241
13158
  );
13242
13159
  onUpdateOwner(owner.id, {
13243
- cargoReceiverEntity: val
13160
+ cargoOwnerEntity: val
13244
13161
  });
13245
- }
13162
+ },
13163
+ placeholder: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.cargoOwnerCompanyPlaceholder : mergedLabels.cargoOwnerIndividualPlaceholder,
13164
+ required: true,
13165
+ size: "large",
13166
+ type: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text"
13246
13167
  }
13247
13168
  )
13248
13169
  }
13249
13170
  ),
13250
- owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13171
+ owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13251
13172
  InputDynamic_default,
13252
13173
  {
13253
13174
  control,
13254
13175
  disabled,
13255
- name: `owners.${index}.cargoReceiverEntityOther`,
13256
- placeholder: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13176
+ name: `owners.${ownerIndex}.cargoOwnerEntityOther`,
13177
+ placeholder: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13257
13178
  required: true,
13258
13179
  size: "large",
13259
13180
  type: "text",
13260
13181
  onChange: (val) => {
13261
13182
  setValue(
13262
- `owners.${index}.cargoReceiverEntityOther`,
13183
+ `owners.${ownerIndex}.cargoOwnerEntityOther`,
13263
13184
  val
13264
13185
  );
13265
13186
  onUpdateOwner(owner.id, {
13266
- cargoReceiverEntityOther: val
13187
+ cargoOwnerEntityOther: val
13267
13188
  });
13268
13189
  }
13269
13190
  }
@@ -13281,895 +13202,1046 @@ var CardVehicleOwnerForm = ({
13281
13202
  )
13282
13203
  ] })
13283
13204
  ] }),
13284
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, children: [
13285
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13286
- mergedLabels.logisticsCompanyTitle,
13287
- " ",
13288
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13289
- ] }) }),
13290
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13291
- /* @__PURE__ */ jsxRuntime.jsx(
13292
- "div",
13293
- {
13294
- style: {
13295
- display: "flex",
13296
- gap: "2rem",
13297
- marginBottom: "0.5rem"
13298
- },
13299
- children: /* @__PURE__ */ jsxRuntime.jsxs(
13300
- reactComponents.RadioGroup,
13205
+ hasLoad && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13206
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, children: [
13207
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoReceiverTitle }) }),
13208
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13209
+ /* @__PURE__ */ jsxRuntime.jsx(
13210
+ "div",
13211
+ {
13212
+ style: {
13213
+ display: "flex",
13214
+ gap: "2rem",
13215
+ marginBottom: "0.5rem"
13216
+ },
13217
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
13218
+ reactComponents.RadioGroup,
13219
+ {
13220
+ disabled,
13221
+ layout: "horizontal",
13222
+ onChange: (_, data) => {
13223
+ onUpdateOwner(owner.id, {
13224
+ cargoReceiverEntityType: data.value,
13225
+ cargoReceiverEntity: "",
13226
+ cargoReceiverEntityOther: ""
13227
+ });
13228
+ setValue(
13229
+ `owners.${ownerIndex}.cargoReceiverEntity`,
13230
+ ""
13231
+ );
13232
+ setValue(
13233
+ `owners.${ownerIndex}.cargoReceiverEntityOther`,
13234
+ ""
13235
+ );
13236
+ },
13237
+ required: true,
13238
+ value: owner.cargoReceiverEntityType || MANIFEST_ENTITY.COMPANY,
13239
+ children: [
13240
+ /* @__PURE__ */ jsxRuntime.jsx(
13241
+ reactComponents.Radio,
13242
+ {
13243
+ value: MANIFEST_ENTITY.COMPANY,
13244
+ label: mergedLabels.entityTypeCompany
13245
+ }
13246
+ ),
13247
+ /* @__PURE__ */ jsxRuntime.jsx(
13248
+ reactComponents.Radio,
13249
+ {
13250
+ value: MANIFEST_ENTITY.INDIVIDUAL,
13251
+ label: mergedLabels.entityTypeIndividual
13252
+ }
13253
+ )
13254
+ ]
13255
+ }
13256
+ )
13257
+ }
13258
+ ),
13259
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13260
+ /* @__PURE__ */ jsxRuntime.jsx(
13261
+ reactGridSystem.Col,
13262
+ {
13263
+ lg: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13264
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13265
+ InputDynamic_default,
13266
+ {
13267
+ control,
13268
+ disabled,
13269
+ name: `owners.${ownerIndex}.cargoReceiverEntity`,
13270
+ placeholder: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.cargoReceiverCompanyPlaceholder : mergedLabels.cargoReceiverIndividualPlaceholder,
13271
+ required: true,
13272
+ size: "large",
13273
+ type: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text",
13274
+ options: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? companyReceiverOptions : [],
13275
+ onChange: (val) => {
13276
+ setValue(
13277
+ `owners.${ownerIndex}.cargoReceiverEntity`,
13278
+ val
13279
+ );
13280
+ onUpdateOwner(owner.id, {
13281
+ cargoReceiverEntity: val
13282
+ });
13283
+ }
13284
+ }
13285
+ )
13286
+ }
13287
+ ),
13288
+ owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13289
+ InputDynamic_default,
13301
13290
  {
13291
+ control,
13302
13292
  disabled,
13303
- layout: "horizontal",
13304
- onChange: (_, data) => {
13305
- onUpdateOwner(owner.id, {
13306
- logisticsEntityType: data.value,
13307
- logisticsEntity: "",
13308
- logisticsEntityOther: ""
13309
- });
13310
- setValue(`owners.${index}.logisticsEntity`, "");
13293
+ name: `owners.${ownerIndex}.cargoReceiverEntityOther`,
13294
+ placeholder: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13295
+ required: true,
13296
+ size: "large",
13297
+ type: "text",
13298
+ onChange: (val) => {
13311
13299
  setValue(
13312
- `owners.${index}.logisticsEntityOther`,
13313
- ""
13300
+ `owners.${ownerIndex}.cargoReceiverEntityOther`,
13301
+ val
13314
13302
  );
13315
- },
13316
- required: true,
13317
- value: owner.logisticsEntityType || MANIFEST_ENTITY.COMPANY,
13318
- children: [
13319
- /* @__PURE__ */ jsxRuntime.jsx(
13320
- reactComponents.Radio,
13321
- {
13322
- value: MANIFEST_ENTITY.COMPANY,
13323
- label: mergedLabels.entityTypeCompany
13324
- }
13325
- ),
13326
- /* @__PURE__ */ jsxRuntime.jsx(
13327
- reactComponents.Radio,
13328
- {
13329
- value: MANIFEST_ENTITY.INDIVIDUAL,
13330
- label: mergedLabels.entityTypeIndividual
13331
- }
13332
- )
13333
- ]
13303
+ onUpdateOwner(owner.id, {
13304
+ cargoReceiverEntityOther: val
13305
+ });
13306
+ }
13334
13307
  }
13335
- )
13336
- }
13337
- ),
13338
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13308
+ ) })
13309
+ ] }),
13339
13310
  /* @__PURE__ */ jsxRuntime.jsx(
13340
- reactGridSystem.Col,
13311
+ reactComponents.Caption1,
13341
13312
  {
13342
- xl: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13343
- children: /* @__PURE__ */ jsxRuntime.jsx(
13344
- InputDynamic_default,
13313
+ style: {
13314
+ color: reactComponents.tokens.colorNeutralForeground3,
13315
+ marginTop: "0.25rem"
13316
+ },
13317
+ children: mergedLabels.otherCompanyHelperText
13318
+ }
13319
+ )
13320
+ ] })
13321
+ ] }),
13322
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, children: [
13323
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13324
+ mergedLabels.logisticsCompanyTitle,
13325
+ " ",
13326
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13327
+ ] }) }),
13328
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13329
+ /* @__PURE__ */ jsxRuntime.jsx(
13330
+ "div",
13331
+ {
13332
+ style: {
13333
+ display: "flex",
13334
+ gap: "2rem",
13335
+ marginBottom: "0.5rem"
13336
+ },
13337
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
13338
+ reactComponents.RadioGroup,
13345
13339
  {
13346
- control,
13347
13340
  disabled,
13348
- name: `owners.${index}.logisticsEntity`,
13349
- placeholder: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.logisticsCompanyPlaceholder : mergedLabels.logisticsIndividualPlaceholder,
13350
- required: true,
13351
- size: "large",
13352
- type: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text",
13353
- options: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? companyLogisticsOptions : [],
13354
- onChange: (val) => {
13355
- setValue(
13356
- `owners.${index}.logisticsEntity`,
13357
- val
13358
- );
13341
+ layout: "horizontal",
13342
+ onChange: (_, data) => {
13359
13343
  onUpdateOwner(owner.id, {
13360
- logisticsEntity: val
13344
+ logisticsEntityType: data.value,
13345
+ logisticsEntity: "",
13346
+ logisticsEntityOther: ""
13361
13347
  });
13362
- }
13348
+ setValue(
13349
+ `owners.${ownerIndex}.logisticsEntity`,
13350
+ ""
13351
+ );
13352
+ setValue(
13353
+ `owners.${ownerIndex}.logisticsEntityOther`,
13354
+ ""
13355
+ );
13356
+ },
13357
+ required: true,
13358
+ value: owner.logisticsEntityType || MANIFEST_ENTITY.COMPANY,
13359
+ children: [
13360
+ /* @__PURE__ */ jsxRuntime.jsx(
13361
+ reactComponents.Radio,
13362
+ {
13363
+ value: MANIFEST_ENTITY.COMPANY,
13364
+ label: mergedLabels.entityTypeCompany
13365
+ }
13366
+ ),
13367
+ /* @__PURE__ */ jsxRuntime.jsx(
13368
+ reactComponents.Radio,
13369
+ {
13370
+ value: MANIFEST_ENTITY.INDIVIDUAL,
13371
+ label: mergedLabels.entityTypeIndividual
13372
+ }
13373
+ )
13374
+ ]
13363
13375
  }
13364
13376
  )
13365
13377
  }
13366
13378
  ),
13367
- owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13368
- InputDynamic_default,
13369
- {
13370
- control,
13371
- disabled,
13372
- name: `owners.${index}.logisticsEntityOther`,
13373
- placeholder: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13374
- required: true,
13375
- size: "large",
13376
- type: "text",
13377
- onChange: (val) => {
13378
- setValue(
13379
- `owners.${index}.logisticsEntityOther`,
13380
- val
13381
- );
13382
- onUpdateOwner(owner.id, {
13383
- logisticsEntityOther: val
13384
- });
13379
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13380
+ /* @__PURE__ */ jsxRuntime.jsx(
13381
+ reactGridSystem.Col,
13382
+ {
13383
+ xl: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13384
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13385
+ InputDynamic_default,
13386
+ {
13387
+ control,
13388
+ disabled,
13389
+ name: `owners.${ownerIndex}.logisticsEntity`,
13390
+ placeholder: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.logisticsCompanyPlaceholder : mergedLabels.logisticsIndividualPlaceholder,
13391
+ required: true,
13392
+ size: "large",
13393
+ type: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? "select" : "text",
13394
+ options: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? companyLogisticsOptions : [],
13395
+ onChange: (val) => {
13396
+ setValue(
13397
+ `owners.${ownerIndex}.logisticsEntity`,
13398
+ val
13399
+ );
13400
+ onUpdateOwner(owner.id, {
13401
+ logisticsEntity: val
13402
+ });
13403
+ }
13404
+ }
13405
+ )
13385
13406
  }
13386
- }
13387
- ) })
13388
- ] })
13389
- ] }),
13390
- /* @__PURE__ */ jsxRuntime.jsx(
13391
- reactComponents.Caption1,
13392
- {
13393
- style: {
13394
- color: reactComponents.tokens.colorNeutralForeground3,
13395
- marginTop: "0.25rem"
13396
- },
13397
- children: mergedLabels.otherCompanyHelperText
13398
- }
13399
- )
13400
- ] })
13401
- ] }),
13402
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13403
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 6, children: [
13404
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.originCityLabel }),
13405
- /* @__PURE__ */ jsxRuntime.jsx(
13406
- InputDynamic_default,
13407
- {
13408
- control,
13409
- disabled,
13410
- name: `owners.${index}.originCity`,
13411
- onChange: (val) => {
13412
- setValue(`owners.${index}.originCity`, val);
13413
- onUpdateOwner(owner.id, {
13414
- originCity: val
13415
- });
13416
- },
13417
- options: cityOriginOptions,
13418
- placeholder: mergedLabels.selectPlaceholder,
13419
- required: true,
13420
- size: "large",
13421
- type: "select"
13422
- }
13423
- )
13424
- ] }),
13425
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 6, children: [
13426
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.destinationCityLabel }),
13427
- /* @__PURE__ */ jsxRuntime.jsx(
13428
- InputDynamic_default,
13429
- {
13430
- control,
13431
- disabled,
13432
- name: `owners.${index}.destinationCity`,
13433
- options: cityDestinationOptions,
13434
- onChange: (val) => {
13435
- setValue(`owners.${index}.destinationCity`, val);
13436
- onUpdateOwner(owner.id, {
13437
- destinationCity: val
13438
- });
13439
- },
13440
- placeholder: mergedLabels.selectPlaceholder,
13441
- required: true,
13442
- size: "large",
13443
- type: "select"
13444
- }
13445
- )
13407
+ ),
13408
+ owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
13409
+ InputDynamic_default,
13410
+ {
13411
+ control,
13412
+ disabled,
13413
+ name: `owners.${ownerIndex}.logisticsEntityOther`,
13414
+ placeholder: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY ? mergedLabels.selectCompanyPlaceholder : mergedLabels.inputSenderNamePlaceholder,
13415
+ required: true,
13416
+ size: "large",
13417
+ type: "text",
13418
+ onChange: (val) => {
13419
+ setValue(
13420
+ `owners.${ownerIndex}.logisticsEntityOther`,
13421
+ val
13422
+ );
13423
+ onUpdateOwner(owner.id, {
13424
+ logisticsEntityOther: val
13425
+ });
13426
+ }
13427
+ }
13428
+ ) })
13429
+ ] })
13430
+ ] }),
13431
+ /* @__PURE__ */ jsxRuntime.jsx(
13432
+ reactComponents.Caption1,
13433
+ {
13434
+ style: {
13435
+ color: reactComponents.tokens.colorNeutralForeground3,
13436
+ marginTop: "0.25rem"
13437
+ },
13438
+ children: mergedLabels.otherCompanyHelperText
13439
+ }
13440
+ )
13441
+ ] })
13446
13442
  ] }),
13447
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13448
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "1rem" } }),
13449
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13450
- mergedLabels.estimatedVehicleWeightLabel,
13451
- " ",
13452
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13443
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13444
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 6, children: [
13445
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.originCityLabel }),
13446
+ /* @__PURE__ */ jsxRuntime.jsx(
13447
+ InputDynamic_default,
13448
+ {
13449
+ control,
13450
+ disabled,
13451
+ name: `owners.${ownerIndex}.originCity`,
13452
+ onChange: (val) => {
13453
+ setValue(`owners.${ownerIndex}.originCity`, val);
13454
+ onUpdateOwner(owner.id, {
13455
+ originCity: val
13456
+ });
13457
+ },
13458
+ options: cityOriginOptions,
13459
+ placeholder: mergedLabels.selectPlaceholder,
13460
+ required: true,
13461
+ size: "large",
13462
+ type: "select"
13463
+ }
13464
+ )
13453
13465
  ] }),
13454
- /* @__PURE__ */ jsxRuntime.jsx(
13455
- InputDynamic_default,
13456
- {
13457
- control,
13458
- disabled,
13459
- name: `owners.${index}.estimatedWeight`,
13460
- placeholder: mergedLabels.inputNumberPlaceholder,
13461
- required: true,
13462
- size: "large",
13463
- type: "number",
13464
- onChange: (val) => {
13465
- setValue(`owners.${index}.estimatedWeight`, val);
13466
- onUpdateOwner(owner.id, {
13467
- estimatedWeight: val
13468
- });
13466
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 6, children: [
13467
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.destinationCityLabel }),
13468
+ /* @__PURE__ */ jsxRuntime.jsx(
13469
+ InputDynamic_default,
13470
+ {
13471
+ control,
13472
+ disabled,
13473
+ name: `owners.${ownerIndex}.destinationCity`,
13474
+ options: cityDestinationOptions,
13475
+ onChange: (val) => {
13476
+ setValue(`owners.${ownerIndex}.destinationCity`, val);
13477
+ onUpdateOwner(owner.id, {
13478
+ destinationCity: val
13479
+ });
13480
+ },
13481
+ placeholder: mergedLabels.selectPlaceholder,
13482
+ required: true,
13483
+ size: "large",
13484
+ type: "select"
13469
13485
  }
13470
- }
13471
- )
13472
- ] })
13473
- ] }),
13474
- hasLoad && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13475
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoListTitle }) }) }),
13476
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xs: 12, children: [
13477
- /* @__PURE__ */ jsxRuntime.jsx(
13478
- reactComponents.Accordion,
13479
- {
13480
- collapsible: true,
13481
- defaultOpenItems: Array.from(defaultOpenCargoItems),
13482
- onToggle: (e, data) => {
13483
- const newOpenItems = new Set(data.openItems);
13484
- setOpenCargoItems(newOpenItems);
13485
- const updatedCargoItems = owner.cargoItems?.map((cargo) => ({
13486
- ...cargo,
13487
- _isAccordionOpen: newOpenItems.has(`cargo-${cargo.id}`)
13488
- }));
13489
- onUpdateOwner(owner.id, {
13490
- cargoItems: updatedCargoItems
13491
- });
13492
- },
13493
- multiple: true,
13494
- children: owner.cargoItems?.map((cargo, cargoIndex) => {
13495
- const watchCommodity = watch(
13496
- `owners.${index}.cargo.${cargoIndex}.commodity`
13497
- );
13498
- const watchLoadType = watch(
13499
- `owners.${index}.cargo.${cargoIndex}.loadType`
13500
- );
13501
- const watchIndustryType = watch(
13502
- `owners.${index}.cargo.${cargoIndex}.industryType`
13503
- );
13504
- const watchQuantity = watch(
13505
- `owners.${index}.cargo.${cargoIndex}.quantity`
13506
- );
13507
- let _loadTypeOptions = [];
13508
- if (watchCommodity && loadTypeOptionsByCommodityId[watchCommodity]) {
13509
- _loadTypeOptions = loadTypeOptionsByCommodityId[watchCommodity];
13510
- } else {
13511
- _loadTypeOptions = loadTypeOptions.map((lt) => ({
13512
- value: lt.id.toString(),
13513
- label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13514
- }));
13486
+ )
13487
+ ] }),
13488
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13489
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "1rem" } }),
13490
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13491
+ (() => {
13492
+ if (selectedLoadType === LOAD_TYPE.PASSENGER_VEHICLE) {
13493
+ return mergedLabels.estimatedVehicleWeightLabel;
13494
+ } else if (selectedLoadType === LOAD_TYPE.GOODS_VEHICLE || selectedLoadType === LOAD_TYPE.LOOSE_LOAD_WITH_VEHICLE) {
13495
+ return hasLoad ? mergedLabels.estimatedVehicleAndCargoWeightLabel : mergedLabels.estimatedVehicleWeightLabel;
13496
+ } else if (selectedLoadType === LOAD_TYPE.LOOSE_LOAD_WITHOUT_VEHICLE) {
13497
+ return mergedLabels.estimatedCargoWeightLabel;
13515
13498
  }
13516
- const _selectedLoadType = loadTypes.find(
13517
- (loadType) => loadType.id.toString() === watchLoadType
13518
- );
13519
- const isLoadTypeOther = _loadTypeOptions.find(
13520
- (lt) => lt.value.toString() === String(watchLoadType)
13521
- )?.label.startsWith(
13522
- HARDCODED_NAME.LOAD_TYPE__LAINNYA
13523
- );
13524
- const isIndustryTypeOther = industryOptions?.find(
13525
- (it) => it.value.toString() === String(watchIndustryType)
13526
- )?.label === HARDCODED_NAME.INDUSTRY_TYPE__LAINNYA;
13527
- return /* @__PURE__ */ jsxRuntime.jsxs(
13528
- reactComponents.AccordionItem,
13529
- {
13530
- value: `cargo-${cargo.id}`,
13531
- className: styles.accordion,
13532
- children: [
13533
- /* @__PURE__ */ jsxRuntime.jsx(
13534
- reactComponents.AccordionHeader,
13535
- {
13536
- className: styles.accordionHeader,
13537
- expandIconPosition: "end",
13538
- children: /* @__PURE__ */ jsxRuntime.jsxs(
13539
- "div",
13540
- {
13541
- style: {
13542
- display: "flex",
13543
- justifyContent: "space-between",
13544
- alignItems: "center",
13545
- width: "100%",
13546
- gap: "1rem"
13547
- },
13548
- children: [
13549
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { style: { minWidth: "fit-content" }, children: mergedLabels.cargoItemTitle.replace(
13550
- "{index}",
13551
- (cargoIndex + 1).toString()
13552
- ) }),
13553
- _selectedLoadType && !cargo._isAccordionOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13554
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { style: { flex: 1 }, children: [
13555
- _selectedLoadType.name,
13556
- " \u2022",
13557
- " ",
13558
- watchQuantity,
13559
- "x",
13560
- " ",
13561
- _selectedLoadType.unit?.name,
13562
- " \u2022",
13563
- " ",
13564
- _selectedLoadType.formattedPrice
13565
- ] }),
13499
+ })(),
13500
+ " ",
13501
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13502
+ ] }),
13503
+ /* @__PURE__ */ jsxRuntime.jsx(
13504
+ InputDynamic_default,
13505
+ {
13506
+ control,
13507
+ disabled,
13508
+ name: `owners.${ownerIndex}.estimatedWeight`,
13509
+ placeholder: mergedLabels.inputNumberPlaceholder,
13510
+ required: true,
13511
+ size: "large",
13512
+ type: "number",
13513
+ onChange: (val) => {
13514
+ setValue(`owners.${ownerIndex}.estimatedWeight`, val);
13515
+ onUpdateOwner(owner.id, {
13516
+ estimatedWeight: val
13517
+ });
13518
+ }
13519
+ }
13520
+ )
13521
+ ] })
13522
+ ] }),
13523
+ hasLoad && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13524
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoListTitle }) }) }),
13525
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xs: 12, children: [
13526
+ /* @__PURE__ */ jsxRuntime.jsx(
13527
+ reactComponents.Accordion,
13528
+ {
13529
+ collapsible: true,
13530
+ defaultOpenItems: Array.from(defaultOpenCargoItems),
13531
+ onToggle: (e, data) => {
13532
+ const newOpenItems = new Set(
13533
+ data.openItems
13534
+ );
13535
+ setOpenCargoItems(newOpenItems);
13536
+ const updatedCargoItems = owner.cargoItems?.map(
13537
+ (cargo) => ({
13538
+ ...cargo,
13539
+ _isAccordionOpen: newOpenItems.has(
13540
+ `cargo-${cargo.id}`
13541
+ )
13542
+ })
13543
+ );
13544
+ onUpdateOwner(owner.id, {
13545
+ cargoItems: updatedCargoItems
13546
+ });
13547
+ },
13548
+ multiple: true,
13549
+ children: owner.cargoItems?.map((cargo, cargoIndex) => {
13550
+ const watchCommodity = watch(
13551
+ `owners.${ownerIndex}.cargo.${cargoIndex}.commodity`
13552
+ );
13553
+ const watchLoadType = watch(
13554
+ `owners.${ownerIndex}.cargo.${cargoIndex}.loadType`
13555
+ );
13556
+ const watchIndustryType = watch(
13557
+ `owners.${ownerIndex}.cargo.${cargoIndex}.industryType`
13558
+ );
13559
+ const watchQuantity = watch(
13560
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`
13561
+ );
13562
+ let _loadTypeOptions = [];
13563
+ if (watchCommodity && loadTypeOptionsByCommodityId[watchCommodity]) {
13564
+ _loadTypeOptions = loadTypeOptionsByCommodityId[watchCommodity];
13565
+ } else {
13566
+ _loadTypeOptions = loadTypeOptions.map(
13567
+ (lt) => ({
13568
+ value: lt.id.toString(),
13569
+ label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13570
+ })
13571
+ );
13572
+ }
13573
+ const _selectedLoadType = loadTypes.find(
13574
+ (loadType) => loadType.id.toString() === watchLoadType
13575
+ );
13576
+ const isLoadTypeOther = _loadTypeOptions.find(
13577
+ (lt) => lt.value.toString() === String(watchLoadType)
13578
+ )?.label.startsWith(
13579
+ HARDCODED_NAME.LOAD_TYPE__LAINNYA
13580
+ );
13581
+ const isIndustryTypeOther = industryOptions?.find(
13582
+ (it) => it.value.toString() === String(watchIndustryType)
13583
+ )?.label === HARDCODED_NAME.INDUSTRY_TYPE__LAINNYA;
13584
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13585
+ reactComponents.AccordionItem,
13586
+ {
13587
+ value: `cargo-${cargo.id}`,
13588
+ className: styles.accordion,
13589
+ children: [
13590
+ /* @__PURE__ */ jsxRuntime.jsx(
13591
+ reactComponents.AccordionHeader,
13592
+ {
13593
+ className: styles.accordionHeader,
13594
+ expandIconPosition: "end",
13595
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
13596
+ "div",
13597
+ {
13598
+ style: {
13599
+ display: "flex",
13600
+ justifyContent: "space-between",
13601
+ alignItems: "center",
13602
+ width: "100%",
13603
+ gap: "1rem"
13604
+ },
13605
+ children: [
13566
13606
  /* @__PURE__ */ jsxRuntime.jsx(
13567
- reactComponents.Body1Stronger,
13607
+ reactComponents.Body1Strong,
13568
13608
  {
13569
- style: {
13570
- color: sharedColors["Shared_Secondary_Primary"],
13571
- minWidth: "fit-content"
13572
- },
13573
- children: new Intl.NumberFormat("id-ID", {
13574
- style: "currency",
13575
- currency: "IDR",
13576
- minimumFractionDigits: 0
13577
- }).format(
13578
- Number(
13579
- getValues(
13580
- `owners.${index}.cargo.${cargoIndex}.quantity`
13581
- ) || 0
13582
- ) * (_selectedLoadType.price || 0)
13609
+ style: { minWidth: "fit-content" },
13610
+ children: mergedLabels.cargoItemTitle.replace(
13611
+ "{index}",
13612
+ (cargoIndex + 1).toString()
13583
13613
  )
13584
13614
  }
13585
- )
13586
- ] })
13587
- ]
13588
- }
13589
- )
13590
- }
13591
- ),
13592
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.AccordionPanel, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.form, children: [
13593
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13594
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isLoadTypeOther ? 4 : 6, children: [
13595
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13596
- mergedLabels.commodityLabel,
13597
- " ",
13598
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13599
- ] }),
13600
- /* @__PURE__ */ jsxRuntime.jsx(
13601
- InputDynamic_default,
13602
- {
13603
- control,
13604
- disabled,
13605
- name: `owners.${index}.cargo.${cargoIndex}.commodity`,
13606
- onChange: (val) => {
13607
- const name = `owners.${index}.cargo.${cargoIndex}.commodity`;
13608
- setValue(name, val);
13609
- const updatedCargoItems = owner.cargoItems?.map(
13610
- (c, cIdx) => cIdx === cargoIndex ? {
13611
- ...c,
13612
- commodity: val
13613
- } : c
13614
- );
13615
- onUpdateOwner(owner.id, {
13616
- cargoItems: updatedCargoItems
13617
- });
13618
- setValue(
13619
- `owners.${index}.cargo.${cargoIndex}.loadType`,
13620
- ""
13621
- );
13622
- },
13623
- options: commodityOptions,
13624
- placeholder: mergedLabels.selectPlaceholder,
13625
- required: true,
13626
- type: "select",
13627
- size: "large"
13615
+ ),
13616
+ _selectedLoadType && !cargo._isAccordionOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13617
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { style: { flex: 1 }, children: [
13618
+ _selectedLoadType.name,
13619
+ " \u2022",
13620
+ " ",
13621
+ watchQuantity,
13622
+ "x",
13623
+ " ",
13624
+ _selectedLoadType.unit?.name,
13625
+ " \u2022",
13626
+ " ",
13627
+ _selectedLoadType.formattedPrice
13628
+ ] }),
13629
+ /* @__PURE__ */ jsxRuntime.jsx(
13630
+ reactComponents.Body1Stronger,
13631
+ {
13632
+ style: {
13633
+ color: sharedColors["Shared_Secondary_Primary"],
13634
+ minWidth: "fit-content"
13635
+ },
13636
+ children: new Intl.NumberFormat("id-ID", {
13637
+ style: "currency",
13638
+ currency: "IDR",
13639
+ minimumFractionDigits: 0
13640
+ }).format(
13641
+ Number(
13642
+ getValues(
13643
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`
13644
+ ) || 0
13645
+ ) * (_selectedLoadType.price || 0)
13646
+ ).replace("Rp", "IDR")
13647
+ }
13648
+ )
13649
+ ] })
13650
+ ]
13628
13651
  }
13629
13652
  )
13630
- ] }),
13631
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isLoadTypeOther ? 4 : 6, children: [
13632
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13633
- mergedLabels.loadTypeLabel,
13634
- " ",
13635
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13653
+ }
13654
+ ),
13655
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.AccordionPanel, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.form, children: [
13656
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13657
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isLoadTypeOther ? 4 : 6, children: [
13658
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13659
+ mergedLabels.commodityLabel,
13660
+ " ",
13661
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13662
+ ] }),
13663
+ /* @__PURE__ */ jsxRuntime.jsx(
13664
+ InputDynamic_default,
13665
+ {
13666
+ control,
13667
+ disabled,
13668
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.commodity`,
13669
+ onChange: (val) => {
13670
+ const name = `owners.${ownerIndex}.cargo.${cargoIndex}.commodity`;
13671
+ setValue(name, val);
13672
+ const updatedCargoItems = owner.cargoItems?.map(
13673
+ (c, cIdx) => cIdx === cargoIndex ? {
13674
+ ...c,
13675
+ commodity: val
13676
+ } : c
13677
+ );
13678
+ onUpdateOwner(owner.id, {
13679
+ cargoItems: updatedCargoItems
13680
+ });
13681
+ setValue(
13682
+ `owners.${ownerIndex}.cargo.${cargoIndex}.loadType`,
13683
+ ""
13684
+ );
13685
+ },
13686
+ options: commodityOptions,
13687
+ placeholder: mergedLabels.selectPlaceholder,
13688
+ required: true,
13689
+ type: "select",
13690
+ size: "large"
13691
+ }
13692
+ )
13636
13693
  ] }),
13637
- /* @__PURE__ */ jsxRuntime.jsx(
13638
- InputDynamic_default,
13639
- {
13640
- control,
13641
- disabled: disabled || (getValues(
13642
- `owners.${index}.cargo.${cargoIndex}.commodity`
13643
- ) || "") === "",
13644
- name: `owners.${index}.cargo.${cargoIndex}.loadType`,
13645
- onChange: (val) => {
13646
- const name = `owners.${index}.cargo.${cargoIndex}.loadType`;
13647
- setValue(name, val);
13648
- const updatedCargoItems = owner.cargoItems?.map(
13649
- (c, cIdx) => cIdx === cargoIndex ? {
13650
- ...c,
13651
- loadType: val
13652
- } : c
13653
- );
13654
- onUpdateOwner(owner.id, {
13655
- cargoItems: updatedCargoItems
13656
- });
13657
- },
13658
- options: _loadTypeOptions,
13659
- placeholder: mergedLabels.selectPlaceholder,
13660
- required: true,
13661
- size: "large",
13662
- type: "select"
13663
- }
13664
- ),
13665
- /* @__PURE__ */ jsxRuntime.jsx(
13666
- reactComponents.Caption1,
13667
- {
13668
- style: {
13669
- color: reactComponents.tokens.colorNeutralForeground3,
13670
- marginTop: "0.25rem"
13671
- },
13672
- children: mergedLabels.loadTypeHelperText
13673
- }
13674
- )
13694
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isLoadTypeOther ? 4 : 6, children: [
13695
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13696
+ mergedLabels.loadTypeLabel,
13697
+ " ",
13698
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13699
+ ] }),
13700
+ /* @__PURE__ */ jsxRuntime.jsx(
13701
+ InputDynamic_default,
13702
+ {
13703
+ control,
13704
+ disabled: disabled || (getValues(
13705
+ `owners.${ownerIndex}.cargo.${cargoIndex}.commodity`
13706
+ ) || "") === "",
13707
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.loadType`,
13708
+ onChange: (val) => {
13709
+ const name = `owners.${ownerIndex}.cargo.${cargoIndex}.loadType`;
13710
+ setValue(name, val);
13711
+ const updatedCargoItems = owner.cargoItems?.map(
13712
+ (c, cIdx) => cIdx === cargoIndex ? {
13713
+ ...c,
13714
+ loadType: val
13715
+ } : c
13716
+ );
13717
+ onUpdateOwner(owner.id, {
13718
+ cargoItems: updatedCargoItems
13719
+ });
13720
+ },
13721
+ options: _loadTypeOptions,
13722
+ placeholder: mergedLabels.selectPlaceholder,
13723
+ required: true,
13724
+ size: "large",
13725
+ type: "select"
13726
+ }
13727
+ ),
13728
+ /* @__PURE__ */ jsxRuntime.jsx(
13729
+ reactComponents.Caption1,
13730
+ {
13731
+ style: {
13732
+ color: reactComponents.tokens.colorNeutralForeground3,
13733
+ marginTop: "0.25rem"
13734
+ },
13735
+ children: mergedLabels.loadTypeHelperText
13736
+ }
13737
+ )
13738
+ ] }),
13739
+ isLoadTypeOther && /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 4, children: [
13740
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13741
+ mergedLabels.loadTypeOthersLabel,
13742
+ " ",
13743
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13744
+ ] }),
13745
+ /* @__PURE__ */ jsxRuntime.jsx(
13746
+ InputDynamic_default,
13747
+ {
13748
+ control,
13749
+ disabled,
13750
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.loadTypeOther`,
13751
+ placeholder: mergedLabels.loadTypeOthersPlaceholder,
13752
+ required: true,
13753
+ size: "large",
13754
+ type: "text",
13755
+ onChange: (val) => {
13756
+ setValue(
13757
+ `owners.${ownerIndex}.cargo.${cargoIndex}.loadTypeOther`,
13758
+ val
13759
+ );
13760
+ const updatedCargoItems = owner.cargoItems?.map(
13761
+ (c, cIdx) => cIdx === cargoIndex ? {
13762
+ ...c,
13763
+ loadTypeOther: val
13764
+ } : c
13765
+ );
13766
+ onUpdateOwner(owner.id, {
13767
+ cargoItems: updatedCargoItems
13768
+ });
13769
+ }
13770
+ }
13771
+ )
13772
+ ] })
13675
13773
  ] }),
13676
- isLoadTypeOther && /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 4, children: [
13677
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13678
- mergedLabels.loadTypeOthersLabel,
13679
- " ",
13680
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13774
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13775
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isIndustryTypeOther ? 4 : 6, children: [
13776
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13777
+ mergedLabels.industryTypeLabel,
13778
+ " ",
13779
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13780
+ ] }),
13781
+ /* @__PURE__ */ jsxRuntime.jsx(
13782
+ InputDynamic_default,
13783
+ {
13784
+ control,
13785
+ disabled,
13786
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.industryType`,
13787
+ options: industryOptions,
13788
+ onChange: (val) => {
13789
+ const name = `owners.${ownerIndex}.cargo.${cargoIndex}.industryType`;
13790
+ setValue(name, val);
13791
+ const updatedCargoItems = owner.cargoItems?.map(
13792
+ (c, cIdx) => cIdx === cargoIndex ? {
13793
+ ...c,
13794
+ industryType: val
13795
+ } : c
13796
+ );
13797
+ onUpdateOwner(owner.id, {
13798
+ cargoItems: updatedCargoItems
13799
+ });
13800
+ },
13801
+ placeholder: mergedLabels.selectPlaceholder,
13802
+ required: true,
13803
+ size: "large",
13804
+ type: "select"
13805
+ }
13806
+ ),
13807
+ /* @__PURE__ */ jsxRuntime.jsx(
13808
+ reactComponents.Caption1,
13809
+ {
13810
+ style: {
13811
+ color: reactComponents.tokens.colorNeutralForeground3,
13812
+ marginTop: "0.25rem"
13813
+ },
13814
+ children: mergedLabels.industryTypeHelperText
13815
+ }
13816
+ )
13681
13817
  ] }),
13682
- /* @__PURE__ */ jsxRuntime.jsx(
13683
- InputDynamic_default,
13684
- {
13685
- control,
13686
- disabled,
13687
- name: `owners.${index}.cargo.${cargoIndex}.loadTypeOther`,
13688
- placeholder: mergedLabels.loadTypeOthersPlaceholder,
13689
- required: true,
13690
- size: "large",
13691
- type: "text",
13692
- onChange: (val) => {
13693
- setValue(
13694
- `owners.${index}.cargo.${cargoIndex}.loadTypeOther`,
13695
- val
13696
- );
13697
- const updatedCargoItems = owner.cargoItems?.map(
13698
- (c, cIdx) => cIdx === cargoIndex ? {
13699
- ...c,
13700
- loadTypeOther: val
13701
- } : c
13702
- );
13703
- onUpdateOwner(owner.id, {
13704
- cargoItems: updatedCargoItems
13705
- });
13818
+ isIndustryTypeOther && /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 4, children: [
13819
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13820
+ mergedLabels.industryTypeOthersLabel,
13821
+ " ",
13822
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13823
+ ] }),
13824
+ /* @__PURE__ */ jsxRuntime.jsx(
13825
+ InputDynamic_default,
13826
+ {
13827
+ control,
13828
+ disabled,
13829
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.industryTypeOther`,
13830
+ placeholder: mergedLabels.industryTypeOthersPlaceholder,
13831
+ required: true,
13832
+ size: "large",
13833
+ type: "text",
13834
+ onChange: (val) => {
13835
+ setValue(
13836
+ `owners.${ownerIndex}.cargo.${cargoIndex}.industryTypeOther`,
13837
+ val
13838
+ );
13839
+ const updatedCargoItems = owner.cargoItems?.map(
13840
+ (c, cIdx) => cIdx === cargoIndex ? {
13841
+ ...c,
13842
+ industryTypeOther: val
13843
+ } : c
13844
+ );
13845
+ onUpdateOwner(owner.id, {
13846
+ cargoItems: updatedCargoItems
13847
+ });
13848
+ }
13706
13849
  }
13707
- }
13708
- )
13709
- ] })
13710
- ] }),
13711
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13712
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isIndustryTypeOther ? 4 : 6, children: [
13713
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13714
- mergedLabels.industryTypeLabel,
13715
- " ",
13716
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13850
+ )
13717
13851
  ] }),
13718
- /* @__PURE__ */ jsxRuntime.jsx(
13719
- InputDynamic_default,
13720
- {
13721
- control,
13722
- disabled,
13723
- name: `owners.${index}.cargo.${cargoIndex}.industryType`,
13724
- options: industryOptions,
13725
- onChange: (val) => {
13726
- const name = `owners.${index}.cargo.${cargoIndex}.industryType`;
13727
- setValue(name, val);
13728
- const updatedCargoItems = owner.cargoItems?.map(
13729
- (c, cIdx) => cIdx === cargoIndex ? {
13730
- ...c,
13731
- industryType: val
13732
- } : c
13733
- );
13734
- onUpdateOwner(owner.id, {
13735
- cargoItems: updatedCargoItems
13736
- });
13737
- },
13738
- placeholder: mergedLabels.selectPlaceholder,
13739
- required: true,
13740
- size: "large",
13741
- type: "select"
13742
- }
13743
- ),
13744
- /* @__PURE__ */ jsxRuntime.jsx(
13745
- reactComponents.Caption1,
13746
- {
13747
- style: {
13748
- color: reactComponents.tokens.colorNeutralForeground3,
13749
- marginTop: "0.25rem"
13750
- },
13751
- children: mergedLabels.industryTypeHelperText
13752
- }
13753
- )
13852
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isIndustryTypeOther ? 4 : 6, children: [
13853
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13854
+ mergedLabels.cargoCategoryLabel,
13855
+ " ",
13856
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13857
+ ] }),
13858
+ /* @__PURE__ */ jsxRuntime.jsx(
13859
+ InputDynamic_default,
13860
+ {
13861
+ control,
13862
+ disabled,
13863
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.cargoCategory`,
13864
+ options: loadCategoryOptions,
13865
+ onChange: (val) => {
13866
+ const name = `owners.${ownerIndex}.cargo.${cargoIndex}.cargoCategory`;
13867
+ setValue(name, val);
13868
+ const updatedCargoItems = owner.cargoItems?.map(
13869
+ (c, cIdx) => cIdx === cargoIndex ? {
13870
+ ...c,
13871
+ cargoCategory: val
13872
+ } : c
13873
+ );
13874
+ onUpdateOwner(owner.id, {
13875
+ cargoItems: updatedCargoItems
13876
+ });
13877
+ },
13878
+ placeholder: mergedLabels.selectPlaceholder,
13879
+ required: true,
13880
+ size: "large",
13881
+ type: "select"
13882
+ }
13883
+ )
13884
+ ] })
13754
13885
  ] }),
13755
- isIndustryTypeOther && /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { xl: 4, children: [
13756
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13757
- mergedLabels.industryTypeOthersLabel,
13758
- " ",
13759
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13760
- ] }),
13761
- /* @__PURE__ */ jsxRuntime.jsx(
13886
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13887
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoLabel }) }),
13888
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { md: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
13762
13889
  InputDynamic_default,
13763
13890
  {
13764
13891
  control,
13765
13892
  disabled,
13766
- name: `owners.${index}.cargo.${cargoIndex}.industryTypeOther`,
13767
- placeholder: mergedLabels.industryTypeOthersPlaceholder,
13768
- required: true,
13893
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.cargoWeight`,
13894
+ placeholder: mergedLabels.cargoWeightPlaceholder,
13769
13895
  size: "large",
13770
- type: "text",
13896
+ type: "number",
13897
+ step: "1",
13771
13898
  onChange: (val) => {
13772
13899
  setValue(
13773
- `owners.${index}.cargo.${cargoIndex}.industryTypeOther`,
13774
- val
13900
+ `owners.${ownerIndex}.cargo.${cargoIndex}.cargoWeight`,
13901
+ val ? Number(val) : 0
13775
13902
  );
13776
13903
  const updatedCargoItems = owner.cargoItems?.map(
13777
13904
  (c, cIdx) => cIdx === cargoIndex ? {
13778
13905
  ...c,
13779
- industryTypeOther: val
13780
- } : c
13781
- );
13782
- onUpdateOwner(owner.id, {
13783
- cargoItems: updatedCargoItems
13784
- });
13785
- }
13786
- }
13787
- )
13788
- ] }),
13789
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: isIndustryTypeOther ? 4 : 6, children: [
13790
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { className: styles.label, children: [
13791
- mergedLabels.cargoCategoryLabel,
13792
- " ",
13793
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red" }, children: "*" })
13794
- ] }),
13795
- /* @__PURE__ */ jsxRuntime.jsx(
13796
- InputDynamic_default,
13797
- {
13798
- control,
13799
- disabled,
13800
- name: `owners.${index}.cargo.${cargoIndex}.cargoCategory`,
13801
- options: loadCategoryOptions,
13802
- onChange: (val) => {
13803
- const name = `owners.${index}.cargo.${cargoIndex}.cargoCategory`;
13804
- setValue(name, val);
13805
- const updatedCargoItems = owner.cargoItems?.map(
13806
- (c, cIdx) => cIdx === cargoIndex ? {
13807
- ...c,
13808
- cargoCategory: val
13906
+ cargoWeight: val ? Number(val) : 0
13809
13907
  } : c
13810
13908
  );
13811
13909
  onUpdateOwner(owner.id, {
13812
13910
  cargoItems: updatedCargoItems
13813
13911
  });
13814
13912
  },
13815
- placeholder: mergedLabels.selectPlaceholder,
13816
- required: true,
13817
- size: "large",
13818
- type: "select"
13913
+ contentAfter: /* @__PURE__ */ jsxRuntime.jsx(
13914
+ "div",
13915
+ {
13916
+ style: {
13917
+ paddingRight: "12px",
13918
+ color: reactComponents.tokens.colorNeutralForeground1,
13919
+ fontSize: reactComponents.tokens.fontSizeBase300
13920
+ },
13921
+ children: "Ton"
13922
+ }
13923
+ )
13819
13924
  }
13820
- )
13821
- ] })
13822
- ] }),
13823
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13824
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.estimatedLooseCargoLabel }) }),
13825
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { md: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
13826
- InputDynamic_default,
13827
- {
13828
- control,
13829
- disabled,
13830
- name: `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13831
- placeholder: mergedLabels.estimatedLooseCargoWeightPlaceholder,
13832
- size: "large",
13833
- type: "number",
13834
- step: "1",
13835
- onChange: (val) => {
13836
- setValue(
13837
- `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13838
- val ? Number(val) : 0
13839
- );
13840
- const updatedCargoItems = owner.cargoItems?.map(
13841
- (c, cIdx) => cIdx === cargoIndex ? {
13842
- ...c,
13843
- estimatedLooseCargoWeight: val ? Number(val) : 0
13844
- } : c
13845
- );
13846
- onUpdateOwner(owner.id, {
13847
- cargoItems: updatedCargoItems
13848
- });
13849
- },
13850
- contentAfter: /* @__PURE__ */ jsxRuntime.jsx(
13851
- "div",
13852
- {
13853
- style: {
13854
- paddingRight: "12px",
13855
- color: reactComponents.tokens.colorNeutralForeground1,
13856
- fontSize: reactComponents.tokens.fontSizeBase300
13857
- },
13858
- children: "Ton"
13859
- }
13860
- )
13861
- }
13862
- ) })
13863
- ] }),
13864
- (() => {
13865
- if (!_selectedLoadType) return null;
13866
- return /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13867
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: 12, children: [
13868
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoQuantityLabel }),
13869
- /* @__PURE__ */ jsxRuntime.jsxs(
13870
- "div",
13871
- {
13872
- style: {
13873
- display: "flex",
13874
- alignItems: "center",
13875
- border: `1px solid ${reactComponents.tokens.colorNeutralStroke1}`,
13876
- borderRadius: reactComponents.tokens.borderRadiusMedium,
13877
- height: "40px",
13878
- padding: "0 12px",
13879
- backgroundColor: reactComponents.tokens.colorNeutralBackground1
13880
- },
13881
- children: [
13882
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 0.5 } }),
13883
- /* @__PURE__ */ jsxRuntime.jsxs(
13884
- "div",
13885
- {
13886
- style: {
13887
- display: "flex",
13888
- alignItems: "center",
13889
- gap: "12px"
13890
- },
13891
- children: [
13892
- /* @__PURE__ */ jsxRuntime.jsx(
13893
- reactComponents.Button,
13894
- {
13895
- appearance: "transparent",
13896
- disabled,
13897
- icon: /* @__PURE__ */ jsxRuntime.jsx(
13898
- react.Icon,
13899
- {
13900
- icon: "fluent:subtract-circle-24-regular",
13901
- style: {
13902
- fontSize: "24px",
13903
- color: reactComponents.tokens.colorNeutralForeground4
13904
- }
13905
- }
13906
- ),
13907
- "aria-label": mergedLabels.decrementQuantityAriaLabel,
13908
- size: "small",
13909
- onClick: () => {
13910
- const currentVal = getValues(
13911
- `owners.${index}.cargo.${cargoIndex}.quantity`
13912
- ) || 0;
13913
- const currentQty = Number(currentVal);
13914
- if (currentQty > 1) {
13915
- const newVal = currentQty - 1;
13916
- setValue(
13917
- `owners.${index}.cargo.${cargoIndex}.quantity`,
13918
- newVal
13919
- );
13920
- onUpdateCargoQuantity(
13921
- owner.id,
13922
- cargo.id,
13923
- newVal
13924
- );
13925
- }
13926
- },
13927
- style: {
13928
- minWidth: "32px",
13929
- padding: "0"
13930
- }
13931
- }
13932
- ),
13933
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "40px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
13934
- reactHookForm.Controller,
13935
- {
13936
- name: `owners.${index}.cargo.${cargoIndex}.quantity`,
13937
- control,
13938
- disabled,
13939
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(
13940
- "input",
13941
- {
13942
- ...field,
13943
- min: 1,
13944
- step: "1",
13945
- type: "number",
13946
- style: {
13947
- border: "none",
13948
- width: "100%",
13949
- textAlign: "center",
13950
- outline: "none",
13951
- backgroundColor: "transparent",
13952
- color: reactComponents.tokens.colorNeutralForeground1,
13953
- fontSize: reactComponents.tokens.fontSizeBase400,
13954
- fontFamily: reactComponents.tokens.fontFamilyBase
13955
- },
13956
- onKeyDown: (e) => {
13957
- if ([
13958
- "e",
13959
- "E",
13960
- "+",
13961
- "-",
13962
- ".",
13963
- ","
13964
- ].includes(e.key)) {
13965
- e.preventDefault();
13966
- }
13967
- },
13968
- onPaste: (e) => {
13969
- const paste = e.clipboardData.getData(
13970
- "text"
13971
- );
13972
- if (!/^\d+$/.test(paste)) {
13973
- e.preventDefault();
13925
+ ) })
13926
+ ] }),
13927
+ (() => {
13928
+ if (!_selectedLoadType) return null;
13929
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13930
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: 12, children: [
13931
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.cargoQuantityLabel }),
13932
+ /* @__PURE__ */ jsxRuntime.jsxs(
13933
+ "div",
13934
+ {
13935
+ style: {
13936
+ display: "flex",
13937
+ alignItems: "center",
13938
+ border: `1px solid ${reactComponents.tokens.colorNeutralStroke1}`,
13939
+ borderRadius: reactComponents.tokens.borderRadiusMedium,
13940
+ height: "40px",
13941
+ padding: "0 12px",
13942
+ backgroundColor: reactComponents.tokens.colorNeutralBackground1
13943
+ },
13944
+ children: [
13945
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 0.5 } }),
13946
+ /* @__PURE__ */ jsxRuntime.jsxs(
13947
+ "div",
13948
+ {
13949
+ style: {
13950
+ display: "flex",
13951
+ alignItems: "center",
13952
+ gap: "12px"
13953
+ },
13954
+ children: [
13955
+ /* @__PURE__ */ jsxRuntime.jsx(
13956
+ reactComponents.Button,
13957
+ {
13958
+ appearance: "transparent",
13959
+ disabled,
13960
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
13961
+ react.Icon,
13962
+ {
13963
+ icon: "fluent:subtract-circle-24-regular",
13964
+ style: {
13965
+ fontSize: "24px",
13966
+ color: reactComponents.tokens.colorNeutralForeground4
13974
13967
  }
13975
- },
13976
- onWheel: (e) => e.target.blur(),
13977
- onChange: (e) => {
13978
- const newVal = Number(
13979
- e.target.value
13968
+ }
13969
+ ),
13970
+ "aria-label": mergedLabels.decrementQuantityAriaLabel,
13971
+ size: "small",
13972
+ onClick: () => {
13973
+ const currentVal = getValues(
13974
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`
13975
+ ) || 0;
13976
+ const currentQty = Number(currentVal);
13977
+ if (currentQty > 1) {
13978
+ const newVal = currentQty - 1;
13979
+ setValue(
13980
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`,
13981
+ newVal
13980
13982
  );
13981
- field.onChange(e);
13982
13983
  onUpdateCargoQuantity(
13983
13984
  owner.id,
13984
13985
  cargo.id,
13985
13986
  newVal
13986
13987
  );
13987
13988
  }
13989
+ },
13990
+ style: {
13991
+ minWidth: "32px",
13992
+ padding: "0"
13988
13993
  }
13989
- ),
13990
- rules: {
13991
- required: true,
13992
- validate: (val) => Number(val) > 0
13993
13994
  }
13994
- }
13995
- ) }),
13996
- /* @__PURE__ */ jsxRuntime.jsx(
13997
- reactComponents.Button,
13998
- {
13999
- appearance: "transparent",
14000
- disabled,
14001
- icon: /* @__PURE__ */ jsxRuntime.jsx(
14002
- react.Icon,
14003
- {
14004
- icon: "fluent:add-circle-24-regular",
14005
- style: {
14006
- fontSize: "24px",
14007
- color: reactComponents.tokens.colorBrandStroke1
13995
+ ),
13996
+ /* @__PURE__ */ jsxRuntime.jsx(
13997
+ "div",
13998
+ {
13999
+ style: { width: "40px" },
14000
+ children: /* @__PURE__ */ jsxRuntime.jsx(
14001
+ reactHookForm.Controller,
14002
+ {
14003
+ name: `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`,
14004
+ control,
14005
+ disabled,
14006
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(
14007
+ "input",
14008
+ {
14009
+ ...field,
14010
+ min: 1,
14011
+ step: "1",
14012
+ type: "number",
14013
+ style: {
14014
+ border: "none",
14015
+ width: "100%",
14016
+ textAlign: "center",
14017
+ outline: "none",
14018
+ backgroundColor: "transparent",
14019
+ color: reactComponents.tokens.colorNeutralForeground1,
14020
+ fontSize: reactComponents.tokens.fontSizeBase400,
14021
+ fontFamily: reactComponents.tokens.fontFamilyBase
14022
+ },
14023
+ onKeyDown: (e) => {
14024
+ if ([
14025
+ "e",
14026
+ "E",
14027
+ "+",
14028
+ "-",
14029
+ ".",
14030
+ ","
14031
+ ].includes(e.key)) {
14032
+ e.preventDefault();
14033
+ }
14034
+ },
14035
+ onPaste: (e) => {
14036
+ const paste = e.clipboardData.getData(
14037
+ "text"
14038
+ );
14039
+ if (!/^\d+$/.test(
14040
+ paste
14041
+ )) {
14042
+ e.preventDefault();
14043
+ }
14044
+ },
14045
+ onWheel: (e) => e.target.blur(),
14046
+ onChange: (e) => {
14047
+ const newVal = Number(
14048
+ e.target.value
14049
+ );
14050
+ field.onChange(e);
14051
+ onUpdateCargoQuantity(
14052
+ owner.id,
14053
+ cargo.id,
14054
+ newVal
14055
+ );
14056
+ }
14057
+ }
14058
+ ),
14059
+ rules: {
14060
+ required: true,
14061
+ validate: (val) => Number(val) > 0
14062
+ }
14008
14063
  }
14064
+ )
14065
+ }
14066
+ ),
14067
+ /* @__PURE__ */ jsxRuntime.jsx(
14068
+ reactComponents.Button,
14069
+ {
14070
+ appearance: "transparent",
14071
+ disabled,
14072
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
14073
+ react.Icon,
14074
+ {
14075
+ icon: "fluent:add-circle-24-regular",
14076
+ style: {
14077
+ fontSize: "24px",
14078
+ color: reactComponents.tokens.colorBrandStroke1
14079
+ }
14080
+ }
14081
+ ),
14082
+ "aria-label": mergedLabels.incrementQuantityAriaLabel,
14083
+ size: "small",
14084
+ onClick: () => {
14085
+ const currentVal = getValues(
14086
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`
14087
+ ) || 0;
14088
+ const currentQty = Number(currentVal);
14089
+ const newVal = currentQty + 1;
14090
+ setValue(
14091
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`,
14092
+ newVal
14093
+ );
14094
+ onUpdateCargoQuantity(
14095
+ owner.id,
14096
+ cargo.id,
14097
+ newVal
14098
+ );
14099
+ },
14100
+ style: {
14101
+ minWidth: "32px",
14102
+ padding: "0"
14009
14103
  }
14010
- ),
14011
- "aria-label": mergedLabels.incrementQuantityAriaLabel,
14012
- size: "small",
14013
- onClick: () => {
14014
- const currentVal = getValues(
14015
- `owners.${index}.cargo.${cargoIndex}.quantity`
14016
- ) || 0;
14017
- const currentQty = Number(currentVal);
14018
- const newVal = currentQty + 1;
14019
- setValue(
14020
- `owners.${index}.cargo.${cargoIndex}.quantity`,
14021
- newVal
14022
- );
14023
- onUpdateCargoQuantity(
14024
- owner.id,
14025
- cargo.id,
14026
- newVal
14027
- );
14028
- },
14029
- style: {
14030
- minWidth: "32px",
14031
- padding: "0"
14032
14104
  }
14105
+ )
14106
+ ]
14107
+ }
14108
+ ),
14109
+ /* @__PURE__ */ jsxRuntime.jsx(
14110
+ "div",
14111
+ {
14112
+ style: {
14113
+ flex: 1,
14114
+ textAlign: "left",
14115
+ color: reactComponents.tokens.colorNeutralForeground1,
14116
+ fontSize: reactComponents.tokens.fontSizeBase300,
14117
+ paddingRight: "8px"
14118
+ },
14119
+ children: (() => {
14120
+ const selectedLoadType2 = loadTypes.find(
14121
+ (loadType) => loadType.id.toString() === watchLoadType
14122
+ );
14123
+ return selectedLoadType2?.unit?.name;
14124
+ })()
14125
+ }
14126
+ )
14127
+ ]
14128
+ }
14129
+ )
14130
+ ] }),
14131
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: 12, children: [
14132
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 0.5 } }),
14133
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.priceLabel }),
14134
+ /* @__PURE__ */ jsxRuntime.jsx(
14135
+ reactComponents.Body2,
14136
+ {
14137
+ style: { marginTop: "0.5rem" },
14138
+ children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
14139
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { children: [
14140
+ _selectedLoadType.name,
14141
+ " \u2022",
14142
+ " ",
14143
+ watchQuantity,
14144
+ "x",
14145
+ " ",
14146
+ _selectedLoadType.unit?.name,
14147
+ " ",
14148
+ "\u2022",
14149
+ " ",
14150
+ _selectedLoadType.formattedPrice
14151
+ ] }) }),
14152
+ /* @__PURE__ */ jsxRuntime.jsx(
14153
+ reactGridSystem.Col,
14154
+ {
14155
+ xl: 6,
14156
+ style: {
14157
+ color: sharedColors["Shared_Secondary_Primary"],
14158
+ textAlign: "right"
14159
+ },
14160
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Stronger, { children: new Intl.NumberFormat(
14161
+ "id-ID",
14162
+ {
14163
+ style: "currency",
14164
+ currency: "IDR",
14165
+ minimumFractionDigits: 0
14033
14166
  }
14034
- )
14035
- ]
14036
- }
14037
- ),
14038
- /* @__PURE__ */ jsxRuntime.jsx(
14039
- "div",
14040
- {
14041
- style: {
14042
- flex: 1,
14043
- textAlign: "left",
14044
- color: reactComponents.tokens.colorNeutralForeground1,
14045
- fontSize: reactComponents.tokens.fontSizeBase300,
14046
- paddingRight: "8px"
14047
- },
14048
- children: (() => {
14049
- const type = watch(
14050
- `owners.${index}.cargo.${cargoIndex}.loadType`
14051
- );
14052
- const selectedLoadType2 = loadTypes.find(
14053
- (loadType) => loadType.id.toString() === type
14054
- );
14055
- return selectedLoadType2?.unit?.name;
14056
- })()
14057
- }
14058
- )
14059
- ]
14060
- }
14061
- )
14062
- ] }),
14063
- /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: 12, children: [
14064
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 0.5 } }),
14065
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.priceLabel }),
14066
- /* @__PURE__ */ jsxRuntime.jsx(
14067
- reactComponents.Body2,
14068
- {
14069
- style: { marginTop: "0.5rem" },
14070
- children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
14071
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { children: [
14072
- _selectedLoadType.name,
14073
- " \u2022",
14074
- " ",
14075
- watchQuantity,
14076
- "x",
14077
- " ",
14078
- _selectedLoadType.unit?.name,
14079
- " ",
14080
- "\u2022",
14081
- " ",
14082
- _selectedLoadType.formattedPrice
14083
- ] }) }),
14084
- /* @__PURE__ */ jsxRuntime.jsx(
14085
- reactGridSystem.Col,
14086
- {
14087
- xl: 6,
14088
- style: {
14089
- color: sharedColors["Shared_Secondary_Primary"],
14090
- textAlign: "right"
14091
- },
14092
- children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Stronger, { children: new Intl.NumberFormat(
14093
- "id-ID",
14094
- {
14095
- style: "currency",
14096
- currency: "IDR",
14097
- minimumFractionDigits: 0
14098
- }
14099
- ).format(
14100
- Number(
14101
- getValues(
14102
- `owners.${index}.cargo.${cargoIndex}.quantity`
14103
- ) || 0
14104
- ) * (_selectedLoadType.price || 0)
14105
- ) })
14106
- }
14107
- )
14108
- ] })
14109
- }
14110
- )
14111
- ] })
14112
- ] });
14113
- })(),
14114
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: (owner.cargoItems?.length || 0) > 1 && /* @__PURE__ */ jsxRuntime.jsx(
14115
- reactComponents.Button,
14116
- {
14117
- disabled,
14118
- icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:delete-24-regular" }),
14119
- onClick: (e) => {
14120
- e.stopPropagation();
14121
- onDeleteCargo(owner.id, cargo.id);
14122
- },
14123
- onKeyDown: (e) => {
14124
- if (e.key === "Enter" || e.key === " ") {
14167
+ ).format(
14168
+ Number(
14169
+ getValues(
14170
+ `owners.${ownerIndex}.cargo.${cargoIndex}.quantity`
14171
+ ) || 0
14172
+ ) * (_selectedLoadType.price || 0)
14173
+ ).replace("Rp", "IDR") })
14174
+ }
14175
+ )
14176
+ ] })
14177
+ }
14178
+ )
14179
+ ] })
14180
+ ] });
14181
+ })(),
14182
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: (owner.cargoItems?.length || 0) > 1 && /* @__PURE__ */ jsxRuntime.jsx(
14183
+ reactComponents.Button,
14184
+ {
14185
+ disabled,
14186
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:delete-24-regular" }),
14187
+ onClick: (e) => {
14125
14188
  e.stopPropagation();
14126
14189
  onDeleteCargo(
14127
14190
  owner.id,
14128
14191
  cargo.id
14129
14192
  );
14130
- }
14131
- },
14132
- size: "medium",
14133
- shape: "circular",
14134
- style: {
14135
- border: `1px solid ${reactComponents.tokens.colorPaletteRedForeground1}`,
14136
- color: reactComponents.tokens.colorPaletteRedForeground1,
14137
- width: "100%"
14138
- },
14139
- children: mergedLabels.deleteCargoButton
14140
- }
14141
- ) }) })
14142
- ] }) })
14143
- ]
14144
- },
14145
- cargo.id
14146
- );
14147
- })
14148
- }
14149
- ),
14150
- /* @__PURE__ */ jsxRuntime.jsx(
14151
- reactComponents.Button,
14152
- {
14153
- appearance: "secondary",
14154
- icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:add-24-regular" }),
14155
- shape: "circular",
14156
- style: {
14157
- borderColor: reactComponents.tokens.colorBrandStroke1,
14158
- color: reactComponents.tokens.colorBrandBackground,
14159
- marginTop: "1rem",
14160
- width: "100%"
14161
- },
14162
- onClick: () => onAddCargo(owner.id),
14163
- children: mergedLabels.addCargoButton
14164
- }
14165
- )
14166
- ] }) })
14167
- ] })
14168
- ] }) })
14169
- ]
14170
- },
14171
- owner.id
14172
- ))
14193
+ },
14194
+ onKeyDown: (e) => {
14195
+ if (e.key === "Enter" || e.key === " ") {
14196
+ e.stopPropagation();
14197
+ onDeleteCargo(
14198
+ owner.id,
14199
+ cargo.id
14200
+ );
14201
+ }
14202
+ },
14203
+ size: "medium",
14204
+ shape: "circular",
14205
+ style: {
14206
+ border: `1px solid ${reactComponents.tokens.colorPaletteRedForeground1}`,
14207
+ color: reactComponents.tokens.colorPaletteRedForeground1,
14208
+ width: "100%"
14209
+ },
14210
+ children: mergedLabels.deleteCargoButton
14211
+ }
14212
+ ) }) })
14213
+ ] }) })
14214
+ ]
14215
+ },
14216
+ cargo.id
14217
+ );
14218
+ })
14219
+ }
14220
+ ),
14221
+ /* @__PURE__ */ jsxRuntime.jsx(
14222
+ reactComponents.Button,
14223
+ {
14224
+ appearance: "secondary",
14225
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:add-24-regular" }),
14226
+ shape: "circular",
14227
+ style: {
14228
+ borderColor: reactComponents.tokens.colorBrandStroke1,
14229
+ color: reactComponents.tokens.colorBrandBackground,
14230
+ marginTop: "1rem",
14231
+ width: "100%"
14232
+ },
14233
+ onClick: () => onAddCargo(owner.id),
14234
+ children: mergedLabels.addCargoButton
14235
+ }
14236
+ )
14237
+ ] }) })
14238
+ ] })
14239
+ ] }) })
14240
+ ]
14241
+ },
14242
+ owner.id
14243
+ )
14244
+ ] }, owner.id))
14173
14245
  }
14174
14246
  )
14175
14247
  ] });