Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BookingMyHrManagement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanachai
BookingMyHrManagement
Commits
7aa10f5a
Commit
7aa10f5a
authored
Apr 08, 2025
by
DESKTOP-E0VCCBD\zedan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update ระบบยืมคืน
parent
4ee746ce
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
97 deletions
+182
-97
emp-borrow-return-status.component.html
...row-return-status/emp-borrow-return-status.component.html
+72
-62
emp-borrow-return-status.component.ts
...orrow-return-status/emp-borrow-return-status.component.ts
+48
-9
emp-borrow-status.component.html
...gement/emp-borrow-status/emp-borrow-status.component.html
+27
-19
emp-borrow-status.component.ts
...nagement/emp-borrow-status/emp-borrow-status.component.ts
+35
-7
No files found.
Web-Manage/src/app/DPU/company-management/emp-borrow-return-status/emp-borrow-return-status.component.html
View file @
7aa10f5a
<app-page-header
[
title
]="'อนุมัตการคืนอุปกรณ์'"
[
title
]="'อนุมัต
ิ
การคืนอุปกรณ์'"
[
activeTitle
]="'ผู้ดูแลระบบ'"
[
title1
]="'อนุมัตการคืนอุปกรณ์'"
[
title1
]="'อนุมัต
ิ
การคืนอุปกรณ์'"
></app-page-header>
<div
class=
"grid grid-cols-12 gap-x-6"
>
...
...
@@ -12,7 +12,7 @@
{{ "รายการทั้งหมด" | translate }}
<span
class=
"badge bg-light text-default rounded-full ms-1 text-[0.75rem] align-middle"
>
{{
his
List.length }}
</span
>
{{
filtered
List.length }}
</span
>
</div>
<!-- แท็บสถานะ -->
...
...
@@ -21,7 +21,7 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-blue-100 text-blue-800 border-blue-200"
(
click
)="
filterByStatus
('
all
'
)"
(
click
)="
selectedStatus =
'!requested,!rejected'
;
applyFilter
(
)"
>
ทั้งหมด
</button>
...
...
@@ -29,35 +29,35 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-warning/10 text-warning border-warning/20"
(
click
)="
filterByStatus
('
requested
'
)"
(
click
)="
selectedStatus =
'approved'
;
applyFilter
(
)"
>
รอ
อนุมัติ
รอ
คืนอุปกรณื
</button>
</div>
<div>
<
!-- <
div>
<button
class="px-4 py-2 rounded-full border text-sm font-medium bg-success/10 text-success border-success/20"
(click)="filterByStatus('approved')"
>
อนุมัติแล้ว
</button>
</div>
</div>
-->
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-
danger/10 text-danger border-danger
/20"
(
click
)="
filterByStatus
('
rejected
'
)"
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-
info/10 text-info border-info
/20"
(
click
)="
selectedStatus =
'returned'
;
applyFilter
(
)"
>
ไม่อนุมันติ
คืนแล้ว
</button>
</div>
<div>
<
!-- <
div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-
info/10 text-info border-info
/20"
(
click
)="
filterByStatus
('
re
turn
ed
')"
class="px-4 py-2 rounded-full border text-sm font-medium bg-
danger/10 text-danger border-danger
/20"
(click)="filterByStatus('re
ject
ed')"
>
คืนแล้ว
ไม่อนุมัติ
</button>
</div>
</div>
-->
</div>
<div
class=
"flex flex-wrap gap-2"
>
<div>
...
...
@@ -67,6 +67,7 @@
type=
"text"
placeholder=
"{{ 'ค้นหารายการ...' | translate }}"
aria-label=
".form-control-sm example"
(
input
)="
applyFilter
()"
/>
</div>
</div>
...
...
@@ -76,6 +77,7 @@
<table
class=
"table whitespace-nowrap table-bordered min-w-full"
>
<thead
class=
"bg-light"
>
<tr>
<th
scope=
"col"
class=
"text-start"
>
โปรเจค
</th>
<th
scope=
"col"
class=
"text-start"
>
อุปกรณ์ที่ยืม
</th>
<th
scope=
"col"
class=
"text-start"
>
พนักงาน
</th>
<th
scope=
"col"
class=
"text-start"
>
จำนวน
</th>
...
...
@@ -89,6 +91,8 @@
<tbody>
@for(product of filteredList; track product.peId){
<tr
class=
"product-list"
>
<td>
{{ product.project_equipment?.project?.project_name }}
</td>
<td>
{{ product.project_equipment?.equipment?.equipmentName }}
</td>
...
...
@@ -110,14 +114,12 @@
<span
class=
"badge"
[
ngClass
]="{
'
bg-success
/
10
text-success
'
:
product
.
status =
==
'
approved
',
'
bg-warning
/
10
text-warning
'
:
product
.
status =
==
'
request
ed
',
'
bg-danger
/
10
text-danger
'
:
product
.
status =
==
'
rejected
',
'
bg-info
/
10
text-info
'
:
product
.
status =
==
'
return
ed
',
'
bg-
purple-100
text-purple-800
'
:
product
.
status =
==
'
repairing
'
product
.
status =
==
'
approv
ed
',
'
bg-danger
/
10
text-danger
'
:
product
.
status =
==
'
reject
ed
',
'
bg-
info
/
10
text-info
'
:
product
.
status =
==
'
returned
',
}"
>
{{ getStatusText(product.status) }}
...
...
@@ -172,12 +174,12 @@
</div>
</div>
</div>
<div
</div>
<div
id=
"detail-container"
class=
"hs-overlay hidden ti-modal"
*
ngIf=
"selectedBorrowItem as item"
>
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-header"
>
...
...
@@ -222,15 +224,6 @@
[(
ngModel
)]="
selectedBorrowItem
.
quantity_borrowed
"
/>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<label
for=
"deal-lead-score"
class=
"form-label"
>
หมายเหตุ
</label>
<textarea
class=
"form-control"
id=
"job-description"
[(
ngModel
)]="
selectStock
.
remark
"
rows=
"4"
></textarea>
</div>
</div>
<div
class=
"ti-modal-footer"
>
<button
...
...
@@ -253,15 +246,16 @@
</div>
</div>
</div>
</div>
<!-- ในส่วน template -->
<div
id=
"detail-borrow"
class=
"hs-overlay hidden ti-modal"
>
</div>
<div
id=
"detail-borrow"
class=
"hs-overlay hidden ti-modal"
*
ngIf=
"selectedBorrowItem"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
>
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
>
รายละเอียดการยืม
</h6>
<button
...
...
@@ -273,7 +267,7 @@
<i
class=
"ri-close-line"
></i>
</button>
</div>
<div
class=
"ti-modal-body px-4"
*
ngIf=
"selectedBorrowItem
"
>
<div
class=
"ti-modal-body px-4
"
>
<div
class=
"grid grid-cols-12 gap-4"
>
<!-- ข้อมูลผู้ยืม -->
<div
class=
"xl:col-span-12 col-span-12"
>
...
...
@@ -282,7 +276,7 @@
readonly
type=
"text"
class=
"form-control"
[(
ngModel
)]="
memberList
.
member
.
getFullname
"
[
value
]="
selectedBorrowItem
.
member
?.
getFullname
()
||
'
-
'
"
/>
</div>
...
...
@@ -292,7 +286,7 @@
readonly
type=
"text"
class=
"form-control"
[(
ngModel
)]="
memberList
.
member
.
phoneNumber
"
[
value
]="
selectedBorrowItem
.
member
?.
phoneNumber
||
'
-
'
"
/>
</div>
...
...
@@ -303,39 +297,64 @@
readonly
type=
"text"
class=
"form-control"
[(
ngModel
)]="
Projecteqlist
.
equipment
.
equipmentName
"
[
value
]="
selectedBorrowItem
.
project_equipment
?.
equipment
?.
equipmentName
||
'
-
'
"
/>
</div>
<!-- ข้อมูลโปรเจค -->
<div
class=
"xl:col-span-12 col-span-12"
>
<label
class=
"form-label"
>
โครงการที่ยืม
</label>
<label
class=
"form-label"
>
ชื่อโปรเจค
</label>
<input
readonly
type=
"text"
class=
"form-control"
[(
ngModel
)]="
projectList
.
project_name
"
[
value
]="
selectedBorrowItem
.
project_equipment
.
project
.
project_name
"
/>
</div>
<!-- ข้อมูลการยืม
-->
<div
class=
"xl:col-span-6
col-span-12"
>
<label
class=
"form-label"
>
จำนวนที่ยืม
</label>
<!-- จำนวน
-->
<div
class=
"xl:col-span-12
col-span-12"
>
<label
class=
"form-label"
>
จำนวน
</label>
<input
readonly
type=
"number"
class=
"form-control"
[(
ngModel
)]="
selectedBorrowItem
.
quantity_borrowed
"
[
value
]="
selectedBorrowItem
.
quantity_borrowed
||
'
0
'
"
/>
</div>
<!-- วันที่ยืม -->
<div
class=
"xl:col-span-6 col-span-12"
>
<label
class=
"form-label"
>
วันที่ยืม
</label>
<input
readonly
type=
"text"
class=
"form-control"
[(
ngModel
)]="
selectedBorrowItem
.
created_at
"
[
value
]="
selectedBorrowItem
.
created_at
?
(
selectedBorrowItem
.
created_at
|
date
:
'
dd
/
MM
/
yyyy
HH:mm
')
:
'
-
'
"
/>
</div>
<!-- วันที่คืน -->
<div
class=
"xl:col-span-6 col-span-12"
>
<label
class=
"form-label"
>
วันที่คืน
</label>
<input
readonly
type=
"text"
class=
"form-control"
[
value
]="
selectedBorrowItem
.
returned_date
?
(
selectedBorrowItem
.
returned_date
|
date
:
'
dd
/
MM
/
yyyy
HH:mm
')
:
'
-
'
"
/>
</div>
</div>
...
...
@@ -348,15 +367,6 @@
>
ปิด
</button>
<!-- <button
type="button"
class="ti-btn bg-primary text-white !font-medium"
data-hs-overlay="#detail-borrow"
(click)="approve(item)"
>
บันทึก
</button> -->
</div>
</div>
</div>
</div>
...
...
Web-Manage/src/app/DPU/company-management/emp-borrow-return-status/emp-borrow-return-status.component.ts
View file @
7aa10f5a
...
...
@@ -17,8 +17,12 @@ import { EquipmentModel, EquipmentStockModel } from "../../models/equipments.mod
import
{
ProjectEquipmentModel
}
from
"../../models/project-equipments"
;
import
{
ProjectMemberModel
}
from
'../../models/project-members'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
FileUploader
}
from
'ng2-file-upload'
;
import
{
ProjectModel
}
from
'../../models/project.model'
;
import
{
ChangeDetectorRef
}
from
'@angular/core'
;
import
{
Subject
}
from
'rxjs'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
@
Component
({
selector
:
'app-emp-borrow-return-status'
,
...
...
@@ -46,7 +50,6 @@ export class EmpBorrowReturnStatusComponent {
projectList
:
ProjectModel
;
allSelected
=
false
;
someSelected
=
false
;
uploaderProfile
:
FileUploader
|
undefined
;
uploadErrorMsg
:
string
=
""
;
itemsList
:
ProjectEquipmentModel
[]
=
[];
filterList
:
ProjectEquipmentModel
[]
=
[];
...
...
@@ -76,9 +79,11 @@ export class EmpBorrowReturnStatusComponent {
isEdit
=
false
;
empList
:
ProjectMemberModel
[]
=
[]
hisList
:
BorrowTransactionsModel
[]
=
[];
selectedStatus
:
string
=
'all'
;
selectedStatus
:
string
=
'!requested,!rejected'
;
isProcessing
=
false
;
constructor
(
private
http
:
HttpClient
,
private
cdr
:
ChangeDetectorRef
,
private
eqService
:
EquipmentService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
...
...
@@ -101,13 +106,28 @@ export class EmpBorrowReturnStatusComponent {
}
loadReturnList
():
void
{
this
.
borrowTransactionsService
.
getLists
().
subscribe
(
result
=>
{
this
.
borrowTransactionsService
.
getLists
().
subscribe
({
next
:
(
result
)
=>
{
// เก็บข้อมูลทั้งหมด
this
.
hisList
=
result
;
// เรียงลำดับจากวันที่ล่าสุด
this
.
hisList
.
sort
((
a
,
b
)
=>
new
Date
(
b
.
created_at
).
getTime
()
-
new
Date
(
a
.
created_at
).
getTime
()
);
// กรองเฉพาะรายการที่ต้องคืน (is_returnable === true)
this
.
hisList
=
this
.
hisList
.
filter
(
item
=>
item
.
project_equipment
?.
equipment
?.
is_returnable
===
true
);
// ใช้ applyFilter เพื่อกรองตามเงื่อนไขอื่นๆ
this
.
applyFilter
();
},
error
:
(
err
)
=>
{
console
.
error
(
'Error loading return list:'
,
err
);
// สามารถเพิ่มการแจ้งเตือนผู้ใช้ที่นี่
}
});
}
...
...
@@ -119,10 +139,30 @@ export class EmpBorrowReturnStatusComponent {
applyFilter
():
void
{
let
filtered
=
[...
this
.
hisList
];
// กรองตามสถานะ
if
(
this
.
selectedStatus
!==
'all'
)
{
filtered
=
filtered
.
filter
(
item
=>
item
.
status
===
this
.
selectedStatus
);
// แยกค่าสถานะเป็น Array
const
statusConditions
=
this
.
selectedStatus
.
split
(
','
);
// กรองตามเงื่อนไขสถานะ
filtered
=
filtered
.
filter
(
item
=>
{
if
(
!
item
.
status
)
return
false
;
// ตรวจสอบแต่ละเงื่อนไข
for
(
const
condition
of
statusConditions
)
{
if
(
condition
.
startsWith
(
'!'
))
{
// กรณีเงื่อนไขแบบยกเว้น (!status)
const
excludedStatus
=
condition
.
substring
(
1
);
if
(
item
.
status
===
excludedStatus
)
{
return
false
;
}
}
else
{
// กรณีเงื่อนไขแบบบังคับ (status)
if
(
item
.
status
!==
condition
)
{
return
false
;
}
}
}
return
true
;
});
// กรองตามคำค้นหา
if
(
this
.
searchTerm
)
{
...
...
@@ -135,7 +175,6 @@ export class EmpBorrowReturnStatusComponent {
}
this
.
filteredList
=
filtered
;
}
...
...
@@ -180,7 +219,7 @@ export class EmpBorrowReturnStatusComponent {
getStatusText
(
status
:
string
):
string
{
switch
(
status
)
{
case
'requested'
:
return
'รออนุมัติ'
;
case
'approved'
:
return
'
อนุมัติแล้ว
'
;
case
'approved'
:
return
'
รอคืนอุปกรณ์
'
;
case
'rejected'
:
return
'ไม่อนุมัติ'
;
case
'returned'
:
return
'คืนแล้ว'
;
case
'repairing'
:
return
'กำลังซ่อม'
;
...
...
Web-Manage/src/app/DPU/company-management/emp-borrow-status/emp-borrow-status.component.html
View file @
7aa10f5a
<app-page-header
[
title
]="'อนุมัตการยืมอุปกรณ์'"
[
title
]="'อนุมัต
ิ
การยืมอุปกรณ์'"
[
activeTitle
]="'ผู้ดูแลระบบ'"
[
title1
]="'อนุมัตการยืมอุปกรณ์'"
[
title1
]="'อนุมัต
ิ
การยืมอุปกรณ์'"
></app-page-header>
<div
class=
"grid grid-cols-12 gap-x-6"
>
...
...
@@ -12,7 +12,7 @@
{{ "รายการทั้งหมด" | translate }}
<span
class=
"badge bg-light text-default rounded-full ms-1 text-[0.75rem] align-middle"
>
{{
his
List.length }}
</span
>
{{
filtered
List.length }}
</span
>
</div>
<!-- แท็บสถานะ -->
...
...
@@ -21,7 +21,7 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-blue-100 text-blue-800 border-blue-200"
(
click
)="
filterByStatus
('
all
'
)"
(
click
)="
selectedStatus =
'!returned'
;
applyFilter
(
)"
>
ทั้งหมด
</button>
...
...
@@ -30,7 +30,7 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-warning/10 text-warning border-warning/20"
(
click
)="
filterByStatus
('
requested
'
)"
(
click
)="
selectedStatus =
'requested'
;
applyFilter
(
)"
>
รออนุมัติ
</button>
...
...
@@ -39,7 +39,7 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-success/10 text-success border-success/20"
(
click
)="
filterByStatus
('
approved
'
)"
(
click
)="
selectedStatus =
'approved'
;
applyFilter
(
)"
>
อนุมัติแล้ว
</button>
...
...
@@ -47,9 +47,9 @@
<div>
<button
class=
"px-4 py-2 rounded-full border text-sm font-medium bg-danger/10 text-danger border-danger/20"
(
click
)="
filterByStatus
('
rejected
'
)"
(
click
)="
selectedStatus =
'rejected'
;
applyFilter
(
)"
>
ไม่อนุมั
น
ติ
ไม่อนุมัติ
</button>
</div>
</div>
...
...
@@ -61,6 +61,7 @@
type=
"text"
placeholder=
"{{ 'ค้นหารายการ...' | translate }}"
aria-label=
".form-control-sm example"
(
input
)="
applyFilter
()"
/>
</div>
</div>
...
...
@@ -71,11 +72,11 @@
<table
class=
"table whitespace-nowrap table-bordered min-w-full"
>
<thead
class=
"bg-light"
>
<tr>
<th
scope=
"col"
class=
"text-start"
>
โปรเจค
</th>
<th
scope=
"col"
class=
"text-start"
>
อุปกรณ์ที่ยืม
</th>
<th
scope=
"col"
class=
"text-start"
>
พนักงาน
</th>
<th
scope=
"col"
class=
"text-start"
>
จำนวน
</th>
<th
scope=
"col"
class=
"text-start"
>
วันที่ยืม
</th>
<th
scope=
"col"
class=
"text-start"
>
วันที่คืน
</th>
<th
scope=
"col"
class=
"text-start"
>
สถานะ
</th>
<th
scope=
"col"
class=
"text-start"
>
ผู้อนุมัติ
</th>
<th
scope=
"col"
class=
"text-start"
>
การดำเนินการ
</th>
...
...
@@ -84,8 +85,9 @@
<tbody>
@for(product of filteredList;track product.peId){
<tr
class=
"product-list"
>
<td>
{{ product.project_equipment?.project?.project_name }}
</td>
<td>
{{ product.project_equipment?.equipment?.equipmentName}}
{{ product.project_equipment?.equipment?.equipmentName
}}
</td>
<td>
<div
class=
"flex items-center"
>
...
...
@@ -95,28 +97,34 @@
</div>
</td>
<td>
{{ product.quantity_borrowed }}
</td>
<td>
{{ product.created_at | date:'dd/MM/yyyy HH:mm' }}
</td>
<td>
{{ product.returned_date | date:'dd/MM/yyyy HH:mm' }}
</td>
<td>
{{ product.created_at | date : "dd/MM/yyyy HH:mm" }}
</td>
<td>
<span
class=
"badge"
[
ngClass
]="{
'
bg-success
/
10
text-success
'
:
product
.
status =
==
'
approved
',
'
bg-warning
/
10
text-warning
'
:
product
.
status =
==
'
requested
',
<span
class=
"badge"
[
ngClass
]="{
'
bg-success
/
10
text-success
'
:
product
.
status =
==
'
approved
',
'
bg-warning
/
10
text-warning
'
:
product
.
status =
==
'
requested
',
'
bg-danger
/
10
text-danger
'
:
product
.
status =
==
'
rejected
',
'
bg-info
/
10
text-info
'
:
product
.
status =
==
'
returned
'
}"
>
}"
>
{{ getStatusText(product.status) }}
</span>
</td>
<td>
{{ product.approved_by_member?.getFullname() ||
'-'
}}
</td>
<td>
{{ product.approved_by_member?.getFullname() ||
"-"
}}
</td>
<td>
<button
*
ngIf=
"product.status === 'requested'"
<button
*
ngIf=
"product.status === 'requested'"
aria-label=
"button"
(
click
)="
approve
(
product
)"
class=
"ti-btn ti-btn-sm ti-btn-success me-1"
>
<i
class=
"ri-check-line"
></i>
</button>
<button
*
ngIf=
"product.status === 'requested'"
<button
*
ngIf=
"product.status === 'requested'"
aria-label=
"button"
(
click
)="
reject
(
product
)"
class=
"ti-btn ti-btn-sm ti-btn-danger"
...
...
Web-Manage/src/app/DPU/company-management/emp-borrow-status/emp-borrow-status.component.ts
View file @
7aa10f5a
...
...
@@ -68,7 +68,7 @@ export class EmpBorrowStatusComponent {
isEdit
=
false
;
empList
:
ProjectMemberModel
[]
=
[]
hisList
:
BorrowTransactionsModel
[]
=
[];
selectedStatus
:
string
=
'
all
'
;
selectedStatus
:
string
=
'
!returned
'
;
constructor
(
private
http
:
HttpClient
,
private
eqService
:
EquipmentService
,
...
...
@@ -86,13 +86,23 @@ export class EmpBorrowStatusComponent {
}
loadBorrowHistory
():
void
{
this
.
borrowTransactionsService
.
getLists
().
subscribe
(
result
=>
{
this
.
borrowTransactionsService
.
getLists
().
subscribe
({
next
:
(
result
)
=>
{
// เก็บข้อมูลทั้งหมด
this
.
hisList
=
result
;
// เรียงลำดับจากวันที่ล่าสุด
this
.
hisList
.
sort
((
a
,
b
)
=>
new
Date
(
b
.
created_at
).
getTime
()
-
new
Date
(
a
.
created_at
).
getTime
()
);
// ใช้ applyFilter เพื่อกรองตามเงื่อนไขอื่นๆ
this
.
applyFilter
();
},
error
:
(
err
)
=>
{
console
.
error
(
'Error loading return list:'
,
err
);
// สามารถเพิ่มการแจ้งเตือนผู้ใช้ที่นี่
}
});
}
...
...
@@ -194,10 +204,30 @@ export class EmpBorrowStatusComponent {
applyFilter
():
void
{
let
filtered
=
[...
this
.
hisList
];
// กรองตามสถานะ
if
(
this
.
selectedStatus
!==
'all'
)
{
filtered
=
filtered
.
filter
(
item
=>
item
.
status
===
this
.
selectedStatus
);
// แยกค่าสถานะเป็น Array
const
statusConditions
=
this
.
selectedStatus
.
split
(
','
);
// กรองตามเงื่อนไขสถานะ
filtered
=
filtered
.
filter
(
item
=>
{
if
(
!
item
.
status
)
return
false
;
// ตรวจสอบแต่ละเงื่อนไข
for
(
const
condition
of
statusConditions
)
{
if
(
condition
.
startsWith
(
'!'
))
{
// กรณีเงื่อนไขแบบยกเว้น (!status)
const
excludedStatus
=
condition
.
substring
(
1
);
if
(
item
.
status
===
excludedStatus
)
{
return
false
;
}
}
else
{
// กรณีเงื่อนไขแบบบังคับ (status)
if
(
item
.
status
!==
condition
)
{
return
false
;
}
}
}
return
true
;
});
// กรองตามคำค้นหา
if
(
this
.
searchTerm
)
{
...
...
@@ -210,8 +240,6 @@ export class EmpBorrowStatusComponent {
}
this
.
filteredList
=
filtered
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment