225 lines
16 KiB
HTML
225 lines
16 KiB
HTML
<app-loading-panel></app-loading-panel>
|
|
|
|
<div class="lfa-page">
|
|
<app-tab-view [(activeIndex)]="selectedTab" [scrollable]="true" (onChange)="onTabSelect($event.index)">
|
|
<!-- ================= LFA Request (design only for now) ================= -->
|
|
<app-tab-panel header="LFA Request ({{ requests.length }})" leftIcon="pi pi-list">
|
|
@if (selectedTab === 0) {
|
|
<div class="lfa-tab">
|
|
<div class="lfa-toolbar">
|
|
<div class="lfa-field lfa-field--wide">
|
|
<label>Search</label>
|
|
<kendo-textbox [(ngModel)]="requestSearch" placeholder="ID, name, designation…" [clearButton]="true"></kendo-textbox>
|
|
</div>
|
|
<div class="lfa-field">
|
|
<label>Department</label>
|
|
<kendo-dropdownlist [data]="[allDepartments]" [(ngModel)]="requestDepartment"></kendo-dropdownlist>
|
|
</div>
|
|
<div class="lfa-field">
|
|
<label>LFA Start From</label>
|
|
<kendo-datepicker [format]="'dd-MMM-yyyy'" [(ngModel)]="requestFrom"></kendo-datepicker>
|
|
</div>
|
|
<div class="lfa-field">
|
|
<label>LFA Start To</label>
|
|
<kendo-datepicker [format]="'dd-MMM-yyyy'" [(ngModel)]="requestTo"></kendo-datepicker>
|
|
</div>
|
|
<button class="gh-reset" kendoButton type="button" fillMode="outline" [svgIcon]="apiService.KendoSVGIcon['undo']" (click)="resetRequestFilter()">Reset</button>
|
|
<span class="lfa-spacer"></span>
|
|
<button class="gh-excel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['fileExcel']" [disabled]="true">Export</button>
|
|
<button class="gh-process" kendoButton type="button" themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['forward']" [disabled]="true">Payment Proceed</button>
|
|
</div>
|
|
<div class="lfa-info">Approved LFA requests awaiting payment · <b>0</b> selected · Est. LFA amount <b>0.00</b></div>
|
|
<kendo-grid [kendoGridBinding]="requests" [pageable]="true" [pageSize]="10" [sortable]="true" [height]="420">
|
|
<kendo-grid-checkbox-column [width]="45" [showSelectAll]="requests.length > 0"></kendo-grid-checkbox-column>
|
|
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="120"></kendo-grid-column>
|
|
<kendo-grid-column field="name" title="Name" [width]="180"></kendo-grid-column>
|
|
<kendo-grid-column field="designationName" title="Designation" [width]="160"></kendo-grid-column>
|
|
<kendo-grid-column field="departmentName" title="Department" [width]="160"></kendo-grid-column>
|
|
<kendo-grid-column field="joiningDate" title="Joining Date" [width]="120"></kendo-grid-column>
|
|
<kendo-grid-column field="service" title="Service (Yrs)" [width]="110"></kendo-grid-column>
|
|
<kendo-grid-column field="leaveFromDate" title="LFA Start Date" [width]="130"></kendo-grid-column>
|
|
<kendo-grid-column field="leaveToDate" title="LFA End Date" [width]="130"></kendo-grid-column>
|
|
<kendo-grid-column field="leaveDays" title="Days" [width]="80"></kendo-grid-column>
|
|
<ng-template kendoGridNoRecordsTemplate>No records found.</ng-template>
|
|
</kendo-grid>
|
|
</div>
|
|
}
|
|
</app-tab-panel>
|
|
|
|
<!-- ================= New LFA Payment ================= -->
|
|
<app-tab-panel header="New LFA Payment ({{ rows.length }})" leftIcon="pi pi-money-bill">
|
|
@if (selectedTab === 1) {
|
|
<div class="lfa-tab">
|
|
<div class="lfa-toolbar">
|
|
<div class="lfa-field">
|
|
<label>Payment Date <span class="lfa-required">*</span></label>
|
|
<kendo-datepicker [format]="'dd-MMM-yyyy'" [(ngModel)]="paymentDate" (valueChange)="paymentDate = $event; onPaymentInfoChange()"></kendo-datepicker>
|
|
</div>
|
|
<!-- same file input as /common-interface/data-upload, on the right of the Payment Date -->
|
|
<div class="lfa-upload">
|
|
<input #fileInput id="fupLFAPayment" kendoTextBox type="file" accept=".xlsx" class="lfa-upload__file"
|
|
(click)="clearSelectedFile()" (change)="selectFile($event)">
|
|
<button class="k-button k-primary gh-import" type="button" kendoButton
|
|
[svgIcon]="apiService.KendoSVGIcon['upload']" [disabled]="isBusy || !selectedFile" (click)="uploadFile()">
|
|
Upload
|
|
</button>
|
|
<button class="k-button k-primary gh-download" type="button" kendoButton
|
|
[svgIcon]="apiService.KendoSVGIcon['download']" (click)="downloadTemplate()">
|
|
Sample File Download
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="lfa-toolbar">
|
|
<div class="lfa-field lfa-field--remarks">
|
|
<label>Remarks</label>
|
|
<kendo-textbox [(ngModel)]="remarks" [maxlength]="500" placeholder="e.g. LFA for December 2026"></kendo-textbox>
|
|
</div>
|
|
<span class="lfa-spacer"></span>
|
|
<button class="gh-reset" kendoButton type="button" fillMode="outline" [svgIcon]="apiService.KendoSVGIcon['cross']" [disabled]="isBusy" (click)="clear()">Clear</button>
|
|
<button class="gh-excel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['fileExcel']" [disabled]="rows.length === 0" (click)="paymentGrid.saveAsExcel()">Export</button>
|
|
<button class="gh-process" kendoButton type="button" themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['gear']" [disabled]="isBusy || rows.length === 0" (click)="confirmProcess()">Process Payment</button>
|
|
</div>
|
|
|
|
<div class="lfa-summary">
|
|
<div class="lfa-stat"><div class="lfa-stat__key">Employees</div><div class="lfa-stat__value">{{ rows.length }}</div></div>
|
|
<div class="lfa-stat"><div class="lfa-stat__key">Total Basic Salary</div><div class="lfa-stat__value">{{ totalBasic | number: '1.2-2' }}</div></div>
|
|
<div class="lfa-stat"><div class="lfa-stat__key">Total LFA Amount (BDT)</div><div class="lfa-stat__value">{{ totalAmount | number: '1.2-2' }}</div></div>
|
|
<div class="lfa-stat"><div class="lfa-stat__key">Batch ID (on process)</div><div class="lfa-stat__value">{{ rows.length > 0 && info ? info.nextBatchNumber : '—' }}</div></div>
|
|
</div>
|
|
|
|
<!-- virtual scrolling: only the rows on screen are rendered -->
|
|
<kendo-grid #paymentGrid="kendoGrid" [kendoGridBinding]="rows" scrollable="virtual" [rowHeight]="40" [pageSize]="50"
|
|
[sortable]="true" [resizable]="true" [height]="430">
|
|
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="120">
|
|
<ng-template kendoGridFooterTemplate>Total</ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-column field="name" title="Name" [width]="210" [style]="{ 'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis' }">
|
|
<ng-template kendoGridFooterTemplate>{{ rows.length }} employees</ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-column field="designationName" title="Designation" [width]="190" [style]="{ 'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis' }"></kendo-grid-column>
|
|
<kendo-grid-column field="departmentName" title="Department" [width]="190" [style]="{ 'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis' }"></kendo-grid-column>
|
|
<kendo-grid-column field="joiningDate" title="Joining Date" [width]="130" format="dd-MMM-yyyy"></kendo-grid-column>
|
|
<kendo-grid-column field="serviceLength" title="Service Length" [width]="190" [sortable]="false"></kendo-grid-column>
|
|
<kendo-grid-column field="basicSalary" title="Basic Salary" [width]="140" format="n2" [style]="{ 'text-align': 'right' }" [headerStyle]="{ 'text-align': 'right', 'justify-content': 'flex-end' }">
|
|
<ng-template kendoGridFooterTemplate><div class="lfa-right">{{ totalBasic | number: '1.2-2' }}</div></ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-column field="amount" title="LFA Amount" [width]="140" format="n2" [style]="{ 'text-align': 'right', 'font-weight': '600' }" [headerStyle]="{ 'text-align': 'right', 'justify-content': 'flex-end' }">
|
|
<ng-template kendoGridFooterTemplate><div class="lfa-right">{{ totalAmount | number: '1.2-2' }}</div></ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-command-column title="Action" [width]="75">
|
|
<ng-template kendoGridCellTemplate let-dataItem>
|
|
<button type="button" kendoButton class="kt-delete" title="Remove" [svgIcon]="apiService.KendoSVGIcon['delete']" (click)="removeRow(dataItem)"></button>
|
|
</ng-template>
|
|
</kendo-grid-command-column>
|
|
<ng-template kendoGridNoRecordsTemplate>No employees yet. Upload the Excel file.</ng-template>
|
|
<kendo-grid-excel fileName="LFA-Payment.xlsx" [fetchData]="allPaymentRows"></kendo-grid-excel>
|
|
</kendo-grid>
|
|
|
|
@if (issues.length > 0) {
|
|
<div class="lfa-issues__head">
|
|
<span>{{ issues.length }} error(s) found. Nothing was calculated: correct every error in the file and upload it again.</span>
|
|
<button class="gh-view" kendoButton type="button" fillMode="outline" [svgIcon]="apiService.KendoSVGIcon['eye']" (click)="showIssues = true">View Errors</button>
|
|
</div>
|
|
}
|
|
|
|
<div class="lfa-note">Uploaded file columns: Employee ID, Name. Amounts in BDT.</div>
|
|
</div>
|
|
}
|
|
</app-tab-panel>
|
|
|
|
<!-- ================= Payment History ================= -->
|
|
<app-tab-panel header="Payment History" leftIcon="pi pi-history">
|
|
@if (selectedTab === 2) {
|
|
<div class="lfa-tab">
|
|
<div class="lfa-toolbar">
|
|
<div class="lfa-field">
|
|
<label>Start Date <span class="lfa-required">*</span></label>
|
|
<kendo-datepicker [format]="'dd-MMM-yyyy'" [(ngModel)]="historyFrom"></kendo-datepicker>
|
|
</div>
|
|
<div class="lfa-field">
|
|
<label>End Date <span class="lfa-required">*</span></label>
|
|
<kendo-datepicker [format]="'dd-MMM-yyyy'" [(ngModel)]="historyTo"></kendo-datepicker>
|
|
</div>
|
|
<div class="lfa-field">
|
|
<label>Department</label>
|
|
<kendo-dropdownlist [data]="historyDepartments" [(ngModel)]="historyDepartment" (valueChange)="historyDepartment = $event; filterHistory()"></kendo-dropdownlist>
|
|
</div>
|
|
<button class="gh-refresh" kendoButton type="button" themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['redo']" [disabled]="isBusy" (click)="loadHistory()">Load</button>
|
|
</div>
|
|
<div class="lfa-toolbar">
|
|
<div class="lfa-field lfa-field--wide">
|
|
<label>Search in results</label>
|
|
<kendo-textbox [(ngModel)]="historySearch" (valueChange)="historySearch = $event; filterHistory()" [clearButton]="true" placeholder="Batch, ID, name…"></kendo-textbox>
|
|
</div>
|
|
<span class="lfa-spacer"></span>
|
|
<button class="gh-excel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['fileExcel']" [disabled]="historyRows.length === 0" (click)="historyGrid.saveAsExcel()">Export</button>
|
|
<button class="gh-print" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['print']" [disabled]="historyRows.length === 0" (click)="printHistory()">Print</button>
|
|
</div>
|
|
|
|
<kendo-grid #historyGrid="kendoGrid" [kendoGridBinding]="historyRows" [sortable]="true" [resizable]="true"
|
|
[pageable]="{ pageSizes: [10, 25, 50, 100] }" [pageSize]="25" [height]="500">
|
|
<kendo-grid-column field="batchNumber" title="Batch ID" [width]="130" [style]="{ 'font-weight': '600' }"></kendo-grid-column>
|
|
<kendo-grid-column field="paymentDate" title="Payment Date" [width]="120" format="dd-MMM-yyyy"></kendo-grid-column>
|
|
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="110"></kendo-grid-column>
|
|
<kendo-grid-column field="name" title="Name" [width]="190"></kendo-grid-column>
|
|
<kendo-grid-column field="designationName" title="Designation" [width]="160"></kendo-grid-column>
|
|
<kendo-grid-column field="departmentName" title="Department" [width]="170"></kendo-grid-column>
|
|
<kendo-grid-column field="joiningDate" title="Joining Date" [width]="120" format="dd-MMM-yyyy"></kendo-grid-column>
|
|
<kendo-grid-column field="basicSalary" title="Basic Salary" [width]="130" format="n2" [style]="{ 'text-align': 'right' }" [headerStyle]="{ 'text-align': 'right', 'justify-content': 'flex-end' }">
|
|
<ng-template kendoGridFooterTemplate><div class="lfa-right">{{ historyTotalBasic | number: '1.2-2' }}</div></ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-column field="amount" title="LFA Amount" [width]="130" format="n2" [style]="{ 'text-align': 'right', 'font-weight': '600' }" [headerStyle]="{ 'text-align': 'right', 'justify-content': 'flex-end' }">
|
|
<ng-template kendoGridFooterTemplate><div class="lfa-right">{{ historyTotalAmount | number: '1.2-2' }}</div></ng-template>
|
|
</kendo-grid-column>
|
|
<ng-template kendoGridNoRecordsTemplate>No records found.</ng-template>
|
|
<kendo-grid-excel fileName="LFA-Payment-History.xlsx" [fetchData]="allHistoryRows"></kendo-grid-excel>
|
|
</kendo-grid>
|
|
<div class="lfa-info">{{ historySummary }}</div>
|
|
</div>
|
|
}
|
|
</app-tab-panel>
|
|
</app-tab-view>
|
|
</div>
|
|
|
|
@if (showConfirm) {
|
|
<div class="blur-background">
|
|
<kendo-dialog title="Confirm LFA Payment" [width]="460" maxHeight="90vh" (close)="showConfirm = false" (keydown.escape)="$event.stopPropagation()">
|
|
<p>You are about to process LFA payment for <b>{{ rows.length }}</b> employee(s). This will create a new payment batch.</p>
|
|
<table class="lfa-confirm">
|
|
<tbody>
|
|
<tr><td>Batch ID</td><td>{{ info ? info.nextBatchNumber : '' }}</td></tr>
|
|
<tr><td>Payment Date</td><td>{{ paymentDate | date: 'dd-MMM-yyyy' }}</td></tr>
|
|
<tr><td>Total LFA Amount</td><td>BDT {{ totalAmount | number: '1.2-2' }}</td></tr>
|
|
</tbody>
|
|
</table>
|
|
<kendo-dialog-actions>
|
|
<button class="gh-cancel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['cancel']" [disabled]="isBusy" (click)="showConfirm = false">Cancel</button>
|
|
<button class="gh-process" kendoButton type="button" themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['check']" [disabled]="isBusy" (click)="process()">Confirm & Process</button>
|
|
</kendo-dialog-actions>
|
|
</kendo-dialog>
|
|
</div>
|
|
}
|
|
|
|
<!-- validation errors of the upload / calculation / process -->
|
|
@if (showIssues) {
|
|
<div class="blur-background">
|
|
<kendo-dialog title="Error List ({{ issues.length }})" [width]="900" maxHeight="90vh" (close)="showIssues = false" (keydown.escape)="$event.stopPropagation()">
|
|
<kendo-grid #issueGrid="kendoGrid" [kendoGridBinding]="issues" [pageable]="true" [pageSize]="20" [sortable]="true" [resizable]="true">
|
|
<kendo-grid-column field="rowNo" title="Excel Row" [width]="90">
|
|
<ng-template kendoGridCellTemplate let-dataItem>{{ dataItem.rowNo > 0 ? dataItem.rowNo : 'File' }}</ng-template>
|
|
</kendo-grid-column>
|
|
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="120"></kendo-grid-column>
|
|
<kendo-grid-column field="employeeName" title="Name" [width]="200"></kendo-grid-column>
|
|
<kendo-grid-column field="message" title="Error"></kendo-grid-column>
|
|
<ng-template kendoGridNoRecordsTemplate>No errors.</ng-template>
|
|
<kendo-grid-excel fileName="LFA-Payment-Errors.xlsx" [fetchData]="allIssues"></kendo-grid-excel>
|
|
</kendo-grid>
|
|
<kendo-dialog-actions>
|
|
<button class="gh-excel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['fileExcel']" (click)="issueGrid.saveAsExcel()">Export</button>
|
|
<button class="gh-cancel" kendoButton type="button" [svgIcon]="apiService.KendoSVGIcon['cancel']" (click)="showIssues = false">Close</button>
|
|
</kendo-dialog-actions>
|
|
</kendo-dialog>
|
|
</div>
|
|
}
|