diff --git a/src/routes/search-products/FiltersModal.svelte b/src/routes/search-products/FiltersModal.svelte
index 52a06534..14d1ab38 100644
--- a/src/routes/search-products/FiltersModal.svelte
+++ b/src/routes/search-products/FiltersModal.svelte
@@ -1,74 +1,159 @@
-
Filtres
-
+
Filtres
+
-
-
+
+
+
+
+
+
+
-
- toggleBio()}>
- Produit issu de l'agriculture biologique
-
+
+ toggleBio()}>
+ Produit issu de l'agriculture biologique
+
-
-
+
+
+
+
diff --git a/src/routes/search-products/ProducerItem.svelte b/src/routes/search-products/ProducerItem.svelte
new file mode 100644
index 00000000..7bdff3dc
--- /dev/null
+++ b/src/routes/search-products/ProducerItem.svelte
@@ -0,0 +1,13 @@
+
+
+
+
+
+
{item.name}
+
{item.address.zipcode} {item.address.city}
+
+
\ No newline at end of file
diff --git a/src/routes/search-products/SearchProducts.svelte b/src/routes/search-products/SearchProducts.svelte
index 9ebcee13..1087c2b6 100644
--- a/src/routes/search-products/SearchProducts.svelte
+++ b/src/routes/search-products/SearchProducts.svelte
@@ -101,7 +101,7 @@
};
const showFiltersModal = () => {
- open(FiltersModal, { filters, visibleNav: true });
+ open(FiltersModal, { filters, visibleNav: true, producer });
};
const renderSort = (sort) => {
@@ -141,8 +141,10 @@
}
}
- if (values["producerId"] && values["producerId"] <= 0)
+ if (values["producerId"] && values["producerId"] <= 0){
values["producerId"] = null;
+ producer = null;
+ }
if (values["maxDistance"] && values["maxDistance"].length > 0) {
values["maxDistance"] = parseInt(values["maxDistance"]);
@@ -360,8 +362,13 @@
});
let currentProducerId = null;
- const GetProducerName = async (producerId) => {
- if (!producerId || producerId.length <= 0 || currentProducerId == producerId) return;
+ const GetProducerFilter = async (producerId) => {
+ if(currentProducerId == producerId) return;
+
+ if (!producerId || producerId.length <= 0){
+ producer = null;
+ return;
+ }
currentProducerId = producerId;
var result = await graphQLInstance.query(
@@ -375,7 +382,7 @@
producer = result.data;
};
- $: GetProducerName($filters.producerId);
+ $: GetProducerFilter($filters.producerId);
$: productsCount = $cartItems.reduce((sum, product) => {
return sum + (product.quantity || 0);
}, 0);
@@ -595,7 +602,7 @@
on:click={() => clearProducer()}
style="font-size: .6rem"
class="mx-1 mb-2 px-3 h-6 rounded-full font-semibold flex
- items-center bg-gray-200">
+ items-center bg-gray-200 cursor-pointer">
producteur: '{producer.name}'
diff --git a/src/routes/search-products/queries.js b/src/routes/search-products/queries.js
index 2e5a379a..bbec5b1c 100644
--- a/src/routes/search-products/queries.js
+++ b/src/routes/search-products/queries.js
@@ -124,3 +124,16 @@ export const GET_PRODUCER_NAME = gql`
}
}
`;
+
+export const SUGGEST_PRODUCER = gql`
+ query SuggestProducer($input: SearchTermsInput!) {
+ suggestProducers(input: $input) {
+ id
+ name
+ address{
+ zipcode
+ city
+ }
+ }
+ }
+`;