@asdp/ferryui 0.1.22-dev.10353 → 0.1.22-dev.10371

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.mjs CHANGED
@@ -443,9 +443,12 @@ var MANIFEST_ENTITY = {
443
443
  INDIVIDUAL: "individual"
444
444
  };
445
445
  var HARDCODED_ID = {
446
- FAQ_ID_PEMESANAN_TIKET: 1,
447
- COMPANY_ID_LAINNYA: "999999",
448
- LOAD_TYPE_ID_LAINNYA: 87
446
+ FAQ__PEMESANAN_TIKET: 1,
447
+ COMPANY__LAINNYA: "999999",
448
+ LOAD_TYPE__LAINNYA: 87
449
+ };
450
+ var HARDCODED_NAME = {
451
+ LOAD_TYPE__LAINNYA: "Lainnya"
449
452
  };
450
453
  var useStyles2 = makeStyles({
451
454
  carousel: {},
@@ -12634,8 +12637,10 @@ var DEFAULT_LABELS26 = {
12634
12637
  cargoItemTitle: "Muatan {index}",
12635
12638
  commodityLabel: "Data Komoditas",
12636
12639
  hereLinkText: "disini",
12637
- cargoTypeLabel: "Data Jenis Muatan",
12638
- cargoTypeHelperText: 'Apabila jenis muatan belum tersedia dapat memilih "Lainnya" dan silakan isi jenis muatannya.',
12640
+ loadTypeLabel: "Data Jenis Muatan",
12641
+ loadTypeOthersLabel: "Jenis Muatan Lainnya",
12642
+ loadTypeHelperText: 'Apabila jenis muatan belum tersedia dapat memilih "Lainnya" dan silakan isi jenis muatannya.',
12643
+ loadTypeOthersPlaceholder: "Masukkan Jenis Muatan",
12639
12644
  cargoQuantityLabel: "Jumlah Muatan",
12640
12645
  priceLabel: "Harga",
12641
12646
  industryTypeLabel: "Data Jenis Industri",
@@ -12643,7 +12648,7 @@ var DEFAULT_LABELS26 = {
12643
12648
  cargoCategoryLabel: "Kategori Muatan",
12644
12649
  deleteCargoButton: "Hapus Muatan",
12645
12650
  addCargoButton: "Tambah Muatan",
12646
- cargoTypeOptions: {
12651
+ loadTypeOptions: {
12647
12652
  karung: "Karung",
12648
12653
  kg: "Kg",
12649
12654
  ton: "Ton",
@@ -12686,8 +12691,10 @@ var DEFAULT_LABELS26 = {
12686
12691
  cargoItemTitle: "Cargo {index}",
12687
12692
  commodityLabel: "Commodity Data",
12688
12693
  hereLinkText: "here",
12689
- cargoTypeLabel: "Cargo Type Data",
12690
- cargoTypeHelperText: 'If the cargo type is not available, select "Other" and enter the cargo type.',
12694
+ loadTypeLabel: "Cargo Type Data",
12695
+ loadTypeHelperText: 'If the cargo type is not available, select "Other" and enter the cargo type.',
12696
+ loadTypeOthersPlaceholder: "Enter Cargo Type",
12697
+ loadTypeOthersLabel: "Other Cargo Type",
12691
12698
  cargoQuantityLabel: "Cargo Quantity",
12692
12699
  priceLabel: "Price",
12693
12700
  industryTypeLabel: "Industry Type Data",
@@ -12695,7 +12702,7 @@ var DEFAULT_LABELS26 = {
12695
12702
  cargoCategoryLabel: "Cargo Category",
12696
12703
  deleteCargoButton: "Delete Cargo",
12697
12704
  addCargoButton: "Add Cargo",
12698
- cargoTypeOptions: {
12705
+ loadTypeOptions: {
12699
12706
  karung: "Sack",
12700
12707
  kg: "Kg",
12701
12708
  ton: "Ton",
@@ -12907,7 +12914,7 @@ var CardVehicleOwnerForm = ({
12907
12914
  /* @__PURE__ */ jsx(
12908
12915
  Col,
12909
12916
  {
12910
- lg: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY_ID_LAINNYA ? 6 : 12,
12917
+ lg: owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
12911
12918
  children: /* @__PURE__ */ jsx(
12912
12919
  InputDynamic_default,
12913
12920
  {
@@ -12929,7 +12936,7 @@ var CardVehicleOwnerForm = ({
12929
12936
  )
12930
12937
  }
12931
12938
  ),
12932
- owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY_ID_LAINNYA && /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsx(
12939
+ owner.cargoOwnerEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoOwnerEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsx(
12933
12940
  InputDynamic_default,
12934
12941
  {
12935
12942
  control,
@@ -13021,7 +13028,7 @@ var CardVehicleOwnerForm = ({
13021
13028
  /* @__PURE__ */ jsx(
13022
13029
  Col,
13023
13030
  {
13024
- lg: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY_ID_LAINNYA ? 6 : 12,
13031
+ lg: owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13025
13032
  children: /* @__PURE__ */ jsx(
13026
13033
  InputDynamic_default,
13027
13034
  {
@@ -13046,7 +13053,7 @@ var CardVehicleOwnerForm = ({
13046
13053
  )
13047
13054
  }
13048
13055
  ),
13049
- owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY_ID_LAINNYA && /* @__PURE__ */ jsx(Col, { lg: 6, children: /* @__PURE__ */ jsx(
13056
+ owner.cargoReceiverEntityType === MANIFEST_ENTITY.COMPANY && owner.cargoReceiverEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsx(Col, { lg: 6, children: /* @__PURE__ */ jsx(
13050
13057
  InputDynamic_default,
13051
13058
  {
13052
13059
  control,
@@ -13138,7 +13145,7 @@ var CardVehicleOwnerForm = ({
13138
13145
  /* @__PURE__ */ jsx(
13139
13146
  Col,
13140
13147
  {
13141
- xl: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY_ID_LAINNYA ? 6 : 12,
13148
+ xl: owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA ? 6 : 12,
13142
13149
  children: /* @__PURE__ */ jsx(
13143
13150
  InputDynamic_default,
13144
13151
  {
@@ -13163,7 +13170,7 @@ var CardVehicleOwnerForm = ({
13163
13170
  )
13164
13171
  }
13165
13172
  ),
13166
- owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY_ID_LAINNYA && /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsx(
13173
+ owner.logisticsEntityType === MANIFEST_ENTITY.COMPANY && owner.logisticsEntity === HARDCODED_ID.COMPANY__LAINNYA && /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsx(
13167
13174
  InputDynamic_default,
13168
13175
  {
13169
13176
  control,
@@ -13281,471 +13288,520 @@ var CardVehicleOwnerForm = ({
13281
13288
  (cargo) => `cargo-${cargo.id}`
13282
13289
  ) || [],
13283
13290
  multiple: true,
13284
- children: owner.cargoItems?.map((cargo, cargoIndex) => /* @__PURE__ */ jsxs(
13285
- AccordionItem,
13286
- {
13287
- value: `cargo-${cargo.id}`,
13288
- className: styles.accordion,
13289
- children: [
13290
- /* @__PURE__ */ jsx(
13291
- AccordionHeader,
13292
- {
13293
- className: styles.accordionHeader,
13294
- expandIconPosition: "end",
13295
- children: /* @__PURE__ */ jsx(
13296
- "div",
13297
- {
13298
- style: {
13299
- display: "flex",
13300
- justifyContent: "space-between",
13301
- alignItems: "center",
13302
- width: "100%"
13303
- },
13304
- children: /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.cargoItemTitle.replace(
13305
- "{index}",
13306
- (cargoIndex + 1).toString()
13307
- ) })
13308
- }
13309
- )
13310
- }
13311
- ),
13312
- /* @__PURE__ */ jsx(AccordionPanel, { children: /* @__PURE__ */ jsxs("div", { className: styles.form, children: [
13313
- /* @__PURE__ */ jsxs(Row, { children: [
13314
- /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13315
- /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13316
- mergedLabels.commodityLabel,
13317
- " ",
13318
- /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13319
- ] }),
13320
- /* @__PURE__ */ jsx(
13321
- InputDynamic_default,
13291
+ children: owner.cargoItems?.map((cargo, cargoIndex) => {
13292
+ const watchCommodity = watch(
13293
+ `owners.${index}.cargo.${cargoIndex}.commodity`
13294
+ );
13295
+ const watchLoadType = watch(
13296
+ `owners.${index}.cargo.${cargoIndex}.loadType`
13297
+ );
13298
+ watch(
13299
+ `owners.${index}.cargo.${cargoIndex}.industryType`
13300
+ );
13301
+ let _loadTypeOptions = [];
13302
+ if (watchCommodity && loadTypeOptionsByCommodityId[watchCommodity]) {
13303
+ _loadTypeOptions = loadTypeOptionsByCommodityId[watchCommodity];
13304
+ } else {
13305
+ _loadTypeOptions = loadTypeOptions.map((lt) => ({
13306
+ value: lt.id.toString(),
13307
+ label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13308
+ }));
13309
+ }
13310
+ const isLoadTypeOther = _loadTypeOptions.find(
13311
+ (lt) => lt.value.toString() === String(watchLoadType)
13312
+ )?.label.startsWith(HARDCODED_NAME.LOAD_TYPE__LAINNYA);
13313
+ return /* @__PURE__ */ jsxs(
13314
+ AccordionItem,
13315
+ {
13316
+ value: `cargo-${cargo.id}`,
13317
+ className: styles.accordion,
13318
+ children: [
13319
+ /* @__PURE__ */ jsx(
13320
+ AccordionHeader,
13321
+ {
13322
+ className: styles.accordionHeader,
13323
+ expandIconPosition: "end",
13324
+ children: /* @__PURE__ */ jsx(
13325
+ "div",
13322
13326
  {
13323
- control,
13324
- disabled,
13325
- name: `owners.${index}.cargo.${cargoIndex}.commodity`,
13326
- onChange: (val) => {
13327
- const name = `owners.${index}.cargo.${cargoIndex}.commodity`;
13328
- setValue(name, val);
13329
- const updatedCargoItems = owner.cargoItems?.map(
13330
- (c, cIdx) => cIdx === cargoIndex ? {
13331
- ...c,
13332
- commodity: val
13333
- } : c
13334
- );
13335
- onUpdateOwner(owner.id, {
13336
- cargoItems: updatedCargoItems
13337
- });
13338
- setValue(
13339
- `owners.${index}.cargo.${cargoIndex}.cargoType`,
13340
- ""
13341
- );
13327
+ style: {
13328
+ display: "flex",
13329
+ justifyContent: "space-between",
13330
+ alignItems: "center",
13331
+ width: "100%"
13342
13332
  },
13343
- options: commodityOptions,
13344
- placeholder: mergedLabels.selectPlaceholder,
13345
- required: true,
13346
- type: "select",
13347
- size: "large"
13333
+ children: /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.cargoItemTitle.replace(
13334
+ "{index}",
13335
+ (cargoIndex + 1).toString()
13336
+ ) })
13348
13337
  }
13349
13338
  )
13350
- ] }),
13351
- /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13352
- /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13353
- mergedLabels.cargoTypeLabel,
13354
- " ",
13355
- /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13339
+ }
13340
+ ),
13341
+ /* @__PURE__ */ jsx(AccordionPanel, { children: /* @__PURE__ */ jsxs("div", { className: styles.form, children: [
13342
+ /* @__PURE__ */ jsxs(Row, { children: [
13343
+ /* @__PURE__ */ jsxs(Col, { md: isLoadTypeOther ? 4 : 6, children: [
13344
+ /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13345
+ mergedLabels.commodityLabel,
13346
+ " ",
13347
+ /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13348
+ ] }),
13349
+ /* @__PURE__ */ jsx(
13350
+ InputDynamic_default,
13351
+ {
13352
+ control,
13353
+ disabled,
13354
+ name: `owners.${index}.cargo.${cargoIndex}.commodity`,
13355
+ onChange: (val) => {
13356
+ const name = `owners.${index}.cargo.${cargoIndex}.commodity`;
13357
+ setValue(name, val);
13358
+ const updatedCargoItems = owner.cargoItems?.map(
13359
+ (c, cIdx) => cIdx === cargoIndex ? {
13360
+ ...c,
13361
+ commodity: val
13362
+ } : c
13363
+ );
13364
+ onUpdateOwner(owner.id, {
13365
+ cargoItems: updatedCargoItems
13366
+ });
13367
+ setValue(
13368
+ `owners.${index}.cargo.${cargoIndex}.loadType`,
13369
+ ""
13370
+ );
13371
+ },
13372
+ options: commodityOptions,
13373
+ placeholder: mergedLabels.selectPlaceholder,
13374
+ required: true,
13375
+ type: "select",
13376
+ size: "large"
13377
+ }
13378
+ )
13356
13379
  ] }),
13357
- /* @__PURE__ */ jsx(
13358
- InputDynamic_default,
13359
- {
13360
- control,
13361
- disabled: disabled || (getValues(
13362
- `owners.${index}.cargo.${cargoIndex}.commodity`
13363
- ) || "") === "",
13364
- name: `owners.${index}.cargo.${cargoIndex}.cargoType`,
13365
- onChange: (val) => {
13366
- const name = `owners.${index}.cargo.${cargoIndex}.cargoType`;
13367
- setValue(name, val);
13368
- const updatedCargoItems = owner.cargoItems?.map(
13369
- (c, cIdx) => cIdx === cargoIndex ? {
13370
- ...c,
13371
- cargoType: val
13372
- } : c
13373
- );
13374
- onUpdateOwner(owner.id, {
13375
- cargoItems: updatedCargoItems
13376
- });
13377
- },
13378
- options: (() => {
13379
- const selectedCommodityId = watch(
13380
+ /* @__PURE__ */ jsxs(Col, { md: isLoadTypeOther ? 4 : 6, children: [
13381
+ /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13382
+ mergedLabels.loadTypeLabel,
13383
+ " ",
13384
+ /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13385
+ ] }),
13386
+ /* @__PURE__ */ jsx(
13387
+ InputDynamic_default,
13388
+ {
13389
+ control,
13390
+ disabled: disabled || (getValues(
13380
13391
  `owners.${index}.cargo.${cargoIndex}.commodity`
13381
- );
13382
- if (selectedCommodityId && loadTypeOptionsByCommodityId[selectedCommodityId]) {
13383
- return loadTypeOptionsByCommodityId[selectedCommodityId];
13384
- }
13385
- return loadTypeOptions.map((lt) => ({
13386
- value: lt.id.toString(),
13387
- label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13388
- }));
13389
- })(),
13390
- placeholder: mergedLabels.selectPlaceholder,
13391
- required: true,
13392
- size: "large",
13393
- type: "select"
13394
- }
13395
- ),
13396
- /* @__PURE__ */ jsx(
13397
- Caption1,
13398
- {
13399
- style: {
13400
- color: tokens.colorNeutralForeground3,
13401
- marginTop: "0.25rem"
13402
- },
13403
- children: mergedLabels.cargoTypeHelperText
13404
- }
13405
- )
13406
- ] })
13407
- ] }),
13408
- /* @__PURE__ */ jsxs(Row, { children: [
13409
- /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13410
- /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13411
- mergedLabels.industryTypeLabel,
13412
- " ",
13413
- /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13392
+ ) || "") === "",
13393
+ name: `owners.${index}.cargo.${cargoIndex}.loadType`,
13394
+ onChange: (val) => {
13395
+ const name = `owners.${index}.cargo.${cargoIndex}.loadType`;
13396
+ setValue(name, val);
13397
+ const updatedCargoItems = owner.cargoItems?.map(
13398
+ (c, cIdx) => cIdx === cargoIndex ? {
13399
+ ...c,
13400
+ loadType: val
13401
+ } : c
13402
+ );
13403
+ onUpdateOwner(owner.id, {
13404
+ cargoItems: updatedCargoItems
13405
+ });
13406
+ },
13407
+ options: _loadTypeOptions,
13408
+ placeholder: mergedLabels.selectPlaceholder,
13409
+ required: true,
13410
+ size: "large",
13411
+ type: "select"
13412
+ }
13413
+ ),
13414
+ /* @__PURE__ */ jsx(
13415
+ Caption1,
13416
+ {
13417
+ style: {
13418
+ color: tokens.colorNeutralForeground3,
13419
+ marginTop: "0.25rem"
13420
+ },
13421
+ children: mergedLabels.loadTypeHelperText
13422
+ }
13423
+ )
13414
13424
  ] }),
13415
- /* @__PURE__ */ jsx(
13416
- InputDynamic_default,
13417
- {
13418
- control,
13419
- disabled,
13420
- name: `owners.${index}.cargo.${cargoIndex}.industryType`,
13421
- options: industryOptions,
13422
- onChange: (val) => {
13423
- const name = `owners.${index}.cargo.${cargoIndex}.industryType`;
13424
- setValue(name, val);
13425
- const updatedCargoItems = owner.cargoItems?.map(
13426
- (c, cIdx) => cIdx === cargoIndex ? {
13427
- ...c,
13428
- industryType: val
13429
- } : c
13430
- );
13431
- onUpdateOwner(owner.id, {
13432
- cargoItems: updatedCargoItems
13433
- });
13434
- },
13435
- placeholder: mergedLabels.selectPlaceholder,
13436
- required: true,
13437
- size: "large",
13438
- type: "select"
13439
- }
13440
- ),
13441
- /* @__PURE__ */ jsx(
13442
- Caption1,
13443
- {
13444
- style: {
13445
- color: tokens.colorNeutralForeground3,
13446
- marginTop: "0.25rem"
13447
- },
13448
- children: mergedLabels.industryTypeHelperText
13449
- }
13450
- )
13425
+ isLoadTypeOther && /* @__PURE__ */ jsxs(Col, { xl: 4, children: [
13426
+ /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13427
+ mergedLabels.loadTypeOthersLabel,
13428
+ " ",
13429
+ /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13430
+ ] }),
13431
+ /* @__PURE__ */ jsx(
13432
+ InputDynamic_default,
13433
+ {
13434
+ control,
13435
+ disabled,
13436
+ name: `owners.${index}.cargo.${cargoIndex}.loadTypeOther`,
13437
+ placeholder: mergedLabels.loadTypeOthersPlaceholder,
13438
+ required: true,
13439
+ size: "large",
13440
+ type: "text",
13441
+ onChange: (val) => {
13442
+ setValue(
13443
+ `owners.${index}.cargo.${cargoIndex}.loadTypeOther`,
13444
+ val
13445
+ );
13446
+ const updatedCargoItems = owner.cargoItems?.map(
13447
+ (c, cIdx) => cIdx === cargoIndex ? {
13448
+ ...c,
13449
+ loadTypeOther: val
13450
+ } : c
13451
+ );
13452
+ onUpdateOwner(owner.id, {
13453
+ cargoItems: updatedCargoItems
13454
+ });
13455
+ }
13456
+ }
13457
+ )
13458
+ ] })
13451
13459
  ] }),
13452
- /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13453
- /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13454
- mergedLabels.cargoCategoryLabel,
13455
- " ",
13456
- /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13457
- ] }),
13458
- /* @__PURE__ */ jsx(
13459
- InputDynamic_default,
13460
- {
13461
- control,
13462
- disabled,
13463
- name: `owners.${index}.cargo.${cargoIndex}.cargoCategory`,
13464
- options: loadCategoryOptions,
13465
- onChange: (val) => {
13466
- const name = `owners.${index}.cargo.${cargoIndex}.cargoCategory`;
13467
- setValue(name, val);
13468
- const updatedCargoItems = owner.cargoItems?.map(
13469
- (c, cIdx) => cIdx === cargoIndex ? {
13470
- ...c,
13471
- cargoCategory: val
13472
- } : c
13473
- );
13474
- onUpdateOwner(owner.id, {
13475
- cargoItems: updatedCargoItems
13476
- });
13477
- },
13478
- placeholder: mergedLabels.selectPlaceholder,
13479
- required: true,
13480
- size: "large",
13481
- type: "select"
13482
- }
13483
- )
13484
- ] })
13485
- ] }),
13486
- /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Col, { children: (owner.cargoItems?.length || 0) > 1 && /* @__PURE__ */ jsx(
13487
- Button,
13488
- {
13489
- disabled,
13490
- icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:delete-24-regular" }),
13491
- onClick: (e) => {
13492
- e.stopPropagation();
13493
- onDeleteCargo(owner.id, cargo.id);
13494
- },
13495
- onKeyDown: (e) => {
13496
- if (e.key === "Enter" || e.key === " ") {
13497
- e.stopPropagation();
13498
- onDeleteCargo(owner.id, cargo.id);
13499
- }
13500
- },
13501
- size: "medium",
13502
- shape: "circular",
13503
- style: {
13504
- border: `1px solid ${tokens.colorPaletteRedForeground1}`,
13505
- color: tokens.colorPaletteRedForeground1,
13506
- width: "100%"
13507
- },
13508
- children: mergedLabels.deleteCargoButton
13509
- }
13510
- ) }) }),
13511
- (() => {
13512
- const type = watch(
13513
- `owners.${index}.cargo.${cargoIndex}.cargoType`
13514
- );
13515
- const _selectedLoadType = loadTypes.find(
13516
- (loadType) => loadType.id.toString() === type
13517
- );
13518
- if (!_selectedLoadType) return null;
13519
- return /* @__PURE__ */ jsxs(Row, { children: [
13520
- /* @__PURE__ */ jsxs(Col, { md: 12, children: [
13521
- /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.cargoQuantityLabel }),
13522
- /* @__PURE__ */ jsxs(
13523
- "div",
13460
+ /* @__PURE__ */ jsxs(Row, { children: [
13461
+ /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13462
+ /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13463
+ mergedLabels.industryTypeLabel,
13464
+ " ",
13465
+ /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13466
+ ] }),
13467
+ /* @__PURE__ */ jsx(
13468
+ InputDynamic_default,
13469
+ {
13470
+ control,
13471
+ disabled,
13472
+ name: `owners.${index}.cargo.${cargoIndex}.industryType`,
13473
+ options: industryOptions,
13474
+ onChange: (val) => {
13475
+ const name = `owners.${index}.cargo.${cargoIndex}.industryType`;
13476
+ setValue(name, val);
13477
+ const updatedCargoItems = owner.cargoItems?.map(
13478
+ (c, cIdx) => cIdx === cargoIndex ? {
13479
+ ...c,
13480
+ industryType: val
13481
+ } : c
13482
+ );
13483
+ onUpdateOwner(owner.id, {
13484
+ cargoItems: updatedCargoItems
13485
+ });
13486
+ },
13487
+ placeholder: mergedLabels.selectPlaceholder,
13488
+ required: true,
13489
+ size: "large",
13490
+ type: "select"
13491
+ }
13492
+ ),
13493
+ /* @__PURE__ */ jsx(
13494
+ Caption1,
13524
13495
  {
13525
13496
  style: {
13526
- display: "flex",
13527
- alignItems: "center",
13528
- border: `1px solid ${tokens.colorNeutralStroke1}`,
13529
- borderRadius: tokens.borderRadiusMedium,
13530
- height: "40px",
13531
- padding: "0 12px",
13532
- backgroundColor: tokens.colorNeutralBackground1
13497
+ color: tokens.colorNeutralForeground3,
13498
+ marginTop: "0.25rem"
13533
13499
  },
13534
- children: [
13535
- /* @__PURE__ */ jsx("div", { style: { flex: 0.5 } }),
13536
- /* @__PURE__ */ jsxs(
13537
- "div",
13538
- {
13539
- style: {
13540
- display: "flex",
13541
- alignItems: "center",
13542
- gap: "12px"
13543
- },
13544
- children: [
13545
- /* @__PURE__ */ jsx(
13546
- Button,
13547
- {
13548
- appearance: "transparent",
13549
- disabled,
13550
- icon: /* @__PURE__ */ jsx(
13551
- Icon,
13552
- {
13553
- icon: "fluent:subtract-circle-24-regular",
13554
- style: {
13555
- fontSize: "24px",
13556
- color: tokens.colorNeutralForeground4
13557
- }
13558
- }
13559
- ),
13560
- "aria-label": mergedLabels.decrementQuantityAriaLabel,
13561
- size: "small",
13562
- onClick: () => {
13563
- const currentVal = getValues(
13564
- `owners.${index}.cargo.${cargoIndex}.quantity`
13565
- ) || 0;
13566
- const currentQty = Number(currentVal);
13567
- if (currentQty > 1) {
13568
- const newVal = currentQty - 1;
13569
- setValue(
13570
- `owners.${index}.cargo.${cargoIndex}.quantity`,
13571
- newVal
13572
- );
13573
- onUpdateCargoQuantity(
13574
- owner.id,
13575
- cargo.id,
13576
- newVal
13577
- );
13578
- }
13579
- },
13580
- style: {
13581
- minWidth: "32px",
13582
- padding: "0"
13583
- }
13584
- }
13585
- ),
13586
- /* @__PURE__ */ jsx("div", { style: { width: "40px" }, children: /* @__PURE__ */ jsx(
13587
- Controller,
13588
- {
13589
- name: `owners.${index}.cargo.${cargoIndex}.quantity`,
13590
- control,
13591
- disabled,
13592
- render: ({ field }) => /* @__PURE__ */ jsx(
13593
- "input",
13594
- {
13595
- ...field,
13596
- min: 1,
13597
- step: "1",
13598
- type: "number",
13599
- style: {
13600
- border: "none",
13601
- width: "100%",
13602
- textAlign: "center",
13603
- outline: "none",
13604
- backgroundColor: "transparent",
13605
- color: tokens.colorNeutralForeground1,
13606
- fontSize: tokens.fontSizeBase400,
13607
- fontFamily: tokens.fontFamilyBase
13608
- },
13609
- onKeyDown: (e) => {
13610
- if ([
13611
- "e",
13612
- "E",
13613
- "+",
13614
- "-",
13615
- ".",
13616
- ","
13617
- ].includes(e.key)) {
13618
- e.preventDefault();
13619
- }
13620
- },
13621
- onPaste: (e) => {
13622
- const paste = e.clipboardData.getData(
13623
- "text"
13624
- );
13625
- if (!/^\d+$/.test(paste)) {
13626
- e.preventDefault();
13500
+ children: mergedLabels.industryTypeHelperText
13501
+ }
13502
+ )
13503
+ ] }),
13504
+ /* @__PURE__ */ jsxs(Col, { md: 6, children: [
13505
+ /* @__PURE__ */ jsxs(Body1, { className: styles.label, children: [
13506
+ mergedLabels.cargoCategoryLabel,
13507
+ " ",
13508
+ /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
13509
+ ] }),
13510
+ /* @__PURE__ */ jsx(
13511
+ InputDynamic_default,
13512
+ {
13513
+ control,
13514
+ disabled,
13515
+ name: `owners.${index}.cargo.${cargoIndex}.cargoCategory`,
13516
+ options: loadCategoryOptions,
13517
+ onChange: (val) => {
13518
+ const name = `owners.${index}.cargo.${cargoIndex}.cargoCategory`;
13519
+ setValue(name, val);
13520
+ const updatedCargoItems = owner.cargoItems?.map(
13521
+ (c, cIdx) => cIdx === cargoIndex ? {
13522
+ ...c,
13523
+ cargoCategory: val
13524
+ } : c
13525
+ );
13526
+ onUpdateOwner(owner.id, {
13527
+ cargoItems: updatedCargoItems
13528
+ });
13529
+ },
13530
+ placeholder: mergedLabels.selectPlaceholder,
13531
+ required: true,
13532
+ size: "large",
13533
+ type: "select"
13534
+ }
13535
+ )
13536
+ ] })
13537
+ ] }),
13538
+ /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Col, { children: (owner.cargoItems?.length || 0) > 1 && /* @__PURE__ */ jsx(
13539
+ Button,
13540
+ {
13541
+ disabled,
13542
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:delete-24-regular" }),
13543
+ onClick: (e) => {
13544
+ e.stopPropagation();
13545
+ onDeleteCargo(owner.id, cargo.id);
13546
+ },
13547
+ onKeyDown: (e) => {
13548
+ if (e.key === "Enter" || e.key === " ") {
13549
+ e.stopPropagation();
13550
+ onDeleteCargo(
13551
+ owner.id,
13552
+ cargo.id
13553
+ );
13554
+ }
13555
+ },
13556
+ size: "medium",
13557
+ shape: "circular",
13558
+ style: {
13559
+ border: `1px solid ${tokens.colorPaletteRedForeground1}`,
13560
+ color: tokens.colorPaletteRedForeground1,
13561
+ width: "100%"
13562
+ },
13563
+ children: mergedLabels.deleteCargoButton
13564
+ }
13565
+ ) }) }),
13566
+ (() => {
13567
+ const type = watch(
13568
+ `owners.${index}.cargo.${cargoIndex}.loadType`
13569
+ );
13570
+ const _selectedLoadType = loadTypes.find(
13571
+ (loadType) => loadType.id.toString() === type
13572
+ );
13573
+ if (!_selectedLoadType) return null;
13574
+ return /* @__PURE__ */ jsxs(Row, { children: [
13575
+ /* @__PURE__ */ jsxs(Col, { md: 12, children: [
13576
+ /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.cargoQuantityLabel }),
13577
+ /* @__PURE__ */ jsxs(
13578
+ "div",
13579
+ {
13580
+ style: {
13581
+ display: "flex",
13582
+ alignItems: "center",
13583
+ border: `1px solid ${tokens.colorNeutralStroke1}`,
13584
+ borderRadius: tokens.borderRadiusMedium,
13585
+ height: "40px",
13586
+ padding: "0 12px",
13587
+ backgroundColor: tokens.colorNeutralBackground1
13588
+ },
13589
+ children: [
13590
+ /* @__PURE__ */ jsx("div", { style: { flex: 0.5 } }),
13591
+ /* @__PURE__ */ jsxs(
13592
+ "div",
13593
+ {
13594
+ style: {
13595
+ display: "flex",
13596
+ alignItems: "center",
13597
+ gap: "12px"
13598
+ },
13599
+ children: [
13600
+ /* @__PURE__ */ jsx(
13601
+ Button,
13602
+ {
13603
+ appearance: "transparent",
13604
+ disabled,
13605
+ icon: /* @__PURE__ */ jsx(
13606
+ Icon,
13607
+ {
13608
+ icon: "fluent:subtract-circle-24-regular",
13609
+ style: {
13610
+ fontSize: "24px",
13611
+ color: tokens.colorNeutralForeground4
13627
13612
  }
13628
- },
13629
- onWheel: (e) => e.target.blur(),
13630
- onChange: (e) => {
13631
- const newVal = Number(
13632
- e.target.value
13613
+ }
13614
+ ),
13615
+ "aria-label": mergedLabels.decrementQuantityAriaLabel,
13616
+ size: "small",
13617
+ onClick: () => {
13618
+ const currentVal = getValues(
13619
+ `owners.${index}.cargo.${cargoIndex}.quantity`
13620
+ ) || 0;
13621
+ const currentQty = Number(currentVal);
13622
+ if (currentQty > 1) {
13623
+ const newVal = currentQty - 1;
13624
+ setValue(
13625
+ `owners.${index}.cargo.${cargoIndex}.quantity`,
13626
+ newVal
13633
13627
  );
13634
- field.onChange(e);
13635
13628
  onUpdateCargoQuantity(
13636
13629
  owner.id,
13637
13630
  cargo.id,
13638
13631
  newVal
13639
13632
  );
13640
13633
  }
13634
+ },
13635
+ style: {
13636
+ minWidth: "32px",
13637
+ padding: "0"
13641
13638
  }
13642
- ),
13643
- rules: {
13644
- required: true,
13645
- validate: (val) => Number(val) > 0
13646
13639
  }
13647
- }
13648
- ) }),
13649
- /* @__PURE__ */ jsx(
13650
- Button,
13651
- {
13652
- appearance: "transparent",
13653
- disabled,
13654
- icon: /* @__PURE__ */ jsx(
13655
- Icon,
13656
- {
13657
- icon: "fluent:add-circle-24-regular",
13658
- style: {
13659
- fontSize: "24px",
13660
- color: tokens.colorBrandStroke1
13640
+ ),
13641
+ /* @__PURE__ */ jsx("div", { style: { width: "40px" }, children: /* @__PURE__ */ jsx(
13642
+ Controller,
13643
+ {
13644
+ name: `owners.${index}.cargo.${cargoIndex}.quantity`,
13645
+ control,
13646
+ disabled,
13647
+ render: ({ field }) => /* @__PURE__ */ jsx(
13648
+ "input",
13649
+ {
13650
+ ...field,
13651
+ min: 1,
13652
+ step: "1",
13653
+ type: "number",
13654
+ style: {
13655
+ border: "none",
13656
+ width: "100%",
13657
+ textAlign: "center",
13658
+ outline: "none",
13659
+ backgroundColor: "transparent",
13660
+ color: tokens.colorNeutralForeground1,
13661
+ fontSize: tokens.fontSizeBase400,
13662
+ fontFamily: tokens.fontFamilyBase
13663
+ },
13664
+ onKeyDown: (e) => {
13665
+ if ([
13666
+ "e",
13667
+ "E",
13668
+ "+",
13669
+ "-",
13670
+ ".",
13671
+ ","
13672
+ ].includes(e.key)) {
13673
+ e.preventDefault();
13674
+ }
13675
+ },
13676
+ onPaste: (e) => {
13677
+ const paste = e.clipboardData.getData(
13678
+ "text"
13679
+ );
13680
+ if (!/^\d+$/.test(paste)) {
13681
+ e.preventDefault();
13682
+ }
13683
+ },
13684
+ onWheel: (e) => e.target.blur(),
13685
+ onChange: (e) => {
13686
+ const newVal = Number(
13687
+ e.target.value
13688
+ );
13689
+ field.onChange(e);
13690
+ onUpdateCargoQuantity(
13691
+ owner.id,
13692
+ cargo.id,
13693
+ newVal
13694
+ );
13695
+ }
13661
13696
  }
13697
+ ),
13698
+ rules: {
13699
+ required: true,
13700
+ validate: (val) => Number(val) > 0
13662
13701
  }
13663
- ),
13664
- "aria-label": mergedLabels.incrementQuantityAriaLabel,
13665
- size: "small",
13666
- onClick: () => {
13667
- const currentVal = getValues(
13668
- `owners.${index}.cargo.${cargoIndex}.quantity`
13669
- ) || 0;
13670
- const currentQty = Number(currentVal);
13671
- const newVal = currentQty + 1;
13672
- setValue(
13673
- `owners.${index}.cargo.${cargoIndex}.quantity`,
13674
- newVal
13675
- );
13676
- onUpdateCargoQuantity(
13677
- owner.id,
13678
- cargo.id,
13679
- newVal
13680
- );
13681
- },
13682
- style: {
13683
- minWidth: "32px",
13684
- padding: "0"
13685
13702
  }
13686
- }
13687
- )
13688
- ]
13689
- }
13690
- ),
13691
- /* @__PURE__ */ jsx(
13692
- "div",
13693
- {
13694
- style: {
13695
- flex: 1,
13696
- textAlign: "left",
13697
- color: tokens.colorNeutralForeground1,
13698
- fontSize: tokens.fontSizeBase300,
13699
- paddingRight: "8px"
13700
- },
13701
- children: (() => {
13702
- const type2 = watch(
13703
- `owners.${index}.cargo.${cargoIndex}.cargoType`
13704
- );
13705
- const selectedLoadType2 = loadTypes.find(
13706
- (loadType) => loadType.id.toString() === type2
13707
- );
13708
- return selectedLoadType2?.unit?.name;
13709
- })()
13710
- }
13711
- )
13712
- ]
13713
- }
13714
- )
13715
- ] }),
13716
- /* @__PURE__ */ jsxs(Col, { md: 12, children: [
13717
- /* @__PURE__ */ jsx("div", { style: { flex: 0.5 } }),
13718
- /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.priceLabel }),
13719
- /* @__PURE__ */ jsx(
13720
- Body2,
13721
- {
13722
- style: { marginTop: "0.5rem" },
13723
- children: (() => {
13724
- return new Intl.NumberFormat(
13725
- "id-ID",
13726
- {
13727
- style: "currency",
13728
- currency: "IDR",
13729
- minimumFractionDigits: 0
13730
- }
13731
- ).format(
13732
- Number(
13733
- getValues(
13734
- `owners.${index}.cargo.${cargoIndex}.quantity`
13735
- ) || 0
13736
- ) * (_selectedLoadType?.price || 0)
13737
- );
13738
- })()
13739
- }
13740
- )
13741
- ] })
13742
- ] });
13743
- })()
13744
- ] }) })
13745
- ]
13746
- },
13747
- cargo.id
13748
- ))
13703
+ ) }),
13704
+ /* @__PURE__ */ jsx(
13705
+ Button,
13706
+ {
13707
+ appearance: "transparent",
13708
+ disabled,
13709
+ icon: /* @__PURE__ */ jsx(
13710
+ Icon,
13711
+ {
13712
+ icon: "fluent:add-circle-24-regular",
13713
+ style: {
13714
+ fontSize: "24px",
13715
+ color: tokens.colorBrandStroke1
13716
+ }
13717
+ }
13718
+ ),
13719
+ "aria-label": mergedLabels.incrementQuantityAriaLabel,
13720
+ size: "small",
13721
+ onClick: () => {
13722
+ const currentVal = getValues(
13723
+ `owners.${index}.cargo.${cargoIndex}.quantity`
13724
+ ) || 0;
13725
+ const currentQty = Number(currentVal);
13726
+ const newVal = currentQty + 1;
13727
+ setValue(
13728
+ `owners.${index}.cargo.${cargoIndex}.quantity`,
13729
+ newVal
13730
+ );
13731
+ onUpdateCargoQuantity(
13732
+ owner.id,
13733
+ cargo.id,
13734
+ newVal
13735
+ );
13736
+ },
13737
+ style: {
13738
+ minWidth: "32px",
13739
+ padding: "0"
13740
+ }
13741
+ }
13742
+ )
13743
+ ]
13744
+ }
13745
+ ),
13746
+ /* @__PURE__ */ jsx(
13747
+ "div",
13748
+ {
13749
+ style: {
13750
+ flex: 1,
13751
+ textAlign: "left",
13752
+ color: tokens.colorNeutralForeground1,
13753
+ fontSize: tokens.fontSizeBase300,
13754
+ paddingRight: "8px"
13755
+ },
13756
+ children: (() => {
13757
+ const type2 = watch(
13758
+ `owners.${index}.cargo.${cargoIndex}.loadType`
13759
+ );
13760
+ const selectedLoadType2 = loadTypes.find(
13761
+ (loadType) => loadType.id.toString() === type2
13762
+ );
13763
+ return selectedLoadType2?.unit?.name;
13764
+ })()
13765
+ }
13766
+ )
13767
+ ]
13768
+ }
13769
+ )
13770
+ ] }),
13771
+ /* @__PURE__ */ jsxs(Col, { md: 12, children: [
13772
+ /* @__PURE__ */ jsx("div", { style: { flex: 0.5 } }),
13773
+ /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.priceLabel }),
13774
+ /* @__PURE__ */ jsx(
13775
+ Body2,
13776
+ {
13777
+ style: { marginTop: "0.5rem" },
13778
+ children: (() => {
13779
+ return new Intl.NumberFormat(
13780
+ "id-ID",
13781
+ {
13782
+ style: "currency",
13783
+ currency: "IDR",
13784
+ minimumFractionDigits: 0
13785
+ }
13786
+ ).format(
13787
+ Number(
13788
+ getValues(
13789
+ `owners.${index}.cargo.${cargoIndex}.quantity`
13790
+ ) || 0
13791
+ ) * (_selectedLoadType?.price || 0)
13792
+ );
13793
+ })()
13794
+ }
13795
+ )
13796
+ ] })
13797
+ ] });
13798
+ })()
13799
+ ] }) })
13800
+ ]
13801
+ },
13802
+ cargo.id
13803
+ );
13804
+ })
13749
13805
  }
13750
13806
  ),
13751
13807
  /* @__PURE__ */ jsx(
@@ -17520,6 +17576,6 @@ var CardProfileMenu = ({
17520
17576
  ) });
17521
17577
  };
17522
17578
 
17523
- export { API_CONFIG, API_ERROR_MESSAGES, BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, COUNTRIES, CardAddon, CardBanner, CardBookingAddOn, CardBookingTicket, CardFAQ, CardMealCatalog, CardOrdererInfo, CardPassengerList, CardPaymentGuide, CardPaymentInfo, CardPaymentMethodList, CardPriceDetails, CardProfileMenu, CardPromo, CardReview, CardReviewDetail, CardReviewPassenger, CardServiceMenu, CardStatusOrder, CardTicket, CardTicketSearch, DEFAULT_LABELS8 as CardTicketSearchDefaultLabels, CardTicketSearchSummary, DEFAULT_LABELS9 as CardTicketSearchSummaryDefaultLabels, CardVehicleDetail, CardVehicleOwnerForm, CarouselWithCustomNav, DEFAULT_DURATION_RANGE, DEFAULT_PRICE_RANGE, DEFAULT_SCROLL_AMOUNT, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS18 as DateFilterDefaultLabels, EmptyContent, DEFAULT_LABELS11 as EmptyContentDefaultLabels, FileUpload_default as FileUpload, GENDER, HARDCODED_ID, HTTP_STATUS, IDENTITY_TYPE, InputDynamic_default as InputDynamic, LOAD_TYPE, MANIFEST_ENTITY, MODAL_PRESETS, MY_TICKET_STATUS, MY_TICKET_TAB, ModalFilterTicket, DEFAULT_LABELS17 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListMenuService, ModalListPassenger, ModalPassengerForm, ModalPreviewImage, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, PASSENGER_TYPE, SortMenu, Stepper, calculateAge, getBadgeConfig, getModalPreset, getSortLabel, hexToRgba };
17579
+ export { API_CONFIG, API_ERROR_MESSAGES, BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, COUNTRIES, CardAddon, CardBanner, CardBookingAddOn, CardBookingTicket, CardFAQ, CardMealCatalog, CardOrdererInfo, CardPassengerList, CardPaymentGuide, CardPaymentInfo, CardPaymentMethodList, CardPriceDetails, CardProfileMenu, CardPromo, CardReview, CardReviewDetail, CardReviewPassenger, CardServiceMenu, CardStatusOrder, CardTicket, CardTicketSearch, DEFAULT_LABELS8 as CardTicketSearchDefaultLabels, CardTicketSearchSummary, DEFAULT_LABELS9 as CardTicketSearchSummaryDefaultLabels, CardVehicleDetail, CardVehicleOwnerForm, CarouselWithCustomNav, DEFAULT_DURATION_RANGE, DEFAULT_PRICE_RANGE, DEFAULT_SCROLL_AMOUNT, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS18 as DateFilterDefaultLabels, EmptyContent, DEFAULT_LABELS11 as EmptyContentDefaultLabels, FileUpload_default as FileUpload, GENDER, HARDCODED_ID, HARDCODED_NAME, HTTP_STATUS, IDENTITY_TYPE, InputDynamic_default as InputDynamic, LOAD_TYPE, MANIFEST_ENTITY, MODAL_PRESETS, MY_TICKET_STATUS, MY_TICKET_TAB, ModalFilterTicket, DEFAULT_LABELS17 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListMenuService, ModalListPassenger, ModalPassengerForm, ModalPreviewImage, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, PASSENGER_TYPE, SortMenu, Stepper, calculateAge, getBadgeConfig, getModalPreset, getSortLabel, hexToRgba };
17524
17580
  //# sourceMappingURL=index.mjs.map
17525
17581
  //# sourceMappingURL=index.mjs.map