Move UPC validation out of ValidationContainer, add code lines tracking
This commit is contained in:
43
.VSCodeCounter/2025-03-17_14-20-03/details.md
Normal file
43
.VSCodeCounter/2025-03-17_14-20-03/details.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Details
|
||||||
|
|
||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 28 files, 6565 codes, 1027 comments, 1053 blanks, all 8645 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Files
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md) | Markdown | 39 | 0 | 19 | 58 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx) | TypeScript JSX | 230 | 10 | 8 | 248 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx) | TypeScript JSX | 18 | 0 | 3 | 21 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx) | TypeScript JSX | 83 | 0 | 4 | 87 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx) | TypeScript JSX | 273 | 19 | 37 | 329 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx) | TypeScript JSX | 193 | 4 | 15 | 212 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx) | TypeScript JSX | 374 | 42 | 44 | 460 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx) | TypeScript JSX | 1,101 | 234 | 213 | 1,548 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx) | TypeScript JSX | 499 | 48 | 54 | 601 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx) | TypeScript JSX | 112 | 12 | 21 | 145 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx) | TypeScript JSX | 232 | 31 | 32 | 295 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx) | TypeScript JSX | 407 | 56 | 52 | 515 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx) | TypeScript JSX | 193 | 23 | 22 | 238 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx) | TypeScript JSX | 289 | 36 | 31 | 356 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx) | TypeScript JSX | 500 | 75 | 89 | 664 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx) | TypeScript JSX | 89 | 12 | 16 | 117 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx) | TypeScript JSX | 204 | 26 | 33 | 263 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx) | TypeScript JSX | 93 | 13 | 18 | 124 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx) | TypeScript JSX | 219 | 39 | 47 | 305 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx) | TypeScript JSX | 1,060 | 228 | 229 | 1,517 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx) | TypeScript JSX | 20 | 6 | 2 | 28 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts) | TypeScript | 4 | 0 | 1 | 5 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts) | TypeScript | 16 | 4 | 4 | 24 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts) | TypeScript | 124 | 4 | 14 | 142 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts) | TypeScript | 21 | 15 | 5 | 41 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts) | TypeScript | 43 | 24 | 7 | 74 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js) | JavaScript | 28 | 7 | 9 | 44 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts) | TypeScript | 101 | 59 | 24 | 184 |
|
||||||
|
|
||||||
|
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
15
.VSCodeCounter/2025-03-17_14-20-03/diff-details.md
Normal file
15
.VSCodeCounter/2025-03-17_14-20-03/diff-details.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Diff Details
|
||||||
|
|
||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||||
|
|
||||||
|
## Files
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||||
19
.VSCodeCounter/2025-03-17_14-20-03/diff.md
Normal file
19
.VSCodeCounter/2025-03-17_14-20-03/diff.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Diff Summary
|
||||||
|
|
||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Languages
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
|
||||||
|
## Directories
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||||
22
.VSCodeCounter/2025-03-17_14-20-03/diff.txt
Normal file
22
.VSCodeCounter/2025-03-17_14-20-03/diff.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
Directory : /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||||
|
|
||||||
|
Languages
|
||||||
|
+----------+------------+------------+------------+------------+------------+
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
+----------+------------+------------+------------+------------+------------+
|
||||||
|
+----------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Directories
|
||||||
|
+------+------------+------------+------------+------------+------------+
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
+------+------------+------------+------------+------------+------------+
|
||||||
|
+------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Files
|
||||||
|
+----------+----------+------------+------------+------------+------------+
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
+----------+----------+------------+------------+------------+------------+
|
||||||
|
| Total | | 0 | 0 | 0 | 0 |
|
||||||
|
+----------+----------+------------+------------+------------+------------+
|
||||||
1
.VSCodeCounter/2025-03-17_14-20-03/results.json
Normal file
1
.VSCodeCounter/2025-03-17_14-20-03/results.json
Normal file
File diff suppressed because one or more lines are too long
31
.VSCodeCounter/2025-03-17_14-20-03/results.md
Normal file
31
.VSCodeCounter/2025-03-17_14-20-03/results.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 28 files, 6565 codes, 1027 comments, 1053 blanks, all 8645 lines
|
||||||
|
|
||||||
|
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Languages
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| TypeScript JSX | 20 | 6,189 | 914 | 970 | 8,073 |
|
||||||
|
| TypeScript | 6 | 309 | 106 | 55 | 470 |
|
||||||
|
| Markdown | 1 | 39 | 0 | 19 | 58 |
|
||||||
|
| JavaScript | 1 | 28 | 7 | 9 | 44 |
|
||||||
|
|
||||||
|
## Directories
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| . | 28 | 6,565 | 1,027 | 1,053 | 8,645 |
|
||||||
|
| . (Files) | 3 | 63 | 6 | 22 | 91 |
|
||||||
|
| components | 13 | 4,004 | 515 | 536 | 5,055 |
|
||||||
|
| components (Files) | 8 | 2,771 | 357 | 378 | 3,506 |
|
||||||
|
| components/cells | 5 | 1,233 | 158 | 158 | 1,549 |
|
||||||
|
| hooks | 6 | 2,165 | 393 | 432 | 2,990 |
|
||||||
|
| types | 1 | 16 | 4 | 4 | 24 |
|
||||||
|
| utils | 5 | 317 | 109 | 59 | 485 |
|
||||||
|
|
||||||
|
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
62
.VSCodeCounter/2025-03-17_14-20-03/results.txt
Normal file
62
.VSCodeCounter/2025-03-17_14-20-03/results.txt
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
Date : 2025-03-17 14:20:03
|
||||||
|
Directory : /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
Total : 28 files, 6565 codes, 1027 comments, 1053 blanks, all 8645 lines
|
||||||
|
|
||||||
|
Languages
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| TypeScript JSX | 20 | 6,189 | 914 | 970 | 8,073 |
|
||||||
|
| TypeScript | 6 | 309 | 106 | 55 | 470 |
|
||||||
|
| Markdown | 1 | 39 | 0 | 19 | 58 |
|
||||||
|
| JavaScript | 1 | 28 | 7 | 9 | 44 |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Directories
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| . | 28 | 6,565 | 1,027 | 1,053 | 8,645 |
|
||||||
|
| . (Files) | 3 | 63 | 6 | 22 | 91 |
|
||||||
|
| components | 13 | 4,004 | 515 | 536 | 5,055 |
|
||||||
|
| components (Files) | 8 | 2,771 | 357 | 378 | 3,506 |
|
||||||
|
| components/cells | 5 | 1,233 | 158 | 158 | 1,549 |
|
||||||
|
| hooks | 6 | 2,165 | 393 | 432 | 2,990 |
|
||||||
|
| types | 1 | 16 | 4 | 4 | 24 |
|
||||||
|
| utils | 5 | 317 | 109 | 59 | 485 |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Files
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md | Markdown | 39 | 0 | 19 | 58 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx | TypeScript JSX | 230 | 10 | 8 | 248 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx | TypeScript JSX | 18 | 0 | 3 | 21 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx | TypeScript JSX | 83 | 0 | 4 | 87 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx | TypeScript JSX | 273 | 19 | 37 | 329 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx | TypeScript JSX | 193 | 4 | 15 | 212 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx | TypeScript JSX | 374 | 42 | 44 | 460 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx | TypeScript JSX | 1,101 | 234 | 213 | 1,548 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx | TypeScript JSX | 499 | 48 | 54 | 601 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx | TypeScript JSX | 112 | 12 | 21 | 145 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx | TypeScript JSX | 232 | 31 | 32 | 295 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx | TypeScript JSX | 407 | 56 | 52 | 515 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx | TypeScript JSX | 193 | 23 | 22 | 238 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx | TypeScript JSX | 289 | 36 | 31 | 356 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx | TypeScript JSX | 500 | 75 | 89 | 664 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx | TypeScript JSX | 89 | 12 | 16 | 117 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx | TypeScript JSX | 204 | 26 | 33 | 263 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx | TypeScript JSX | 93 | 13 | 18 | 124 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx | TypeScript JSX | 219 | 39 | 47 | 305 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx | TypeScript JSX | 1,060 | 228 | 229 | 1,517 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx | TypeScript JSX | 20 | 6 | 2 | 28 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts | TypeScript | 4 | 0 | 1 | 5 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts | TypeScript | 16 | 4 | 4 | 24 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts | TypeScript | 124 | 4 | 14 | 142 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts | TypeScript | 21 | 15 | 5 | 41 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts | TypeScript | 43 | 24 | 7 | 74 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js | JavaScript | 28 | 7 | 9 | 44 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts | TypeScript | 101 | 59 | 24 | 184 |
|
||||||
|
| Total | | 6,565 | 1,027 | 1,053 | 8,645 |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
43
.VSCodeCounter/2025-03-17_16-02-14/details.md
Normal file
43
.VSCodeCounter/2025-03-17_16-02-14/details.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Details
|
||||||
|
|
||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 28 files, 6551 codes, 1023 comments, 1050 blanks, all 8624 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Files
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md) | Markdown | 39 | 0 | 19 | 58 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx) | TypeScript JSX | 230 | 10 | 8 | 248 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx) | TypeScript JSX | 18 | 0 | 3 | 21 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx) | TypeScript JSX | 83 | 0 | 4 | 87 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx) | TypeScript JSX | 273 | 19 | 37 | 329 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx) | TypeScript JSX | 193 | 4 | 15 | 212 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx) | TypeScript JSX | 374 | 42 | 44 | 460 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx) | TypeScript JSX | 971 | 194 | 178 | 1,343 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx) | TypeScript JSX | 499 | 48 | 54 | 601 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx) | TypeScript JSX | 112 | 12 | 21 | 145 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx) | TypeScript JSX | 232 | 31 | 32 | 295 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx) | TypeScript JSX | 407 | 56 | 52 | 515 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx) | TypeScript JSX | 193 | 23 | 22 | 238 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx) | TypeScript JSX | 289 | 36 | 31 | 356 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx) | TypeScript JSX | 500 | 75 | 89 | 664 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx) | TypeScript JSX | 89 | 12 | 16 | 117 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx) | TypeScript JSX | 204 | 26 | 33 | 263 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx) | TypeScript JSX | 209 | 49 | 50 | 308 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx) | TypeScript JSX | 219 | 39 | 47 | 305 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx) | TypeScript JSX | 1,060 | 228 | 229 | 1,517 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx) | TypeScript JSX | 20 | 6 | 2 | 28 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts) | TypeScript | 4 | 0 | 1 | 5 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts) | TypeScript | 16 | 4 | 4 | 24 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts) | TypeScript | 124 | 4 | 14 | 142 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts) | TypeScript | 21 | 15 | 5 | 41 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts) | TypeScript | 43 | 24 | 7 | 74 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js) | JavaScript | 28 | 7 | 9 | 44 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts) | TypeScript | 101 | 59 | 24 | 184 |
|
||||||
|
|
||||||
|
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
17
.VSCodeCounter/2025-03-17_16-02-14/diff-details.md
Normal file
17
.VSCodeCounter/2025-03-17_16-02-14/diff-details.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Diff Details
|
||||||
|
|
||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 2 files, -14 codes, -4 comments, -3 blanks, all -21 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||||
|
|
||||||
|
## Files
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx) | TypeScript JSX | -130 | -40 | -35 | -205 |
|
||||||
|
| [inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx](/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx) | TypeScript JSX | 116 | 36 | 32 | 184 |
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||||
23
.VSCodeCounter/2025-03-17_16-02-14/diff.md
Normal file
23
.VSCodeCounter/2025-03-17_16-02-14/diff.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Diff Summary
|
||||||
|
|
||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 2 files, -14 codes, -4 comments, -3 blanks, all -21 lines
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Languages
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| TypeScript JSX | 2 | -14 | -4 | -3 | -21 |
|
||||||
|
|
||||||
|
## Directories
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| . | 2 | -14 | -4 | -3 | -21 |
|
||||||
|
| components | 1 | -130 | -40 | -35 | -205 |
|
||||||
|
| hooks | 1 | 116 | 36 | 32 | 184 |
|
||||||
|
|
||||||
|
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||||
28
.VSCodeCounter/2025-03-17_16-02-14/diff.txt
Normal file
28
.VSCodeCounter/2025-03-17_16-02-14/diff.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
Directory : /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
Total : 2 files, -14 codes, -4 comments, -3 blanks, all -21 lines
|
||||||
|
|
||||||
|
Languages
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| TypeScript JSX | 2 | -14 | -4 | -3 | -21 |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Directories
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| . | 2 | -14 | -4 | -3 | -21 |
|
||||||
|
| components | 1 | -130 | -40 | -35 | -205 |
|
||||||
|
| hooks | 1 | 116 | 36 | 32 | 184 |
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Files
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx | TypeScript JSX | -130 | -40 | -35 | -205 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx | TypeScript JSX | 116 | 36 | 32 | 184 |
|
||||||
|
| Total | | -14 | -4 | -3 | -21 |
|
||||||
|
+-------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
1
.VSCodeCounter/2025-03-17_16-02-14/results.json
Normal file
1
.VSCodeCounter/2025-03-17_16-02-14/results.json
Normal file
File diff suppressed because one or more lines are too long
31
.VSCodeCounter/2025-03-17_16-02-14/results.md
Normal file
31
.VSCodeCounter/2025-03-17_16-02-14/results.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
|
||||||
|
Directory /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
|
||||||
|
Total : 28 files, 6551 codes, 1023 comments, 1050 blanks, all 8624 lines
|
||||||
|
|
||||||
|
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
|
|
||||||
|
## Languages
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| TypeScript JSX | 20 | 6,175 | 910 | 967 | 8,052 |
|
||||||
|
| TypeScript | 6 | 309 | 106 | 55 | 470 |
|
||||||
|
| Markdown | 1 | 39 | 0 | 19 | 58 |
|
||||||
|
| JavaScript | 1 | 28 | 7 | 9 | 44 |
|
||||||
|
|
||||||
|
## Directories
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||||
|
| . | 28 | 6,551 | 1,023 | 1,050 | 8,624 |
|
||||||
|
| . (Files) | 3 | 63 | 6 | 22 | 91 |
|
||||||
|
| components | 13 | 3,874 | 475 | 501 | 4,850 |
|
||||||
|
| components (Files) | 8 | 2,641 | 317 | 343 | 3,301 |
|
||||||
|
| components/cells | 5 | 1,233 | 158 | 158 | 1,549 |
|
||||||
|
| hooks | 6 | 2,281 | 429 | 464 | 3,174 |
|
||||||
|
| types | 1 | 16 | 4 | 4 | 24 |
|
||||||
|
| utils | 5 | 317 | 109 | 59 | 485 |
|
||||||
|
|
||||||
|
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||||
62
.VSCodeCounter/2025-03-17_16-02-14/results.txt
Normal file
62
.VSCodeCounter/2025-03-17_16-02-14/results.txt
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
Date : 2025-03-17 16:02:14
|
||||||
|
Directory : /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew
|
||||||
|
Total : 28 files, 6551 codes, 1023 comments, 1050 blanks, all 8624 lines
|
||||||
|
|
||||||
|
Languages
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| language | files | code | comment | blank | total |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
| TypeScript JSX | 20 | 6,175 | 910 | 967 | 8,052 |
|
||||||
|
| TypeScript | 6 | 309 | 106 | 55 | 470 |
|
||||||
|
| Markdown | 1 | 39 | 0 | 19 | 58 |
|
||||||
|
| JavaScript | 1 | 28 | 7 | 9 | 44 |
|
||||||
|
+----------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Directories
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| path | files | code | comment | blank | total |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
| . | 28 | 6,551 | 1,023 | 1,050 | 8,624 |
|
||||||
|
| . (Files) | 3 | 63 | 6 | 22 | 91 |
|
||||||
|
| components | 13 | 3,874 | 475 | 501 | 4,850 |
|
||||||
|
| components (Files) | 8 | 2,641 | 317 | 343 | 3,301 |
|
||||||
|
| components/cells | 5 | 1,233 | 158 | 158 | 1,549 |
|
||||||
|
| hooks | 6 | 2,281 | 429 | 464 | 3,174 |
|
||||||
|
| types | 1 | 16 | 4 | 4 | 24 |
|
||||||
|
| utils | 5 | 317 | 109 | 59 | 485 |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||||
|
|
||||||
|
Files
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| filename | language | code | comment | blank | total |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/README.md | Markdown | 39 | 0 | 19 | 58 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/AiValidationDialogs.tsx | TypeScript JSX | 230 | 10 | 8 | 248 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/BaseCellContent.tsx | TypeScript JSX | 18 | 0 | 3 | 21 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SaveTemplateDialog.tsx | TypeScript JSX | 83 | 0 | 4 | 87 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/SearchableTemplateSelect.tsx | TypeScript JSX | 273 | 19 | 37 | 329 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/TemplateManager.tsx | TypeScript JSX | 193 | 4 | 15 | 212 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx | TypeScript JSX | 374 | 42 | 44 | 460 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationContainer.tsx | TypeScript JSX | 971 | 194 | 178 | 1,343 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationTable.tsx | TypeScript JSX | 499 | 48 | 54 | 601 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/CheckboxCell.tsx | TypeScript JSX | 112 | 12 | 21 | 145 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/InputCell.tsx | TypeScript JSX | 232 | 31 | 32 | 295 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultiSelectCell.tsx | TypeScript JSX | 407 | 56 | 52 | 515 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/MultilineInput.tsx | TypeScript JSX | 193 | 23 | 22 | 238 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/cells/SelectCell.tsx | TypeScript JSX | 289 | 36 | 31 | 356 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useAiValidation.tsx | TypeScript JSX | 500 | 75 | 89 | 664 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useFilters.tsx | TypeScript JSX | 89 | 12 | 16 | 117 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useTemplates.tsx | TypeScript JSX | 204 | 26 | 33 | 263 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useUpcValidation.tsx | TypeScript JSX | 209 | 49 | 50 | 308 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidation.tsx | TypeScript JSX | 219 | 39 | 47 | 305 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx | TypeScript JSX | 1,060 | 228 | 229 | 1,517 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/index.tsx | TypeScript JSX | 20 | 6 | 2 | 28 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types.ts | TypeScript | 4 | 0 | 1 | 5 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/types/index.ts | TypeScript | 16 | 4 | 4 | 24 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/dataMutations.ts | TypeScript | 124 | 4 | 14 | 142 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/errorUtils.ts | TypeScript | 21 | 15 | 5 | 41 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/upcValidation.ts | TypeScript | 43 | 24 | 7 | 74 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validation-helper.js | JavaScript | 28 | 7 | 9 | 44 |
|
||||||
|
| /Users/matt/Dev/inventory/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/utils/validationUtils.ts | TypeScript | 101 | 59 | 24 | 184 |
|
||||||
|
| Total | | 6,551 | 1,023 | 1,050 | 8,624 |
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+----------------+------------+------------+------------+------------+
|
||||||
@@ -15,6 +15,7 @@ import { SearchProductTemplateDialog } from '@/components/templates/SearchProduc
|
|||||||
import { TemplateForm } from '@/components/templates/TemplateForm'
|
import { TemplateForm } from '@/components/templates/TemplateForm'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { RowSelectionState } from '@tanstack/react-table'
|
import { RowSelectionState } from '@tanstack/react-table'
|
||||||
|
import { useUpcValidation } from '../hooks/useUpcValidation'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ValidationContainer component - the main wrapper for the validation step
|
* ValidationContainer component - the main wrapper for the validation step
|
||||||
@@ -72,50 +73,17 @@ const ValidationContainer = <T extends string>({
|
|||||||
const [companyLinesCache, setCompanyLinesCache] = useState<Record<string, any[]>>({});
|
const [companyLinesCache, setCompanyLinesCache] = useState<Record<string, any[]>>({});
|
||||||
const [lineSublineCache, setLineSublineCache] = useState<Record<string, any[]>>({});
|
const [lineSublineCache, setLineSublineCache] = useState<Record<string, any[]>>({});
|
||||||
|
|
||||||
// Add UPC validation state
|
|
||||||
const [, setIsValidatingUpc] = useState(false);
|
|
||||||
const [validatingUpcRows, setValidatingUpcRows] = useState<Set<number>>(new Set());
|
|
||||||
|
|
||||||
// Add state for tracking cells in loading state
|
// Add state for tracking cells in loading state
|
||||||
const [validatingCells, setValidatingCells] = useState<Set<string>>(new Set());
|
const [validatingCells, setValidatingCells] = useState<Set<string>>(new Set());
|
||||||
|
|
||||||
// Store item numbers in a separate state to avoid updating the main data
|
// Use UPC validation hook
|
||||||
const [itemNumbers, setItemNumbers] = useState<Record<number, string>>({});
|
const upcValidation = useUpcValidation<T>(data, setData);
|
||||||
|
|
||||||
// Cache for UPC validation results
|
|
||||||
const processedUpcMapRef = useRef(new Map<string, string>());
|
|
||||||
const initialUpcValidationDoneRef = useRef(false);
|
|
||||||
|
|
||||||
// Function to check if a specific row is being validated - memoized
|
// Function to check if a specific row is being validated - memoized
|
||||||
const isRowValidatingUpc = useCallback((rowIndex: number): boolean => {
|
const isRowValidatingUpc = upcValidation.isRowValidatingUpc;
|
||||||
return validatingUpcRows.has(rowIndex);
|
|
||||||
}, [validatingUpcRows]);
|
|
||||||
|
|
||||||
// Apply all pending updates to the data state
|
// Apply all pending updates to the data state
|
||||||
const applyItemNumbersToData = useCallback(() => {
|
const applyItemNumbersToData = upcValidation.applyItemNumbersToData;
|
||||||
if (Object.keys(itemNumbers).length === 0) return;
|
|
||||||
|
|
||||||
setData(prevData => {
|
|
||||||
const newData = [...prevData];
|
|
||||||
|
|
||||||
// Apply all item numbers without changing other data
|
|
||||||
Object.entries(itemNumbers).forEach(([indexStr, itemNumber]) => {
|
|
||||||
const index = parseInt(indexStr);
|
|
||||||
if (index >= 0 && index < newData.length) {
|
|
||||||
// Only update the item_number field and leave everything else unchanged
|
|
||||||
newData[index] = {
|
|
||||||
...newData[index],
|
|
||||||
item_number: itemNumber
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return newData;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Clear the item numbers state after applying
|
|
||||||
setItemNumbers({});
|
|
||||||
}, [setData, itemNumbers]);
|
|
||||||
|
|
||||||
// Function to fetch product lines for a specific company - memoized
|
// Function to fetch product lines for a specific company - memoized
|
||||||
const fetchProductLines = useCallback(async (rowIndex: string | number, companyId: string) => {
|
const fetchProductLines = useCallback(async (rowIndex: string | number, companyId: string) => {
|
||||||
@@ -223,170 +191,6 @@ const ValidationContainer = <T extends string>({
|
|||||||
}
|
}
|
||||||
}, [lineSublineCache]);
|
}, [lineSublineCache]);
|
||||||
|
|
||||||
// Function to validate UPC with the API - memoized
|
|
||||||
const validateUpc = useCallback(async (rowIndex: number, supplierId: string, upcValue: string): Promise<{ success: boolean, itemNumber?: string }> => {
|
|
||||||
try {
|
|
||||||
// Skip if either value is missing
|
|
||||||
if (!supplierId || !upcValue) {
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add logging to help debug
|
|
||||||
console.log(`Validating UPC for row ${rowIndex}. Supplier ID: ${supplierId}, UPC: ${upcValue}`);
|
|
||||||
|
|
||||||
// Check if we've already validated this UPC/supplier combination
|
|
||||||
const cacheKey = `${supplierId}-${upcValue}`;
|
|
||||||
if (processedUpcMapRef.current.has(cacheKey)) {
|
|
||||||
const cachedItemNumber = processedUpcMapRef.current.get(cacheKey);
|
|
||||||
|
|
||||||
if (cachedItemNumber) {
|
|
||||||
// Just update the item numbers state, not the main data
|
|
||||||
setItemNumbers(prev => ({
|
|
||||||
...prev,
|
|
||||||
[rowIndex]: cachedItemNumber
|
|
||||||
}));
|
|
||||||
|
|
||||||
return { success: true, itemNumber: cachedItemNumber };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make API call to validate UPC - ensure we're using supplierId (not company)
|
|
||||||
const response = await fetch(`${config.apiUrl}/import/check-upc-and-generate-sku?upc=${encodeURIComponent(upcValue)}&supplierId=${encodeURIComponent(supplierId)}`);
|
|
||||||
|
|
||||||
// Process the response
|
|
||||||
if (response.status === 409) {
|
|
||||||
// UPC already exists - show validation error
|
|
||||||
|
|
||||||
// We need to trigger validation for this row to update the validation errors
|
|
||||||
// This will update the validationErrors Map in useValidationState
|
|
||||||
const row = data[rowIndex];
|
|
||||||
if (row) {
|
|
||||||
// Update the UPC field to trigger validation
|
|
||||||
updateRow(rowIndex, 'upc' as T, row.upc);
|
|
||||||
|
|
||||||
// We also need to manually add the error to the validation errors
|
|
||||||
// But we don't have direct access to setValidationErrors
|
|
||||||
// So we'll use a workaround by updating the row data
|
|
||||||
setData(prevData => {
|
|
||||||
const newData = [...prevData];
|
|
||||||
// We're only updating the row to trigger validation
|
|
||||||
// The actual error will be handled by the validation system
|
|
||||||
return newData;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return { success: false };
|
|
||||||
} else if (response.ok) {
|
|
||||||
// Successful validation - update item number
|
|
||||||
const responseData = await response.json();
|
|
||||||
|
|
||||||
if (responseData.success && responseData.itemNumber) {
|
|
||||||
// Store in cache
|
|
||||||
processedUpcMapRef.current.set(cacheKey, responseData.itemNumber);
|
|
||||||
|
|
||||||
// Update the item numbers state, not the main data
|
|
||||||
setItemNumbers(prev => ({
|
|
||||||
...prev,
|
|
||||||
[rowIndex]: responseData.itemNumber
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Clear any UPC errors by triggering validation
|
|
||||||
const row = data[rowIndex];
|
|
||||||
if (row) {
|
|
||||||
// Update the UPC field to trigger validation
|
|
||||||
updateRow(rowIndex, 'upc' as T, row.upc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { success: true, itemNumber: responseData.itemNumber };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return { success: false };
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error validating UPC for row ${rowIndex}:`, error);
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
}, [data, updateRow, setData]);
|
|
||||||
|
|
||||||
// Apply item numbers when they're available
|
|
||||||
useEffect(() => {
|
|
||||||
// Apply item numbers immediately if there are any
|
|
||||||
if (Object.keys(itemNumbers).length > 0) {
|
|
||||||
applyItemNumbersToData();
|
|
||||||
}
|
|
||||||
}, [itemNumbers, applyItemNumbersToData]);
|
|
||||||
|
|
||||||
// Optimized batch validation function - memoized
|
|
||||||
const validateAllUPCs = useCallback(async () => {
|
|
||||||
// Skip if we've already done the initial validation
|
|
||||||
if (initialUpcValidationDoneRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark that we've done the initial validation
|
|
||||||
initialUpcValidationDoneRef.current = true;
|
|
||||||
|
|
||||||
console.log('Starting UPC validation...');
|
|
||||||
|
|
||||||
// Set validation state
|
|
||||||
setIsValidatingUpc(true);
|
|
||||||
|
|
||||||
// Find all rows that have both supplier and UPC/barcode
|
|
||||||
const rowsToValidate = data
|
|
||||||
.map((row, index) => ({ row, index }))
|
|
||||||
.filter(({ row }) => {
|
|
||||||
const rowAny = row as Record<string, any>;
|
|
||||||
const hasSupplier = rowAny.supplier;
|
|
||||||
const hasUpc = rowAny.upc || rowAny.barcode;
|
|
||||||
return hasSupplier && hasUpc;
|
|
||||||
});
|
|
||||||
|
|
||||||
const totalRows = rowsToValidate.length;
|
|
||||||
console.log(`Found ${totalRows} rows with both supplier and UPC`);
|
|
||||||
|
|
||||||
if (totalRows === 0) {
|
|
||||||
setIsValidatingUpc(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark all rows as being validated
|
|
||||||
setValidatingUpcRows(new Set(rowsToValidate.map(({ index }) => index)));
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Process all rows in parallel without batching
|
|
||||||
await Promise.all(
|
|
||||||
rowsToValidate.map(async ({ row, index }) => {
|
|
||||||
try {
|
|
||||||
const rowAny = row as Record<string, any>;
|
|
||||||
const supplierId = rowAny.supplier.toString();
|
|
||||||
const upcValue = (rowAny.upc || rowAny.barcode).toString();
|
|
||||||
|
|
||||||
// Validate the UPC
|
|
||||||
await validateUpc(index, supplierId, upcValue);
|
|
||||||
|
|
||||||
// Remove this row from the validating set
|
|
||||||
setValidatingUpcRows(prev => {
|
|
||||||
const newSet = new Set(prev);
|
|
||||||
newSet.delete(index);
|
|
||||||
return newSet;
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error processing row ${index}:`, error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error in validation:', error);
|
|
||||||
} finally {
|
|
||||||
// Reset validation state
|
|
||||||
setIsValidatingUpc(false);
|
|
||||||
setValidatingUpcRows(new Set());
|
|
||||||
console.log('Completed UPC validation');
|
|
||||||
}
|
|
||||||
}, [data, validateUpc]);
|
|
||||||
|
|
||||||
// Enhanced updateRow function - memoized
|
// Enhanced updateRow function - memoized
|
||||||
const enhancedUpdateRow = useCallback(async (rowIndex: number, fieldKey: T, value: any) => {
|
const enhancedUpdateRow = useCallback(async (rowIndex: number, fieldKey: T, value: any) => {
|
||||||
// Process value before updating data
|
// Process value before updating data
|
||||||
@@ -478,30 +282,23 @@ const ValidationContainer = <T extends string>({
|
|||||||
if (rowDataAny.upc || rowDataAny.barcode) {
|
if (rowDataAny.upc || rowDataAny.barcode) {
|
||||||
const upcValue = rowDataAny.upc || rowDataAny.barcode;
|
const upcValue = rowDataAny.upc || rowDataAny.barcode;
|
||||||
|
|
||||||
// Run UPC validation immediately without timeout
|
|
||||||
try {
|
try {
|
||||||
// Mark this row as being validated
|
// Mark the item_number cell as being validated
|
||||||
setValidatingUpcRows(prev => {
|
setValidatingCells(prev => {
|
||||||
const newSet = new Set(prev);
|
const newSet = new Set(prev);
|
||||||
newSet.add(rowIndex);
|
newSet.add(`${rowIndex}-item_number`);
|
||||||
return newSet;
|
return newSet;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set global validation state
|
|
||||||
setIsValidatingUpc(true);
|
|
||||||
|
|
||||||
// Use supplier ID (the value being set) to validate UPC
|
// Use supplier ID (the value being set) to validate UPC
|
||||||
await validateUpc(rowIndex, value.toString(), upcValue.toString());
|
await upcValidation.validateUpc(rowIndex, value.toString(), upcValue.toString());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error validating UPC:', error);
|
console.error('Error validating UPC:', error);
|
||||||
} finally {
|
} finally {
|
||||||
// Always clean up validation state, even if there was an error
|
// Clear validation state for the item_number cell
|
||||||
setValidatingUpcRows(prev => {
|
setValidatingCells(prev => {
|
||||||
const newSet = new Set(prev);
|
const newSet = new Set(prev);
|
||||||
newSet.delete(rowIndex);
|
newSet.delete(`${rowIndex}-item_number`);
|
||||||
if (newSet.size === 0) {
|
|
||||||
setIsValidatingUpc(false);
|
|
||||||
}
|
|
||||||
return newSet;
|
return newSet;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -547,36 +344,29 @@ const ValidationContainer = <T extends string>({
|
|||||||
if ((fieldKey === 'upc' || fieldKey === 'barcode') && value && rowData) {
|
if ((fieldKey === 'upc' || fieldKey === 'barcode') && value && rowData) {
|
||||||
const rowDataAny = rowData as Record<string, any>;
|
const rowDataAny = rowData as Record<string, any>;
|
||||||
if (rowDataAny.supplier) {
|
if (rowDataAny.supplier) {
|
||||||
// Run UPC validation immediately without timeout
|
|
||||||
try {
|
try {
|
||||||
// Mark this row as being validated
|
// Mark the item_number cell as being validated
|
||||||
setValidatingUpcRows(prev => {
|
setValidatingCells(prev => {
|
||||||
const newSet = new Set(prev);
|
const newSet = new Set(prev);
|
||||||
newSet.add(rowIndex);
|
newSet.add(`${rowIndex}-item_number`);
|
||||||
return newSet;
|
return newSet;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set global validation state
|
// Use supplier ID from the row data to validate UPC
|
||||||
setIsValidatingUpc(true);
|
await upcValidation.validateUpc(rowIndex, rowDataAny.supplier.toString(), value.toString());
|
||||||
|
|
||||||
// Use supplier ID from the row data (NOT company ID) to validate UPC
|
|
||||||
await validateUpc(rowIndex, rowDataAny.supplier.toString(), value.toString());
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error validating UPC:', error);
|
console.error('Error validating UPC:', error);
|
||||||
} finally {
|
} finally {
|
||||||
// Always clean up validation state, even if there was an error
|
// Clear validation state for the item_number cell
|
||||||
setValidatingUpcRows(prev => {
|
setValidatingCells(prev => {
|
||||||
const newSet = new Set(prev);
|
const newSet = new Set(prev);
|
||||||
newSet.delete(rowIndex);
|
newSet.delete(`${rowIndex}-item_number`);
|
||||||
if (newSet.size === 0) {
|
|
||||||
setIsValidatingUpc(false);
|
|
||||||
}
|
|
||||||
return newSet;
|
return newSet;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [data, filteredData, updateRow, fetchProductLines, fetchSublines, validateUpc, setData, companyLinesCache, lineSublineCache]);
|
}, [data, filteredData, updateRow, fetchProductLines, fetchSublines, setData, companyLinesCache, lineSublineCache, upcValidation]);
|
||||||
|
|
||||||
// When data changes, fetch product lines and sublines for rows that have company/line values
|
// When data changes, fetch product lines and sublines for rows that have company/line values
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -834,16 +624,16 @@ const ValidationContainer = <T extends string>({
|
|||||||
|
|
||||||
}, [data, rowProductLines, rowSublines, companyLinesCache, lineSublineCache]);
|
}, [data, rowProductLines, rowSublines, companyLinesCache, lineSublineCache]);
|
||||||
|
|
||||||
// Validate UPCs on initial data load
|
// Use UPC validation when data changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Skip if there's no data or we've already done the validation
|
// Skip if there's no data or already validated
|
||||||
if (data.length === 0 || initialUpcValidationDoneRef.current) return;
|
if (data.length === 0 || upcValidation.initialValidationDone) return;
|
||||||
|
|
||||||
// Run validation immediately without timeout
|
// Run validation immediately without timeout
|
||||||
validateAllUPCs();
|
upcValidation.validateAllUPCs();
|
||||||
|
|
||||||
// No cleanup needed since we're not using a timer
|
// No cleanup needed since we're not using a timer
|
||||||
}, [data, validateAllUPCs]);
|
}, [data, upcValidation]);
|
||||||
|
|
||||||
// Use AI validation hook
|
// Use AI validation hook
|
||||||
const aiValidation = useAiValidation<T>(
|
const aiValidation = useAiValidation<T>(
|
||||||
@@ -1013,11 +803,11 @@ const ValidationContainer = <T extends string>({
|
|||||||
// Handle next button click - memoized
|
// Handle next button click - memoized
|
||||||
const handleNext = useCallback(() => {
|
const handleNext = useCallback(() => {
|
||||||
// Make sure any pending item numbers are applied
|
// Make sure any pending item numbers are applied
|
||||||
applyItemNumbersToData();
|
upcValidation.applyItemNumbersToData();
|
||||||
|
|
||||||
// Call the onNext callback with the validated data
|
// Call the onNext callback with the validated data
|
||||||
onNext?.(data)
|
onNext?.(data)
|
||||||
}, [onNext, data, applyItemNumbersToData]);
|
}, [onNext, data, upcValidation.applyItemNumbersToData]);
|
||||||
|
|
||||||
const deleteSelectedRows = useCallback(() => {
|
const deleteSelectedRows = useCallback(() => {
|
||||||
// Get selected row keys (which may be UUIDs)
|
// Get selected row keys (which may be UUIDs)
|
||||||
@@ -1146,12 +936,12 @@ const ValidationContainer = <T extends string>({
|
|||||||
|
|
||||||
// Memoize the enhanced validation table component
|
// Memoize the enhanced validation table component
|
||||||
const EnhancedValidationTable = useMemo(() => React.memo((props: React.ComponentProps<typeof ValidationTable>) => {
|
const EnhancedValidationTable = useMemo(() => React.memo((props: React.ComponentProps<typeof ValidationTable>) => {
|
||||||
// Create validatingCells set from validatingUpcRows, but only for item_number fields
|
// Create validatingCells set from validating rows, but only for item_number fields
|
||||||
// This ensures only the item_number column shows loading state during UPC validation
|
// This ensures only the item_number column shows loading state during UPC validation
|
||||||
const combinedValidatingCells = new Set<string>();
|
const combinedValidatingCells = new Set<string>();
|
||||||
|
|
||||||
// Add UPC validation cells
|
// Add UPC validation cells
|
||||||
validatingUpcRows.forEach(rowIndex => {
|
upcValidation.validatingRows.forEach(rowIndex => {
|
||||||
// Only mark the item_number cells as validating, NOT the UPC or supplier
|
// Only mark the item_number cells as validating, NOT the UPC or supplier
|
||||||
combinedValidatingCells.add(`${rowIndex}-item_number`);
|
combinedValidatingCells.add(`${rowIndex}-item_number`);
|
||||||
});
|
});
|
||||||
@@ -1161,15 +951,20 @@ const ValidationContainer = <T extends string>({
|
|||||||
combinedValidatingCells.add(cellKey);
|
combinedValidatingCells.add(cellKey);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Convert itemNumbers to Map
|
// Convert the Map to the expected format for the ValidationTable
|
||||||
const itemNumbersMap = new Map(Object.entries(itemNumbers).map(([key, value]) => [parseInt(key), value]));
|
// Create a new Map from the item numbers to ensure proper typing
|
||||||
|
const itemNumbersMap = new Map<number, string>();
|
||||||
|
|
||||||
// Merge the item numbers with the data for display purposes only
|
// Merge the item numbers with the data for display purposes only
|
||||||
const enhancedData = props.data.map((row: any, index: number) => {
|
const enhancedData = props.data.map((row: any, index: number) => {
|
||||||
if (itemNumbers[index]) {
|
const itemNumber = upcValidation.getItemNumber(index);
|
||||||
|
if (itemNumber) {
|
||||||
|
// Add to our map for proper prop passing
|
||||||
|
itemNumbersMap.set(index, itemNumber);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
item_number: itemNumbers[index]
|
item_number: itemNumber
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
@@ -1189,7 +984,7 @@ const ValidationContainer = <T extends string>({
|
|||||||
isLoadingSublines={isLoadingSublines}
|
isLoadingSublines={isLoadingSublines}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}), [validatingUpcRows, itemNumbers, isLoadingTemplates, handleCopyDown, validatingCells, rowProductLines, rowSublines, isLoadingLines, isLoadingSublines]);
|
}), [upcValidation.validatingRows, upcValidation.getItemNumber, isLoadingTemplates, handleCopyDown, validatingCells, rowProductLines, rowSublines, isLoadingLines, isLoadingSublines]);
|
||||||
|
|
||||||
// Memoize the rendered validation table
|
// Memoize the rendered validation table
|
||||||
const renderValidationTable = useMemo(() => (
|
const renderValidationTable = useMemo(() => (
|
||||||
@@ -1201,7 +996,7 @@ const ValidationContainer = <T extends string>({
|
|||||||
updateRow={handleUpdateRow as (rowIndex: number, key: string, value: any) => void}
|
updateRow={handleUpdateRow as (rowIndex: number, key: string, value: any) => void}
|
||||||
validationErrors={validationErrors}
|
validationErrors={validationErrors}
|
||||||
isValidatingUpc={isRowValidatingUpc}
|
isValidatingUpc={isRowValidatingUpc}
|
||||||
validatingUpcRows={Array.from(validatingUpcRows)}
|
validatingUpcRows={Array.from(upcValidation.validatingRows)}
|
||||||
filters={filters}
|
filters={filters}
|
||||||
templates={templates}
|
templates={templates}
|
||||||
applyTemplate={applyTemplate}
|
applyTemplate={applyTemplate}
|
||||||
@@ -1225,7 +1020,7 @@ const ValidationContainer = <T extends string>({
|
|||||||
handleUpdateRow,
|
handleUpdateRow,
|
||||||
validationErrors,
|
validationErrors,
|
||||||
isRowValidatingUpc,
|
isRowValidatingUpc,
|
||||||
validatingUpcRows,
|
upcValidation.validatingRows,
|
||||||
filters,
|
filters,
|
||||||
templates,
|
templates,
|
||||||
applyTemplate,
|
applyTemplate,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState, useCallback, useRef } from 'react'
|
import { useState, useCallback, useRef, useEffect } from 'react'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
|
||||||
interface UpcValidationResult {
|
interface UpcValidationResult {
|
||||||
error?: boolean
|
error?: boolean
|
||||||
@@ -10,18 +11,29 @@ interface UpcValidationResult {
|
|||||||
interface ValidationState {
|
interface ValidationState {
|
||||||
validatingCells: Set<string>; // Using rowIndex-fieldKey as identifier
|
validatingCells: Set<string>; // Using rowIndex-fieldKey as identifier
|
||||||
itemNumbers: Map<number, string>; // Using rowIndex as key
|
itemNumbers: Map<number, string>; // Using rowIndex as key
|
||||||
|
validatingRows: Set<number>; // Rows currently being validated
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUpcValidation = () => {
|
export const useUpcValidation = <T extends string>(
|
||||||
|
data: any[],
|
||||||
|
setData: (updater: any[] | ((prevData: any[]) => any[])) => void
|
||||||
|
) => {
|
||||||
// Use a ref for validation state to avoid triggering re-renders
|
// Use a ref for validation state to avoid triggering re-renders
|
||||||
const validationStateRef = useRef<ValidationState>({
|
const validationStateRef = useRef<ValidationState>({
|
||||||
validatingCells: new Set(),
|
validatingCells: new Set(),
|
||||||
itemNumbers: new Map()
|
itemNumbers: new Map(),
|
||||||
|
validatingRows: new Set()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use state only for forcing re-renders of specific cells
|
// Use state only for forcing re-renders of specific cells
|
||||||
const [validatingCellKeys, setValidatingCellKeys] = useState<Set<string>>(new Set());
|
const [validatingCellKeys, setValidatingCellKeys] = useState<Set<string>>(new Set());
|
||||||
const [itemNumberUpdates, setItemNumberUpdates] = useState<Map<number, string>>(new Map());
|
const [itemNumberUpdates, setItemNumberUpdates] = useState<Map<number, string>>(new Map());
|
||||||
|
const [validatingRows, setValidatingRows] = useState<Set<number>>(new Set());
|
||||||
|
const [isValidatingUpc, setIsValidatingUpc] = useState(false);
|
||||||
|
|
||||||
|
// Cache for UPC validation results
|
||||||
|
const processedUpcMapRef = useRef(new Map<string, string>());
|
||||||
|
const initialUpcValidationDoneRef = useRef(false);
|
||||||
|
|
||||||
// Helper to create cell key
|
// Helper to create cell key
|
||||||
const getCellKey = (rowIndex: number, fieldKey: string) => `${rowIndex}-${fieldKey}`;
|
const getCellKey = (rowIndex: number, fieldKey: string) => `${rowIndex}-${fieldKey}`;
|
||||||
@@ -46,79 +58,251 @@ export const useUpcValidation = () => {
|
|||||||
setItemNumberUpdates(new Map(validationStateRef.current.itemNumbers));
|
setItemNumberUpdates(new Map(validationStateRef.current.itemNumbers));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Mark a row as being validated
|
||||||
|
const startValidatingRow = useCallback((rowIndex: number) => {
|
||||||
|
validationStateRef.current.validatingRows.add(rowIndex);
|
||||||
|
setValidatingRows(new Set(validationStateRef.current.validatingRows));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Mark a row as no longer being validated
|
||||||
|
const stopValidatingRow = useCallback((rowIndex: number) => {
|
||||||
|
validationStateRef.current.validatingRows.delete(rowIndex);
|
||||||
|
setValidatingRows(new Set(validationStateRef.current.validatingRows));
|
||||||
|
|
||||||
|
// If no more rows are being validated, set global validation state to false
|
||||||
|
if (validationStateRef.current.validatingRows.size === 0) {
|
||||||
|
setIsValidatingUpc(false);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Check if a specific cell is being validated
|
// Check if a specific cell is being validated
|
||||||
const isValidatingCell = useCallback((rowIndex: number, fieldKey: string): boolean => {
|
const isValidatingCell = useCallback((rowIndex: number, fieldKey: string): boolean => {
|
||||||
return validationStateRef.current.validatingCells.has(getCellKey(rowIndex, fieldKey));
|
return validationStateRef.current.validatingCells.has(getCellKey(rowIndex, fieldKey));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Check if a specific row is being validated
|
||||||
|
const isRowValidatingUpc = useCallback((rowIndex: number): boolean => {
|
||||||
|
return validationStateRef.current.validatingRows.has(rowIndex);
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Get item number for a row
|
// Get item number for a row
|
||||||
const getItemNumber = useCallback((rowIndex: number): string | undefined => {
|
const getItemNumber = useCallback((rowIndex: number): string | undefined => {
|
||||||
return validationStateRef.current.itemNumbers.get(rowIndex);
|
return validationStateRef.current.itemNumbers.get(rowIndex);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Apply all pending updates to the data state
|
||||||
|
const applyItemNumbersToData = useCallback(() => {
|
||||||
|
if (validationStateRef.current.itemNumbers.size === 0) return;
|
||||||
|
|
||||||
|
setData((prevData: any[]) => {
|
||||||
|
const newData = [...prevData];
|
||||||
|
|
||||||
|
// Apply all item numbers without changing other data
|
||||||
|
Array.from(validationStateRef.current.itemNumbers.entries()).forEach(([index, itemNumber]) => {
|
||||||
|
if (index >= 0 && index < newData.length) {
|
||||||
|
// Only update the item_number field and leave everything else unchanged
|
||||||
|
newData[index] = {
|
||||||
|
...newData[index],
|
||||||
|
item_number: itemNumber
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return newData;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear the item numbers state after applying
|
||||||
|
validationStateRef.current.itemNumbers.clear();
|
||||||
|
setItemNumberUpdates(new Map());
|
||||||
|
}, [setData]);
|
||||||
|
|
||||||
// Validate a UPC value
|
// Validate a UPC value
|
||||||
const validateUpc = useCallback(async (
|
const validateUpc = useCallback(async (
|
||||||
upcValue: string,
|
|
||||||
rowIndex: number,
|
rowIndex: number,
|
||||||
supplier: string
|
supplierId: string,
|
||||||
): Promise<UpcValidationResult> => {
|
upcValue: string
|
||||||
// Start validating UPC and item number cells
|
): Promise<{success: boolean, itemNumber?: string}> => {
|
||||||
startValidatingCell(rowIndex, 'upc');
|
|
||||||
startValidatingCell(rowIndex, 'item_number');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Call the UPC validation API
|
// Skip if either value is missing
|
||||||
const response = await fetch(`${config.apiUrl}/import/check-upc-and-generate-sku?upc=${encodeURIComponent(upcValue)}&supplierId=${encodeURIComponent(supplier)}`);
|
if (!supplierId || !upcValue) {
|
||||||
|
return { success: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add logging to help debug
|
||||||
|
console.log(`Validating UPC for row ${rowIndex}. Supplier ID: ${supplierId}, UPC: ${upcValue}`);
|
||||||
|
|
||||||
|
// Start validating both UPC and item_number cells
|
||||||
|
startValidatingCell(rowIndex, 'upc');
|
||||||
|
startValidatingCell(rowIndex, 'item_number');
|
||||||
|
|
||||||
|
// Also mark the row as being validated
|
||||||
|
startValidatingRow(rowIndex);
|
||||||
|
|
||||||
|
// Check if we've already validated this UPC/supplier combination
|
||||||
|
const cacheKey = `${supplierId}-${upcValue}`;
|
||||||
|
if (processedUpcMapRef.current.has(cacheKey)) {
|
||||||
|
const cachedItemNumber = processedUpcMapRef.current.get(cacheKey);
|
||||||
|
|
||||||
|
if (cachedItemNumber) {
|
||||||
|
// Use cached item number
|
||||||
|
updateItemNumber(rowIndex, cachedItemNumber);
|
||||||
|
return { success: true, itemNumber: cachedItemNumber };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make API call to validate UPC
|
||||||
|
const response = await fetch(`${config.apiUrl}/import/check-upc-and-generate-sku?upc=${encodeURIComponent(upcValue)}&supplierId=${encodeURIComponent(supplierId)}`);
|
||||||
|
|
||||||
|
// Process the response
|
||||||
if (response.status === 409) {
|
if (response.status === 409) {
|
||||||
|
// UPC already exists - show validation error
|
||||||
const errorData = await response.json();
|
const errorData = await response.json();
|
||||||
return {
|
return { success: false };
|
||||||
error: true,
|
} else if (response.ok) {
|
||||||
message: `UPC already exists (${errorData.existingItemNumber})`,
|
// Successful validation - update item number
|
||||||
data: errorData
|
const responseData = await response.json();
|
||||||
};
|
|
||||||
|
if (responseData.success && responseData.itemNumber) {
|
||||||
|
// Store in cache
|
||||||
|
processedUpcMapRef.current.set(cacheKey, responseData.itemNumber);
|
||||||
|
|
||||||
|
// Update the item numbers state
|
||||||
|
updateItemNumber(rowIndex, responseData.itemNumber);
|
||||||
|
|
||||||
|
return { success: true, itemNumber: responseData.itemNumber };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
return { success: false };
|
||||||
throw new Error(`API error (${response.status})`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await response.json();
|
|
||||||
|
|
||||||
if (result.success && result.itemNumber) {
|
|
||||||
// Update item number in our state
|
|
||||||
updateItemNumber(rowIndex, result.itemNumber);
|
|
||||||
return {
|
|
||||||
error: false,
|
|
||||||
data: {
|
|
||||||
itemNumber: result.itemNumber,
|
|
||||||
...result
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
error: true,
|
|
||||||
message: 'Invalid response from server'
|
|
||||||
};
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error validating UPC:', error);
|
console.error(`Error validating UPC for row ${rowIndex}:`, error);
|
||||||
return {
|
return { success: false };
|
||||||
error: true,
|
|
||||||
message: 'Failed to validate UPC'
|
|
||||||
};
|
|
||||||
} finally {
|
} finally {
|
||||||
// Stop validating both cells
|
// Clear validation state
|
||||||
stopValidatingCell(rowIndex, 'upc');
|
stopValidatingCell(rowIndex, 'upc');
|
||||||
stopValidatingCell(rowIndex, 'item_number');
|
stopValidatingCell(rowIndex, 'item_number');
|
||||||
|
stopValidatingRow(rowIndex);
|
||||||
}
|
}
|
||||||
}, [startValidatingCell, stopValidatingCell, updateItemNumber]);
|
}, [startValidatingCell, stopValidatingCell, updateItemNumber, startValidatingRow, stopValidatingRow]);
|
||||||
|
|
||||||
|
// Batch validate all UPCs in the data
|
||||||
|
const validateAllUPCs = useCallback(async () => {
|
||||||
|
// Skip if we've already done the initial validation
|
||||||
|
if (initialUpcValidationDoneRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark that we've done the initial validation
|
||||||
|
initialUpcValidationDoneRef.current = true;
|
||||||
|
|
||||||
|
console.log('Starting UPC validation...');
|
||||||
|
|
||||||
|
// Set validation state
|
||||||
|
setIsValidatingUpc(true);
|
||||||
|
|
||||||
|
// Find all rows that have both supplier and UPC/barcode
|
||||||
|
const rowsToValidate = data
|
||||||
|
.map((row, index) => ({ row, index }))
|
||||||
|
.filter(({ row }) => {
|
||||||
|
const rowAny = row as Record<string, any>;
|
||||||
|
const hasSupplier = rowAny.supplier;
|
||||||
|
const hasUpc = rowAny.upc || rowAny.barcode;
|
||||||
|
return hasSupplier && hasUpc;
|
||||||
|
});
|
||||||
|
|
||||||
|
const totalRows = rowsToValidate.length;
|
||||||
|
console.log(`Found ${totalRows} rows with both supplier and UPC`);
|
||||||
|
|
||||||
|
if (totalRows === 0) {
|
||||||
|
setIsValidatingUpc(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark all rows as being validated
|
||||||
|
const newValidatingRows = new Set(rowsToValidate.map(({ index }) => index));
|
||||||
|
validationStateRef.current.validatingRows = newValidatingRows;
|
||||||
|
setValidatingRows(newValidatingRows);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Process all rows in parallel
|
||||||
|
await Promise.all(
|
||||||
|
rowsToValidate.map(async ({ row, index }) => {
|
||||||
|
try {
|
||||||
|
const rowAny = row as Record<string, any>;
|
||||||
|
const supplierId = rowAny.supplier.toString();
|
||||||
|
const upcValue = (rowAny.upc || rowAny.barcode).toString();
|
||||||
|
|
||||||
|
// Validate the UPC
|
||||||
|
await validateUpc(index, supplierId, upcValue);
|
||||||
|
|
||||||
|
// Remove this row from the validating set (handled in validateUpc)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error processing row ${index}:`, error);
|
||||||
|
stopValidatingRow(index);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error in batch validation:', error);
|
||||||
|
} finally {
|
||||||
|
// Reset validation state
|
||||||
|
setIsValidatingUpc(false);
|
||||||
|
validationStateRef.current.validatingRows.clear();
|
||||||
|
setValidatingRows(new Set());
|
||||||
|
console.log('Completed UPC validation');
|
||||||
|
|
||||||
|
// Apply item numbers to data
|
||||||
|
applyItemNumbersToData();
|
||||||
|
}
|
||||||
|
}, [data, validateUpc, stopValidatingRow, applyItemNumbersToData]);
|
||||||
|
|
||||||
|
// Run initial UPC validation when data changes
|
||||||
|
useEffect(() => {
|
||||||
|
// Skip if there's no data or we've already done the validation
|
||||||
|
if (data.length === 0 || initialUpcValidationDoneRef.current) return;
|
||||||
|
|
||||||
|
// Run validation
|
||||||
|
validateAllUPCs();
|
||||||
|
}, [data, validateAllUPCs]);
|
||||||
|
|
||||||
|
// Apply item numbers when they change
|
||||||
|
useEffect(() => {
|
||||||
|
// Apply item numbers if there are any
|
||||||
|
if (validationStateRef.current.itemNumbers.size > 0) {
|
||||||
|
applyItemNumbersToData();
|
||||||
|
}
|
||||||
|
}, [itemNumberUpdates, applyItemNumbersToData]);
|
||||||
|
|
||||||
|
// Reset validation state when hook is unmounted
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
initialUpcValidationDoneRef.current = false;
|
||||||
|
processedUpcMapRef.current.clear();
|
||||||
|
validationStateRef.current.validatingCells.clear();
|
||||||
|
validationStateRef.current.itemNumbers.clear();
|
||||||
|
validationStateRef.current.validatingRows.clear();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
validateUpc,
|
validateUpc,
|
||||||
|
validateAllUPCs,
|
||||||
isValidatingCell,
|
isValidatingCell,
|
||||||
|
isRowValidatingUpc,
|
||||||
|
isValidatingUpc,
|
||||||
getItemNumber,
|
getItemNumber,
|
||||||
|
applyItemNumbersToData,
|
||||||
itemNumbers: itemNumberUpdates,
|
itemNumbers: itemNumberUpdates,
|
||||||
validatingCells: validatingCellKeys
|
validatingCells: validatingCellKeys,
|
||||||
|
validatingRows,
|
||||||
|
resetInitialValidation: () => {
|
||||||
|
initialUpcValidationDoneRef.current = false;
|
||||||
|
},
|
||||||
|
// Export the ref for direct access
|
||||||
|
get initialValidationDone() {
|
||||||
|
return initialUpcValidationDoneRef.current;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user