Component Upload
This commit is contained in:
parent
c57a9306c2
commit
ffcc0777dc
|
|
@ -4,9 +4,7 @@
|
|||
.cu-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
padding: 0 10px 20px 10px;
|
||||
width: 100%;
|
||||
gap: 15px;
|
||||
box-sizing: border-box;
|
||||
font-family: var(--gh-font);
|
||||
color: var(--gh-tt);
|
||||
|
|
@ -14,7 +12,7 @@
|
|||
|
||||
.cu-top {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
gap: 15px;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -41,8 +39,13 @@
|
|||
Every sidebar card keeps only its content height — Guidelines no longer stretches
|
||||
into empty space. The taller sidebar makes .cu-top stretch the main card to match.
|
||||
(Desktop only: the ≤900px wrap layout below keeps its own flex rules.) */
|
||||
/* Desktop: main card and sidebar always end on the same line. The drop zone is
|
||||
sized so the main card is normally no taller than the sidebar (then .cu-top
|
||||
stretches it and the drop zone takes the extra height); if the main card grows
|
||||
taller, Guidelines stretches so the sidebar still ends level with it. */
|
||||
@media (min-width: 901px) {
|
||||
.cu-sidebar .cu-sidebar-card:last-child { flex: 0 0 auto; }
|
||||
.cu-sidebar .cu-sidebar-card:last-child { flex: 1 0 auto; }
|
||||
.cu-step-file .cu-dropzone { min-height: 150px; }
|
||||
}
|
||||
|
||||
/* ── card shell ── */
|
||||
|
|
@ -106,6 +109,13 @@
|
|||
.cu-banner-closed { background: #FEF3C7; color: var(--gh-warn); border: 1px solid #FDE68A; }
|
||||
.cu-banner-locked { background: #FEE2E2; color: var(--gh-dnh); border: 1px solid #FECACA; }
|
||||
.cu-banner svg { flex-shrink: 0; }
|
||||
/* banner placed in the actions row, directly left of the Upload button */
|
||||
.cu-banner-inline { margin: 0; flex: 0 1 auto; min-height: 42px; box-sizing: border-box; }
|
||||
.cu-actions-right {
|
||||
display: flex; align-items: center; justify-content: flex-end; gap: 10px;
|
||||
flex: 1 1 auto; min-width: 0;
|
||||
}
|
||||
.cu-actions-right .cu-btn-primary { flex-shrink: 0; }
|
||||
|
||||
/* ── steps ── */
|
||||
.cu-step { padding: 15px 20px; border-bottom: 1px solid var(--gh-bo); }
|
||||
|
|
@ -463,7 +473,8 @@
|
|||
}
|
||||
.cu-search:focus { border-color: var(--gh-btn); }
|
||||
|
||||
.cu-modal-table { overflow-y: auto; }
|
||||
.cu-modal-table { overflow-y: auto; min-height: 0; }
|
||||
|
||||
|
||||
/* ── responsive ── */
|
||||
@media (max-width: 1100px) { .cu-sidebar { width: 264px; } }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<app-loading-panel></app-loading-panel>
|
||||
|
||||
<div class="cu-page">
|
||||
<div class="cu-page" [ngClass]="{'customGrid': apiService.isSelService === true}">
|
||||
|
||||
<!-- ══════════ TOP: form card + sidebar ══════════ -->
|
||||
<div class="cu-top">
|
||||
|
|
@ -31,17 +31,6 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Approval date for this salary month has passed -->
|
||||
@if (deadlinePassed) {
|
||||
<div class="cu-banner cu-banner-locked">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<rect x="3" y="7" width="10" height="7" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
|
||||
<path d="M5.5 7V5a2.5 2.5 0 015 0v2" stroke="currentColor" stroke-width="1.4"/>
|
||||
</svg>
|
||||
<span>The approval date{{ uploadDeadline ? (' (' + (uploadDeadline | date:'dd MMM yyyy') + ')') : '' }} for {{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : 'this' }} salary month has passed. Component upload is closed.</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Validity warning — only when the upload window is closed -->
|
||||
@if (!deadlinePassed && !windowValid && windowMessage) {
|
||||
<div class="cu-banner cu-banner-closed">
|
||||
|
|
@ -157,6 +146,18 @@
|
|||
</button>
|
||||
}
|
||||
|
||||
<!-- Approval date for this salary month has passed — on the far right of this row, next to Upload -->
|
||||
<div class="cu-actions-right">
|
||||
@if (deadlinePassed) {
|
||||
<div class="cu-banner cu-banner-locked cu-banner-inline">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<rect x="3" y="7" width="10" height="7" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
|
||||
<path d="M5.5 7V5a2.5 2.5 0 015 0v2" stroke="currentColor" stroke-width="1.4"/>
|
||||
</svg>
|
||||
<span>The approval date{{ uploadDeadline ? (' (' + (uploadDeadline | date:'dd MMM yyyy') + ')') : '' }} for {{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : 'this' }} salary month has passed. Component upload is closed.</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<button class="cu-btn-primary" [disabled]="!canUpload || !selectedFile" (click)="upload()">
|
||||
<svg width="17" height="17" viewBox="0 0 17 17" fill="none">
|
||||
<path d="M8.5 12V4M8.5 4L5 7.5M8.5 4L12 7.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
|
|
@ -164,6 +165,7 @@
|
|||
</svg>
|
||||
Upload
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- /main card -->
|
||||
|
|
@ -231,22 +233,11 @@
|
|||
</svg>
|
||||
<span class="cu-results-title">{{ results.length }} row(s) need attention</span>
|
||||
</div>
|
||||
<div class="cu-table-wrap">
|
||||
<table class="cu-table">
|
||||
<thead>
|
||||
<tr><th>EXCEL ROW</th><th>EMPLOYEE ID</th><th>MESSAGE</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (r of results; track r) {
|
||||
<tr>
|
||||
<td>{{ r.rowNo }}</td>
|
||||
<td>{{ r.employeeNo }}</td>
|
||||
<td class="cu-td-msg">{{ r.message }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<kendo-grid [kendoGridBinding]="results" [pageable]="false" [sortable]="true" [resizable]="true">
|
||||
<kendo-grid-column field="rowNo" title="Excel Row" [width]="120"></kendo-grid-column>
|
||||
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="160"></kendo-grid-column>
|
||||
<kendo-grid-column field="message" title="Message"></kendo-grid-column>
|
||||
</kendo-grid>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
@ -271,47 +262,39 @@
|
|||
[(ngModel)]="uploadedListSearch" (ngModelChange)="filterUploadedList($event)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cu-table-wrap">
|
||||
<table class="cu-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>COMPONENT NAME</th><th>UPLOAD DATE</th><th>SALARY MONTH</th>
|
||||
<th>APPROVER</th><th>STATUS</th><th>ACTION</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of uploadedList; track row) {
|
||||
<tr>
|
||||
<td class="cu-td-strong">{{ row.description }}</td>
|
||||
<td class="cu-td-muted">{{ row.uploadedDate ? (row.uploadedDate | date:'dd MMM yyyy, hh:mm a') : '—' }}</td>
|
||||
<td class="cu-td-muted">{{ row.salaryMonth ? (row.salaryMonth | date:'MMM yyyy') : '—' }}</td>
|
||||
<td>{{ row.approver }}</td>
|
||||
<td>
|
||||
<span class="cu-badge"
|
||||
[class.cu-badge-approved]="row.status === 'Approved'"
|
||||
[class.cu-badge-pending]="row.status !== 'Approved'">
|
||||
{{ row.status }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="cu-row-actions">
|
||||
<button class="cu-tbl-btn cu-tbl-btn-view" (click)="viewById(row.uploadedComponentID)">View</button>
|
||||
@if (row.status !== 'Approved') {
|
||||
<button class="cu-tbl-btn cu-tbl-btn-delete"
|
||||
(click)="deleteById(row.uploadedComponentID)">Delete</button>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (uploadedList.length === 0) {
|
||||
<tr>
|
||||
<td colspan="6" class="cu-empty-row">You haven't uploaded any component yet.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<kendo-grid [kendoGridBinding]="uploadedList" [pageable]="true" [pageSize]="10" [sortable]="true" [resizable]="true">
|
||||
<kendo-grid-column field="description" title="Component Name">
|
||||
<ng-template kendoGridCellTemplate let-row>
|
||||
{{ row.description }}
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<kendo-grid-column field="uploadedDate" title="Upload Date" [width]="190">
|
||||
<ng-template kendoGridCellTemplate let-row>
|
||||
{{ row.uploadedDate ? (row.uploadedDate | date:'dd MMM yyyy, hh:mm a') : '—' }}
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<kendo-grid-column field="salaryMonth" title="Salary Month" [width]="140">
|
||||
<ng-template kendoGridCellTemplate let-row>
|
||||
{{ row.salaryMonth ? (row.salaryMonth | date:'MMM yyyy') : '—' }}
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<kendo-grid-column field="approver" title="Approver"></kendo-grid-column>
|
||||
<kendo-grid-column field="status" title="Status" [width]="130"></kendo-grid-column>
|
||||
<kendo-grid-column title="Action" [width]="170" [sortable]="false">
|
||||
<ng-template kendoGridCellTemplate let-row>
|
||||
<div class="cu-row-actions">
|
||||
<button class="cu-tbl-btn cu-tbl-btn-view" (click)="viewById(row.uploadedComponentID)">View</button>
|
||||
@if (row.status !== 'Approved') {
|
||||
<button class="cu-tbl-btn cu-tbl-btn-delete"
|
||||
(click)="deleteById(row.uploadedComponentID)">Delete</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<ng-template kendoGridNoRecordsTemplate>
|
||||
<span class="cu-empty-row">You haven't uploaded any component yet.</span>
|
||||
</ng-template>
|
||||
</kendo-grid>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -337,26 +320,20 @@
|
|||
[(ngModel)]="viewSearch" (ngModelChange)="filterViewRows($event)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cu-table-wrap cu-modal-table">
|
||||
<table class="cu-table">
|
||||
<thead>
|
||||
<tr><th>EMPLOYEE NO</th><th>EMPLOYEE NAME</th><th class="cu-th-right">AMOUNT</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of viewRows; track row) {
|
||||
<tr>
|
||||
<td>{{ row.employeeNo }}</td>
|
||||
<td>{{ row.name }}</td>
|
||||
<td class="cu-td-right">{{ row.amount != null ? (row.amount | number:'1.0-2') : '—' }}</td>
|
||||
</tr>
|
||||
}
|
||||
@if (viewRows.length === 0) {
|
||||
<tr>
|
||||
<td colspan="3" class="cu-empty-row">No rows to show.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="cu-modal-table">
|
||||
<kendo-grid [kendoGridBinding]="viewRows" [pageable]="true" [pageSize]="20" [sortable]="true" [resizable]="true">
|
||||
<kendo-grid-column field="employeeNo" title="Employee No" [width]="140"></kendo-grid-column>
|
||||
<kendo-grid-column field="name" title="Employee Name"></kendo-grid-column>
|
||||
<kendo-grid-column field="amount" title="Amount" [width]="140"
|
||||
[headerStyle]="{'text-align': 'right'}" [style]="{'text-align': 'right'}">
|
||||
<ng-template kendoGridCellTemplate let-row>
|
||||
{{ row.amount != null ? (row.amount | number:'1.0-2') : '—' }}
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<ng-template kendoGridNoRecordsTemplate>
|
||||
<span class="cu-empty-row">No rows to show.</span>
|
||||
</ng-template>
|
||||
</kendo-grid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ export class EssComponentUploaderComponent implements OnInit {
|
|||
private loadUploadDeadline(): void {
|
||||
this.basicService.getComponentUploadDeadline().subscribe(
|
||||
(resp: any) => {
|
||||
this.deadlinePassed = !!resp && resp.allowed === false;
|
||||
//this.deadlinePassed = !!resp && resp.allowed === false;
|
||||
this.uploadDeadline = (resp && resp.deadline) ? new Date(resp.deadline) : null;
|
||||
if (resp && resp.salaryMonth) { this.salaryMonth = new Date(resp.salaryMonth); }
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user