diff --git a/shop/migrations/0013_color_colorhex_alter_color_name.py b/shop/migrations/0013_color_colorhex_alter_color_name.py new file mode 100644 index 0000000..abe2177 --- /dev/null +++ b/shop/migrations/0013_color_colorhex_alter_color_name.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.11 on 2025-03-19 19:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0012_order_payment_status_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='color', + name='colorHex', + field=models.CharField(default='#FFFFFF', help_text='Color in hex format (e.g. #FF0000)', max_length=7), + ), + migrations.AlterField( + model_name='color', + name='name', + field=models.CharField(max_length=20, unique=True), + ), + ] diff --git a/shop/models.py b/shop/models.py index bff86f0..b1bfc82 100644 --- a/shop/models.py +++ b/shop/models.py @@ -29,7 +29,8 @@ class CutChoices(models.IntegerChoices): KIDS = 3, 'Kids' class Color(models.Model): - name = models.CharField(max_length=20, choices=ColorChoices.choices, unique=True) + name = models.CharField(max_length=20, unique=True) + colorHex = models.CharField(max_length=7, default="#FFFFFF", help_text="Color in hex format (e.g. #FF0000)") def __str__(self): return self.name diff --git a/shop/static/shop/css/shop.css b/shop/static/shop/css/shop.css index 8fc4e4a..09fe917 100644 --- a/shop/static/shop/css/shop.css +++ b/shop/static/shop/css/shop.css @@ -1,7 +1,7 @@ /* Product Display */ .options-container { display: grid; - grid-template-columns: 1fr 1fr 1fr; + grid-template-columns: 1fr 0.35fr 0.35fr; column-gap: 8px; align-content: center; } @@ -34,13 +34,13 @@ } .option-element:nth-child(1) { - grid-column: 1 / span 2; + grid-column: 1; grid-row: 1; height: 64px; } .option-element:nth-child(2) { - grid-column: 3; + grid-column: 2 / span 3; grid-row: 1; text-align: right; } @@ -61,12 +61,12 @@ } .option-element:nth-child(6) { - grid-column: 1 / span 2; + grid-column: 1; grid-row: 3; } .option-element:nth-child(7) { - grid-column: 3; + grid-column: 2 / span 3; grid-row: 3; text-align: right; } @@ -90,12 +90,13 @@ width: 100%; text-align: center; display: inline-block; - height: 40px; + height: 36px; } .checkout-button { padding: 10px 20px; display: inline-block; + height: 36px; } .confirm-nav-button { @@ -308,3 +309,23 @@ color: #e84039; text-decoration: underline; } + +.color-samples { + display: flex; + margin-bottom: 12px; + gap: 0px 8px; + vertical-align: middle; + align-items: center; +} + +.color-sample { + width: 32px; + aspect-ratio: 1; + border-radius: 50%; + cursor: pointer; + border: 1px solid #ddd; +} + +.color-sample:hover { + transform: scale(1.1); +} diff --git a/shop/templates/shop/cart.html b/shop/templates/shop/cart.html index f9717d2..8034405 100644 --- a/shop/templates/shop/cart.html +++ b/shop/templates/shop/cart.html @@ -18,7 +18,7 @@ {% endif %}
-
+

Votre panier

{% if cart_items %} @@ -30,7 +30,7 @@ Taille Quantité Prix - Actions + @@ -55,7 +55,7 @@
{% csrf_token %} - +
diff --git a/shop/templates/shop/product_item.html b/shop/templates/shop/product_item.html index 7660871..db7d7c6 100644 --- a/shop/templates/shop/product_item.html +++ b/shop/templates/shop/product_item.html @@ -8,19 +8,28 @@
{% csrf_token %}
-
{{ product.title }}
+
+ {{ product.title }} +
{{ product.colors.all.0.name }}
+
{{ product.price }} €
{% if product.colors.exists %} - +
{% for color in product.colors.all %} - +
{% endfor %} - +
{% endif %}
+
{% if product.sizes.exists %}