Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prjcloud_65160270
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
Show more breadcrumbs
65160270
prjcloud_65160270
Commits
242dd7f8
Commit
242dd7f8
authored
3 months ago
by
65160270
Browse files
Options
Downloads
Patches
Plain Diff
update-edit
parent
b8927994
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/css/style.css
+2
-4
2 additions, 4 deletions
public/css/style.css
views/cart.ejs
+36
-25
36 additions, 25 deletions
views/cart.ejs
with
38 additions
and
29 deletions
public/css/style.css
+
2
−
4
View file @
242dd7f8
...
...
@@ -436,18 +436,16 @@ footer {
background-color
:
#3d38b1
;
}
.edit-
order-
btn
{
.edit-btn
{
background-color
:
#ffc107
;
color
:
black
;
padding
:
5px
10px
;
text-decoration
:
none
;
border-radius
:
5px
;
display
:
inline-block
;
margin-left
:
5px
;
border
:
1px
solid
#ffc107
;
}
.edit-
order-
btn
:hover
{
.edit-btn
:hover
{
background-color
:
#e0a800
;
border-color
:
#e0a800
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
views/cart.ejs
+
36
−
25
View file @
242dd7f8
...
...
@@ -8,11 +8,15 @@
<a href="/" class="continue-shopping">Continue Shopping</a>
</div>
<% } else { %>
<div class="cart-items">
<% cartItems.forEach(item => { %>
<div class="cart-item">
<div class="item-info">
<h3><%= item.name %></h3>
<p>Price: ฿<%= item.price.toLocaleString() %></p>
<p class="price">Total: ฿<%= (item.price * item.quantity).toLocaleString() %></p>
<p class="price">
Total: ฿<%= (item.price * item.quantity).toLocaleString() %>
</p>
<% if (item.stock < 5) { %>
<p style="color: var(--primary);">Only <%= item.stock %> items left!</p>
<% } %>
...
...
@@ -20,19 +24,26 @@
<form method="POST" action="/cart/update" style="display: flex; gap: 0.8rem; align-items: center;">
<input type="hidden" name="cartItemId" value="<%= item.id %>">
<input type="number" name="quantity" value="<%= item.quantity %>" min="1" max="<%= item.stock %>" style="width: 70px;">
<input type="number"
name="quantity"
value="<%= item.quantity %>"
min="1"
max="<%= item.stock %>"
style="width: 70px;">
<button type="button" class="update-btn" style="margin: 0; padding: 0.5rem 1rem;">
Update
</button>
</form>
<div class="cart-actions">
<a href="/edit-cart/<%= item.id %>" class="edit-btn">Edit</a> <!-- ปุ่ม Edit -->
<form action="/cart/remove" method="POST">
<form action="/cart/remove" method="POST" style="text-align: right;">
<input type="hidden" name="cartItemId" value="<%= item.id %>">
<button type="submit" class="remove-btn">Remove</button>
<button type="submit" class="back-btn" style="margin: 0; padding: 0.5rem 1rem; background-color: red;">
Remove
</button>
</form>
<a href="/edit-cart/<%= item.id %>" class="edit-btn">Edit</a> <!-- ปุ่ม Edit -->
</div>
<% }); %>
</div>
<div class="cart-summary">
...
...
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