Files
IOT_application/machine-operations/src/app/machine-slots/machine-slots.component.scss

777 lines
12 KiB
SCSS

//machine slot.scss
.vending-container {
padding: 20px;
position: relative;
}
.header {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.logout-button, .cart-button {
padding: 8px 16px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
&:hover {
background-color: #0069d9;
}
}
.cart-button {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.cart-icon {
font-size: 18px;
}
.cart-count {
position: absolute;
top: -8px;
right: -8px;
background-color: red;
color: white;
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.vending-row {
margin-bottom: 20px;
border: 1px solid #ddd;
border-radius: 5px;
background: #f9f9f9;
}
.row-title {
display: flex;
justify-content: space-between;
padding: 10px;
background: #e9ecef;
border-bottom: 1px solid #ddd;
}
.scroll-hint {
display: flex;
align-items: center;
gap: 5px;
color: #6c757d;
}
.slots-container {
display: flex;
overflow-x: auto;
padding: 10px;
gap: 10px;
}
.slot-card {
min-width: 180px;
border: 1px solid #ddd;
border-radius: 5px;
padding: 10px;
text-align: center;
background: #fff;
}
.slot-card.disabled {
background: #f9f9f9;
opacity: 0.7;
}
.slot-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.slot-name {
font-weight: bold;
}
.status-text {
font-size: 0.9em;
}
.status-text.enabled {
color: green;
}
.status-text.disabled {
color: red;
}
.slot-body {
cursor: default;
}
.product-image-container {
margin-bottom: 10px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.product-image {
max-width: 100px;
max-height: 100px;
object-fit: contain;
}
.product-details {
text-align: left;
}
.product-name {
font-weight: bold;
margin: 0 0 5px;
}
.product-stats {
margin: 0 0 10px;
color: #000;
}
.units-display {
font-weight: bold;
color: #000;
}
.product-actions {
display: flex;
flex-direction: column;
gap: 5px;
margin-top: 10px;
}
.quantity-selector {
margin-bottom: 5px;
select {
width: 100%;
padding: 5px;
border-radius: 4px;
border: 1px solid #ddd;
}
}
.add-to-cart-btn {
padding: 5px 10px;
background-color: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
&:hover:not(:disabled) {
background-color: #218838;
}
&:disabled {
background-color: #6c757d;
cursor: not-allowed;
opacity: 0.65;
}
}
.empty-slot {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100px;
}
.add-product-text {
color: #6c757d;
}
.error {
color: red;
padding: 10px;
}
.scroll-shadows {
height: 10px;
background: linear-gradient(to right, rgba(0,0,0,0.1), transparent);
}
/* Shopping Cart Styles */
.shopping-cart {
position: fixed;
top: 0;
right: -400px;
width: 350px;
height: 100%;
background-color: white;
box-shadow: -2px 0 5px rgba(0,0,0,0.2);
transition: right 0.3s ease-in-out;
z-index: 1000;
display: flex;
flex-direction: column;
}
.shopping-cart.open {
right: 0;
}
.cart-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
border-bottom: 1px solid #ddd;
h2 {
margin: 0;
font-size: 1.5rem;
}
.close-cart {
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #6c757d;
&:hover {
color: #343a40;
}
}
}
.cart-items {
flex: 1;
overflow-y: auto;
padding: 15px;
}
.empty-cart-message {
text-align: center;
color: #6c757d;
margin-top: 20px;
}
.cart-item {
display: flex;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid #ddd;
position: relative;
}
.cart-item-image {
width: 60px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
}
.cart-item-details {
flex: 1;
margin-left: 10px;
}
.cart-item-name {
font-weight: bold;
margin: 0 0 5px;
}
.cart-item-controls {
display: flex;
align-items: center;
margin-bottom: 5px;
}
.quantity-btn {
background-color: #e9ecef;
border: 1px solid #ddd;
width: 25px;
height: 25px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.quantity {
margin: 0 10px;
min-width: 20px;
text-align: center;
}
.cart-item-price {
margin: 0;
color: #000;
}
.remove-item {
position: absolute;
top: 0;
right: 0;
background: none;
border: none;
font-size: 18px;
color: #dc3545;
cursor: pointer;
&:hover {
color: #c82333;
}
}
.cart-footer {
padding: 15px;
border-top: 1px solid #ddd;
}
.cart-total {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
font-weight: bold;
}
.total-price {
color: #28a745;
}
.checkout-btn {
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
&:hover {
background-color: #0069d9;
}
}
.cart-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
z-index: 999;
}
// Add/Update these styles in your machine-slots.component.scss file
.price-quantity-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
gap: 8px;
}
.product-price {
font-weight: 600;
color: #2c3e50;
font-size: 16px;
margin: 0;
flex-shrink: 0; // Prevents price from shrinking
}
// Update your existing quantity-selector styles
.quantity-selector {
display: flex;
align-items: center;
justify-content: center;
gap: 4px; // Reduced gap for tighter layout
font-family: Arial, sans-serif;
flex-shrink: 0; // Prevents quantity selector from shrinking
}
.quantity-btn {
width: 28px; // Slightly smaller for better fit
height: 28px;
border: 2px solid #ddd;
background-color: white;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
font-size: 16px; // Slightly smaller font
font-weight: bold;
color: #666;
&:hover:not(:disabled) {
background-color: #f5f5f5;
border-color: #bbb;
}
&:active:not(:disabled) {
background-color: #e5e5e5;
}
&:disabled {
background-color: #f9f9f9;
border-color: #e5e5e5;
color: #ccc;
cursor: not-allowed;
}
}
.quantity-display {
font-size: 14px; // Smaller font for compact layout
font-weight: 500;
color: #333;
min-width: 20px;
text-align: center;
padding: 0 6px; // Reduced padding
}
.minus-icon,
.plus-icon {
line-height: 1;
user-select: none;
}
// Make sure the product-actions only contains the button now
.product-actions {
margin-top: 8px;
.add-to-cart-btn {
width: 100%;
padding: 8px 12px;
background-color: #3498db;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: background-color 0.2s ease;
&:hover:not(:disabled) {
background-color: #2980b9;
}
&:disabled {
background-color: #bdc3c7;
cursor: not-allowed;
}
}
}
/* ============================================
PAYMENT DIALOG
============================================ */
.payment-dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 99999;
padding: 20px;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.payment-dialog {
background: white;
border-radius: 12px;
width: 100%;
max-width: 500px;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
animation: slideUp 0.3s ease;
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 24px;
border-bottom: 1px solid #e0e0e0;
h2 {
margin: 0;
font-size: 24px;
font-weight: 600;
color: #333;
}
.close-dialog {
background: none;
border: none;
font-size: 32px;
color: #999;
cursor: pointer;
padding: 0;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
&:hover {
color: #333;
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
}
.dialog-body {
padding: 24px;
}
.order-summary {
h3 {
margin: 0 0 16px;
font-size: 18px;
font-weight: 600;
color: #333;
}
}
.summary-items {
border-top: 1px solid #e0e0e0;
padding-top: 12px;
}
.summary-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #f0f0f0;
.summary-item-left {
display: flex;
flex-direction: column;
gap: 4px;
}
.item-name {
font-size: 15px;
color: #333;
font-weight: 500;
}
.item-quantity {
font-size: 13px;
color: #666;
}
.item-price {
font-size: 15px;
font-weight: 600;
color: #333;
}
}
.summary-total {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 0 0;
margin-top: 12px;
border-top: 2px solid #333;
.total-label {
font-size: 18px;
font-weight: 600;
color: #333;
}
.total-amount {
font-size: 24px;
font-weight: 700;
color: #4CAF50;
}
}
.dialog-footer {
display: flex;
gap: 12px;
padding: 20px 24px;
border-top: 1px solid #e0e0e0;
}
.dialog-btn {
flex: 1;
padding: 14px 24px;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
.cancel-btn {
background: #f5f5f5;
color: #666;
&:hover:not(:disabled) {
background: #e0e0e0;
}
}
.paid-btn {
background: #4CAF50;
color: white;
&:hover:not(:disabled) {
background: #45a049;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}
}
/* Dark mode support */
.dark .payment-dialog {
background: #1e293b;
.dialog-header {
border-bottom-color: rgba(255, 255, 255, 0.1);
h2 {
color: #fff;
}
.close-dialog {
color: #999;
&:hover {
color: #fff;
}
}
}
.summary-items {
border-top-color: rgba(255, 255, 255, 0.1);
}
.summary-item {
border-bottom-color: rgba(255, 255, 255, 0.05);
.item-name {
color: #fff;
}
.item-quantity {
color: #999;
}
.item-price {
color: #fff;
}
}
.summary-total {
border-top-color: rgba(255, 255, 255, 0.2);
.total-label {
color: #fff;
}
}
.dialog-footer {
border-top-color: rgba(255, 255, 255, 0.1);
}
}
@media (max-width: 575px) {
.payment-dialog {
max-width: 95vw;
}
.dialog-header {
padding: 16px 20px;
h2 {
font-size: 20px;
}
}
.dialog-body {
padding: 20px;
}
.summary-total {
.total-label {
font-size: 16px;
}
.total-amount {
font-size: 20px;
}
}
.dialog-footer {
padding: 16px 20px;
}
.dialog-btn {
padding: 12px 20px;
font-size: 15px;
}
}