@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.d.mts CHANGED
@@ -3151,6 +3151,10 @@ interface CardVehicleOwnerFormLabels {
3151
3151
  industryTypeOthersLabel: string;
3152
3152
  industryTypeOthersPlaceholder: string;
3153
3153
  cargoCategoryLabel: string;
3154
+ estimatedLooseCargoLabel: string;
3155
+ estimatedLooseCargoWeightPlaceholder: string;
3156
+ estimatedLooseCargoQuantityLabel: string;
3157
+ estimatedLooseCargoUnitLabel: string;
3154
3158
  deleteCargoButton: string;
3155
3159
  addCargoButton: string;
3156
3160
  loadTypeOptions: {
package/dist/index.d.ts CHANGED
@@ -3151,6 +3151,10 @@ interface CardVehicleOwnerFormLabels {
3151
3151
  industryTypeOthersLabel: string;
3152
3152
  industryTypeOthersPlaceholder: string;
3153
3153
  cargoCategoryLabel: string;
3154
+ estimatedLooseCargoLabel: string;
3155
+ estimatedLooseCargoWeightPlaceholder: string;
3156
+ estimatedLooseCargoQuantityLabel: string;
3157
+ estimatedLooseCargoUnitLabel: string;
3154
3158
  deleteCargoButton: string;
3155
3159
  addCargoButton: string;
3156
3160
  loadTypeOptions: {
package/dist/index.js CHANGED
@@ -287,7 +287,8 @@ var sharedColors = {
287
287
  "Shared_Green_Primary": "#107c10",
288
288
  "Shared_Lilac_Primary": "#b146c2",
289
289
  "Shared_Lilac_Tint_40": "#e6bfed",
290
- "Shared_Lilac_Tint_60": "#fcf6fd"};
290
+ "Shared_Lilac_Tint_60": "#fcf6fd",
291
+ "Shared_Secondary_Primary": "#5C9F38"};
291
292
  var foundationColors = {
292
293
  "Foundation_Danger_error": "#FD3A3A"
293
294
  };
@@ -12797,6 +12798,10 @@ var DEFAULT_LABELS26 = {
12797
12798
  industryTypeOthersLabel: "Jenis Industri Lainnya",
12798
12799
  industryTypeOthersPlaceholder: "Masukkan Jenis Industri",
12799
12800
  cargoCategoryLabel: "Kategori Muatan",
12801
+ estimatedLooseCargoLabel: "Estimasi Berat Barang Lepas",
12802
+ estimatedLooseCargoWeightPlaceholder: "Masukkan Berat (Ton)",
12803
+ estimatedLooseCargoQuantityLabel: "Jumlah Karung",
12804
+ estimatedLooseCargoUnitLabel: "Karung",
12800
12805
  deleteCargoButton: "Hapus Muatan",
12801
12806
  addCargoButton: "Tambah Muatan",
12802
12807
  loadTypeOptions: {
@@ -12853,6 +12858,10 @@ var DEFAULT_LABELS26 = {
12853
12858
  industryTypeOthersLabel: "Other Industry Type",
12854
12859
  industryTypeOthersPlaceholder: "Enter Industry Type",
12855
12860
  cargoCategoryLabel: "Cargo Category",
12861
+ estimatedLooseCargoLabel: "Estimated Loose Cargo Weight",
12862
+ estimatedLooseCargoWeightPlaceholder: "Enter Weight (Ton)",
12863
+ estimatedLooseCargoQuantityLabel: "Number of Bags",
12864
+ estimatedLooseCargoUnitLabel: "Bags",
12856
12865
  deleteCargoButton: "Delete Cargo",
12857
12866
  addCargoButton: "Add Cargo",
12858
12867
  loadTypeOptions: {
@@ -13451,6 +13460,9 @@ var CardVehicleOwnerForm = ({
13451
13460
  const watchIndustryType = watch(
13452
13461
  `owners.${index}.cargo.${cargoIndex}.industryType`
13453
13462
  );
13463
+ const watchQuantity = watch(
13464
+ `owners.${index}.cargo.${cargoIndex}.quantity`
13465
+ );
13454
13466
  let _loadTypeOptions = [];
13455
13467
  if (watchCommodity && loadTypeOptionsByCommodityId[watchCommodity]) {
13456
13468
  _loadTypeOptions = loadTypeOptionsByCommodityId[watchCommodity];
@@ -13460,6 +13472,9 @@ var CardVehicleOwnerForm = ({
13460
13472
  label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13461
13473
  }));
13462
13474
  }
13475
+ const _selectedLoadType = loadTypes.find(
13476
+ (loadType) => loadType.id.toString() === watchLoadType
13477
+ );
13463
13478
  const isLoadTypeOther = _loadTypeOptions.find(
13464
13479
  (lt) => lt.value.toString() === String(watchLoadType)
13465
13480
  )?.label.startsWith(
@@ -13727,13 +13742,295 @@ var CardVehicleOwnerForm = ({
13727
13742
  )
13728
13743
  ] })
13729
13744
  ] }),
13745
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13746
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.estimatedLooseCargoLabel }) }),
13747
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { md: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
13748
+ InputDynamic_default,
13749
+ {
13750
+ control,
13751
+ disabled,
13752
+ name: `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13753
+ placeholder: mergedLabels.estimatedLooseCargoWeightPlaceholder,
13754
+ size: "large",
13755
+ type: "number",
13756
+ step: "1",
13757
+ onChange: (val) => {
13758
+ setValue(
13759
+ `owners.${index}.cargo.${cargoIndex}.cargoWeight`,
13760
+ val ? Number(val) : 0
13761
+ );
13762
+ const updatedCargoItems = owner.cargoItems?.map(
13763
+ (c, cIdx) => cIdx === cargoIndex ? {
13764
+ ...c,
13765
+ estimatedLooseCargoWeight: val ? Number(val) : 0
13766
+ } : c
13767
+ );
13768
+ onUpdateOwner(owner.id, {
13769
+ cargoItems: updatedCargoItems
13770
+ });
13771
+ },
13772
+ contentAfter: /* @__PURE__ */ jsxRuntime.jsx(
13773
+ "div",
13774
+ {
13775
+ style: {
13776
+ paddingRight: "12px",
13777
+ color: reactComponents.tokens.colorNeutralForeground1,
13778
+ fontSize: reactComponents.tokens.fontSizeBase300
13779
+ },
13780
+ children: "Ton"
13781
+ }
13782
+ )
13783
+ }
13784
+ ) })
13785
+ ] }),
13786
+ /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13787
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.estimatedLooseCargoQuantityLabel }) }),
13788
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { lg: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
13789
+ "div",
13790
+ {
13791
+ style: {
13792
+ display: "flex",
13793
+ alignItems: "center",
13794
+ border: `1px solid ${reactComponents.tokens.colorNeutralStroke1}`,
13795
+ borderRadius: reactComponents.tokens.borderRadiusMedium,
13796
+ height: "40px",
13797
+ padding: "0 12px",
13798
+ backgroundColor: reactComponents.tokens.colorNeutralBackground1
13799
+ },
13800
+ children: [
13801
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 0.5 } }),
13802
+ /* @__PURE__ */ jsxRuntime.jsxs(
13803
+ "div",
13804
+ {
13805
+ style: {
13806
+ display: "flex",
13807
+ alignItems: "center",
13808
+ gap: "12px"
13809
+ },
13810
+ children: [
13811
+ /* @__PURE__ */ jsxRuntime.jsx(
13812
+ reactComponents.Button,
13813
+ {
13814
+ appearance: "transparent",
13815
+ disabled,
13816
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
13817
+ react.Icon,
13818
+ {
13819
+ icon: "fluent:subtract-circle-24-regular",
13820
+ style: {
13821
+ fontSize: "24px",
13822
+ color: reactComponents.tokens.colorNeutralForeground4
13823
+ }
13824
+ }
13825
+ ),
13826
+ "aria-label": mergedLabels.decrementQuantityAriaLabel,
13827
+ size: "small",
13828
+ onClick: () => {
13829
+ const currentVal = getValues(
13830
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
13831
+ ) || 0;
13832
+ const currentQty = Number(currentVal);
13833
+ if (currentQty > 0) {
13834
+ const newVal = currentQty - 1;
13835
+ setValue(
13836
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13837
+ newVal
13838
+ );
13839
+ const updatedCargoItems = owner.cargoItems?.map(
13840
+ (c, cIdx) => cIdx === cargoIndex ? {
13841
+ ...c,
13842
+ estimatedLooseCargoQuantity: newVal
13843
+ } : c
13844
+ );
13845
+ onUpdateOwner(owner.id, {
13846
+ cargoItems: updatedCargoItems
13847
+ });
13848
+ }
13849
+ },
13850
+ style: {
13851
+ minWidth: "32px",
13852
+ padding: "0"
13853
+ }
13854
+ }
13855
+ ),
13856
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "40px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
13857
+ reactHookForm.Controller,
13858
+ {
13859
+ name: `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13860
+ control,
13861
+ disabled,
13862
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(
13863
+ "input",
13864
+ {
13865
+ ...field,
13866
+ min: 0,
13867
+ step: "1",
13868
+ type: "number",
13869
+ style: {
13870
+ border: "none",
13871
+ width: "100%",
13872
+ textAlign: "center",
13873
+ outline: "none",
13874
+ backgroundColor: "transparent",
13875
+ color: reactComponents.tokens.colorNeutralForeground1,
13876
+ fontSize: reactComponents.tokens.fontSizeBase400,
13877
+ fontFamily: reactComponents.tokens.fontFamilyBase
13878
+ },
13879
+ onKeyDown: (e) => {
13880
+ if ([
13881
+ "e",
13882
+ "E",
13883
+ "+",
13884
+ "-",
13885
+ ".",
13886
+ ","
13887
+ ].includes(e.key)) {
13888
+ e.preventDefault();
13889
+ }
13890
+ },
13891
+ onPaste: (e) => {
13892
+ const paste = e.clipboardData.getData(
13893
+ "text"
13894
+ );
13895
+ if (!/^\d+$/.test(paste)) {
13896
+ e.preventDefault();
13897
+ }
13898
+ },
13899
+ onWheel: (e) => e.target.blur(),
13900
+ onChange: (e) => {
13901
+ const newVal = Number(
13902
+ e.target.value
13903
+ );
13904
+ field.onChange(e);
13905
+ const updatedCargoItems = owner.cargoItems?.map(
13906
+ (c, cIdx) => cIdx === cargoIndex ? {
13907
+ ...c,
13908
+ estimatedLooseCargoQuantity: newVal
13909
+ } : c
13910
+ );
13911
+ onUpdateOwner(owner.id, {
13912
+ cargoItems: updatedCargoItems
13913
+ });
13914
+ }
13915
+ }
13916
+ ),
13917
+ rules: {
13918
+ validate: (val) => Number(val) >= 0
13919
+ }
13920
+ }
13921
+ ) }),
13922
+ /* @__PURE__ */ jsxRuntime.jsx(
13923
+ reactComponents.Button,
13924
+ {
13925
+ appearance: "transparent",
13926
+ disabled,
13927
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
13928
+ react.Icon,
13929
+ {
13930
+ icon: "fluent:add-circle-24-regular",
13931
+ style: {
13932
+ fontSize: "24px",
13933
+ color: reactComponents.tokens.colorBrandStroke1
13934
+ }
13935
+ }
13936
+ ),
13937
+ "aria-label": mergedLabels.incrementQuantityAriaLabel,
13938
+ size: "small",
13939
+ onClick: () => {
13940
+ const currentVal = getValues(
13941
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
13942
+ ) || 0;
13943
+ const currentQty = Number(currentVal);
13944
+ const newVal = currentQty + 1;
13945
+ setValue(
13946
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`,
13947
+ newVal
13948
+ );
13949
+ const updatedCargoItems = owner.cargoItems?.map(
13950
+ (c, cIdx) => cIdx === cargoIndex ? {
13951
+ ...c,
13952
+ estimatedLooseCargoQuantity: newVal
13953
+ } : c
13954
+ );
13955
+ onUpdateOwner(owner.id, {
13956
+ cargoItems: updatedCargoItems
13957
+ });
13958
+ },
13959
+ style: {
13960
+ minWidth: "32px",
13961
+ padding: "0"
13962
+ }
13963
+ }
13964
+ )
13965
+ ]
13966
+ }
13967
+ ),
13968
+ /* @__PURE__ */ jsxRuntime.jsx(
13969
+ "div",
13970
+ {
13971
+ style: {
13972
+ flex: 1,
13973
+ textAlign: "left",
13974
+ color: reactComponents.tokens.colorNeutralForeground1,
13975
+ fontSize: reactComponents.tokens.fontSizeBase300,
13976
+ paddingRight: "8px"
13977
+ },
13978
+ children: mergedLabels.estimatedLooseCargoUnitLabel
13979
+ }
13980
+ )
13981
+ ]
13982
+ }
13983
+ ) })
13984
+ ] }),
13985
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { lg: 12, children: [
13986
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.label, children: mergedLabels.priceLabel }),
13987
+ /* @__PURE__ */ jsxRuntime.jsx(
13988
+ reactComponents.Body2,
13989
+ {
13990
+ style: { marginTop: "0.5rem" },
13991
+ children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13992
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { children: [
13993
+ watch(
13994
+ `owners.${index}.cargo.${cargoIndex}.commodity`
13995
+ ) || "Komoditas",
13996
+ " ",
13997
+ "\u2022 ",
13998
+ watch(
13999
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
14000
+ ) || 0,
14001
+ "x",
14002
+ " ",
14003
+ mergedLabels.estimatedLooseCargoUnitLabel,
14004
+ " ",
14005
+ "\u2022 IDR. 15,000"
14006
+ ] }) }),
14007
+ /* @__PURE__ */ jsxRuntime.jsx(
14008
+ reactGridSystem.Col,
14009
+ {
14010
+ xl: 6,
14011
+ style: {
14012
+ color: sharedColors["Shared_Secondary_Primary"],
14013
+ textAlign: "right"
14014
+ },
14015
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Stronger, { children: new Intl.NumberFormat(
14016
+ "id-ID",
14017
+ {
14018
+ style: "currency",
14019
+ currency: "IDR",
14020
+ minimumFractionDigits: 0
14021
+ }
14022
+ ).format(
14023
+ (watch(
14024
+ `owners.${index}.cargo.${cargoIndex}.estimatedLooseCargoQuantity`
14025
+ ) || 0) * 15e3
14026
+ ) })
14027
+ }
14028
+ )
14029
+ ] })
14030
+ }
14031
+ )
14032
+ ] }) }),
13730
14033
  (() => {
13731
- const type = watch(
13732
- `owners.${index}.cargo.${cargoIndex}.loadType`
13733
- );
13734
- const _selectedLoadType = loadTypes.find(
13735
- (loadType) => loadType.id.toString() === type
13736
- );
13737
14034
  if (!_selectedLoadType) return null;
13738
14035
  return /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
13739
14036
  /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Col, { md: 12, children: [
@@ -13918,11 +14215,11 @@ var CardVehicleOwnerForm = ({
13918
14215
  paddingRight: "8px"
13919
14216
  },
13920
14217
  children: (() => {
13921
- const type2 = watch(
14218
+ const type = watch(
13922
14219
  `owners.${index}.cargo.${cargoIndex}.loadType`
13923
14220
  );
13924
14221
  const selectedLoadType2 = loadTypes.find(
13925
- (loadType) => loadType.id.toString() === type2
14222
+ (loadType) => loadType.id.toString() === type
13926
14223
  );
13927
14224
  return selectedLoadType2?.unit?.name;
13928
14225
  })()
@@ -13939,22 +14236,42 @@ var CardVehicleOwnerForm = ({
13939
14236
  reactComponents.Body2,
13940
14237
  {
13941
14238
  style: { marginTop: "0.5rem" },
13942
- children: (() => {
13943
- return new Intl.NumberFormat(
13944
- "id-ID",
14239
+ children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { children: [
14240
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xl: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1Strong, { children: [
14241
+ _selectedLoadType.name,
14242
+ " \u2022",
14243
+ " ",
14244
+ watchQuantity,
14245
+ "x",
14246
+ " ",
14247
+ _selectedLoadType.unit?.name,
14248
+ " ",
14249
+ "\u2022",
14250
+ " ",
14251
+ _selectedLoadType.formattedPrice
14252
+ ] }) }),
14253
+ /* @__PURE__ */ jsxRuntime.jsx(
14254
+ reactGridSystem.Col,
13945
14255
  {
13946
- style: "currency",
13947
- currency: "IDR",
13948
- minimumFractionDigits: 0
14256
+ xl: 6,
14257
+ style: { color: sharedColors["Shared_Secondary_Primary"], textAlign: "right" },
14258
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Stronger, { children: new Intl.NumberFormat(
14259
+ "id-ID",
14260
+ {
14261
+ style: "currency",
14262
+ currency: "IDR",
14263
+ minimumFractionDigits: 0
14264
+ }
14265
+ ).format(
14266
+ Number(
14267
+ getValues(
14268
+ `owners.${index}.cargo.${cargoIndex}.quantity`
14269
+ ) || 0
14270
+ ) * (_selectedLoadType.price || 0)
14271
+ ) })
13949
14272
  }
13950
- ).format(
13951
- Number(
13952
- getValues(
13953
- `owners.${index}.cargo.${cargoIndex}.quantity`
13954
- ) || 0
13955
- ) * (_selectedLoadType?.price || 0)
13956
- );
13957
- })()
14273
+ )
14274
+ ] })
13958
14275
  }
13959
14276
  )
13960
14277
  ] })