@visns-studio/visns-components 5.6.13 → 5.6.14

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/package.json CHANGED
@@ -84,7 +84,7 @@
84
84
  "react-dom": "^17.0.0 || ^18.0.0"
85
85
  },
86
86
  "name": "@visns-studio/visns-components",
87
- "version": "5.6.13",
87
+ "version": "5.6.14",
88
88
  "description": "Various packages to assist in the development of our Custom Applications.",
89
89
  "main": "src/index.js",
90
90
  "files": [
@@ -491,18 +491,45 @@ const DataGrid = forwardRef(
491
491
  }
492
492
  };
493
493
 
494
- const handleTimer = async (id, key) => {
494
+ const handleTimer = async (id, key, data) => {
495
495
  try {
496
- const res = await CustomFetch(`${form.url}/${id}`, 'PUT', {
497
- [key]: moment().toDate(),
498
- });
496
+ // Special handling for galvanizing timers to generate dip numbers
497
+ if (
498
+ key === 'galvanizing_start_1' ||
499
+ key === 'galvanizing_start_2'
500
+ ) {
501
+ // For galvanizing_start_1 and galvanizing_start_2, we need to generate dip numbers
502
+ const payload = {
503
+ [key]: moment().toDate(),
504
+ timer_type: key, // Pass the timer type to the backend
505
+ };
499
506
 
500
- if (res.data.error === '') {
501
- toast.success('Timer has been updated.');
507
+ const res = await CustomFetch(
508
+ `${form.url}/${id}/timer`,
509
+ 'PUT',
510
+ payload
511
+ );
502
512
 
503
- handleReload();
513
+ if (res.data.error === '') {
514
+ toast.success(
515
+ 'Timer has been updated and dip number generated.'
516
+ );
517
+ handleReload();
518
+ } else {
519
+ toast.error(res.data.error);
520
+ }
504
521
  } else {
505
- toast.error(res.data.error);
522
+ // Normal timer handling for other stages
523
+ const res = await CustomFetch(`${form.url}/${id}`, 'PUT', {
524
+ [key]: moment().toDate(),
525
+ });
526
+
527
+ if (res.data.error === '') {
528
+ toast.success('Timer has been updated.');
529
+ handleReload();
530
+ } else {
531
+ toast.error(res.data.error);
532
+ }
506
533
  }
507
534
  } catch (error) {
508
535
  console.info(error);
@@ -2807,7 +2834,8 @@ const DataGrid = forwardRef(
2807
2834
  form
2808
2835
  .primaryKey
2809
2836
  ],
2810
- column.id
2837
+ column.id,
2838
+ data
2811
2839
  );
2812
2840
  } else {
2813
2841
  // Format field names to be more readable
@@ -2852,7 +2880,8 @@ const DataGrid = forwardRef(
2852
2880
  form
2853
2881
  .primaryKey
2854
2882
  ],
2855
- column.id
2883
+ column.id,
2884
+ data
2856
2885
  );
2857
2886
  }
2858
2887
  }}
@@ -1085,7 +1085,7 @@ function Field({
1085
1085
  ? settings.options
1086
1086
  : options
1087
1087
  }
1088
- isSearchable={settings.isSearchable || false}
1088
+ isSearchable={settings.isSearchable || true}
1089
1089
  isCreatable={settings.isCreatable || false}
1090
1090
  dataOptions={dataOptions}
1091
1091
  style={style}