@asdp/ferryui 0.1.22-dev.10685 → 0.1.22-dev.10687

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
@@ -278,7 +278,8 @@ var sharedColors = {
278
278
  "Shared_Green_Primary": "#107c10",
279
279
  "Shared_Lilac_Primary": "#b146c2",
280
280
  "Shared_Lilac_Tint_40": "#e6bfed",
281
- "Shared_Lilac_Tint_60": "#fcf6fd"};
281
+ "Shared_Lilac_Tint_60": "#fcf6fd",
282
+ "Shared_Secondary_Primary": "#5C9F38"};
282
283
  var foundationColors = {
283
284
  "Foundation_Danger_error": "#FD3A3A"
284
285
  };
@@ -12788,6 +12789,10 @@ var DEFAULT_LABELS26 = {
12788
12789
  industryTypeOthersLabel: "Jenis Industri Lainnya",
12789
12790
  industryTypeOthersPlaceholder: "Masukkan Jenis Industri",
12790
12791
  cargoCategoryLabel: "Kategori Muatan",
12792
+ estimatedLooseCargoLabel: "Estimasi Berat Barang Lepas",
12793
+ estimatedLooseCargoWeightPlaceholder: "Masukkan Berat (Ton)",
12794
+ estimatedLooseCargoQuantityLabel: "Jumlah Karung",
12795
+ estimatedLooseCargoUnitLabel: "Karung",
12791
12796
  deleteCargoButton: "Hapus Muatan",
12792
12797
  addCargoButton: "Tambah Muatan",
12793
12798
  loadTypeOptions: {
@@ -12844,6 +12849,10 @@ var DEFAULT_LABELS26 = {
12844
12849
  industryTypeOthersLabel: "Other Industry Type",
12845
12850
  industryTypeOthersPlaceholder: "Enter Industry Type",
12846
12851
  cargoCategoryLabel: "Cargo Category",
12852
+ estimatedLooseCargoLabel: "Estimated Loose Cargo Weight",
12853
+ estimatedLooseCargoWeightPlaceholder: "Enter Weight (Ton)",
12854
+ estimatedLooseCargoQuantityLabel: "Number of Bags",
12855
+ estimatedLooseCargoUnitLabel: "Bags",
12847
12856
  deleteCargoButton: "Delete Cargo",
12848
12857
  addCargoButton: "Add Cargo",
12849
12858
  loadTypeOptions: {
@@ -13442,6 +13451,9 @@ var CardVehicleOwnerForm = ({
13442
13451
  const watchIndustryType = watch(
13443
13452
  `owners.${index}.cargo.${cargoIndex}.industryType`
13444
13453
  );
13454
+ const watchQuantity = watch(
13455
+ `owners.${index}.cargo.${cargoIndex}.quantity`
13456
+ );
13445
13457
  let _loadTypeOptions = [];
13446
13458
  if (watchCommodity && loadTypeOptionsByCommodityId[watchCommodity]) {
13447
13459
  _loadTypeOptions = loadTypeOptionsByCommodityId[watchCommodity];
@@ -13451,6 +13463,9 @@ var CardVehicleOwnerForm = ({
13451
13463
  label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13452
13464
  }));
13453
13465
  }
13466
+ const _selectedLoadType = loadTypes.find(
13467
+ (loadType) => loadType.id.toString() === watchLoadType
13468
+ );
13454
13469
  const isLoadTypeOther = _loadTypeOptions.find(
13455
13470
  (lt) => lt.value.toString() === String(watchLoadType)
13456
13471
  )?.label.startsWith(
@@ -13718,13 +13733,295 @@ var CardVehicleOwnerForm = ({
13718
13733
  )
13719
13734
  ] })
13720
13735
  ] }),
13736
+ /* @__PURE__ */ jsxs(Row, { children: [
13737
+ /* @__PURE__ */ jsx(Col, { lg: 12, children: /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.estimatedLooseCargoLabel }) }),
13738
+ /* @__PURE__ */ jsx(Col, { md: 12, children: /* @__PURE__ */ jsx(
13739
+ InputDynamic_default,
13740
+ {
13741
+ control,
13742
+ disabled,
13743
+ name: `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13744
+ placeholder: mergedLabels.estimatedLooseCargoWeightPlaceholder,
13745
+ size: "large",
13746
+ type: "number",
13747
+ step: "1",
13748
+ onChange: (val) => {
13749
+ setValue(
13750
+ `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13751
+ val ? Number(val) : 0
13752
+ );
13753
+ const updatedCargoItems = owner.cargoItems?.map(
13754
+ (c, cIdx) => cIdx === cargoIndex ? {
13755
+ ...c,
13756
+ estimatedLooseCargoWeight: val ? Number(val) : 0
13757
+ } : c
13758
+ );
13759
+ onUpdateOwner(owner.id, {
13760
+ cargoItems: updatedCargoItems
13761
+ });
13762
+ },
13763
+ contentAfter: /* @__PURE__ */ jsx(
13764
+ "div",
13765
+ {
13766
+ style: {
13767
+ paddingRight: "12px",
13768
+ color: tokens.colorNeutralForeground1,
13769
+ fontSize: tokens.fontSizeBase300
13770
+ },
13771
+ children: "Ton"
13772
+ }
13773
+ )
13774
+ }
13775
+ ) })
13776
+ ] }),
13777
+ /* @__PURE__ */ jsxs(Row, { children: [
13778
+ /* @__PURE__ */ jsx(Col, { lg: 12, children: /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.estimatedLooseCargoQuantityLabel }) }),
13779
+ /* @__PURE__ */ jsx(Col, { lg: 12, children: /* @__PURE__ */ jsxs(
13780
+ "div",
13781
+ {
13782
+ style: {
13783
+ display: "flex",
13784
+ alignItems: "center",
13785
+ border: `1px solid ${tokens.colorNeutralStroke1}`,
13786
+ borderRadius: tokens.borderRadiusMedium,
13787
+ height: "40px",
13788
+ padding: "0 12px",
13789
+ backgroundColor: tokens.colorNeutralBackground1
13790
+ },
13791
+ children: [
13792
+ /* @__PURE__ */ jsx("div", { style: { flex: 0.5 } }),
13793
+ /* @__PURE__ */ jsxs(
13794
+ "div",
13795
+ {
13796
+ style: {
13797
+ display: "flex",
13798
+ alignItems: "center",
13799
+ gap: "12px"
13800
+ },
13801
+ children: [
13802
+ /* @__PURE__ */ jsx(
13803
+ Button,
13804
+ {
13805
+ appearance: "transparent",
13806
+ disabled,
13807
+ icon: /* @__PURE__ */ jsx(
13808
+ Icon,
13809
+ {
13810
+ icon: "fluent:subtract-circle-24-regular",
13811
+ style: {
13812
+ fontSize: "24px",
13813
+ color: tokens.colorNeutralForeground4
13814
+ }
13815
+ }
13816
+ ),
13817
+ "aria-label": mergedLabels.decrementQuantityAriaLabel,
13818
+ size: "small",
13819
+ onClick: () => {
13820
+ const currentVal = getValues(
13821
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
13822
+ ) || 0;
13823
+ const currentQty = Number(currentVal);
13824
+ if (currentQty > 0) {
13825
+ const newVal = currentQty - 1;
13826
+ setValue(
13827
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13828
+ newVal
13829
+ );
13830
+ const updatedCargoItems = owner.cargoItems?.map(
13831
+ (c, cIdx) => cIdx === cargoIndex ? {
13832
+ ...c,
13833
+ estimatedLooseCargoQuantity: newVal
13834
+ } : c
13835
+ );
13836
+ onUpdateOwner(owner.id, {
13837
+ cargoItems: updatedCargoItems
13838
+ });
13839
+ }
13840
+ },
13841
+ style: {
13842
+ minWidth: "32px",
13843
+ padding: "0"
13844
+ }
13845
+ }
13846
+ ),
13847
+ /* @__PURE__ */ jsx("div", { style: { width: "40px" }, children: /* @__PURE__ */ jsx(
13848
+ Controller,
13849
+ {
13850
+ name: `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13851
+ control,
13852
+ disabled,
13853
+ render: ({ field }) => /* @__PURE__ */ jsx(
13854
+ "input",
13855
+ {
13856
+ ...field,
13857
+ min: 0,
13858
+ step: "1",
13859
+ type: "number",
13860
+ style: {
13861
+ border: "none",
13862
+ width: "100%",
13863
+ textAlign: "center",
13864
+ outline: "none",
13865
+ backgroundColor: "transparent",
13866
+ color: tokens.colorNeutralForeground1,
13867
+ fontSize: tokens.fontSizeBase400,
13868
+ fontFamily: tokens.fontFamilyBase
13869
+ },
13870
+ onKeyDown: (e) => {
13871
+ if ([
13872
+ "e",
13873
+ "E",
13874
+ "+",
13875
+ "-",
13876
+ ".",
13877
+ ","
13878
+ ].includes(e.key)) {
13879
+ e.preventDefault();
13880
+ }
13881
+ },
13882
+ onPaste: (e) => {
13883
+ const paste = e.clipboardData.getData(
13884
+ "text"
13885
+ );
13886
+ if (!/^\d+$/.test(paste)) {
13887
+ e.preventDefault();
13888
+ }
13889
+ },
13890
+ onWheel: (e) => e.target.blur(),
13891
+ onChange: (e) => {
13892
+ const newVal = Number(
13893
+ e.target.value
13894
+ );
13895
+ field.onChange(e);
13896
+ const updatedCargoItems = owner.cargoItems?.map(
13897
+ (c, cIdx) => cIdx === cargoIndex ? {
13898
+ ...c,
13899
+ estimatedLooseCargoQuantity: newVal
13900
+ } : c
13901
+ );
13902
+ onUpdateOwner(owner.id, {
13903
+ cargoItems: updatedCargoItems
13904
+ });
13905
+ }
13906
+ }
13907
+ ),
13908
+ rules: {
13909
+ validate: (val) => Number(val) >= 0
13910
+ }
13911
+ }
13912
+ ) }),
13913
+ /* @__PURE__ */ jsx(
13914
+ Button,
13915
+ {
13916
+ appearance: "transparent",
13917
+ disabled,
13918
+ icon: /* @__PURE__ */ jsx(
13919
+ Icon,
13920
+ {
13921
+ icon: "fluent:add-circle-24-regular",
13922
+ style: {
13923
+ fontSize: "24px",
13924
+ color: tokens.colorBrandStroke1
13925
+ }
13926
+ }
13927
+ ),
13928
+ "aria-label": mergedLabels.incrementQuantityAriaLabel,
13929
+ size: "small",
13930
+ onClick: () => {
13931
+ const currentVal = getValues(
13932
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
13933
+ ) || 0;
13934
+ const currentQty = Number(currentVal);
13935
+ const newVal = currentQty + 1;
13936
+ setValue(
13937
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13938
+ newVal
13939
+ );
13940
+ const updatedCargoItems = owner.cargoItems?.map(
13941
+ (c, cIdx) => cIdx === cargoIndex ? {
13942
+ ...c,
13943
+ estimatedLooseCargoQuantity: newVal
13944
+ } : c
13945
+ );
13946
+ onUpdateOwner(owner.id, {
13947
+ cargoItems: updatedCargoItems
13948
+ });
13949
+ },
13950
+ style: {
13951
+ minWidth: "32px",
13952
+ padding: "0"
13953
+ }
13954
+ }
13955
+ )
13956
+ ]
13957
+ }
13958
+ ),
13959
+ /* @__PURE__ */ jsx(
13960
+ "div",
13961
+ {
13962
+ style: {
13963
+ flex: 1,
13964
+ textAlign: "left",
13965
+ color: tokens.colorNeutralForeground1,
13966
+ fontSize: tokens.fontSizeBase300,
13967
+ paddingRight: "8px"
13968
+ },
13969
+ children: mergedLabels.estimatedLooseCargoUnitLabel
13970
+ }
13971
+ )
13972
+ ]
13973
+ }
13974
+ ) })
13975
+ ] }),
13976
+ /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { lg: 12, children: [
13977
+ /* @__PURE__ */ jsx(Body1, { className: styles.label, children: mergedLabels.priceLabel }),
13978
+ /* @__PURE__ */ jsx(
13979
+ Body2,
13980
+ {
13981
+ style: { marginTop: "0.5rem" },
13982
+ children: /* @__PURE__ */ jsxs(Row, { children: [
13983
+ /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsxs(Body1Strong, { children: [
13984
+ watch(
13985
+ `owners.${index}.cargo.${cargoIndex}.commodity`
13986
+ ) || "Komoditas",
13987
+ " ",
13988
+ "\u2022 ",
13989
+ watch(
13990
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
13991
+ ) || 0,
13992
+ "x",
13993
+ " ",
13994
+ mergedLabels.estimatedLooseCargoUnitLabel,
13995
+ " ",
13996
+ "\u2022 IDR. 15,000"
13997
+ ] }) }),
13998
+ /* @__PURE__ */ jsx(
13999
+ Col,
14000
+ {
14001
+ xl: 6,
14002
+ style: {
14003
+ color: sharedColors["Shared_Secondary_Primary"],
14004
+ textAlign: "right"
14005
+ },
14006
+ children: /* @__PURE__ */ jsx(Body1Stronger, { children: new Intl.NumberFormat(
14007
+ "id-ID",
14008
+ {
14009
+ style: "currency",
14010
+ currency: "IDR",
14011
+ minimumFractionDigits: 0
14012
+ }
14013
+ ).format(
14014
+ (watch(
14015
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
14016
+ ) || 0) * 15e3
14017
+ ) })
14018
+ }
14019
+ )
14020
+ ] })
14021
+ }
14022
+ )
14023
+ ] }) }),
13721
14024
  (() => {
13722
- const type = watch(
13723
- `owners.${index}.cargo.${cargoIndex}.loadType`
13724
- );
13725
- const _selectedLoadType = loadTypes.find(
13726
- (loadType) => loadType.id.toString() === type
13727
- );
13728
14025
  if (!_selectedLoadType) return null;
13729
14026
  return /* @__PURE__ */ jsxs(Row, { children: [
13730
14027
  /* @__PURE__ */ jsxs(Col, { md: 12, children: [
@@ -13909,11 +14206,11 @@ var CardVehicleOwnerForm = ({
13909
14206
  paddingRight: "8px"
13910
14207
  },
13911
14208
  children: (() => {
13912
- const type2 = watch(
14209
+ const type = watch(
13913
14210
  `owners.${index}.cargo.${cargoIndex}.loadType`
13914
14211
  );
13915
14212
  const selectedLoadType2 = loadTypes.find(
13916
- (loadType) => loadType.id.toString() === type2
14213
+ (loadType) => loadType.id.toString() === type
13917
14214
  );
13918
14215
  return selectedLoadType2?.unit?.name;
13919
14216
  })()
@@ -13930,22 +14227,42 @@ var CardVehicleOwnerForm = ({
13930
14227
  Body2,
13931
14228
  {
13932
14229
  style: { marginTop: "0.5rem" },
13933
- children: (() => {
13934
- return new Intl.NumberFormat(
13935
- "id-ID",
14230
+ children: /* @__PURE__ */ jsxs(Row, { children: [
14231
+ /* @__PURE__ */ jsx(Col, { xl: 6, children: /* @__PURE__ */ jsxs(Body1Strong, { children: [
14232
+ _selectedLoadType.name,
14233
+ " \u2022",
14234
+ " ",
14235
+ watchQuantity,
14236
+ "x",
14237
+ " ",
14238
+ _selectedLoadType.unit?.name,
14239
+ " ",
14240
+ "\u2022",
14241
+ " ",
14242
+ _selectedLoadType.formattedPrice
14243
+ ] }) }),
14244
+ /* @__PURE__ */ jsx(
14245
+ Col,
13936
14246
  {
13937
- style: "currency",
13938
- currency: "IDR",
13939
- minimumFractionDigits: 0
14247
+ xl: 6,
14248
+ style: { color: sharedColors["Shared_Secondary_Primary"], textAlign: "right" },
14249
+ children: /* @__PURE__ */ jsx(Body1Stronger, { children: new Intl.NumberFormat(
14250
+ "id-ID",
14251
+ {
14252
+ style: "currency",
14253
+ currency: "IDR",
14254
+ minimumFractionDigits: 0
14255
+ }
14256
+ ).format(
14257
+ Number(
14258
+ getValues(
14259
+ `owners.${index}.cargo.${cargoIndex}.quantity`
14260
+ ) || 0
14261
+ ) * (_selectedLoadType.price || 0)
14262
+ ) })
13940
14263
  }
13941
- ).format(
13942
- Number(
13943
- getValues(
13944
- `owners.${index}.cargo.${cargoIndex}.quantity`
13945
- ) || 0
13946
- ) * (_selectedLoadType?.price || 0)
13947
- );
13948
- })()
14264
+ )
14265
+ ] })
13949
14266
  }
13950
14267
  )
13951
14268
  ] })