diff --git a/backend/product/views.py b/backend/product/views.py index ccc51ee..797b97e 100644 --- a/backend/product/views.py +++ b/backend/product/views.py @@ -12,6 +12,7 @@ from drf_spectacular.utils import extend_schema, OpenApiParameter, OpenApiTypes from rest_framework.permissions import AllowAny from order.serializers import OrderItemSerailzier from order.models import OrderModel +from django.db.models import Min, Max # class APIView(APIView): # def __init__(self, *args, **kwargs): # super().__init__(*args, **kwargs) @@ -177,15 +178,16 @@ class AllProductsView(APIView): if search_query: products = products.filter(Q(name__icontains=search_query) | Q(description__icontains=search_query)) - # # Price filters + # Price filters price_gte = request.query_params.get('price_gte', None) price_lte = request.query_params.get('price_lte', None) - - if price_gte: - products = products.filter(variants__price__gte=price_gte) - if price_lte: - products = products.filter(variants__price__lte=price_lte) + products = products.annotate(min_price=Min('variants__price'), max_price=Max('variants__price')) + + if price_gte: + products = products.filter(max_price__gte=price_gte) + if price_lte: + products = products.filter(min_price__lte=price_lte) # Sorting sort_by = request.query_params.get('sort', None) if sort_by in ['name', '-name', 'created_at', '-created_at']: diff --git a/frontend/assets/css/other.utils.css b/frontend/assets/css/other.utils.css index 45c7fec..a34b0b2 100644 --- a/frontend/assets/css/other.utils.css +++ b/frontend/assets/css/other.utils.css @@ -1,7 +1,7 @@ @utility persian-number { - -moz-font-feature-settings: "ss03"; - -webkit-font-feature-settings: "ss03"; - font-feature-settings: "ss03"; + -moz-font-feature-settings: "ss02"; + -webkit-font-feature-settings: "ss02"; + font-feature-settings: "ss02"; } @utility text-gradient { diff --git a/frontend/components/global/BlogPost.vue b/frontend/components/global/BlogPost.vue index 457a707..1e26aa7 100644 --- a/frontend/components/global/BlogPost.vue +++ b/frontend/components/global/BlogPost.vue @@ -39,7 +39,7 @@ const createdAt = usePersianTimeAgo(new Date(date.value)); {{ category.name }} @@ -49,7 +49,7 @@ const createdAt = usePersianTimeAgo(new Date(date.value)); class="aspect-square w-full rounded-150 overflow-hidden relative" > {{ category.name }} diff --git a/frontend/components/global/Header.vue b/frontend/components/global/Header.vue index 9ae43bc..06097a3 100644 --- a/frontend/components/global/Header.vue +++ b/frontend/components/global/Header.vue @@ -123,7 +123,7 @@ const isHomePage = computed(() => route.path === "/");
diff --git a/frontend/components/global/LoadingOverlay.vue b/frontend/components/global/LoadingOverlay.vue index 57494c6..fecd7bf 100644 --- a/frontend/components/global/LoadingOverlay.vue +++ b/frontend/components/global/LoadingOverlay.vue @@ -92,7 +92,7 @@ onMounted(() => { src="/img/heymlz/heymlz-text-logo.png" class="invert w-[250px]" /> -
+
{ :key="slide" class="py-4" > -
+
+ +
diff --git a/frontend/components/global/product/ProductCard.vue b/frontend/components/global/product/ProductCard.vue index 745cdb8..f96e0dc 100644 --- a/frontend/components/global/product/ProductCard.vue +++ b/frontend/components/global/product/ProductCard.vue @@ -22,11 +22,17 @@ type Props = { // props const props = defineProps(); -const { id } = toRefs(props); +const { id, colors } = toRefs(props); // state const { colorObject } = useImageColor(`#product-image-${id.value}`); + +// computed + +const limitedColors = computed(() => { + return colors.value.slice(0, 3); +});