From 77321b60ffe5485559f333a61a02dff5bb1a5890 Mon Sep 17 00:00:00 2001 From: Mohaimen Hasan Date: Mon, 16 Nov 2026 16:17:32 +0600 Subject: [PATCH] System Configuration new design --- .../system-configuration.component.css | 234 +++++++++++++++++- .../system-configuration.component.html | 152 +++++++++--- .../system-configuration.component.ts | 62 +++++ 3 files changed, 412 insertions(+), 36 deletions(-) diff --git a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.css b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.css index e02abfc..78cc49b 100644 --- a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.css +++ b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.css @@ -1 +1,233 @@ - +.sc-page { + /* padding: 1.5rem; */ +} +.sc-header { + display: flex; + align-items: center; + gap: 14px; + margin-bottom: 0.5rem; +} +.sc-header-icon { + width: 44px; + height: 44px; + border-radius: 10px; + background: #f0f0f0; + display: flex; + align-items: center; + justify-content: center; + font-size: 20px; + color: #555; + flex-shrink: 0; +} +.sc-title { + font-size: 18px; + font-weight: 600; + color: #1a1a1a; + margin: 0 0 2px; +} +.sc-subtitle { + font-size: 13px; + color: #888; + margin: 0; +} +.sc-card { + background: #fff; + border: 1px solid #e8e8e8; + border-radius: 12px; + padding: 0.85rem; +} +.sc-field { + margin-bottom: 0.5rem; +} +.sc-label { + display: block; + font-size: 12px; + font-weight: 600; + color: #888; + text-transform: uppercase; + letter-spacing: 0.05em; + margin-bottom: 8px; +} +.sc-drop-zone { + border: 1.5px dashed #d4d4d4; + border-radius: 10px; + transition: border-color 0.15s, background 0.15s; + overflow: hidden; +} +.sc-drop-zone--dragging { + border-color: #4a90d9; + background: #f0f6fd; +} +.sc-drop-zone--has-file { + border-style: solid; + border-color: #c8e0f7; + background: #f7fbff; +} +.sc-drop-empty { + padding: 1rem 1rem; + text-align: center; +} +.sc-drop-icon { + font-size: 28px; + color: #bbb; + display: block; + margin-bottom: 10px; +} +.sc-drop-label { + font-size: 14px; + color: #777; + margin: 0 0 4px; +} +.sc-drop-hint { + font-size: 13px; + color: #aaa; + margin: 0 0 12px; +} +.sc-browse-btn { + display: inline-block; + padding: 6px 18px; + border: 1px solid #4a90d9; + border-radius: 6px; + font-size: 13px; + font-weight: 500; + color: #4a90d9; + cursor: pointer; + transition: background 0.15s; +} +.sc-browse-btn:hover { + background: #f0f6fd; +} +.sc-drop-selected { + padding: 12px 14px; +} +.sc-file-info { + display: flex; + align-items: center; + gap: 12px; +} +.sc-file-icon-wrap { + width: 38px; + height: 38px; + border-radius: 8px; + background: #e8f2fd; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} +.sc-file-icon { + font-size: 18px; + color: #4a90d9; +} +.sc-file-details { + display: flex; + flex-direction: column; + flex: 1; + min-width: 0; +} +.sc-file-name { + font-size: 14px; + font-weight: 500; + color: #1a1a1a; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.sc-file-size { + font-size: 12px; + color: #aaa; + margin-top: 2px; +} +.sc-file-clear { + background: none; + border: none; + cursor: pointer; + color: #bbb; + padding: 4px; + display: flex; + align-items: center; + border-radius: 4px; + transition: color 0.15s, background 0.15s; + flex-shrink: 0; +} +.sc-file-clear:hover { + color: #e24b4a; + background: #fef0f0; +} +.sc-drop-restriction { + font-size: 12px; + color: #aaa; + margin-top: 6px; +} +.sc-drop-restriction code { + font-family: monospace; + background: #f4f4f4; + padding: 1px 5px; + border-radius: 4px; + font-size: 11px; + color: #666; +} +.sc-divider { + border: none; + border-top: 1px solid #f0f0f0; + margin: 1.25rem 0; +} +.sc-btn-row { + display: flex; + gap: 10px; +} +.sc-btn { + display: inline-flex; + align-items: center; + gap: 7px; + height: 38px; + padding: 0 18px; + border-radius: 8px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: background 0.15s, opacity 0.15s, transform 0.1s; + border: 1px solid transparent; +} +.sc-btn:active:not(:disabled) { + transform: scale(0.98); +} +.sc-btn:disabled { + opacity: 0.4; + cursor: not-allowed; +} +.sc-btn--primary { + background: #1a1a1a; + color: #fff; + border-color: #1a1a1a; +} +.sc-btn--primary:hover:not(:disabled) { + background: #333; +} +.sc-btn--secondary { + background: #fff; + color: #1a1a1a; + border-color: #ddd; +} +.sc-btn--secondary:hover:not(:disabled) { + background: #f7f7f7; +} +.sc-status { + display: flex; + align-items: center; + gap: 8px; + font-size: 13px; + margin-top: 14px; + padding: 10px 14px; + border-radius: 8px; +} +.sc-status--success { + background: #f0faf4; + color: #2e7d52; + border: 1px solid #c3e8d4; +} +.sc-status--error { + background: #fff5f5; + color: #c0392b; + border: 1px solid #f5c6c6; +} \ No newline at end of file diff --git a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.html b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.html index b9d3f90..a6b7e20 100644 --- a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.html +++ b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.html @@ -1,36 +1,118 @@ - -
-
-
- -
-
-
-
-
-

Configuration Type:

-
-
-
- - -
-
- -
-
- -
-
- -
-
-
+ + +
+ + +
+
+
-
+
+

System Configuration

+

Upload or download XML configuration files

+
+
+ + +
+ + +
+ + + +
+ + +
+ + +
+ + +
+ +

Drag & drop your XML file here

+

or

+ + +
+ + +
+
+
+ +
+
+ {{ selectedFileName }} + {{ selectedFileSize }} +
+ +
+
+
+ +

Only .xml files are accepted

+
+ +
+ + +
+ + + +
+ + +
+ + + {{ statusMessage }} +
+ +
+
\ No newline at end of file diff --git a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.ts b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.ts index 34f42d7..674bb2b 100644 --- a/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.ts +++ b/HRM.UI/ClientApp/src/app/authentication/system-configuration/system-configuration.component.ts @@ -59,6 +59,13 @@ export class SystemConfigurationComponent implements OnInit { _fromValidator: FormGroup; selectedFiles?: FileList; + // UI state for the redesigned template + public isDragging = false; + public selectedFileName = ''; + public selectedFileSize = ''; + public statusType: 'success' | 'error' | '' = ''; + public statusMessage = ''; + configtypes: any = EnumExtension.getNamesAndValues(EnumConfigurationType); constructor(public systemConfigService: SystemConfigurationService, @@ -160,10 +167,14 @@ export class SystemConfigurationComponent implements OnInit { (err) => { this.loadingPanelService.ShowLoadingPanel = false; this.notificationService.showError(err.error); + this.statusType = 'error'; + this.statusMessage = err.error; }, () => { this.loadingPanelService.ShowLoadingPanel = false; this.notificationService.showSuccess("Data uploaded successfully.") + this.statusType = 'success'; + this.statusMessage = 'File uploaded successfully.'; }); } @@ -279,12 +290,63 @@ export class SystemConfigurationComponent implements OnInit { selectFile(event: any): void { this.selectedFiles = event.target.files; + if (this.selectedFiles && this.selectedFiles.length > 0) { + const file = this.selectedFiles.item(0); + this.selectedFileName = file.name; + this.selectedFileSize = this.formatFileSize(file.size); + this.statusType = ''; + this.statusMessage = ''; + } //if (this.selectedFiles.length > 0) { // const file: File | null = this.selectedFiles.item(0); // this.selectedFiles = file; //} } + onDragOver(event: DragEvent): void { + event.preventDefault(); + this.isDragging = true; + } + onDragLeave(): void { + this.isDragging = false; + } + onDrop(event: DragEvent): void { + event.preventDefault(); + this.isDragging = false; + const files = event.dataTransfer?.files; + if (files && files.length > 0) { + const file = files[0]; + if (!file.name.endsWith('.xml')) { + this.notificationService.showWarning('Only .xml files are accepted.'); + return; + } + const dt = new DataTransfer(); + dt.items.add(file); + this.selectedFiles = dt.files; + this.selectedFileName = file.name; + this.selectedFileSize = this.formatFileSize(file.size); + this.statusType = ''; + this.statusMessage = ''; + } + } + clearFile(): void { + this.selectedFiles = null; + this.selectedFileName = ''; + this.selectedFileSize = ''; + this.statusType = ''; + this.statusMessage = ''; + } + formatFileSize(bytes: number): string { + if (bytes < 1024) return bytes + ' B'; + if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB'; + return (bytes / (1024 * 1024)).toFixed(1) + ' MB'; + } + get canUpload(): boolean { + return !!this.fileTypeid && !!this.selectedFiles && this.selectedFiles.length > 0; + } + get canDownload(): boolean { + return !!this.fileTypeid; + } public downloadFile(uid: string): void { const temporiginalName = ''; let tempName = '';