feat: implement order management and checkout functionality
All checks were successful
Build and Push Docker Image / build (push) Successful in 50s
All checks were successful
Build and Push Docker Image / build (push) Successful in 50s
- Added `Order` and `OrderItem` models with migrations for managing orders and their details - Created `CheckoutForm` for validating order data and customer information - Built templates for order confirmation, checkout success, and emails (HTML and plain text) - Added logic for email notifications upon successful order placement - Enhanced shopping cart template with checkout panel integration - Updated styles and JavaScript for streamlined checkout UX - Refactored cart view to support item summaries and final totals during checkout
This commit is contained in:
@@ -1,89 +1,43 @@
|
||||
.cart-page {
|
||||
margin-bottom: 88px;
|
||||
padding-top: 34px;
|
||||
}
|
||||
|
||||
.cart-hero {
|
||||
padding: 28px 0 34px;
|
||||
}
|
||||
|
||||
.cart-kicker {
|
||||
color: #63768d;
|
||||
font-size: 16px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.cart-hero__row {
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.cart-title {
|
||||
font-size: 44px;
|
||||
line-height: 1.04;
|
||||
}
|
||||
|
||||
.cart-description {
|
||||
margin-top: 12px;
|
||||
max-width: 620px;
|
||||
color: #554971;
|
||||
font-size: 18px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.cart-summary-card {
|
||||
min-width: 220px;
|
||||
padding: 18px 22px;
|
||||
border: 1px solid rgba(54, 33, 62, 0.12);
|
||||
background: rgba(99, 118, 141, 0.06);
|
||||
}
|
||||
|
||||
.cart-summary-card__value {
|
||||
display: block;
|
||||
font-size: 34px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.cart-summary-card__label {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
color: #554971;
|
||||
}
|
||||
|
||||
.cart-content {
|
||||
.checkout-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 280px;
|
||||
gap: 28px;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(360px, 490px);
|
||||
gap: 68px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.cart-content--guest {
|
||||
min-height: 280px;
|
||||
.cart-section-title {
|
||||
margin: 0 0 28px;
|
||||
color: var(--dark);
|
||||
font-family: 'BerlinType', serif;
|
||||
font-size: 38px;
|
||||
font-weight: 400;
|
||||
line-height: 1.05;
|
||||
}
|
||||
|
||||
.cart-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
.cart-item {
|
||||
display: grid;
|
||||
grid-template-columns: 180px minmax(0, 1fr);
|
||||
gap: 22px;
|
||||
padding: 22px;
|
||||
border: 1px solid rgba(54, 33, 62, 0.12);
|
||||
background: #ffffff;
|
||||
grid-template-columns: 230px minmax(0, 1fr);
|
||||
gap: 34px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.cart-item__media {
|
||||
display: block;
|
||||
aspect-ratio: 4 / 3;
|
||||
background: rgba(99, 118, 141, 0.08);
|
||||
width: 100%;
|
||||
aspect-ratio: 1.55 / 1;
|
||||
overflow: hidden;
|
||||
background: rgba(99, 118, 141, 0.12);
|
||||
}
|
||||
|
||||
.cart-item__media img {
|
||||
@@ -99,170 +53,399 @@
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #63768d;
|
||||
color: var(--mid);
|
||||
}
|
||||
|
||||
.cart-item__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
.cart-item__info {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cart-item__category {
|
||||
color: #63768d;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.cart-item__title {
|
||||
display: inline-block;
|
||||
margin-top: 8px;
|
||||
font-family: 'BerlinType', serif;
|
||||
font-size: 28px;
|
||||
color: var(--dark);
|
||||
font-size: 25px;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.cart-item__price {
|
||||
margin-top: 10px;
|
||||
color: #554971;
|
||||
margin-top: 24px;
|
||||
color: var(--dark);
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.cart-item__controls {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
gap: 24px;
|
||||
margin-top: 28px;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.cart-quantity {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cart-quantity form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.cart-quantity__button {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border: 1px solid #63768d;
|
||||
.cart-quantity__button,
|
||||
.cart-item__remove {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #36213e;
|
||||
font-size: 24px;
|
||||
color: var(--dark);
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cart-quantity__value {
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.cart-item__aside {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cart-item__subtotal {
|
||||
font-size: 17px;
|
||||
color: #36213e;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--dark);
|
||||
color: var(--white);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.cart-item__remove {
|
||||
width: auto;
|
||||
min-width: 30px;
|
||||
color: transparent;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cart-item__remove::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 8px;
|
||||
transform: translateX(-50%);
|
||||
width: 15px;
|
||||
height: 18px;
|
||||
border: 2px solid var(--dark);
|
||||
border-top: 0;
|
||||
border-radius: 0 0 3px 3px;
|
||||
}
|
||||
|
||||
.cart-item__remove::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 4px;
|
||||
transform: translateX(-50%);
|
||||
width: 19px;
|
||||
height: 2px;
|
||||
background: var(--dark);
|
||||
box-shadow: 0 -3px 0 -1px var(--dark);
|
||||
}
|
||||
|
||||
.cart-products-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
margin-top: 34px;
|
||||
color: var(--mid);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.checkout-summary p,
|
||||
.checkout-services p,
|
||||
.order-success__items p {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.cart-products-summary p {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.cart-products-summary span,
|
||||
.cart-products-summary strong {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.checkout-panel {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.checkout-form {
|
||||
color: var(--dark);
|
||||
}
|
||||
|
||||
.checkout-fieldset {
|
||||
margin: 0 0 18px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #a14b4b;
|
||||
}
|
||||
|
||||
.checkout-fieldset legend {
|
||||
margin-bottom: 12px;
|
||||
font-size: 19px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.checkout-options {
|
||||
display: grid;
|
||||
gap: 14px 34px;
|
||||
}
|
||||
|
||||
.checkout-options--two {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.checkout-options--three {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.checkout-radio,
|
||||
.checkout-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--dark);
|
||||
font-size: 16px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.checkout-radio input,
|
||||
.checkout-checkbox input {
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
accent-color: var(--mid);
|
||||
}
|
||||
|
||||
.checkout-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.checkout-grid--contacts {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.checkout-input {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.checkout-input--wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.checkout-input span {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.checkout-input input {
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
border: 1px solid rgba(85, 73, 113, 0.65);
|
||||
background: #dedede;
|
||||
padding: 0 13px;
|
||||
color: var(--dark);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.checkout-input input::placeholder {
|
||||
color: rgba(85, 73, 113, 0.55);
|
||||
}
|
||||
|
||||
.checkout-checkbox {
|
||||
margin-top: 12px;
|
||||
color: var(--mid);
|
||||
}
|
||||
|
||||
.promo-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 178px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.promo-row button {
|
||||
border: 0;
|
||||
background: var(--blue-gray);
|
||||
color: var(--white);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.cart-totals {
|
||||
position: sticky;
|
||||
top: 120px;
|
||||
padding: 24px;
|
||||
border: 1px solid rgba(54, 33, 62, 0.12);
|
||||
background: rgba(99, 118, 141, 0.06);
|
||||
.checkout-summary {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
width: min(320px, 100%);
|
||||
margin-top: 24px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.cart-totals__label {
|
||||
color: #554971;
|
||||
.checkout-summary strong,
|
||||
.checkout-services strong,
|
||||
.order-success__items strong {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.checkout-submit,
|
||||
.order-success__link,
|
||||
.cart-empty a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 245px;
|
||||
height: 38px;
|
||||
margin-top: 18px;
|
||||
border: 0;
|
||||
background: var(--blue-gray);
|
||||
color: var(--white);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checkout-checkbox--terms {
|
||||
display: flex;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.checkout-services {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
width: min(260px, 100%);
|
||||
margin-top: 18px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.checkout-services h3 {
|
||||
font-family: 'Noah', sans-serif;
|
||||
font-size: 19px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.field-error,
|
||||
.checkout-errors {
|
||||
margin-top: 8px;
|
||||
color: #a14b4b;
|
||||
font-size: 15px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.checkout-errors {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.cart-empty,
|
||||
.order-success {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
padding: 54px 0 72px;
|
||||
}
|
||||
|
||||
.cart-empty h1,
|
||||
.order-success h1 {
|
||||
font-size: 44px;
|
||||
font-weight: 400;
|
||||
line-height: 1.08;
|
||||
}
|
||||
|
||||
.cart-empty p,
|
||||
.order-success__lead {
|
||||
margin-top: 14px;
|
||||
color: var(--mid);
|
||||
font-size: 19px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.order-success__eyebrow {
|
||||
margin-bottom: 10px;
|
||||
color: var(--blue-gray);
|
||||
font-size: 16px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.cart-totals__value {
|
||||
margin-top: 10px;
|
||||
font-family: 'BerlinType', serif;
|
||||
font-size: 36px;
|
||||
line-height: 1.1;
|
||||
.order-success__summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
margin-top: 28px;
|
||||
padding: 24px;
|
||||
background: rgba(99, 118, 141, 0.08);
|
||||
}
|
||||
|
||||
.cart-totals__meta {
|
||||
margin-top: 12px;
|
||||
color: #554971;
|
||||
font-size: 16px;
|
||||
line-height: 1.4;
|
||||
.order-success__summary span {
|
||||
display: block;
|
||||
color: var(--mid);
|
||||
}
|
||||
|
||||
.cart-empty {
|
||||
padding: 32px;
|
||||
border: 1px solid rgba(54, 33, 62, 0.12);
|
||||
color: #554971;
|
||||
.order-success__summary strong {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
font-size: 18px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.cart-item__summary-line {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
color: #554971;
|
||||
font-size: 16px;
|
||||
.order-success__items {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
@media (max-width: 980px) {
|
||||
.cart-page {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
.cart-hero__row,
|
||||
.cart-content {
|
||||
.checkout-layout {
|
||||
grid-template-columns: 1fr;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.cart-summary-card,
|
||||
.cart-totals {
|
||||
min-width: 0;
|
||||
position: static;
|
||||
gap: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.cart-section-title,
|
||||
.cart-empty h1,
|
||||
.order-success h1 {
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
.cart-item {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cart-products-summary,
|
||||
.checkout-options--two,
|
||||
.checkout-options--three,
|
||||
.checkout-grid,
|
||||
.checkout-grid--contacts,
|
||||
.promo-row,
|
||||
.order-success__summary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.cart-item__controls {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
.promo-row button {
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.cart-item__aside {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.cart-title {
|
||||
font-size: 34px;
|
||||
.checkout-submit,
|
||||
.order-success__link,
|
||||
.cart-empty a {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user