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
fafe75a4
Commit
fafe75a4
authored
Mar 18, 2025
by
Ooh-Ao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add borrow
parent
4c4314e6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
172 deletions
+113
-172
borrow_schema.cpython-312.pyc
...ast/src/schemas/__pycache__/borrow_schema.cpython-312.pyc
+0
-0
borrow_schema.py
API-Fast/src/schemas/borrow_schema.py
+2
-2
admin-project-equirement.component.html
...roject-equirement/admin-project-equirement.component.html
+31
-33
admin-project-equirement.component.ts
...-project-equirement/admin-project-equirement.component.ts
+73
-124
borrow-transactions.service.ts
...anage/src/app/DPU/services/borrow-transactions.service.ts
+6
-12
index.html
Web-Manage/src/index.html
+1
-1
No files found.
API-Fast/src/schemas/__pycache__/borrow_schema.cpython-312.pyc
View file @
fafe75a4
No preview for this file type
API-Fast/src/schemas/borrow_schema.py
View file @
fafe75a4
...
@@ -4,12 +4,12 @@ from typing import Optional
...
@@ -4,12 +4,12 @@ from typing import Optional
from
datetime
import
datetime
from
datetime
import
datetime
class
BorrowTransactionBase
(
BaseModel
):
class
BorrowTransactionBase
(
BaseModel
):
# peId: UUID
peId
:
Optional
[
UUID
]
=
None
quantity_borrowed
:
int
quantity_borrowed
:
int
status
:
str
=
"borrowed"
# เช่น requested, borrowed, returned
status
:
str
=
"borrowed"
# เช่น requested, borrowed, returned
returned_date
:
Optional
[
datetime
]
=
None
returned_date
:
Optional
[
datetime
]
=
None
memberId
:
UUID
memberId
:
UUID
# approved_by: UUID
approved_by
:
Optional
[
UUID
]
=
None
class
BorrowTransactionCreate
(
BorrowTransactionBase
):
class
BorrowTransactionCreate
(
BorrowTransactionBase
):
peId
:
UUID
peId
:
UUID
...
...
Web-Manage/src/app/DPU/company-management/admin-project-equirement/admin-project-equirement.component.html
View file @
fafe75a4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
class=
"badge bg-light text-default rounded-full ms-1 text-[0.75rem] align-middle"
>
{{itemsList.length}}
</span>
class=
"badge bg-light text-default rounded-full ms-1 text-[0.75rem] align-middle"
>
{{itemsList.length}}
</span>
</div>
</div>
<div
class=
"flex flex-wrap gap-2"
>
<div
class=
"flex flex-wrap gap-2"
>
<a
href=
"javascript:void(0);"
class=
"hs-dropdown-toggle ti-btn ti-btn-primary-full me-2"
(
click
)="
new
()"
<a
href=
"javascript:void(0);"
class=
"hs-dropdown-toggle ti-btn ti-btn-primary-full me-2"
data-hs-overlay=
"#modal-detail"
><i
class=
"ri-add-line font-semibold align-middle"
></i>
{{ 'เพิ่ม' |
data-hs-overlay=
"#modal-detail"
><i
class=
"ri-add-line font-semibold align-middle"
></i>
{{ 'เพิ่ม' |
translate}}
translate}}
</a>
</a>
...
@@ -66,20 +66,18 @@
...
@@ -66,20 +66,18 @@
<button type="button" class="ti-btn ti-btn-primary btn-wave waves-effect waves-light">Place Bid</button>
<button type="button" class="ti-btn ti-btn-primary btn-wave waves-effect waves-light">Place Bid</button>
</div> -->
</div> -->
</div>
</div>
<
!-- <
div class="box-footer border-block-start-dashed dark:border-defaultborder/10 text-center">
<div
class=
"box-footer border-block-start-dashed dark:border-defaultborder/10 text-center"
>
<div
class=
"btn-list"
>
<div
class=
"btn-list"
>
<div
class=
"btn-list"
>
<div
class=
"btn-list"
>
<button type="button" aria-label="button" data-hs-overlay="#modal-detail" (click)="view(item)"
class="ti-btn ti-btn-sm ti-btn-primary me-[0.375rem]"><i class="ri-edit-line"></i></button>
<button
data-hs-overlay=
"#modal-stock"
type=
"button"
aria-label=
"button"
(
click
)="
viewStock
(
item
);"
<button
data-hs-overlay=
"#modal-stock"
type=
"button"
aria-label=
"button"
(
click
)="
viewStock
(
item
);"
class=
"ti-btn ti-btn-sm ti-btn-warning me-[0.375rem]"
>
class=
"ti-btn ti-btn-sm ti-btn-warning me-[0.375rem]"
>
<i
class=
"ri-store-line"
></i>
<i
class=
"ri-store-line"
></i>
</button>
</button>
<button (click)="delete(item)" type="button" aria-label="button"
<button
type=
"button"
aria-label=
"button"
class="ti-btn ti-btn-sm ti-btn-danger me-0"><i class="ri-delete-bin-line"></i></button>
class=
"ti-btn ti-btn-sm ti-btn-danger me-0"
><i
class=
"ri-time-line"
></i></button>
</div>
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
</div>
</div>
}
}
...
@@ -92,7 +90,7 @@
...
@@ -92,7 +90,7 @@
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<div
class=
"ti-modal-header"
>
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
id=
"mail-ComposeLabel"
>
ข้อมูล
อุปกรณ์
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
id=
"mail-ComposeLabel"
>
นำเข้า
อุปกรณ์
</h6>
</h6>
<button
type=
"button"
class=
"hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
<button
type=
"button"
class=
"hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay=
"#modal-detail"
>
data-hs-overlay=
"#modal-detail"
>
...
@@ -185,11 +183,11 @@
...
@@ -185,11 +183,11 @@
<!-- Start:: New Deal -->
<!-- Start:: New Deal -->
<div
id=
"modal-stock"
class=
"hs-overlay hidden ti-modal"
*
ngIf=
"select
Stock
"
>
<div
id=
"modal-stock"
class=
"hs-overlay hidden ti-modal"
*
ngIf=
"select
Model
"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<div
class=
"ti-modal-header"
>
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
id=
"mail-ComposeLabel"
>
ข้อมูลอุปกรณ์
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
id=
"mail-ComposeLabel"
>
การยืม/
ข้อมูลอุปกรณ์
</h6>
</h6>
<button
type=
"button"
class=
"hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
<button
type=
"button"
class=
"hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay=
"#modal-stock"
>
data-hs-overlay=
"#modal-stock"
>
...
@@ -200,46 +198,46 @@
...
@@ -200,46 +198,46 @@
<div
class=
"ti-modal-body px-4"
>
<div
class=
"ti-modal-body px-4"
>
<div
class=
"grid grid-cols-12 gap-4"
>
<div
class=
"grid grid-cols-12 gap-4"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<img
[
src
]="
selectModel
.
getPicture
()"
class=
"!rounded-t-md"
alt=
"..."
<img
[
src
]="
selectModel
.
equipment
.
getPicture
()"
class=
"!rounded-t-md"
alt=
"..."
style=
"width: 100%;height: auto;object-fit: cover;"
>
style=
"width: 100%;height: auto;object-fit: cover;"
>
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<label
for=
"deal-name"
class=
"form-label"
>
ชื่ออุปกรณ์
</label>
<label
for=
"deal-name"
class=
"form-label"
>
ชื่ออุปกรณ์
</label>
<input
readonly
type=
"text"
class=
"form-control"
id=
"deal-name"
placeholder=
"ชื่ออุปกรณ์"
<input
readonly
type=
"text"
class=
"form-control"
id=
"deal-name"
placeholder=
"ชื่ออุปกรณ์"
[(
ngModel
)]="
selectModel
.
equipmentName
"
>
[(
ngModel
)]="
selectModel
.
equipment
.
equipment
Name
"
>
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<label
for=
"deal-name"
class=
"form-label"
>
S/N
</label>
<label
for=
"deal-name"
class=
"form-label"
>
S/N
</label>
<input
readonly
type=
"text"
class=
"form-control"
id=
"deal-name"
placeholder=
"S/N"
<input
readonly
type=
"text"
class=
"form-control"
id=
"deal-name"
placeholder=
"S/N"
[(
ngModel
)]="
selectModel
.
serialNumber
"
>
[(
ngModel
)]="
selectModel
.
equipment
.
serialNumber
"
>
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<label
for=
"deal-name"
class=
"form-label"
>
จำนวน
</label>
<label
for=
"deal-name"
class=
"form-label"
>
จำนวนยืม
</label>
<input
type=
"number"
class=
"form-control"
id=
"deal-name"
placeholder=
"จำนวน"
<input
type=
"number"
class=
"form-control"
id=
"deal-name"
placeholder=
"จำนวนยืม"
[(
ngModel
)]="
selectStock
.
quantity
"
>
[(
ngModel
)]="
borrowSelect
.
quantity_borrowed
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"form-check form-check-lg flex items-center"
>
<label
for=
"product-availability"
class=
"form-label"
>
ประเภท
</label>
<select
class=
"form-control"
data-trigger
name=
"product-availability"
id=
"product-availability"
[(
ngModel
)]="
selectStock
.
action
"
placeholder=
"Select"
>
<option
value=
"INBOUND"
selected
>
In Stock
</option>
<option
value=
"OUTBOUND"
>
Out Of Stock
</option>
<!-- <option value="OUTBOUND">Out Of Stock</option> -->
</select>
</div>
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
>
<label
for=
"deal-lead-score"
class=
"form-label"
>
หมายเหตุ
</label>
<label
for=
"input-label"
class=
"form-label"
>
{{ "พนักงานที่ยืม" | translate}}
</label>
<!-- <input type="text" class="form-control" id="deal-lead-score" placeholder="รายละเอียด"
<!-- <ng-select [items]="customerList" bindLabel="companyThName" [(ngModel)]="projectModel.customer">
[(ngModel)]="selectModel.description"> -->
</ng-select> -->
<textarea
class=
"form-control"
id=
"job-description"
[(
ngModel
)]="
selectStock
.
remark
"
rows=
"4"
></textarea>
<ng-select
#
selectCustomer
[
items
]="
empList
"
bindLabel=
"member.firstName"
bindValue=
"memberId"
[(
ngModel
)]="
borrowSelect
.
memberId
"
>
<ng-template
ng-header-tmp
>
<input
style=
"width: 100%; line-height: 24px"
type=
"text"
(
input
)="
selectCustomer
.
filter
($
any
($
event
.
target
).
value
)"
/>
</ng-template>
</ng-select>
<!-- <select class="mb-4 sm:mb-0 form-select !py-3" id="inlineFormSelectPref"
[(ngModel)]="projectModel.customer">
<option [ngValue]="null" selected>-</option>
<option *ngFor="let item of customerList" [ngValue]="item">{{item.getCompanyName()}}</option>
</select> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"ti-modal-footer"
>
<div
class=
"ti-modal-footer"
>
...
@@ -247,7 +245,7 @@
...
@@ -247,7 +245,7 @@
data-hs-overlay=
"#modal-stock"
>
data-hs-overlay=
"#modal-stock"
>
ยกเลิก
ยกเลิก
</button>
</button>
<button
type=
"button"
class=
"ti-btn bg-primary text-white !font-medium"
(
click
)="
save
Stock
()"
>
บันทึก
</button>
<button
type=
"button"
class=
"ti-btn bg-primary text-white !font-medium"
(
click
)="
save
Borrow
()"
>
บันทึก
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
Web-Manage/src/app/DPU/company-management/admin-project-equirement/admin-project-equirement.component.ts
View file @
fafe75a4
import
{
BorrowTransactionsService
}
from
'./../../services/borrow-transactions.service'
;
import
{
ProjectEquipmentService
}
from
'./../../services/project-equipments.service'
;
import
{
ProjectEquipmentService
}
from
'./../../services/project-equipments.service'
;
import
{
CommonModule
}
from
"@angular/common"
;
import
{
CommonModule
}
from
"@angular/common"
;
import
{
ChangeDetectionStrategy
,
Component
,
ElementRef
,
ViewChild
}
from
'@angular/core'
;
import
{
ChangeDetectionStrategy
,
Component
,
ElementRef
,
ViewChild
}
from
'@angular/core'
;
...
@@ -15,8 +16,11 @@ import { FileItem, FileUploader, ParsedResponseHeaders } from "ng2-file-upload";
...
@@ -15,8 +16,11 @@ import { FileItem, FileUploader, ParsedResponseHeaders } from "ng2-file-upload";
import
{
environment
}
from
"../../../../environments/environment"
;
import
{
environment
}
from
"../../../../environments/environment"
;
import
{
EquipmentModel
,
EquipmentStockModel
}
from
"../../models/equipments.model"
;
import
{
EquipmentModel
,
EquipmentStockModel
}
from
"../../models/equipments.model"
;
import
{
EquipmentService
}
from
"../../services/equirement.service"
;
import
{
EquipmentService
}
from
"../../services/equirement.service"
;
import
{
HttpClient
}
from
"@angular/common/http"
;
import
{
HttpClient
,
HttpErrorResponse
}
from
"@angular/common/http"
;
import
{
ProjectEquipmentModel
}
from
'../../models/project-equipments'
;
import
{
ProjectEquipmentModel
}
from
'../../models/project-equipments'
;
import
{
BorrowTransactionsModel
}
from
'../../models/borrow-transactions'
;
import
{
ProjectMemberModel
}
from
'../../models/project-members'
;
import
{
ProjectMemberService
}
from
'../../services/project-members.service'
;
@
Component
({
@
Component
({
selector
:
'app-admin-project-equirement'
,
selector
:
'app-admin-project-equirement'
,
...
@@ -46,9 +50,10 @@ export class AdminProjectEquirementComponent {
...
@@ -46,9 +50,10 @@ export class AdminProjectEquirementComponent {
itemsListAll
:
EquipmentModel
[]
=
[]
itemsListAll
:
EquipmentModel
[]
=
[]
filterListAll
:
EquipmentModel
[]
=
[]
filterListAll
:
EquipmentModel
[]
=
[]
selectModel
:
EquipmentModel
=
new
EquipmentModel
()
selectModel
:
ProjectEquipmentModel
=
new
Project
EquipmentModel
()
selectStock
?:
EquipmentStockModel
selectStock
?:
EquipmentStockModel
selectedItems
=
new
Map
<
string
,
boolean
>
();
selectedItems
=
new
Map
<
string
,
boolean
>
();
borrowSelect
:
BorrowTransactionsModel
=
new
BorrowTransactionsModel
()
pageIndex
=
0
;
pageIndex
=
0
;
get
searchTerm
():
string
{
get
searchTerm
():
string
{
return
this
.
_searchTerm
;
return
this
.
_searchTerm
;
...
@@ -66,8 +71,8 @@ export class AdminProjectEquirementComponent {
...
@@ -66,8 +71,8 @@ export class AdminProjectEquirementComponent {
projectId
=
""
projectId
=
""
_searchTerm
=
""
;
_searchTerm
=
""
;
isEdit
=
false
;
isEdit
=
false
;
constructor
(
private
http
:
HttpClient
,
private
eqService
:
EquipmentService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
private
projectEquipmentService
:
ProjectEquipmentService
)
{
empList
:
ProjectMemberModel
[]
=
[]
this
.
uploadConfig
()
constructor
(
private
http
:
HttpClient
,
private
eqService
:
EquipmentService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
private
projectEquipmentService
:
ProjectEquipmentService
,
private
borrowTransactionsService
:
BorrowTransactionsService
,
private
projectMemberService
:
ProjectMemberService
)
{
this
.
projectId
=
this
.
tokenService
.
getSelectCompany
().
projectId
!
;
this
.
projectId
=
this
.
tokenService
.
getSelectCompany
().
projectId
!
;
}
}
...
@@ -80,70 +85,26 @@ export class AdminProjectEquirementComponent {
...
@@ -80,70 +85,26 @@ export class AdminProjectEquirementComponent {
isFaceDetected
=
false
;
// Flag to determine if a face is detected
isFaceDetected
=
false
;
// Flag to determine if a face is detected
uploadConfig
()
{
this
.
uploaderProfile
=
new
FileUploader
({
url
:
environment
.
baseUrl
+
"/api/upload-image"
,
isHTML5
:
true
,
authToken
:
this
.
tokenService
.
getToken
()
!
,
});
this
.
uploaderProfile
.
onAfterAddingFile
=
(
fileItem
:
FileItem
)
=>
{
fileItem
.
withCredentials
=
false
;
this
.
uploadErrorMsg
=
""
;
while
(
this
.
uploaderProfile
!
.
queue
.
length
>
1
)
{
this
.
uploaderProfile
!
.
queue
[
0
].
remove
();
}
if
(
fileItem
.
file
.
size
>
5000000
)
{
this
.
uploadErrorMsg
=
"maximum file size 5mb."
;
swal
(
"Opp!!"
,
"ไม่สามารถอัพโหลดได้"
,
"info"
);
fileItem
.
isCancel
=
true
;
return
;
}
if
(
fileItem
.
file
.
type
!
.
indexOf
(
"image"
)
===
-
1
)
{
this
.
uploadErrorMsg
=
"please upload image only."
;
swal
(
"Opp!!"
,
"ไม่สามารถอัพโหลดได้"
,
"info"
);
fileItem
.
isCancel
=
true
;
return
;
}
fileItem
.
upload
();
};
this
.
uploaderProfile
.
onCompleteItem
=
(
item
:
FileItem
,
response
:
string
,
status
:
number
,
headers
:
ParsedResponseHeaders
)
=>
{
if
(
item
.
isSuccess
)
{
const
res
=
JSON
.
parse
(
response
);
console
.
log
(
"res"
,
res
);
this
.
selectModel
.
picture
=
res
.
filename
swal
(
res
.
message
,
"บันทึกสำเร็จ"
,
"success"
);
}
else
{
this
.
uploadErrorMsg
=
"cannot upload file."
;
swal
(
"Opp!!"
,
"ไม่สามารถอัพโหลดได้"
,
"info"
);
}
};
}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
getCompanyEquirment
()
this
.
getCompanyEquirment
()
this
.
getProjectEquirment
()
this
.
getProjectEquirment
()
this
.
getUserProject
()
}
}
getCompanyEquirment
(){
getUserProject
()
{
this
.
projectMemberService
.
getLists
(
this
.
projectId
).
subscribe
(
result
=>
{
this
.
empList
=
result
})
}
getCompanyEquirment
()
{
this
.
eqService
.
getLists
().
subscribe
(
result
=>
{
this
.
eqService
.
getLists
().
subscribe
(
result
=>
{
this
.
itemsListAll
=
result
.
filter
(
e
=>
e
.
quantity
>
0
)
this
.
itemsListAll
=
result
.
filter
(
e
=>
e
.
quantity
>
0
)
this
.
updatePagedItemsAll
()
this
.
updatePagedItemsAll
()
})
})
}
}
getProjectEquirment
(){
getProjectEquirment
()
{
this
.
projectEquipmentService
.
getLists
(
this
.
projectId
).
subscribe
(
result
=>
{
this
.
projectEquipmentService
.
getLists
(
this
.
projectId
).
subscribe
(
result
=>
{
this
.
itemsList
=
result
this
.
itemsList
=
result
this
.
updatePagedItems
()
this
.
updatePagedItems
()
...
@@ -179,80 +140,60 @@ export class AdminProjectEquirementComponent {
...
@@ -179,80 +140,60 @@ export class AdminProjectEquirementComponent {
});
});
}
}
new
()
{
// new() {
this
.
isEdit
=
false
// this.isEdit = false
this
.
selectModel
=
new
EquipmentModel
()
// this.selectModel = new EquipmentModel()
}
// }
view
(
item
:
EquipmentModel
)
{
console
.
log
(
item
)
this
.
isEdit
=
true
;
this
.
selectModel
=
item
}
viewStock
(
item
:
EquipmentModel
)
{
this
.
selectModel
=
item
this
.
selectStock
=
new
EquipmentStockModel
()
this
.
selectStock
.
equipmentId
=
this
.
selectModel
.
equipmentId
this
.
selectStock
.
created_by
=
this
.
tokenService
.
getUser
().
member
.
memberId
this
.
selectStock
.
action
=
"INBOUND"
}
save
()
{
console
.
log
(
this
.
selectModel
)
swal
({
title
:
"Are you sure?"
,
text
:
"คุณต้องการบันทึกหรือไม่"
,
icon
:
"warning"
,
dangerMode
:
false
,
buttons
:
[
"Cancel"
,
"Confirm"
],
})
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
if
(
!
this
.
isEdit
)
{
this
.
eqService
.
save
(
this
.
selectModel
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
()
this
.
childModal
?.
nativeElement
.
click
()
})
}
else
{
this
.
eqService
.
update
(
this
.
selectModel
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
()
this
.
childModal
?.
nativeElement
.
click
()
})
}
// view(item: EquipmentModel) {
// this.selectModel.member.role = 0
// console.log(item)
// this.isEdit = true;
// this.selectModel = item
// }
viewStock
(
item
:
ProjectEquipmentModel
)
{
this
.
selectModel
=
new
ProjectEquipmentModel
(
item
)
this
.
borrowSelect
=
new
BorrowTransactionsModel
()
// this.selectStock = new EquipmentStockModel()
// this.selectStock.equipmentId = this.selectModel.equipmentId
// this.selectStock.created_by = this.tokenService.getUser().member.memberId
// this.selectStock.action = "INBOUND"
}
}
});
// save() {
// console.log(this.selectModel)
// swal({
// title: "Are you sure?",
// text: "คุณต้องการบันทึกหรือไม่",
// icon: "warning",
// dangerMode: false,
// buttons: ["Cancel", "Confirm"],
// })
// .then((willDelete: any) => {
// if (willDelete) {
// if (!this.isEdit) {
// this.eqService.save(this.selectModel).subscribe(result => {
// swal("Save Success!!", "บันทึกข้อมูลสำเร็จ", "success");
// this.ngOnInit()
// this.childModal?.nativeElement.click()
// })
// } else {
// this.eqService.update(this.selectModel).subscribe(result => {
// swal("Save Success!!", "บันทึกข้อมูลสำเร็จ", "success");
// this.ngOnInit()
// this.childModal?.nativeElement.click()
// })
// }
// // this.selectModel.member.role = 0
}
//
}
updateEmp
()
{
// });
swal
({
title
:
"Are you sure?"
,
text
:
"คุณต้องการบันทึกหรือไม่"
,
icon
:
"warning"
,
dangerMode
:
false
,
buttons
:
[
"Cancel"
,
"Confirm"
],
})
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
this
.
eqService
.
save
(
this
.
selectModel
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
()
this
.
childModal
?.
nativeElement
.
click
()
})
}
});
// }
}
// filterEmp(empId: string) {
// filterEmp(empId: string) {
// this.selectModel.supervisor = this.itemsList.filter(e => e.employeeId == empId)[0]
// this.selectModel.supervisor = this.itemsList.filter(e => e.employeeId == empId)[0]
...
@@ -272,8 +213,8 @@ export class AdminProjectEquirementComponent {
...
@@ -272,8 +213,8 @@ export class AdminProjectEquirementComponent {
this
.
filterListAll
=
this
.
itemsListAll
this
.
filterListAll
=
this
.
itemsListAll
}
}
save
Stock
()
{
save
Borrow
()
{
console
.
log
(
this
.
selectStock
)
//
console.log(this.selectStock)
swal
({
swal
({
title
:
"Are you sure?"
,
title
:
"Are you sure?"
,
text
:
"คุณต้องการบันทึกหรือไม่"
,
text
:
"คุณต้องการบันทึกหรือไม่"
,
...
@@ -283,10 +224,18 @@ export class AdminProjectEquirementComponent {
...
@@ -283,10 +224,18 @@ export class AdminProjectEquirementComponent {
})
})
.
then
((
willDelete
:
any
)
=>
{
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
if
(
willDelete
)
{
this
.
eqService
.
stock
(
this
.
selectStock
!
).
subscribe
(
result
=>
{
this
.
borrowTransactionsService
.
save
({
"peId"
:
this
.
selectModel
.
peId
,
"quantity_borrowed"
:
this
.
borrowSelect
.
quantity_borrowed
,
"status"
:
"approved"
,
"memberId"
:
this
.
borrowSelect
.
memberId
,
"approved_by"
:
this
.
tokenService
.
getUser
().
member
.
memberId
}).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
()
this
.
ngOnInit
()
this
.
closeModalStock
?.
nativeElement
.
click
()
this
.
closeModalStock
?.
nativeElement
.
click
()
},(
error
:
any
)
=>
{
swal
(
"Fail!!"
,
error
.
error
.
detail
,
"info"
);
})
})
}
}
...
...
Web-Manage/src/app/DPU/services/borrow-transactions.service.ts
View file @
fafe75a4
import
{
Injectable
}
from
'@angular/core'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
map
,
tap
,
switchMap
,
filter
,
reduce
}
from
"rxjs/operators"
;
import
{
map
,
tap
,
switchMap
,
filter
,
reduce
}
from
"rxjs/operators"
;
import
{
ProjectEquipmentModel
}
from
'../models/project-equipments'
;
import
{
BorrowTransactionsModel
}
from
'../models/borrow-transactions'
;
import
{
BorrowTransactionsModel
}
from
'../models/borrow-transactions'
;
import
{
environment
}
from
'../../../environments/environment'
;
@
Injectable
({
@
Injectable
({
...
@@ -12,7 +10,7 @@ import { BorrowTransactionsModel } from '../models/borrow-transactions';
...
@@ -12,7 +10,7 @@ import { BorrowTransactionsModel } from '../models/borrow-transactions';
})
})
export
class
BorrowTransactionsService
{
export
class
BorrowTransactionsService
{
apiBaseUrl
=
environment
.
baseUrl
+
"/borrow-transactions"
;
apiBaseUrl
=
environment
.
baseUrl
+
"/borrow-transactions"
;
constructor
(
constructor
(
private
http
:
HttpClient
private
http
:
HttpClient
)
{
}
)
{
}
...
@@ -31,28 +29,24 @@ apiBaseUrl = environment.baseUrl + "/borrow-transactions";
...
@@ -31,28 +29,24 @@ apiBaseUrl = environment.baseUrl + "/borrow-transactions";
);
);
}
}
save
(
body
:
BorrowTransactionsModel
)
{
save
(
body
:
any
)
{
return
this
.
http
.
post
<
{
return
this
.
http
.
post
<
BorrowTransactionsModel
>
(
this
.
apiBaseUrl
,
body
);
"message"
:
string
,
"user"
:
BorrowTransactionsModel
}
>
(
this
.
apiBaseUrl
,
new
BorrowTransactionsModel
(
body
));
}
}
update
(
body
:
BorrowTransactionsModel
)
{
update
(
body
:
BorrowTransactionsModel
)
{
return
this
.
http
.
put
<
{
return
this
.
http
.
put
<
{
"message"
:
string
,
"message"
:
string
,
"user"
:
BorrowTransactionsModel
"user"
:
BorrowTransactionsModel
}
>
(
this
.
apiBaseUrl
+
"/"
+
body
.
borrow
_i
d
,
new
BorrowTransactionsModel
(
body
));
}
>
(
this
.
apiBaseUrl
+
"/"
+
body
.
borrow
I
d
,
new
BorrowTransactionsModel
(
body
));
}
}
delete
(
body
:
BorrowTransactionsModel
)
{
delete
(
body
:
BorrowTransactionsModel
)
{
return
this
.
http
.
delete
<
{
return
this
.
http
.
delete
<
{
"message"
:
string
,
"message"
:
string
,
"user"
:
BorrowTransactionsModel
"user"
:
BorrowTransactionsModel
}
>
(
this
.
apiBaseUrl
+
"/"
+
body
.
borrow
_i
d
);
}
>
(
this
.
apiBaseUrl
+
"/"
+
body
.
borrow
I
d
);
}
}
}
}
}
Web-Manage/src/index.html
View file @
fafe75a4
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<title>
Time Attendance System
</title>
<title>
Assets Management
</title>
<base
href=
"/"
>
<base
href=
"/"
>
<!-- <base href="/ynex-tailwind/preview/"> -->
<!-- <base href="/ynex-tailwind/preview/"> -->
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
...
...
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