Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BorrowProject65160024-deleted-1917
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is pending deletion, and will be deleted on
2025-07-22
. Repository and other project resources are read-only.
Show more breadcrumbs
65160024
BorrowProject65160024-deleted-1917
Commits
4ff2ea28
Commit
4ff2ea28
authored
4 months ago
by
65160024
Browse files
Options
Downloads
Patches
Plain Diff
update confirm loan
parent
92d8ac24
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
views/confirm-loan.ejs
+46
-19
46 additions, 19 deletions
views/confirm-loan.ejs
with
46 additions
and
19 deletions
views/confirm-loan.ejs
+
46
−
19
View file @
4ff2ea28
...
@@ -43,17 +43,13 @@
...
@@ -43,17 +43,13 @@
<div
class=
"flex justify-center space-x-4"
>
<div
class=
"flex justify-center space-x-4"
>
<!-- ฟอร์มยืนยันการยืม -->
<!-- ฟอร์มยืนยันการยืม -->
<form
action=
"/submit-loan"
method=
"POST"
class=
"flex space-x-2"
>
<button
id=
"confirmButton"
class=
"bg-blue-600 text-white px-6 py-3 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400"
>
<input
type=
"hidden"
name=
"equipment_id"
value=
"<%= equipment.id %>"
>
ยืนยันการยืม
<input
type=
"hidden"
name=
"quantity"
value=
"<%= quantity %>"
>
</button>
<button
type=
"submit"
class=
"bg-blue-600 text-white px-6 py-3 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400"
>
ยืนยันการยืม
</button>
</form>
<!-- ฟอร์มยกเลิกการยืม -->
<!-- ฟอร์มยกเลิกการยืม -->
<form
action=
"/cancel-loan"
method=
"GET"
class=
"flex space-x-2"
>
<form
action=
"/cancel-loan"
method=
"GET"
class=
"flex space-x-2"
>
<button
type=
"submit"
<button
type=
"submit"
class=
"bg-gray-300 text-gray-800 px-6 py-3 rounded-md hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-400"
>
ยกเลิก
</button>
class=
"bg-gray-300 text-gray-800 px-6 py-3 rounded-md hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-400"
>
ยกเลิก
</button>
</form>
</form>
</div>
</div>
</div>
</div>
...
@@ -64,6 +60,37 @@
...
@@ -64,6 +60,37 @@
</div>
</div>
<
%
}
%
>
<
%
}
%
>
<script>
// เมื่อกดปุ่ม "ยืนยันการยืม" ให้เปลี่ยนเส้นทางไปยังหน้า /loans
document
.
getElementById
(
'
confirmButton
'
).
addEventListener
(
'
click
'
,
function
()
{
// ส่งข้อมูลยืมไปยังเซิร์ฟเวอร์ (ในกรณีที่ต้องการให้มีการบันทึกข้อมูลก่อน)
const
equipment_id
=
"
<%= equipment.id %>
"
;
const
quantity
=
"
<%= quantity %>
"
;
fetch
(
'
/submit-loan
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
({
equipment_id
:
equipment_id
,
quantity
:
quantity
})
})
.
then
(
response
=>
{
if
(
response
.
ok
)
{
// หลังจากยืนยันเสร็จแล้วเปลี่ยนเส้นทางไปที่ /loans
window
.
location
.
href
=
'
/loans
'
;
}
else
{
alert
(
'
การยืมอุปกรณ์ล้มเหลว
'
);
}
})
.
catch
(
error
=>
{
alert
(
'
เกิดข้อผิดพลาด:
'
+
error
);
});
});
</script>
</body>
</body>
</html>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment