diff --git a/Common-UI b/Common-UI index 6412a482..063e6e34 160000 --- a/Common-UI +++ b/Common-UI @@ -1 +1 @@ -Subproject commit 6412a482513a89ab2793422fb1cbbbe95d330324 +Subproject commit 063e6e347418f804e5df9ee0be9f3df82fb04fe1 diff --git a/package.json b/package.json index 0df91aa4..08a00180 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve", + "start": "ng serve Admin-UI", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", diff --git a/pom.xml b/pom.xml index b59faada..6e048740 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.iemr.admin-ui admin-ui - 3.1.0 + 3.6.0 Admin-UI Piramal - admin: Module ui diff --git a/src/app/app-provider-admin/provider-admin/activities/activities.module.ts b/src/app/app-provider-admin/provider-admin/activities/activities.module.ts index b6dc2968..449749aa 100644 --- a/src/app/app-provider-admin/provider-admin/activities/activities.module.ts +++ b/src/app/app-provider-admin/provider-admin/activities/activities.module.ts @@ -1,14 +1,5 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { MatSelectModule } from '@angular/material/select'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatIconModule } from '@angular/material/icon'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatNativeDateModule } from '@angular/material/core'; -import { MatTooltipModule } from '@angular/material/tooltip'; -import { MatTableModule } from '@angular/material/table'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ProviderAdminRoleService } from './services/state-serviceline-role.service'; import { MaterialModule } from 'src/app/core/material.module'; @@ -19,6 +10,7 @@ import { import { CategorySubcategoryProvisioningComponent } from './category-subcategory-provisioning/category-subcategory-provisioning.component'; import { EditCategorySubcategoryComponent } from './category-subcategory-provisioning/edit-category-subcategory/edit-category-subcategory.component'; import { EmployeeMasterNewComponent } from './employee-master-new/employee-master-new.component'; +import { EmployeeMasterBulkUploadComponent } from './employee-master-bulk-upload/employee-master-bulk-upload.component'; import { FeedbackTypeMasterComponent, EditFeedbackModalComponent, @@ -108,7 +100,7 @@ import { ProjectConfigutationScreenComponent } from './project-configutation-scr import { ProjectConfigurationService } from './services/project-configuration-service'; import { AddFieldsToProjectComponent } from './add-fields-to-project/add-fields-to-project.component'; import { AddFieldsService } from './services/add-fields-service'; -import { MatChipGrid, MatChipsModule } from '@angular/material/chips'; +import { MatChipsModule } from '@angular/material/chips'; import { CoreModule } from 'src/app/core/core.module'; @NgModule({ @@ -161,22 +153,13 @@ import { CoreModule } from 'src/app/core/core.module'; ProjectServicelineMappingComponent, ProjectConfigutationScreenComponent, AddFieldsToProjectComponent, + EmployeeMasterBulkUploadComponent, ], imports: [ CommonModule, - MatSelectModule, - MatInputModule, - MatFormFieldModule, - MatIconModule, - MatDialogModule, - MatDatepickerModule, - MatNativeDateModule, - MatTooltipModule, - MatTableModule, MaterialModule, FormsModule, ReactiveFormsModule, - MatNativeDateModule, MatChipsModule, CoreModule, ], diff --git a/src/app/app-provider-admin/provider-admin/activities/call-disposition-type-master/call-disposition-type-master.component.html b/src/app/app-provider-admin/provider-admin/activities/call-disposition-type-master/call-disposition-type-master.component.html index d2b85291..9a3183c4 100644 --- a/src/app/app-provider-admin/provider-admin/activities/call-disposition-type-master/call-disposition-type-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/call-disposition-type-master/call-disposition-type-master.component.html @@ -66,6 +66,7 @@

Create Call Disposition Type/Sub Type

@@ -361,6 +362,7 @@

Create Call Disposition Type/Sub Type

diff --git a/src/app/app-provider-admin/provider-admin/activities/category-subcategory-provisioning/category-subcategory-provisioning.component.html b/src/app/app-provider-admin/provider-admin/activities/category-subcategory-provisioning/category-subcategory-provisioning.component.html index a5062ec4..8fbfcdf3 100644 --- a/src/app/app-provider-admin/provider-admin/activities/category-subcategory-provisioning/category-subcategory-provisioning.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/category-subcategory-provisioning/category-subcategory-provisioning.component.html @@ -120,6 +120,7 @@

Category and Sub Category Master

@@ -216,6 +217,7 @@

Category and Sub Category Master

@@ -562,6 +564,7 @@

Create Category and Sub Category

@@ -621,6 +624,7 @@

Create Category and Sub Category

diff --git a/src/app/app-provider-admin/provider-admin/activities/device-id-master/device-id-master.component.html b/src/app/app-provider-admin/provider-admin/activities/device-id-master/device-id-master.component.html index 48620e75..c143372a 100644 --- a/src/app/app-provider-admin/provider-admin/activities/device-id-master/device-id-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/device-id-master/device-id-master.component.html @@ -74,6 +74,7 @@

Edit Device ID

@@ -226,6 +227,7 @@

Edit Device ID

diff --git a/src/app/app-provider-admin/provider-admin/activities/drug-group/drug-group.component.html b/src/app/app-provider-admin/provider-admin/activities/drug-group/drug-group.component.html index f6a8b40f..9abd6ef8 100644 --- a/src/app/app-provider-admin/provider-admin/activities/drug-group/drug-group.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/drug-group/drug-group.component.html @@ -23,6 +23,7 @@

Drug Group Master

@@ -215,6 +216,7 @@

Edit Drug Group

diff --git a/src/app/app-provider-admin/provider-admin/activities/drug-list/drug-list.component.html b/src/app/app-provider-admin/provider-admin/activities/drug-list/drug-list.component.html index 436f6c42..1eec649b 100644 --- a/src/app/app-provider-admin/provider-admin/activities/drug-list/drug-list.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/drug-list/drug-list.component.html @@ -23,6 +23,7 @@

Drug Master

@@ -230,6 +231,7 @@

Edit Drug

diff --git a/src/app/app-provider-admin/provider-admin/activities/drug-mapping/drug-mapping.component.html b/src/app/app-provider-admin/provider-admin/activities/drug-mapping/drug-mapping.component.html index ed41a936..7f16ad37 100644 --- a/src/app/app-provider-admin/provider-admin/activities/drug-mapping/drug-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/drug-mapping/drug-mapping.component.html @@ -64,6 +64,7 @@

Drug Group-Drug Mapping

@@ -232,6 +233,7 @@

Drug Group-Drug Mapping

diff --git a/src/app/app-provider-admin/provider-admin/activities/drug-strength/drug-strength.component.html b/src/app/app-provider-admin/provider-admin/activities/drug-strength/drug-strength.component.html index 597a9d2a..a43ef695 100644 --- a/src/app/app-provider-admin/provider-admin/activities/drug-strength/drug-strength.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/drug-strength/drug-strength.component.html @@ -21,6 +21,7 @@

Drug Strength Master

@@ -214,6 +215,7 @@

Edit Drug Strength

diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.css b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.html b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.html new file mode 100644 index 00000000..da5bb93f --- /dev/null +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.html @@ -0,0 +1,81 @@ +
+
+
+

Bulk User Upload

+
+
+ +
+
+
+ +
+
+
+ *This user doesn't have 104 serviceline previlage to upload data +
+
+
+ Upload File(Size :{{ file.size / 1024 / 1024 | number: "1.2-2" }}/{{ + maxFileSize + }}MB) + Upload File(Size :0/{{ maxFileSize }}MB), Supported File + Formats(.xls, .xlsx, .xlsm, .xlsb) + + + Supported File Formats(.xls, .xlsx, .xlsm, .xlsb) + File size should not exceed {{ maxFileSize }}MB +
+
+ {{ fileuploadedCount }} out of {{ filetotalCount }} users created + successfully !
+ {{ errorloglist }} +
+ +
+
+ +
+
+
+
diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.spec.ts b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.spec.ts new file mode 100644 index 00000000..4861434e --- /dev/null +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EmployeeMasterBulkUploadComponent } from './employee-master-bulk-upload.component'; + +describe('EmployeeMasterBulkUploadComponent', () => { + let component: EmployeeMasterBulkUploadComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [EmployeeMasterBulkUploadComponent], + }); + fixture = TestBed.createComponent(EmployeeMasterBulkUploadComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.ts b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.ts new file mode 100644 index 00000000..7beb6721 --- /dev/null +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-bulk-upload/employee-master-bulk-upload.component.ts @@ -0,0 +1,245 @@ +import { + Component, + ViewChild, + OnInit, + Output, + EventEmitter, +} from '@angular/core'; +import { BlockSubcenterMappingService } from '../services/block-subcenter-mapping-service'; +import { ConfirmationDialogsService } from 'src/app/core/services/dialog/confirmation.service'; +import { dataService } from 'src/app/core/services/dataService/data.service'; +import { MatTableDataSource } from '@angular/material/table'; +import { MatPaginator } from '@angular/material/paginator'; +import * as XLSX from 'xlsx'; +import { MatDialog } from '@angular/material/dialog'; +import { Location } from '@angular/common'; +import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; + +@Component({ + selector: 'app-employee-master-bulk-upload', + templateUrl: './employee-master-bulk-upload.component.html', + styleUrls: ['./employee-master-bulk-upload.component.css'], +}) +export class EmployeeMasterBulkUploadComponent { + @Output() closeUpload = new EventEmitter(); + objs = new MatTableDataSource(); + + paginator!: MatPaginator; + @ViewChild(MatPaginator) set matPaginator(mp: MatPaginator) { + this.paginator = mp; + this.setDataSourceAttributes(); + } + + filteredsearchResult = new MatTableDataSource(); + + setDataSourceAttributes() { + this.filteredsearchResult.paginator = this.paginator; + // this.objs.paginator = this.paginator; + } + + file: any; + fileList!: FileList; + error1 = false; + error2 = false; + successcount = false; + invalid_file_flag = false; + inValidFileName = false; + maxFileSize = 5.0; + jsonData: any; + enableUPloadButton = false; + valid_file_extensions = ['xls', 'xlsx', 'xlsm', 'xlsb']; + fileContent: any; + userID: any; + showProgressBar = false; + disableUpload = true; + showUpload = false; + fileuploadedCount = 0; + filetotalCount = 0; + errorloglist: any; + + tableMode = true; + editMode = false; + + constructor( + public dataService: dataService, + public blockSubcenterMappingService: BlockSubcenterMappingService, + public alertService: ConfirmationDialogsService, + public dialog: MatDialog, + private location: Location, + ) {} + + ngOnInit() { + this.userID = this.dataService.uid; + const servicelines = this.dataService.userPriveliges; + + this.showUpload = true; + return this.showUpload; + } + + onLoadFileCallback = (event: any) => { + this.fileContent = event.currentTarget.result; + this.showProgressBar = false; + }; + + onFileUpload(event: any) { + const target: DataTransfer = event.target; + if (target.files.length !== 1) { + throw new Error('Cannot use multiple files'); + } + + const file = target.files[0]; + + // Validate file size (e.g., max size 10 MB) + const maxSizeInMB = 5; // Set your max file size (in MB) + const fileSizeInMB = file.size / 1000 / 1000; // Convert file size to MB + + // Check if the file size exceeds the limit + if (fileSizeInMB > maxSizeInMB) { + this.alertService.alert( + `File size exceeds the maximum allowed size of ${maxSizeInMB} MB`, + 'error', + ); + this.resetFileInput(); + return; // Exit early if the file is too large + } + + // Validate file extension + + const valid_file_extensions = ['.xls', '.xlsx', '.xlsm']; // Define the allowed extensions + const fileExtension = file.name.split('.').pop()?.toLowerCase(); // Extract file extension + + // Check if the file extension is valid + if ( + !fileExtension || + !valid_file_extensions.includes(`.${fileExtension}`) + ) { + this.alertService.alert( + 'Invalid file extension. Please upload a valid Excel', + 'error', + ); + this.resetFileInput(); + return; // Exit early if the extension is not valid + } + + const reader: FileReader = new FileReader(); + reader.readAsBinaryString(target.files[0]); + reader.onload = (e: any) => { + const binarystr: string = e.target.result; + const wb: XLSX.WorkBook = XLSX.read(binarystr, { type: 'binary' }); + const wsname: string = wb.SheetNames[0]; + const ws: XLSX.WorkSheet = wb.Sheets[wsname]; + const data = XLSX.utils.sheet_to_json(ws); + + const xmlData = this.convertJsonToXml(data); + + this.showProgressBar = true; + this.blockSubcenterMappingService.memberBulkUploadXML(xmlData).subscribe( + (response: any) => { + if (response) { + this.fileuploadedCount = response.registeredUser; + this.filetotalCount = response.totalUser; + + if ( + Number(this.fileuploadedCount) !== Number(this.filetotalCount) + ) { + this.downloadFile(); + } + this.showProgressBar = false; + this.alertService.alert('File Uploaded', 'success'); + + this.resetFileInput(); + this.file = undefined; + this.successcount = true; + + this.errorloglist = response.error; + } else { + this.showProgressBar = false; + this.alertService.alert(response.errorMessage, 'error'); + } + }, + (error: HttpErrorResponse) => { + if ( + !navigator.onLine || + (error.status === 0 && error.error instanceof ProgressEvent) + ) { + this.showProgressBar = false; + this.alertService.alert( + 'Internet connection not available!', + 'error', + ); + } + }, + ); + (err: any) => { + this.showProgressBar = false; + this.alertService.alert(err.errorMessage, 'error'); + this.resetFileInput(); + this.file = undefined; + this.fileContent = null; + this.disableUpload = true; + }; + }; + } + + convertJsonToXml(json: any): string { + const xml = ['\n']; + json.forEach((item: any) => { + xml.push('\n'); + for (const [key, value] of Object.entries(item)) { + xml.push(`<${key}>${value}\n`); + } + xml.push('\n'); + }); + + xml.push('\n'); + return xml.join(''); + } + + resetFileInput() { + const fileInput = document.getElementById( + 'upload-file', + ) as HTMLInputElement; + fileInput.value = ''; + } + + downloadMaster() { + const filePath = 'assets/bulkuser_excel_sheet.xlsx'; + + // Create a temporary link to trigger the download + const link = document.createElement('a'); + link.href = filePath; + link.download = 'bulkuser_excel_sheet.xlsx'; // Set the file name when downloaded + + // Trigger the click event on the anchor element to initiate the download + link.click(); + } + + downloadFile(): void { + this.blockSubcenterMappingService.downloadErrorExcel().subscribe( + (blob: Blob) => { + const link = document.createElement('a'); + const url = window.URL.createObjectURL(blob); // Create a URL for the Blob + link.href = url; + link.download = 'Error-log-file.xlsx'; // Set the desired filename + link.click(); // Programmatically trigger the download + window.URL.revokeObjectURL(url); // Clean up the URL object + }, + (error) => { + console.error('Download failed', error); + }, + ); + } + + back() { + this.alertService + .confirm( + 'confirm', + 'Do you really want to cancel? Any unsaved data would be lost', + ) + .subscribe((res) => { + if (res) { + this.closeUpload.emit(); + } + }); + } +} diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.html b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.html index 96c45fd8..9cc8e523 100644 --- a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.html @@ -20,9 +20,15 @@

Employee Master

+
@@ -103,24 +109,35 @@

Employee Master

+
No Records Found
-
+
+
+
+
+ +
diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts index 6623e28b..6255b411 100644 --- a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts @@ -19,11 +19,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ -import { Component, OnInit, ViewChild, Inject } from '@angular/core'; +import { + Component, + OnInit, + ViewChild, + Inject, + ChangeDetectorRef, + ViewRef, +} from '@angular/core'; import { NgForm } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; +import { MatSort } from '@angular/material/sort'; +import { finalize } from 'rxjs/operators'; import { EmployeeMasterNewServices } from 'src/app/app-provider-admin/provider-admin/activities/services/employee-master-new-services.service'; import { dataService } from 'src/app/core/services/dataService/data.service'; import { ConfirmationDialogsService } from 'src/app/core/services/dialog/confirmation.service'; @@ -61,14 +70,25 @@ export class EmployeeMasterNewComponent implements OnInit { 'action', ]; paginator!: MatPaginator; + sort!: MatSort; @ViewChild(MatPaginator) set matPaginator(mp: MatPaginator) { this.paginator = mp; this.setDataSourceAttributes(); } + @ViewChild(MatSort) set matSort(ms: MatSort) { + this.sort = ms; + this.setDataSourceAttributes(); + } filteredsearchResult = new MatTableDataSource(); + isLoading = false; setDataSourceAttributes() { - this.filteredsearchResult.paginator = this.paginator; + if (this.filteredsearchResult && this.paginator) { + this.filteredsearchResult.paginator = this.paginator; + } + if (this.filteredsearchResult && this.sort) { + this.filteredsearchResult.sort = this.sort; + } // this.objs.paginator = this.paginator; } //ngModel @@ -151,6 +171,9 @@ export class EmployeeMasterNewComponent implements OnInit { permanentDistricts: any = []; communities: any = []; religions: any = []; + + downloadMemberExcelFile: any; + // objs: any = []; searchTerm: any; selfHealthProfessionalID: any; @@ -177,6 +200,7 @@ export class EmployeeMasterNewComponent implements OnInit { @ViewChild('communicationDetailsForm') communicationDetailsForm!: NgForm; disableGenerateOTP: any; + employeeMasterUpload = false; // md2.data: Observable>; @@ -186,6 +210,7 @@ export class EmployeeMasterNewComponent implements OnInit { public dialogService: ConfirmationDialogsService, public dialog: MatDialog, readonly sessionstorage: SessionStorageService, + private cdr: ChangeDetectorRef, ) { this.filteredsearchResult.data = []; } @@ -205,17 +230,88 @@ export class EmployeeMasterNewComponent implements OnInit { getAllUserDetails() { console.log('serviceProvider', this.serviceProviderID); - this.employeeMasterNewService.getAllUsers(this.serviceProviderID).subscribe( - (response: any) => { - if (response) { - console.log('All details of the user', response); - this.searchResult = response.data; - this.filteredsearchResult.data = response.data; - this.filteredsearchResult.paginator = this.paginator; - } - }, - (err) => console.log('error', err), - ); + this.isLoading = true; + this.employeeMasterNewService + .getAllUsers(this.serviceProviderID) + .pipe( + finalize(() => { + this.isLoading = false; + if (!(this.cdr as ViewRef).destroyed) { + this.cdr.detectChanges(); + } + }), + ) + .subscribe( + (response: any) => { + const employeeList = this.extractEmployeeList(response); + console.log('All details of the user', employeeList); + console.log('list length', employeeList?.length); + this.searchResult = employeeList; + this.refreshFilteredData(employeeList); + }, + (err) => { + console.log('error', err); + this.refreshFilteredData([]); + }, + ); + } + + private extractEmployeeList(response: any): any[] { + let rawData = response; + + if (rawData && typeof rawData === 'object' && 'data' in rawData) { + rawData = rawData.data; + } + + rawData = this.deepParseIfString(rawData); + + if (Array.isArray(rawData)) { + return rawData; + } + + if (rawData && typeof rawData === 'object') { + if (Array.isArray(rawData.data)) { + return rawData.data; + } + if (Array.isArray(rawData.response)) { + return rawData.response; + } + if (Array.isArray(rawData.result)) { + return rawData.result; + } + const firstArray = Object.values(rawData).find((value) => + Array.isArray(value), + ); + if (Array.isArray(firstArray)) { + return firstArray; + } + } + + return []; + } + + private deepParseIfString(candidate: any): any { + let parsedValue = candidate; + const seen = new Set(); + + while (typeof parsedValue === 'string') { + const trimmed = parsedValue.trim(); + if (!trimmed) { + return []; + } + if (seen.has(trimmed)) { + break; + } + seen.add(trimmed); + try { + parsedValue = JSON.parse(trimmed); + } catch (error) { + console.error('Failed to parse employee master response string', error); + return []; + } + } + + return parsedValue; } showForm() { this.tableMode = false; @@ -300,8 +396,7 @@ export class EmployeeMasterNewComponent implements OnInit { if (res) { this.objs.data = []; this.searchTerm = null; - this.filteredsearchResult.data = this.searchResult; - this.filteredsearchResult.paginator = this.paginator; + this.refreshFilteredData(this.searchResult); this.showTable(); this.resetAllFlags(); } @@ -1536,28 +1631,25 @@ export class EmployeeMasterNewComponent implements OnInit { } filterComponentList(searchTerm?: string) { if (!searchTerm) { - this.filteredsearchResult.data = this.searchResult; - this.filteredsearchResult.paginator = this.paginator; - } else { - this.filteredsearchResult.data = []; - this.searchResult.forEach((item: any) => { - for (const key in item) { - if ( - key === 'userName' || - key === 'emergencyContactNo' || - key === 'emailID' || - key === 'designationName' - ) { - const value: string = '' + item[key]; - if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { - this.filteredsearchResult.data.push(item); - break; - } - } - } - }); - this.filteredsearchResult.paginator = this.paginator; + this.refreshFilteredData(this.searchResult); + return; } + + const normalizedTerm = searchTerm.trim().toLowerCase(); + const filtered = this.searchResult.filter((item: any) => + ['userName', 'emergencyContactNo', 'emailID', 'designationName'].some( + (key) => { + const value = item[key]; + return ( + value !== undefined && + value !== null && + value.toString().toLowerCase().includes(normalizedTerm) + ); + }, + ), + ); + + this.refreshFilteredData(filtered); } // to enable health professional ID feild upon selecting designation enableHPID() { @@ -1579,4 +1671,29 @@ export class EmployeeMasterNewComponent implements OnInit { this.enablehealthProfessionalID = false; } } + + uploadMaster() { + this.employeeMasterUpload = true; + this.tableMode = false; + this.formMode = false; + } + + closeBulkUpload() { + this.employeeMasterUpload = false; + this.tableMode = true; + this.formMode = false; + } + + private refreshFilteredData(rows: any[]) { + const safeRows = Array.isArray(rows) ? rows : []; + console.log('refreshFilteredData rows', safeRows.length); + this.filteredsearchResult.data = [...safeRows]; + this.setDataSourceAttributes(); + if (this.filteredsearchResult.paginator) { + this.filteredsearchResult.paginator.firstPage(); + } + if (!(this.cdr as ViewRef).destroyed) { + this.cdr.detectChanges(); + } + } } diff --git a/src/app/app-provider-admin/provider-admin/activities/feedback-complaint-nature-master/feedback-complaint-nature-master.component.html b/src/app/app-provider-admin/provider-admin/activities/feedback-complaint-nature-master/feedback-complaint-nature-master.component.html index ccde6683..47d0c10f 100644 --- a/src/app/app-provider-admin/provider-admin/activities/feedback-complaint-nature-master/feedback-complaint-nature-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/feedback-complaint-nature-master/feedback-complaint-nature-master.component.html @@ -85,6 +85,7 @@

Feedback/Complaint Nature Master

@@ -314,6 +315,7 @@

Add Feedback/Complaint Nature

diff --git a/src/app/app-provider-admin/provider-admin/activities/feedback-type-master/feedback-type-master.component.html b/src/app/app-provider-admin/provider-admin/activities/feedback-type-master/feedback-type-master.component.html index b543d2a8..3b184d0d 100644 --- a/src/app/app-provider-admin/provider-admin/activities/feedback-type-master/feedback-type-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/feedback-type-master/feedback-type-master.component.html @@ -67,6 +67,7 @@

Feedback/Complaint Type Master

@@ -298,6 +299,7 @@

Add Feedback/Complaint Type

diff --git a/src/app/app-provider-admin/provider-admin/activities/fetosense-test-master/fetosense-test-master.component.html b/src/app/app-provider-admin/provider-admin/activities/fetosense-test-master/fetosense-test-master.component.html index e873670b..40a555d1 100644 --- a/src/app/app-provider-admin/provider-admin/activities/fetosense-test-master/fetosense-test-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/fetosense-test-master/fetosense-test-master.component.html @@ -81,6 +81,7 @@

Edit Test

@@ -249,6 +250,7 @@

Edit Test

diff --git a/src/app/app-provider-admin/provider-admin/activities/hospital-master/hospital-master.component.html b/src/app/app-provider-admin/provider-admin/activities/hospital-master/hospital-master.component.html index 6973c3b5..01c03b78 100644 --- a/src/app/app-provider-admin/provider-admin/activities/hospital-master/hospital-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/hospital-master/hospital-master.component.html @@ -99,6 +99,7 @@

Create Institution

diff --git a/src/app/app-provider-admin/provider-admin/activities/institute-type-master/institute-type-master.component.html b/src/app/app-provider-admin/provider-admin/activities/institute-type-master/institute-type-master.component.html index 991baad6..d92253e7 100644 --- a/src/app/app-provider-admin/provider-admin/activities/institute-type-master/institute-type-master.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/institute-type-master/institute-type-master.component.html @@ -69,6 +69,7 @@

Create Institute Type

@@ -225,6 +226,7 @@

Create Institute Type

diff --git a/src/app/app-provider-admin/provider-admin/activities/language-mapping/language-mapping.component.html b/src/app/app-provider-admin/provider-admin/activities/language-mapping/language-mapping.component.html index 1f3f9557..e7cf9efc 100644 --- a/src/app/app-provider-admin/provider-admin/activities/language-mapping/language-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/language-mapping/language-mapping.component.html @@ -26,6 +26,7 @@

@@ -310,6 +311,7 @@

diff --git a/src/app/app-provider-admin/provider-admin/activities/location-serviceline-mapping/location-serviceline-mapping.component.html b/src/app/app-provider-admin/provider-admin/activities/location-serviceline-mapping/location-serviceline-mapping.component.html index e53d133a..15811621 100644 --- a/src/app/app-provider-admin/provider-admin/activities/location-serviceline-mapping/location-serviceline-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/activities/location-serviceline-mapping/location-serviceline-mapping.component.html @@ -125,7 +125,7 @@

Create Work Location

- +
ActionAction + + + + \ No newline at end of file diff --git a/src/app/app-provider-admin/provider-admin/configurations/user-signature-mapping/user-signature-mapping.component.ts b/src/app/app-provider-admin/provider-admin/configurations/user-signature-mapping/user-signature-mapping.component.ts index d64048ea..fa18af58 100644 --- a/src/app/app-provider-admin/provider-admin/configurations/user-signature-mapping/user-signature-mapping.component.ts +++ b/src/app/app-provider-admin/provider-admin/configurations/user-signature-mapping/user-signature-mapping.component.ts @@ -19,20 +19,21 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, - FormControl, - FormArray, - NgForm, Validators, } from '@angular/forms'; import { ConfirmationDialogsService } from 'src/app/core/services/dialog/confirmation.service'; import { EmployeeParkingPlaceMappingService } from '../../activities/services/employee-parking-place-mapping.service'; import { dataService } from 'src/app/core/services/dataService/data.service'; import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service'; - +import { MatDialog } from '@angular/material/dialog'; +import { map, Observable, forkJoin, switchMap, takeUntil, Subject } from 'rxjs'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; @Component({ selector: 'app-user-signature-mapping', templateUrl: './user-signature-mapping.component.html', @@ -50,6 +51,12 @@ export class UserSignatureMappingComponent implements OnInit { public imagePath: any; imgURL: any; enableDownloadButton = false; + displayedColumns: string[] = ['role', 'username', 'upload', 'download', 'view', 'active']; + userSignatureTable: any[] = []; + selectedUser: any; + dataSource = new MatTableDataSource([]); + private destroy$ = new Subject(); + constructor( private fb: FormBuilder, @@ -57,14 +64,42 @@ export class UserSignatureMappingComponent implements OnInit { private alertMessage: ConfirmationDialogsService, private dataService: dataService, readonly sessionstorage: SessionStorageService, - ) {} + private dialog: MatDialog, + + ) { } + + @ViewChild('signatureDialog') signatureDialog!: TemplateRef; + @ViewChild(MatPaginator) paginator!: MatPaginator; + @ViewChild(MatSort) sort!: MatSort; ngOnInit() { this.signUploadForm = this.createSignUploadForm(); this.createdBy = this.dataService.uname; this.serviceProviderID = this.sessionstorage.getItem('service_providerID'); this.getDesignations(); + + this.dataSource.filterPredicate = (data: any, filter: string) => { + const dataStr = (data.role + data.username).toLowerCase(); + return dataStr.includes(filter); + }; + } + + ngAfterViewInit() { + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + } + + ngAfterViewChecked() { + if (this.paginator && this.dataSource.paginator !== this.paginator) { + this.dataSource.paginator = this.paginator; + } } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + createSignUploadForm() { return this.fb.group({ designation: [null, Validators.required], @@ -87,42 +122,91 @@ export class UserSignatureMappingComponent implements OnInit { }, ); } + + getUserNames() { const reqObj = { designationID: this.designation.designationID, serviceProviderID: this.serviceProviderID, }; + this.employeeParkingPlaceMappingService .getUserNameBasedOnDesig(reqObj) + .pipe( + switchMap((response: any) => { + if (!response?.data) return []; + this.userNames = response.data; + + // map users to observables + const requests = this.userNames.map((user: any) => + this.employeeParkingPlaceMappingService + .checkUsersignatureExist(user.userID) + .pipe( + map((signRes: any) => ({ + role: this.designation.designationName, + username: user.userName, + userID: user.userID, + signatureStatus: user?.signatureStatus || 'InActive', + signatureUrl: signRes?.data?.signatureUrl || null, + signExist: String(signRes?.data?.response).toLowerCase() === 'true', + active: signRes?.data?.active || false, + statusID: String(signRes?.data?.response).toLowerCase() === 'true', + })) + ) + ); + + return forkJoin(requests).pipe( + map(results => results as any[]) + ); // run all requests in parallel and cast result to any[] + }), + takeUntil(this.destroy$) + ) .subscribe( - (response: any) => { - if (response && response.data) this.userNames = response.data; - }, - (err) => { - console.log('usernames not fetched'); + (usersWithSignatures: any[]) => { + this.userSignatureTable = usersWithSignatures; + this.dataSource.data = this.userSignatureTable; }, + () => console.log('Usernames not fetched') ); } + + + // When a user is selected checkUsersignExist() { this.imgURL = null; + this.selectedUser = this.username; // Store selected user for table + this.employeeParkingPlaceMappingService .checkUsersignatureExist(this.username.userID) .subscribe( (response: any) => { this.signExist = response.data.response; - if (this.signExist === 'true') { - this.enableDownloadButton = true; - } else { - this.enableDownloadButton = false; - } + this.enableDownloadButton = this.signExist === 'true'; + + // Fill table data (example format) + this.userSignatureTable = [ + { + role: this.designation.designationName, + username: this.username.userName, + signatureUrl: response.data.signatureUrl || null, + active: response.data.active || false, + userID: this.username.userID, + statusID: this.username.statusID + }, + ]; + this.dataSource.data = this.userSignatureTable }, (err) => { console.log('Error while fetching response'); - }, + } ); } + public message: any; - preview(files: any) { + + preview(files: any, row: any) { + + this.selectedUser = row.userID; if (files.length === 0) return; const imgType = files[0].type; @@ -138,6 +222,7 @@ export class UserSignatureMappingComponent implements OnInit { this.checkImageSize(reader); }; } + checkImageSize(reader: any) { if (this.imagePath.size > 20000) { this.alertMessage.alert('Image size should be less than 20kb'); @@ -165,13 +250,14 @@ export class UserSignatureMappingComponent implements OnInit { createdBy: this.createdBy, fileName: this.imagePath.name, fileType: this.imagePath.type, - userID: this.username.userID, + userID: this.selectedUser, fileContent: this.imgURL !== undefined ? this.imgURL.split(',')[1] : '', }; this.employeeParkingPlaceMappingService.uploadSignature(signObj).subscribe( (response) => { this.alertMessage.alert('Saved successfully', 'success'); - this.signUploadForm.reset(); + this.getUserNames(); // Refresh table to show new signature + this.imgURL = null; this.signExist = null; this.enableDownloadButton = false; @@ -182,25 +268,135 @@ export class UserSignatureMappingComponent implements OnInit { }, ); } - downloadSign() { + + private processDownloadResponse(response: any): { filename: string; url: string } { + let filename = 'signature.png'; + const contentDisposition = response.headers.get('content-disposition'); + + if (contentDisposition) { + const utf8FilenameRegex = /filename\*\=UTF-8''(.+)/; + const asciiFilenameRegex = /filename="?([^"]+)"?/; + + let matches = utf8FilenameRegex.exec(contentDisposition); + if (matches?.[1]) { + filename = decodeURIComponent(matches[1]); + } else { + matches = asciiFilenameRegex.exec(contentDisposition); + if (matches?.[1]) { + filename = decodeURIComponent(matches[1]); + } + } + } + // const blob = new Blob([response.body!], { type: response.body!.type }); + const body: Blob | null = response.body as Blob; + if (!body) { + throw new Error('Empty response body'); + } + const blob = new Blob([body], { type: (body as any).type || 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + + return { filename, url }; + } + + downloadSign(row: any) { this.employeeParkingPlaceMappingService - .downloadSign(this.username.userID) + .downloadSign(row?.userID) .subscribe( - (response: any) => { - const filename = response.headers.get('filename'); - // let blobResponse = response.body.blob(); - const blob = new Blob([response], { type: response.type }); - console.log(blob, 'blob'); - const url = window.URL.createObjectURL(blob); + (response) => { + const { filename, url } = this.processDownloadResponse(response); + const a = document.createElement('a'); a.href = url; a.download = filename; - document.body.appendChild(a); a.click(); + + URL.revokeObjectURL(url); }, (err) => { this.alertMessage.alert(err.errorMessage, 'error'); + } + ); + } + + downloadSignature(userID: any): Observable { + return this.employeeParkingPlaceMappingService.downloadSign(userID).pipe( + map((response) => { + const { url } = this.processDownloadResponse(response); + return url; + }) + ); + } + + // View signature popup + openSignatureDialog(row: any) { + if (!row.userID) { + this.alertMessage.alert('No signature uploaded for this user'); + return; + } + + this.downloadSignature(row.userID).subscribe( + (signatureUrl: string) => { + // Open dialog with image + this.dialogRef = this.dialog.open(this.signatureDialog, { + width: '400px', + data: { + username: row.username, + signatureUrl: signatureUrl + }, + }); + }, + (err) => { + this.alertMessage.alert('Error fetching signature', 'error'); + } + ); + } + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + } + + // Toggle signature status + toggleActive(row: any, action: boolean) { + const req = { userID: row.userID, active: action, role: this.designation.designationName, username: row.username }; + this.alertMessage + .confirm( + 'confirm', + 'Are you sure you want to ' + (action ? 'activate' : 'deactivate') + ' this signature?', + ).subscribe( + (res) => { + if (res) { + + this.employeeParkingPlaceMappingService + .activateOrDeActivateSignature(req) + .subscribe( + + () => { + if (action) + this.alertMessage.alert('Signature has been Activated', 'success') + else + this.alertMessage.alert('Signature has been Deactivated', 'success'); + + this.getUserNames(); // Refresh table to show new signature + + }, + (err) => { + this.alertMessage.alert('Error updating status', 'error'); + row.active = !row.active; // rollback on failure + } + ); + } + }, + (err) => { + console.log(err); }, ); } + + dialogRef: any; + + closeDialog(): void { + if (this.dialogRef) { + this.dialogRef.close(); + } + } } diff --git a/src/app/app-provider-admin/provider-admin/configurations/van-device-id-mapping/van-device-id-mapping.component.html b/src/app/app-provider-admin/provider-admin/configurations/van-device-id-mapping/van-device-id-mapping.component.html index 0fc049f7..8369cd05 100644 --- a/src/app/app-provider-admin/provider-admin/configurations/van-device-id-mapping/van-device-id-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/configurations/van-device-id-mapping/van-device-id-mapping.component.html @@ -144,6 +144,7 @@

Edit Spoke Fetosense Device ID Mapping

diff --git a/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.html b/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.html index 11bb86b9..e205d729 100644 --- a/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.html @@ -171,8 +171,8 @@

Van Service Point Mapping

@@ -183,8 +183,8 @@

Van Service Point Mapping

@@ -195,7 +195,7 @@

Van Service Point Mapping

diff --git a/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.ts b/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.ts index 859b9410..56f7159e 100644 --- a/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.ts +++ b/src/app/app-provider-admin/provider-admin/configurations/van-service-point-mapping/van-service-point-mapping.component.ts @@ -37,14 +37,10 @@ import { SessionStorageService } from 'Common-UI/src/registrar/services/session- export class VanServicePointMappingComponent implements OnInit, AfterViewInit { // [x: string]: any; filteredsearchResultArray = new MatTableDataSource(); - // bufferArray = new MatTableDataSource(); - // @ViewChild(MatPaginator) paginator: MatPaginator | null = null; - paginator!: MatPaginator; - @ViewChild(MatPaginator) set matPaginator(mp: MatPaginator) { - this.paginator = mp; - this.setDataSourceAttributes(); - } + @ViewChild(MatPaginator) paginator!: MatPaginator; + + // @ViewChild(MatSort) sort!: MatSort; setDataSourceAttributes() { this.filteredsearchResultArray.paginator = this.paginator; } @@ -136,6 +132,11 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { this.filteredsearchResultArray.paginator = this.paginator; } + ngAfterViewChecked() { + if (this.paginator && this.filteredsearchResultArray.paginator !== this.paginator) { + this.filteredsearchResultArray.paginator = this.paginator; + } + } getServiceLines() { this.vanServicePointMappingService .getServiceLinesNew(this.userID) @@ -350,7 +351,8 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { console.log('response', response); console.log('response.data', response.data); const temp: any = this.MappingForm.controls['mappings'] as FormArray; - this.filteredsearchResultArray.data = response.data; + // this.filteredsearchResultArray.data = response.data; + this.filteredsearchResultArray = new MatTableDataSource(response.data); this.filteredsearchResultArray.paginator = this.paginator; console.log( 'this.filteredsearchResultArray.data', @@ -398,19 +400,26 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { } } - getCheckedData(VSession: any, index: any) { - const formData = this.MappingForm.controls['mappings'].value; - console.log('formData', formData); - if (VSession === 'vanSession1' && formData[index].vanSession1) { - return true; - } else if (VSession === 'vanSession2' && formData[index].vanSession2) { - return true; - } else if (VSession === 'vanSession3' && formData[index].vanSession3) { - return true; - } - return false; + getCheckedData(VSession: string, row: any) { + const mappingsArray = this.MappingForm.controls['mappings'].value; + + // find the mapping by unique servicePointID + const mapping = mappingsArray.find( + (m: any) => m.servicePointID === row.servicePointID + ); + + if (!mapping) return false; + + if (VSession === 'vanSession1') { + return mapping.vanSession1; + } else if (VSession === 'vanSession2') { + return mapping.vanSession2; + } else if (VSession === 'vanSession3') { + return mapping.vanSession3; } + return false; +} servicePointIDList: any = []; createItem(obj: any): FormGroup { console.log('objCreateItem', obj); @@ -438,31 +447,7 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { vanSession3: vanSession === 3, }); } - checkboxChange(event: any, checkboxName: any, i: any) { - const mappingsArray = this.MappingForm.get('mappings'); - const mappingGroup = mappingsArray.controls[i]; - const temp2: any = this.MappingForm.controls['mappings'] as FormArray; - - if (checkboxName === 'vanSession1') { - mappingGroup.controls['vanSession1'].setValue(event.checked); - mappingGroup.controls['vanSession1'].markAsTouched(); - // localStorage.setItem('vanSession1', event.checked); - } else if (checkboxName === 'vanSession2') { - mappingGroup.controls['vanSession2'].setValue(event.checked); - mappingGroup.controls['vanSession2'].markAsTouched(); - // localStorage.setItem('vanSession2', event.checked); - } - console.log( - 'vanSession1 value:', - mappingGroup.controls['vanSession1'].value, - ); - console.log( - 'vanSession2 value:', - mappingGroup.controls['vanSession2'].value, - ); - console.log('CKFIRST', this.MappingForm.value); - console.log('temp2', temp2); - } + vanID: any; selectedVan(van: any) { (this.vanID = van.vanID), @@ -470,24 +455,55 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { (this.parkingPlaceID = van.parkingPlaceID); } + checkboxChange(event: any, checkboxName: string, row: any) { + const mappingsArray = this.MappingForm.get('mappings'); + + // find index by unique ID + const index = mappingsArray.controls.findIndex( + (ctrl: any) => ctrl.value.servicePointID === row.servicePointID + ); + + if (index === -1) return; + + const mappingGroup = mappingsArray.controls[index]; + + if (checkboxName === 'vanSession1') { + mappingGroup.controls['vanSession1'].setValue(event.checked); + mappingGroup.controls['vanSession1'].markAsTouched(); + } else if (checkboxName === 'vanSession2') { + mappingGroup.controls['vanSession2'].setValue(event.checked); + mappingGroup.controls['vanSession2'].markAsTouched(); + } + + console.log('Updated FormArray:', this.MappingForm.value); +} + + storeVanServicePointMapping() { - console.log(this.MappingForm.value); + console.log("SERVrice ID:",this.MappingForm.value); const mappings = this.MappingForm.value.mappings; const mappingArray = this.MappingForm.controls['mappings']; + + for (let i = 0; i < mappings.length; i++) { const mappingGroup = mappingArray.controls[i]; + console.log("Mapping Group:", mappingGroup); console.log(mappingGroup.controls['vanSession1'].touched); if ( mappingGroup.controls['vanSession1'].touched || mappingGroup.controls['vanSession2'].touched ) { + console.log("vanServicePointMapID:",mappings[i].vanServicePointMapID); + console.log("Service Point Id", mappings[i].servicePointID); + + this.vanServicePointMappingObj = {}; this.vanServicePointMappingObj.vanServicePointMapID = mappings[i].vanServicePointMapID; this.vanServicePointMappingObj.vanID = this.vanID; - this.vanServicePointMappingObj.servicePointID = - mappings[i].servicePointID; + this.vanServicePointMappingObj.servicePointID = mappings[i].servicePointID; + if (mappings[i].vanSession1) { this.vanServicePointMappingObj.vanSession = 1; } @@ -505,6 +521,7 @@ export class VanServicePointMappingComponent implements OnInit, AfterViewInit { this.vanServicePointMappingList.push(this.vanServicePointMappingObj); } } + console.log('Req body:', this.vanServicePointMappingList); const obj = { vanServicePointMappings: this.vanServicePointMappingList }; this.vanServicePointMappingService .saveVanServicePointMappings(obj) diff --git a/src/app/app-provider-admin/provider-admin/configurations/van-spoke-mapping/van-spoke-mapping.component.html b/src/app/app-provider-admin/provider-admin/configurations/van-spoke-mapping/van-spoke-mapping.component.html index 508420f5..5bfe2c13 100644 --- a/src/app/app-provider-admin/provider-admin/configurations/van-spoke-mapping/van-spoke-mapping.component.html +++ b/src/app/app-provider-admin/provider-admin/configurations/van-spoke-mapping/van-spoke-mapping.component.html @@ -166,6 +166,7 @@

From

@@ -476,6 +477,7 @@

Map Van and Spoke

diff --git a/src/app/app-provider-admin/provider-admin/inventory/manufacturer-master/manufacturer-master.component.html b/src/app/app-provider-admin/provider-admin/inventory/manufacturer-master/manufacturer-master.component.html index bb32aee7..fa701e91 100644 --- a/src/app/app-provider-admin/provider-admin/inventory/manufacturer-master/manufacturer-master.component.html +++ b/src/app/app-provider-admin/provider-admin/inventory/manufacturer-master/manufacturer-master.component.html @@ -75,6 +75,7 @@

@@ -536,6 +537,7 @@

--> diff --git a/src/app/app-provider-admin/provider-admin/inventory/supplier-master/supplier-master.component.html b/src/app/app-provider-admin/provider-admin/inventory/supplier-master/supplier-master.component.html index acf06e7e..533f6a8b 100644 --- a/src/app/app-provider-admin/provider-admin/inventory/supplier-master/supplier-master.component.html +++ b/src/app/app-provider-admin/provider-admin/inventory/supplier-master/supplier-master.component.html @@ -69,6 +69,7 @@

@@ -621,6 +622,7 @@

diff --git a/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.html b/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.html index adf5a266..0236eb33 100644 --- a/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.html +++ b/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.html @@ -26,6 +26,7 @@

diff --git a/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.ts b/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.ts index 4856b244..acb1298f 100644 --- a/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.ts +++ b/src/app/app-provider-admin/super-admin/super-admin/Activities/service-provider-master/service-provider-master.component.ts @@ -26,6 +26,8 @@ import { dataService } from 'src/app/core/services/dataService/data.service'; import { SuperAdmin_ServiceProvider_Service } from 'src/app/core/services/adminServices/AdminServiceProvider/superadmin_serviceprovider.service'; import { MatTableDataSource } from '@angular/material/table'; import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; + @Component({ selector: 'app-service-provider-master', @@ -108,6 +110,11 @@ export class ServiceProviderMasterComponent implements OnInit { this.getAllProviders(); } + @ViewChild(MatSort) sort!: MatSort; + ngAfterViewInit() { + this.filteredsearchResult.sort = this.sort; + } + showTable() { if (this.editMode) { this.tableMode = true; diff --git a/src/app/app-provider-admin/super-admin/super-admin/Activities/village-master/village-master.component.html b/src/app/app-provider-admin/super-admin/super-admin/Activities/village-master/village-master.component.html index 7e87a076..f4b3c30f 100644 --- a/src/app/app-provider-admin/super-admin/super-admin/Activities/village-master/village-master.component.html +++ b/src/app/app-provider-admin/super-admin/super-admin/Activities/village-master/village-master.component.html @@ -98,6 +98,7 @@

Create Village

@@ -387,6 +388,7 @@

Create Village

diff --git a/src/app/core/material.module.ts b/src/app/core/material.module.ts index 304ea092..cda068d1 100644 --- a/src/app/core/material.module.ts +++ b/src/app/core/material.module.ts @@ -12,10 +12,13 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatSidenavModule } from '@angular/material/sidenav'; import { MatDialogModule } from '@angular/material/dialog'; import { MatSelectModule } from '@angular/material/select'; +import { MatOptionModule } from '@angular/material/core'; import { MatMenuModule } from '@angular/material/menu'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatButtonModule } from '@angular/material/button'; import { MatInputModule } from '@angular/material/input'; +import { MatFormFieldModule } from '@angular/material/form-field'; import { MatRadioModule } from '@angular/material/radio'; import { MatStepperModule } from '@angular/material/stepper'; import { MatExpansionModule } from '@angular/material/expansion'; @@ -25,6 +28,7 @@ import { MatListModule } from '@angular/material/list'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatTableModule } from '@angular/material/table'; +import { MatSortModule } from '@angular/material/sort'; @NgModule({ imports: [ @@ -40,9 +44,12 @@ import { MatTableModule } from '@angular/material/table'; MatDialogModule, MatProgressSpinnerModule, MatSelectModule, + MatOptionModule, MatButtonToggleModule, + MatButtonModule, MatSlideToggleModule, MatInputModule, + MatFormFieldModule, MatRadioModule, MatStepperModule, MatExpansionModule, @@ -54,6 +61,7 @@ import { MatTableModule } from '@angular/material/table'; MatListModule, MatSnackBarModule, MatTableModule, + MatSortModule, ], providers: [], exports: [ @@ -70,9 +78,12 @@ import { MatTableModule } from '@angular/material/table'; MatDialogModule, MatProgressSpinnerModule, MatSelectModule, + MatOptionModule, MatButtonToggleModule, + MatButtonModule, MatSlideToggleModule, MatInputModule, + MatFormFieldModule, MatRadioModule, MatStepperModule, MatExpansionModule, @@ -83,6 +94,8 @@ import { MatTableModule } from '@angular/material/table'; MatProgressBarModule, MatListModule, MatSnackBarModule, + MatTableModule, + MatSortModule, ], }) export class MaterialModule {} diff --git a/src/app/core/services/httpInterceptor/http-interceptor.service.ts b/src/app/core/services/httpInterceptor/http-interceptor.service.ts index c8d9029a..0599f51a 100644 --- a/src/app/core/services/httpInterceptor/http-interceptor.service.ts +++ b/src/app/core/services/httpInterceptor/http-interceptor.service.ts @@ -82,7 +82,29 @@ export class HttpInterceptorService implements HttpInterceptor { }), catchError((error: HttpErrorResponse) => { console.error(error); - + if(error.status === 401){ + this.sessionstorage.clear(); + this.confirmationService.alert('Session expired. Please login again.', 'error'); + + } else if (error.status === 403) { + this.confirmationService.alert( + 'Access Denied', + 'error', + ); + } else if (error.status === 500) { + this.confirmationService.alert( + 'Internal Server Error', + 'error', + ); + } else { + this.confirmationService.alert( + error.message || 'Something went wrong', + 'error', + ); + } + this.router.navigate(['/login']); + sessionStorage.clear(); + this.sessionstorage.clear(); this.spinnerService.setLoading(false); return throwError(error.error); }), @@ -110,7 +132,6 @@ export class HttpInterceptorService implements HttpInterceptor { console.log('there', Date()); if ( - this.sessionstorage.getItem('authenticationToken') && sessionStorage.getItem('isAuthenticated') ) { this.confirmationService @@ -130,7 +151,7 @@ export class HttpInterceptorService implements HttpInterceptor { this.sessionstorage.clear(); localStorage.clear(); this.confirmationService.alert( - this.currentLanguageSet.sessionExpired, + this.currentLanguageSet.sessionExpired || 'Your session has expired. Please login again.', 'error', ); this.router.navigate(['/login']); @@ -140,7 +161,7 @@ export class HttpInterceptorService implements HttpInterceptor { this.sessionstorage.clear(); localStorage.clear(); this.confirmationService.alert( - this.currentLanguageSet.sessionExpired, + this.currentLanguageSet.sessionExpired || 'Your session has expired. Please login again.', 'error', ); this.router.navigate(['/login']); diff --git a/src/assets/bulkuser_excel_sheet.xlsx b/src/assets/bulkuser_excel_sheet.xlsx new file mode 100644 index 00000000..f52d752c Binary files /dev/null and b/src/assets/bulkuser_excel_sheet.xlsx differ diff --git a/src/environments/environment.ci.ts.template b/src/environments/environment.ci.ts.template index 689ebe42..e20a5326 100644 --- a/src/environments/environment.ci.ts.template +++ b/src/environments/environment.ci.ts.template @@ -505,6 +505,10 @@ export const environment = { siteKey: siteKey, captchaChallengeURL: captchaChallengeURL, - enableCaptcha: enableCaptcha + enableCaptcha: enableCaptcha, + // Missing properties that services are trying to use + getXMLDataUploadUrl: `${adminBaseUrl}bulkRegistration`, + getDataUploadErrorExcel: `${adminBaseUrl}download-error-sheet`, + signatureStatus: `${adminBaseUrl}signature1/activateOrdeActivateSignature` }; diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 0bd86903..79107641 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -83,6 +83,7 @@ export const environment = { getQuestionType_url: `${commonBaseURL}questionTypeController/get/questionTypeList`, editQuestionnaire_url: `${adminBaseUrl}editQuestionnaire`, getBlockSubcentreDataUploadUrl: `${adminBaseUrl}uptsu/saveFacility`, + getServiceLines_newrole_url: `${adminBaseUrl}m/role/serviceNew`, getStates_newparking_url: `${adminBaseUrl}m/role/stateNew`, _getZonesParkURL: `${adminBaseUrl}zonemaster/get/zones`, @@ -505,4 +506,9 @@ export const environment = { siteKey: siteKey, captchaChallengeURL: captchaChallengeURL, enableCaptcha: enableCaptcha, + + // Missing properties that services are trying to use + getXMLDataUploadUrl: `${adminBaseUrl}bulkRegistration`, + getDataUploadErrorExcel: `${adminBaseUrl}download-error-sheet`, + signatureStatus: `${adminBaseUrl}signature1/status`, }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index e1090e6e..beac063c 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -506,4 +506,9 @@ export const environment = { siteKey: siteKey, captchaChallengeURL: captchaChallengeURL, enableCaptcha: enableCaptcha, + + // Missing properties that services are trying to use + getXMLDataUploadUrl: `${adminBaseUrl}bulkRegistration`, + getDataUploadErrorExcel: `${adminBaseUrl}download-error-sheet`, + signatureStatus: `${adminBaseUrl}signature1/status`, }; diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 44d123c6..3300c1fb 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -498,4 +498,9 @@ export const environment = { //ABDM Facility getAbdmFacilities: `${fhirBaseUrl}facility/getAbdmRegisteredFacilities`, + + // Missing properties that services are trying to use + getXMLDataUploadUrl: `${adminBaseUrl}bulkRegistration`, + getDataUploadErrorExcel: `${adminBaseUrl}download-error-sheet`, + signatureStatus: `${adminBaseUrl}signature1/status`, };