Skip to content

Commit

Permalink
can select fournisseur for the course
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptTF committed Apr 26, 2024
1 parent 279d48c commit f69c43b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions frontend/src/routes/panel/products/course/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
<script lang="ts">
import { api } from '$lib/config/config';
import { CourseApi } from '$lib/requests/requests';
import type { CourseItem, Item } from '$lib/api';
import type { CourseItem, Item, RestockType } from '$lib/api';
let items: CourseItem[] = [];
CourseApi()
.getCourse('promocash', {
withCredentials: true
})
.then((res) => {
items = res.data.items;
});
let fournisseur = "promocash";
function reloadCourse() {
CourseApi()
.getCourse(fournisseur, {
withCredentials: true
})
.then((res) => {
if (res.data.items != null) {
items = res.data.items;
} else {
items = [];
}
});
console.log(items);
}
reloadCourse()
</script>

<div class="relative mt-4 w-96 md:mt-0">
<!-- filter by state -->
<select
id="fournisseur"
name="fournisseur"
class="py-3 px-4 block w-full border-gray-200 border-2 rounded-md text-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400"
required
aria-describedby="text-error"
on:change={(e) => {
// @ts-ignore
let val = e.target?.value;
fournisseur = val;
reloadCourse();
}}
>
<option value="promocash">Promocash</option>
<option value="auchan_drive">Auchan drive</option>
<option value="auchan">Auchan</option>
<option value="viennoiserie">Boulangerie Benoist</option>
</select>
</div>

<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
<thead class="bg-gray-50 dark:bg-slate-800">
<tr>
Expand Down

0 comments on commit f69c43b

Please sign in to comment.