cat-documents-ng 0.2.58 → 0.2.60

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.
@@ -338,6 +338,25 @@ export declare class SHARED {
338
338
  static BUTTON_LABEL_REJECTED: string;
339
339
  static BUTTON_LABEL_ACCEPT: string;
340
340
  static BUTTON_LABEL_ACCEPTED: string;
341
+ static VALIDATION_NO_APPLICANT_SELECTED: string;
342
+ static VALIDATION_NO_APPLICANT_DETAIL: string;
343
+ static VALIDATION_NO_CATEGORY_SELECTED: string;
344
+ static VALIDATION_NO_CATEGORY_DETAIL: string;
345
+ static VALIDATION_NO_DOCUMENT_TYPE_SELECTED: string;
346
+ static VALIDATION_NO_DOCUMENT_TYPE_DETAIL: string;
347
+ static VALIDATION_NO_DOCUMENTS_UPLOADED: string;
348
+ static VALIDATION_NO_DOCUMENTS_DETAIL: string;
349
+ static VALIDATION_FORM_INCOMPLETE: string;
350
+ static VALIDATION_FORM_INCOMPLETE_DETAIL: string;
351
+ static VALIDATION_MISSING_REQUIRED_DATA: string;
352
+ static VALIDATION_SELECT_ASSIGNMENT_TYPE: string;
353
+ static VALIDATION_SELECT_CATEGORY: string;
354
+ static VALIDATION_SELECT_DOCUMENT_TYPE: string;
355
+ static VALIDATION_UPLOAD_AT_LEAST_ONE: string;
356
+ static VALIDATION_WAIT_FOR_UPLOAD: string;
357
+ static VALIDATION_SELECT_APPLICANT: string;
358
+ static VALIDATION_ALL_FIELDS_COMPLETED: string;
359
+ static VALIDATION_OPTIONS_NOT_LOADED: string;
341
360
  }
342
361
  /**
343
362
  * `DUMMYDOCUMENTLIST` is a mock list of document objects used for testing and development purposes.
@@ -510,6 +510,27 @@ class SHARED {
510
510
  static BUTTON_LABEL_REJECTED = 'Rejected';
511
511
  static BUTTON_LABEL_ACCEPT = 'Accept';
512
512
  static BUTTON_LABEL_ACCEPTED = 'Accepted';
513
+ // Document Upload Validation Messages
514
+ static VALIDATION_NO_APPLICANT_SELECTED = 'No Applicant Selected';
515
+ static VALIDATION_NO_APPLICANT_DETAIL = 'Please select an applicant.';
516
+ static VALIDATION_NO_CATEGORY_SELECTED = 'No Category Selected';
517
+ static VALIDATION_NO_CATEGORY_DETAIL = 'Please select a category.';
518
+ static VALIDATION_NO_DOCUMENT_TYPE_SELECTED = 'No Document Type Selected';
519
+ static VALIDATION_NO_DOCUMENT_TYPE_DETAIL = 'Please select a document type.';
520
+ static VALIDATION_NO_DOCUMENTS_UPLOADED = 'No Documents Uploaded';
521
+ static VALIDATION_NO_DOCUMENTS_DETAIL = 'Please upload at least one document.';
522
+ static VALIDATION_FORM_INCOMPLETE = 'Form Incomplete';
523
+ static VALIDATION_FORM_INCOMPLETE_DETAIL = 'Please complete all required fields and upload at least one document.';
524
+ static VALIDATION_MISSING_REQUIRED_DATA = 'Missing Required Data';
525
+ // Document Upload Assignment Type Messages
526
+ static VALIDATION_SELECT_ASSIGNMENT_TYPE = 'Please select an assignment type (Applicant or Application)';
527
+ static VALIDATION_SELECT_CATEGORY = 'Please select a document category';
528
+ static VALIDATION_SELECT_DOCUMENT_TYPE = 'Please select a document type';
529
+ static VALIDATION_UPLOAD_AT_LEAST_ONE = 'Please upload at least one document';
530
+ static VALIDATION_WAIT_FOR_UPLOAD = 'Please wait for all files to finish uploading';
531
+ static VALIDATION_SELECT_APPLICANT = 'Please select an applicant';
532
+ static VALIDATION_ALL_FIELDS_COMPLETED = 'All required fields are completed';
533
+ static VALIDATION_OPTIONS_NOT_LOADED = 'Document options are not loaded yet';
513
534
  }
514
535
  /**
515
536
  * `DUMMYDOCUMENTLIST` is a mock list of document objects used for testing and development purposes.
@@ -1272,7 +1293,7 @@ class DocumentService {
1272
1293
  * @returns {Observable<any>} Observable that emits the newly created document.
1273
1294
  */
1274
1295
  create(entity) {
1275
- const headers = { 'Authorization': 'Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04' };
1296
+ const headers = { 'Authorization': 'Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d' };
1276
1297
  return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, entity, { headers }).pipe(tap((newEntity) => this.documentStore.add(newEntity)));
1277
1298
  }
1278
1299
  /**
@@ -1677,7 +1698,7 @@ class DocumentHttpService {
1677
1698
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
1678
1699
  */
1679
1700
  getDocumentCatagories(contextId) {
1680
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1701
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1681
1702
  return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`, { headers }).pipe(tap((response) => {
1682
1703
  // Store only the categories array, not the entire response
1683
1704
  if (response && response.categories) {
@@ -1736,7 +1757,7 @@ class DocumentHttpService {
1736
1757
  * @returns {Observable<DocumentModel>} An observable that emits the updated DocumentModel.
1737
1758
  */
1738
1759
  updateDocumentName(documentId, payload) {
1739
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1760
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1740
1761
  return this.http.put(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${documentId}`, payload, { headers }).pipe(catchError((error) => {
1741
1762
  return throwError(() => new Error(error));
1742
1763
  }));
@@ -1749,7 +1770,7 @@ class DocumentHttpService {
1749
1770
  getUserListByContextId(contextId) {
1750
1771
  if (!contextId)
1751
1772
  return EMPTY;
1752
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1773
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1753
1774
  return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`, { headers }).pipe(tap((userList) => {
1754
1775
  this.documentStore.setUserList(userList);
1755
1776
  }), catchError((error) => {
@@ -1775,7 +1796,7 @@ class DocumentHttpService {
1775
1796
  if (categoryId) {
1776
1797
  params = params.set(SHARED.CATEGORY, categoryId);
1777
1798
  }
1778
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1799
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1779
1800
  return this.http.get(url, { params, headers }).pipe(tap((statusData) => {
1780
1801
  this.documentStore.setStatusData(statusData);
1781
1802
  }), catchError((error) => {
@@ -1806,7 +1827,7 @@ class DocumentHttpService {
1806
1827
  if (searchKey) {
1807
1828
  params = params.set(SHARED.SEARCH_KEY, searchKey);
1808
1829
  }
1809
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1830
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1810
1831
  return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params, headers }).pipe(tap((response) => {
1811
1832
  if (response.documents) {
1812
1833
  this.documentStore.setDocumentList(response.documents);
@@ -1819,7 +1840,7 @@ class DocumentHttpService {
1819
1840
  if (!documentId) {
1820
1841
  return of([]);
1821
1842
  }
1822
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1843
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1823
1844
  return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`, { headers });
1824
1845
  }
1825
1846
  /**
@@ -1830,7 +1851,7 @@ class DocumentHttpService {
1830
1851
  getCategoriesBySource(source) {
1831
1852
  if (!source)
1832
1853
  return EMPTY;
1833
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1854
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1834
1855
  return this.http.get(`${this.apiUrl}${URLS.GET_CATEGORIES_BY_SOURCE}${source}`, { headers }).pipe(catchError((error) => {
1835
1856
  return throwError(() => new Error(error));
1836
1857
  }));
@@ -1843,7 +1864,7 @@ class DocumentHttpService {
1843
1864
  getDocumentTypesByCategory(categoryId) {
1844
1865
  if (!categoryId)
1845
1866
  return EMPTY;
1846
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1867
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1847
1868
  return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`, { headers }).pipe(catchError((error) => {
1848
1869
  return throwError(() => new Error(error));
1849
1870
  }));
@@ -1854,7 +1875,7 @@ class DocumentHttpService {
1854
1875
  * @returns {Observable<any>} Observable that emits the upload response.
1855
1876
  */
1856
1877
  uploadFile(formData) {
1857
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1878
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1858
1879
  return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData, { headers }).pipe(catchError((error) => {
1859
1880
  return throwError(() => new Error(error));
1860
1881
  }));
@@ -1865,7 +1886,7 @@ class DocumentHttpService {
1865
1886
  * @returns {Observable<any>} Observable that emits the save response.
1866
1887
  */
1867
1888
  saveDocumentUpload(payload) {
1868
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1889
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1869
1890
  return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload, { headers }).pipe(catchError((error) => {
1870
1891
  return throwError(() => new Error(error));
1871
1892
  }));
@@ -1881,7 +1902,7 @@ class DocumentHttpService {
1881
1902
  const payload = {
1882
1903
  statusUpdateDescription: statusUpdateDescription
1883
1904
  };
1884
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1905
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1885
1906
  return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload, { headers }).pipe(tap((response) => {
1886
1907
  if (response && response.status) {
1887
1908
  const normalizedStatus = this.normalizeStatus(response.status);
@@ -1915,7 +1936,7 @@ class DocumentHttpService {
1915
1936
  * @returns {Observable<any>} Observable that emits the delete response
1916
1937
  */
1917
1938
  deleteDocument(documentId, contextId) {
1918
- let headers = new HttpHeaders({ Authorization: `Bearer e9a9d462-da86-4d3a-9f4d-e2d48f480e04` });
1939
+ let headers = new HttpHeaders({ Authorization: `Bearer 514330f0-41d4-4c03-8d2e-f248a1340e8d` });
1919
1940
  return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`, { headers }).pipe(tap(() => {
1920
1941
  this.getDocumentCatagories(contextId).subscribe();
1921
1942
  this.getUserListByContextId(contextId).subscribe();
@@ -2436,68 +2457,77 @@ class DocumentUploadBusinessService {
2436
2457
  }
2437
2458
  }
2438
2459
  /**
2439
- * Validates form data
2460
+ * Helper method to validate form data and return validation result
2440
2461
  */
2441
- validateForm(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles, categoryOptions, documentTypeOptions) {
2442
- // If no assignment type is selected, form is invalid
2462
+ validateFormData(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles, categoryOptions, documentTypeOptions) {
2463
+ // Check assignment type
2443
2464
  if (!assignmentType) {
2444
- return false;
2465
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_ASSIGNMENT_TYPE };
2445
2466
  }
2446
- // Check if category and document type options are available
2467
+ // Check if options are loaded
2447
2468
  if (!categoryOptions.length || !documentTypeOptions.length) {
2448
- return false;
2469
+ return { isValid: false, message: SHARED.VALIDATION_OPTIONS_NOT_LOADED };
2449
2470
  }
2450
- // Check if required selections are made
2451
- if (!selectedCategory || !selectedDocumentType) {
2452
- return false;
2471
+ // Check category
2472
+ if (!selectedCategory) {
2473
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_CATEGORY };
2453
2474
  }
2454
- // Check if files are uploaded
2475
+ // Check document type
2476
+ if (!selectedDocumentType) {
2477
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_DOCUMENT_TYPE };
2478
+ }
2479
+ // Check files
2455
2480
  if (uploadedFiles.length === 0) {
2456
- return false;
2481
+ return { isValid: false, message: SHARED.VALIDATION_UPLOAD_AT_LEAST_ONE };
2457
2482
  }
2458
- // Check if all files are fully uploaded
2459
- const allFilesUploaded = uploadedFiles.every(file => file.progress === 100);
2460
- if (!allFilesUploaded) {
2461
- return false;
2483
+ // Check if all files are uploaded
2484
+ const incompleteFiles = uploadedFiles.filter(file => file.progress !== 100);
2485
+ if (incompleteFiles.length > 0) {
2486
+ return { isValid: false, message: SHARED.VALIDATION_WAIT_FOR_UPLOAD };
2462
2487
  }
2463
- // For Applicant type, require applicant selection
2464
- if (assignmentType === SHARED.APPLICANT) {
2465
- return Boolean(selectedApplicant);
2488
+ // For Applicant type, check applicant selection
2489
+ if (assignmentType === SHARED.APPLICANT && !selectedApplicant) {
2490
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_APPLICANT };
2466
2491
  }
2467
- // For Application type, no applicant required
2468
- return true;
2492
+ return { isValid: true, message: SHARED.VALIDATION_ALL_FIELDS_COMPLETED };
2493
+ }
2494
+ /**
2495
+ * Validates form data
2496
+ */
2497
+ validateForm(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles, categoryOptions, documentTypeOptions) {
2498
+ return this.validateFormData(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles, categoryOptions, documentTypeOptions).isValid;
2469
2499
  }
2470
2500
  /**
2471
2501
  * Checks if save button should be disabled
2472
2502
  */
2473
2503
  isSaveButtonDisabled(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles, isSaving) {
2474
- // If no assignment type is selected, disable save button
2504
+ if (isSaving) {
2505
+ return true;
2506
+ }
2507
+ // For button state, we only need to check if required fields are filled
2508
+ // We don't need to validate if options are loaded
2475
2509
  if (!assignmentType) {
2476
2510
  return true;
2477
2511
  }
2478
- // Check if files are uploaded
2479
- if (uploadedFiles.length === 0) {
2512
+ if (!selectedCategory) {
2480
2513
  return true;
2481
2514
  }
2482
- // Check if all files are fully uploaded (progress = 100)
2483
- const allFilesUploaded = uploadedFiles.every(file => file.progress === 100);
2484
- if (!allFilesUploaded) {
2515
+ if (!selectedDocumentType) {
2485
2516
  return true;
2486
2517
  }
2487
- // Check basic required fields
2488
- if (!selectedCategory || !selectedDocumentType) {
2518
+ if (uploadedFiles.length === 0) {
2489
2519
  return true;
2490
2520
  }
2491
- // For Applicant type, require applicant selection
2492
- if (assignmentType === SHARED.APPLICANT && !selectedApplicant) {
2521
+ // Check if all files are uploaded
2522
+ const incompleteFiles = uploadedFiles.filter(file => file.progress !== 100);
2523
+ if (incompleteFiles.length > 0) {
2493
2524
  return true;
2494
2525
  }
2495
- // If saving is in progress, disable save button
2496
- if (isSaving) {
2526
+ // For Applicant type, check applicant selection
2527
+ if (assignmentType === SHARED.APPLICANT && !selectedApplicant) {
2497
2528
  return true;
2498
2529
  }
2499
- // All validation passed, enable save button
2500
- return false;
2530
+ return false; // Button should be enabled
2501
2531
  }
2502
2532
  /**
2503
2533
  * Validates the complete payload before save
@@ -2505,30 +2535,30 @@ class DocumentUploadBusinessService {
2505
2535
  validatePayload(assignmentType, selectedCategory, selectedDocumentType, selectedApplicant, uploadedFiles) {
2506
2536
  // Check assignment type
2507
2537
  if (!assignmentType) {
2508
- return { isValid: false, message: 'Please select an assignment type (Applicant or Application)' };
2538
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_ASSIGNMENT_TYPE };
2509
2539
  }
2510
2540
  // Check category
2511
2541
  if (!selectedCategory) {
2512
- return { isValid: false, message: 'Please select a document category' };
2542
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_CATEGORY };
2513
2543
  }
2514
2544
  // Check document type
2515
2545
  if (!selectedDocumentType) {
2516
- return { isValid: false, message: 'Please select a document type' };
2546
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_DOCUMENT_TYPE };
2517
2547
  }
2518
2548
  // Check files
2519
2549
  if (uploadedFiles.length === 0) {
2520
- return { isValid: false, message: 'Please upload at least one document' };
2550
+ return { isValid: false, message: SHARED.VALIDATION_UPLOAD_AT_LEAST_ONE };
2521
2551
  }
2522
2552
  // Check if all files are uploaded
2523
2553
  const incompleteFiles = uploadedFiles.filter(file => file.progress !== 100);
2524
2554
  if (incompleteFiles.length > 0) {
2525
- return { isValid: false, message: 'Please wait for all files to finish uploading' };
2555
+ return { isValid: false, message: SHARED.VALIDATION_WAIT_FOR_UPLOAD };
2526
2556
  }
2527
2557
  // For Applicant type, check applicant selection
2528
2558
  if (assignmentType === SHARED.APPLICANT && !selectedApplicant) {
2529
- return { isValid: false, message: 'Please select an applicant' };
2559
+ return { isValid: false, message: SHARED.VALIDATION_SELECT_APPLICANT };
2530
2560
  }
2531
- return { isValid: true, message: 'All required fields are completed' };
2561
+ return { isValid: true, message: SHARED.VALIDATION_ALL_FIELDS_COMPLETED };
2532
2562
  }
2533
2563
  /**
2534
2564
  * Prepares upload payload
@@ -2542,8 +2572,8 @@ class DocumentUploadBusinessService {
2542
2572
  documents: uploadedFiles.map(file => ({
2543
2573
  fileName: file.file.name,
2544
2574
  fileSize: file.file.size,
2545
- fileType: file.file.type,
2546
- file: file.file,
2575
+ url: file.url,
2576
+ contentType: file.contentType,
2547
2577
  uploadedFileId: file.uploadResponse?.fileId || file.uploadResponse?.id || file.uploadResponse?.fileName
2548
2578
  }))
2549
2579
  };
@@ -2641,32 +2671,65 @@ class DocumentUploadFormService {
2641
2671
  });
2642
2672
  }
2643
2673
  /**
2644
- * Validates required fields for upload
2674
+ * Helper method to validate required fields and show appropriate messages
2645
2675
  */
2646
- validateRequiredFields(assignmentType, selectedApplicant, selectedCategory, selectedDocumentType, uploadedFiles) {
2676
+ validateRequiredFieldsWithMessages(assignmentType, selectedApplicant, selectedCategory, selectedDocumentType, uploadedFiles) {
2647
2677
  if (assignmentType === 'Applicant' && !selectedApplicant) {
2648
- this.showWarningMessage('No Applicant Selected', 'Please select an applicant.');
2649
- return false;
2678
+ return { isValid: false, field: 'applicant' };
2650
2679
  }
2651
2680
  if (!selectedCategory) {
2652
- this.showWarningMessage('No Category Selected', 'Please select a category.');
2653
- return false;
2681
+ return { isValid: false, field: 'category' };
2654
2682
  }
2655
2683
  if (!selectedDocumentType) {
2656
- this.showWarningMessage('No Document Type Selected', 'Please select a document type.');
2657
- return false;
2684
+ return { isValid: false, field: 'documentType' };
2658
2685
  }
2659
2686
  if (uploadedFiles.length === 0) {
2660
- this.showWarningMessage('No Documents Uploaded', 'Please upload at least one document.');
2661
- return false;
2687
+ return { isValid: false, field: 'documents' };
2688
+ }
2689
+ return { isValid: true, field: null };
2690
+ }
2691
+ /**
2692
+ * Validates required fields for upload
2693
+ */
2694
+ validateRequiredFields(assignmentType, selectedApplicant, selectedCategory, selectedDocumentType, uploadedFiles) {
2695
+ const validation = this.validateRequiredFieldsWithMessages(assignmentType, selectedApplicant, selectedCategory, selectedDocumentType, uploadedFiles);
2696
+ if (!validation.isValid) {
2697
+ this.showValidationMessage(validation.field);
2698
+ }
2699
+ return validation.isValid;
2700
+ }
2701
+ /**
2702
+ * Shows appropriate validation message based on the field that failed
2703
+ */
2704
+ showValidationMessage(field) {
2705
+ const messages = {
2706
+ applicant: {
2707
+ summary: SHARED.VALIDATION_NO_APPLICANT_SELECTED,
2708
+ detail: SHARED.VALIDATION_NO_APPLICANT_DETAIL
2709
+ },
2710
+ category: {
2711
+ summary: SHARED.VALIDATION_NO_CATEGORY_SELECTED,
2712
+ detail: SHARED.VALIDATION_NO_CATEGORY_DETAIL
2713
+ },
2714
+ documentType: {
2715
+ summary: SHARED.VALIDATION_NO_DOCUMENT_TYPE_SELECTED,
2716
+ detail: SHARED.VALIDATION_NO_DOCUMENT_TYPE_DETAIL
2717
+ },
2718
+ documents: {
2719
+ summary: SHARED.VALIDATION_NO_DOCUMENTS_UPLOADED,
2720
+ detail: SHARED.VALIDATION_NO_DOCUMENTS_DETAIL
2721
+ }
2722
+ };
2723
+ const message = messages[field];
2724
+ if (message) {
2725
+ this.showWarningMessage(message.summary, message.detail);
2662
2726
  }
2663
- return true;
2664
2727
  }
2665
2728
  /**
2666
2729
  * Validates form completeness
2667
2730
  */
2668
2731
  validateFormCompleteness() {
2669
- this.showWarningMessage('Form Incomplete', 'Please complete all required fields and upload at least one document.');
2732
+ this.showWarningMessage(SHARED.VALIDATION_FORM_INCOMPLETE, SHARED.VALIDATION_FORM_INCOMPLETE_DETAIL);
2670
2733
  return false;
2671
2734
  }
2672
2735
  /**
@@ -2674,7 +2737,7 @@ class DocumentUploadFormService {
2674
2737
  */
2675
2738
  validateContextId(contextId, message) {
2676
2739
  if (!contextId) {
2677
- this.showErrorMessage('Missing Required Data', message);
2740
+ this.showErrorMessage(SHARED.VALIDATION_MISSING_REQUIRED_DATA, message);
2678
2741
  return false;
2679
2742
  }
2680
2743
  return true;
@@ -2797,6 +2860,8 @@ class DocumentUploadComponent {
2797
2860
  isSaving = false;
2798
2861
  /** Current form validation state */
2799
2862
  isFormValid = false;
2863
+ /** File size property for testing */
2864
+ fileSize = '';
2800
2865
  /** Subject for managing component lifecycle and unsubscribing from observables */
2801
2866
  destroy$ = new Subject();
2802
2867
  /**
@@ -2830,6 +2895,7 @@ class DocumentUploadComponent {
2830
2895
  this.resetSelections();
2831
2896
  this.loadCategories();
2832
2897
  this.handleApplicantLoading();
2898
+ this.validateForm(); // Validate form after assignment type change
2833
2899
  this.emitFormValidationChange();
2834
2900
  }
2835
2901
  /**
@@ -2840,6 +2906,7 @@ class DocumentUploadComponent {
2840
2906
  this.resetDocumentType();
2841
2907
  if (this.selectedCategory)
2842
2908
  this.loadDocumentTypes();
2909
+ this.validateForm(); // Validate form after category change
2843
2910
  this.validateAndEmit();
2844
2911
  }
2845
2912
  /**
@@ -2953,7 +3020,8 @@ class DocumentUploadComponent {
2953
3020
  * @returns True if the save button should be disabled, false otherwise
2954
3021
  */
2955
3022
  getSaveButtonDisabled() {
2956
- return this.businessService.isSaveButtonDisabled(this.selectedAssignmentType, this.selectedCategory, this.selectedDocumentType, this.selectedApplicant, this.uploadedFiles, this.isSaving);
3023
+ const isDisabled = this.businessService.isSaveButtonDisabled(this.selectedAssignmentType, this.selectedCategory, this.selectedDocumentType, this.selectedApplicant, this.uploadedFiles, this.isSaving);
3024
+ return isDisabled;
2957
3025
  }
2958
3026
  /**
2959
3027
  * Gets the upload progress for a specific file.
@@ -3117,6 +3185,8 @@ class DocumentUploadComponent {
3117
3185
  if (uploadedFileObj) {
3118
3186
  uploadedFileObj.uploadResponse = response;
3119
3187
  uploadedFileObj.progress = SHARED.UPLOAD_PROGRESS_100;
3188
+ uploadedFileObj.url = response?.url;
3189
+ uploadedFileObj.contentType = response?.contentType;
3120
3190
  }
3121
3191
  this.cdr.detectChanges();
3122
3192
  this.onFormValidationChange.emit();
@@ -3146,6 +3216,13 @@ class DocumentUploadComponent {
3146
3216
  emitFormValidationChange() {
3147
3217
  this.onFormValidationChange.emit();
3148
3218
  }
3219
+ /**
3220
+ * Formats file size for testing purposes.
3221
+ * @param size - The file size in bytes
3222
+ */
3223
+ formatSize(size) {
3224
+ this.fileSize = this.businessService.formatFileSize(size, this.config);
3225
+ }
3149
3226
  /**
3150
3227
  * Lifecycle hook that is called when component is destroyed.
3151
3228
  * Cleans up subscriptions and destroys services.