Skip to content

Commit 2478f18

Browse files
authored
[MOSIP-44045] - Bulk Upload Error Message Fix (#833)
* [MOSIP-44045] - Bulk Upload Error Message Fix Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Added validation for Uploadfile Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Update create.component.css Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Added proper validation messages Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Corrected error message Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Corrected Upload File Label Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Resolved review comments Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --------- Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
1 parent 0faba15 commit 2478f18

10 files changed

Lines changed: 109 additions & 46 deletions

File tree

admin-ui/src/app/features/bulkupload/masterdataupload/create/create.component.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
.fileuploadcontainer label {
8383
color: #FF4081;
8484
width: 148px;
85-
height: 44px;
85+
height: 52px;
8686
border-radius: 5px;
8787
background: #FFFFFF;
8888
padding: 10px;

admin-ui/src/app/features/bulkupload/masterdataupload/create/create.component.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ <h3>{{labelanddatas.title |translate}}</h3>
2929
{{data.label | translate }}
3030
</mat-option>
3131
</mat-select>
32-
<mat-error *ngIf="uploadForm.controls.operation.touched">
33-
{{"genericerror.fieldValidation" | translate}}
32+
<mat-error *ngIf="uploadForm.controls.operation.touched && uploadForm.controls.operation.hasError('required')">
33+
{{'bulkUpload.validationMessages.operation.required' | translate}}
3434
</mat-error>
3535
</mat-form-field>
3636
<div style="width:100%;display:inline">
@@ -45,9 +45,9 @@ <h3>{{labelanddatas.title |translate}}</h3>
4545
{{data.value | translate }}
4646
</mat-option>
4747
</mat-select>
48-
<mat-error *ngIf="uploadForm.controls.tableName.touched && !showDownloadBtn">
49-
{{'genericerror.fieldValidation' | translate}}
50-
</mat-error>
48+
<mat-error *ngIf="uploadForm.controls.tableName.touched && uploadForm.controls.tableName.hasError('required') && !showDownloadBtn">
49+
{{'bulkUpload.validationMessages.tableName.required' | translate}}
50+
</mat-error>
5151
</mat-form-field>
5252
<mat-label style="width:2%" *ngIf="showDownloadBtn" (click)="downloadCSV()" (keypress)="downloadCSV()"><img src="assets/images/download-csv.png" alt="Download CSV" height="18px" width="18px" style="cursor:pointer;" /></mat-label>
5353
<mat-label style="width:2%" *ngIf="showDownloadBtn" (click)="downloadExcel()" (keypress)="downloadExcel()"><img src="assets/images/download-excel.png" alt="Download Excel" height="18px" width="18px" style="cursor:pointer;" /></mat-label>
@@ -62,8 +62,9 @@ <h3>{{labelanddatas.title |translate}}</h3>
6262
{{'genericerror.fieldValidation' | translate}}
6363
</mat-error>
6464
</div> -->
65-
<label class="labelfileupload" for="fileInput">{{'uploadcertificate.uploadYourFile' | translate}} <span style="color:red;">*</span></label>
66-
<div class="fileuploadcontainer" appDnd (fileDropped)="onFileDropped($event)" id="custom-file-input">
65+
<label class="labelfileupload" for="fileInput" [style.color]="uploadForm.controls.fileName.touched && uploadForm.controls.fileName.hasError('required') ? 'red' : 'rgba(0, 0, 0, 0.54)'">{{'uploadcertificate.uploadYourFile' | translate}} <span style="color:red;">*</span></label>
66+
<div class="fileuploadcontainer" appDnd (fileDropped)="onFileDropped($event)" id="fileName">
67+
<mat-error *ngIf="uploadForm.controls.fileName.touched && uploadForm.controls.fileName.hasError('required')">{{ 'bulkUpload.validationMessages.file.required' | translate }}</mat-error>
6768
<input (click)="$event.target.value=null" type="file" accept=".xlsx, .xls, .csv" #fileInput id="fileInput" (change)="onFileSelect($event)"/>
6869
<label style="margin-right: 1rem;display: flex;" for="fileInput">
6970
<svg id="upload_icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24.042"

admin-ui/src/app/features/bulkupload/masterdataupload/create/create.component.ts

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export class CreateComponent {
2424
labelanddatas:any;
2525
subscribed: any;
2626
popupMessages:any;
27-
fileNameError:boolean = false;
2827
buttonalignment = 'ltr';
2928
serverError:any;
3029
tableName: string;
@@ -132,7 +131,6 @@ export class CreateComponent {
132131
this.uploadForm.get('files').setValue(file);
133132
this.uploadForm.get('fileName').setValue(file.name);
134133
//document.getElementById("fileName").classList.remove('addredborder');
135-
this.fileNameError = false;
136134
}
137135
}
138136

@@ -142,43 +140,30 @@ export class CreateComponent {
142140
}
143141

144142
submit(){
145-
if (this.uploadForm.valid) {
146-
this.auditService.audit(24, 'ADM-333', 'Master Data Upload Form');
147-
let data = {};
148-
data = {
149-
case: 'CONFIRMATION',
150-
title: this.popupMessages['popup1'].title,
151-
message: this.popupMessages['popup1'].message[0] + this.uploadForm.get('operation').value + this.popupMessages['popup1'].message[1] + this.uploadForm.get('tableName').value + this.popupMessages['popup1'].message[2],
152-
yesBtnTxt: this.popupMessages['popup1'].yesBtnText,
153-
noBtnTxt: this.popupMessages['popup1'].noBtnText
154-
};
155-
const dialogRef = this.dialog.open(DialogComponent, {
156-
width: '650px',
157-
data
158-
});
159-
dialogRef.afterClosed().subscribe(response => {
160-
if(response){
161-
this.auditService.audit(18, 'ADM-334', 'Master Data Upload Form');
162-
this.saveData();
163-
}
164-
});
165-
} else {
166-
for (const i in this.uploadForm.controls) {
167-
if (this.uploadForm.controls[i]) {
168-
if(i === "fileName"){
169-
if(!this.uploadForm.get('fileName').value){
170-
document.getElementById("fileName").classList.add('addredborder');
171-
this.fileNameError = true;
172-
}else{
173-
console.log("this.uploadForm.get('fileName').value>>>"+this.uploadForm.get('fileName').value);
174-
}
175-
}else{
176-
this.uploadForm.controls[i].markAsTouched();
177-
}
178-
179-
}
143+
if (this.uploadForm.invalid) {
144+
this.uploadForm.markAllAsTouched();
145+
return;
146+
}
147+
this.auditService.audit(24, 'ADM-333', 'Master Data Upload Form');
148+
const operationValue = this.uploadForm.get('operation') ? this.uploadForm.get('operation').value : '';
149+
const tableNameValue = this.uploadForm.get('tableName') ? this.uploadForm.get('tableName').value : '';
150+
const data = {
151+
case: 'CONFIRMATION',
152+
title: this.popupMessages['popup1'].title,
153+
message: this.popupMessages['popup1'].message[0] + operationValue + this.popupMessages['popup1'].message[1] + tableNameValue + this.popupMessages['popup1'].message[2],
154+
yesBtnTxt: this.popupMessages['popup1'].yesBtnText,
155+
noBtnTxt: this.popupMessages['popup1'].noBtnText
156+
};
157+
const dialogRef = this.dialog.open(DialogComponent, {
158+
width: '650px',
159+
data
160+
});
161+
dialogRef.afterClosed().subscribe(response => {
162+
if(response){
163+
this.auditService.audit(18, 'ADM-334', 'Master Data Upload Form');
164+
this.saveData();
180165
}
181-
}
166+
});
182167
}
183168

184169
saveData(){

admin-ui/src/assets/i18n/ara.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,17 @@
662662
"upload": "تحميل",
663663
"cancel": "يلغي",
664664
"tableNames":[{"id":"applicant_valid_document","value":"وثيقة مقدم الطلب سارية المفعول"},{"id":"biometric_attribute","value":"السمة البيومترية"},{"id":"biometric_type","value":"البيومترية"},{"id":"blocklisted_words","value":"الكلمات المحظورة"},{"id":"daysofweek_list","value":"ايام الاسبوع"},{"id":"device_master","value":"جهاز"},{"id":"device_spec","value":"الجهاز"},{"id":"device_type","value":"نوع الجهاز"},{"id":"doc_category","value":"فئة الوثيقة"},{"id":"doc_type","value":"نوع الوثيقة"},{"id":"dynamic_field","value":"مجال ديناميكي"},{"id":"reg_exceptional_holiday","value":"استثنائي"},{"id":"gender","value":"جنس تذكير أو تأنيث"},{"id":"loc_holiday","value":"عطلة"},{"id":"id_type","value":"نوع المعرف"},{"id":"individual_type","value":"النوع الفردي"},{"id":"language","value":"لغة"},{"id":"location","value":"موقع"},{"id":"loc_hierarchy_list","value":"التسلسل الهرمي"},{"id":"machine_master","value":"آلة"},{"id":"machine_spec","value":"آلةالمواصفات"},{"id":"machine_type","value":"نوع الآلة"},{"id":"module_detail","value":"الوحدة النمطية"},{"id":"reason_category","value":"السببالفئة"},{"id":"reason_list","value":"قائمة الأسباب"},{"id":"reg_exceptional_holiday","value":"عطلة رسمية"},{"id":"registration_center","value":"مركز التسجيل"},{"id":"reg_center_type","value":"نوع التسجيل"},{"id":"reg_working_nonworking","value":"ريج العمل غير العامل"},{"id":"template","value":"نموذج"},{"id":"template_file_format","value":"تنسيق ملف القالب"},{"id":"template_type","value":"نوع النموذج"},{"id":"title","value":"عنوان"},{"id":"user_detail","value":"بيانات المستخدم"},{"id":"valid_document","value":"مستند صالح"},{"id":"zone","value":"منطقة"},{"id":"zone_user","value":"مستخدم المنطقة"}],
665+
"validationMessages": {
666+
"operation": {
667+
"required": "العملية مطلوبة"
668+
},
669+
"tableName": {
670+
"required": "اسم الجدول مطلوب"
671+
},
672+
"file": {
673+
"required": "الملف مطلوب"
674+
}
675+
},
665676
"popupMessages": {
666677
"popup1": {
667678
"title": "تأكيد تحميل البيانات الرئيسية المجمعة",

admin-ui/src/assets/i18n/eng.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,17 @@
663663
"upload": "UPLOAD",
664664
"cancel": "Cancel",
665665
"tableNames":[{"id":"applicant_valid_document","value":"Applicant Valid Document"},{"id":"biometric_attribute","value":"BiometricAttribute"},{"id":"biometric_type","value":"BiometricType"},{"id":"blocklisted_words","value":"BlocklistedWords"},{"id":"daysofweek_list","value":"DaysOfWeek"},{"id":"device_master","value":"Device"},{"id":"device_spec","value":"DeviceSpecification"},{"id":"device_type","value":"DeviceType"},{"id":"doc_category","value":"DocumentCategory"},{"id":"doc_type","value":"DocumentType"},{"id":"dynamic_field","value":"DynamicField"},{"id":"reg_exceptional_holiday","value":"ExceptionalHoliday"},{"id":"gender","value":"Gender"},{"id":"loc_holiday","value":"Holiday"},{"id":"id_type","value":"IdType"},{"id":"individual_type","value":"IndividualType"},{"id":"language","value":"Language"},{"id":"location","value":"Location"},{"id":"loc_hierarchy_list","value":"LocationHierarchy"},{"id":"machine_master","value":"Machine"},{"id":"machine_spec","value":"MachineSpecification"},{"id":"machine_type","value":"MachineType"},{"id":"module_detail","value":"ModuleDetail"},{"id":"reason_category","value":"ReasonCategory"},{"id":"reason_list","value":"ReasonList"},{"id":"reg_exceptional_holiday","value":"RegExceptionalHoliday"},{"id":"registration_center","value":"RegistrationCenter"},{"id":"reg_center_type","value":"RegistrationCenterType"},{"id":"reg_working_nonworking","value":"RegWorkingNonWorking"},{"id":"template","value":"Template"},{"id":"template_file_format","value":"TemplateFileFormat"},{"id":"template_type","value":"TemplateType"},{"id":"title","value":"Title"},{"id":"user_detail","value":"UserDetails"},{"id":"valid_document","value":"ValidDocument"},{"id":"zone","value":"Zone"},{"id":"zone_user","value":"ZoneUser"}],
666+
"validationMessages": {
667+
"operation": {
668+
"required": "Operation is required"
669+
},
670+
"tableName": {
671+
"required": "Table Name is required"
672+
},
673+
"file": {
674+
"required": "File is required"
675+
}
676+
},
666677
"popupMessages": {
667678
"popup1": {
668679
"title": "Confirm Bulk Master Data Upload",

admin-ui/src/assets/i18n/es.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,17 @@
705705
{ "id": "zone", "value": "Zona" },
706706
{ "id": "zone_user", "value": "Usuario de zona" }
707707
],
708+
"validationMessages": {
709+
"operation": {
710+
"required": "La operación es requerida"
711+
},
712+
"tableName": {
713+
"required": "El nombre de la tabla es requerido"
714+
},
715+
"file": {
716+
"required": "El archivo es requerido"
717+
}
718+
},
708719
"popupMessages": {
709720
"popup1": {
710721
"title": "Confirmar carga masiva de datos maestros",

admin-ui/src/assets/i18n/fra.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,17 @@
921921
"value": "ZoneUtilisateur"
922922
}
923923
],
924+
"validationMessages": {
925+
"operation": {
926+
"required": "L'opération est requise"
927+
},
928+
"tableName": {
929+
"required": "Le nom de la table est requis"
930+
},
931+
"file": {
932+
"required": "Le fichier est requis"
933+
}
934+
},
924935
"popupMessages": {
925936
"popup1": {
926937
"title": "Confirmer le téléchargement en bloc des données de base",

admin-ui/src/assets/i18n/hin.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,17 @@
781781
"id": "zone_user",
782782
"value": "क्षेत्र उपयोगकर्ता "
783783
}],
784+
"validationMessages": {
785+
"operation": {
786+
"required": "कार्य आवश्यक है"
787+
},
788+
"tableName": {
789+
"required": "तालिका का नाम आवश्यक है"
790+
},
791+
"file": {
792+
"required": "फ़ाइल आवश्यक है"
793+
}
794+
},
784795
"popupMessages": {
785796
"popup1": {
786797
"title": "बल्क मास्टर डेटा अपलोड की पुष्टि करें",

admin-ui/src/assets/i18n/kan.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,17 @@
788788
"id": "zone_user",
789789
"value": "ವಲಯ ಬಳಕೆದಾರ"
790790
}],
791+
"validationMessages": {
792+
"operation": {
793+
"required": "ಕಾರ್ಯಾಚರಣೆ ಅಗತ್ಯ"
794+
},
795+
"tableName": {
796+
"required": "ಅட்டಿಯ ಹೆಸರು ಅಗತ್ಯ"
797+
},
798+
"file": {
799+
"required": "ಫೈಲ್ ಅಗತ್ಯವಿದೆ"
800+
}
801+
},
791802
"popupMessages": {
792803
"popup1": {
793804
"title": "ಬೃಹತ್ ಮಾಸ್ಟರ್ ಡೇಟಾ ಅಪ್‌ಲೋಡ್ ಅನ್ನು ದೃirೀಕರಿಸಿ",

admin-ui/src/assets/i18n/tam.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,17 @@
789789
"id": "zone_user",
790790
"value": "மண்டல பயனர் "
791791
}],
792+
"validationMessages": {
793+
"operation": {
794+
"required": "செயல்பாடு தேவை"
795+
},
796+
"tableName": {
797+
"required": "அட்டவணை தேவை"
798+
},
799+
"file": {
800+
"required": "கோப்பு தேவை"
801+
}
802+
},
792803
"popupMessages": {
793804
"popup1": {
794805
"title": "மொத்த முதன்மை தரவு பதிவேற்றத்தை உறுதிப்படுத்தவும்",

0 commit comments

Comments
 (0)