2016-09-04 17:24:53 +00:00
|
|
|
{% extends "core/base.jinja" %}
|
2024-12-13 23:10:34 +00:00
|
|
|
{% from "core/macros.jinja" import paginate_alpine %}
|
2016-07-27 15:23:02 +00:00
|
|
|
|
|
|
|
{% block title %}
|
2024-07-23 22:16:31 +00:00
|
|
|
{% trans %}Product list{% endtrans %}
|
2016-07-27 15:23:02 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-12-13 23:10:34 +00:00
|
|
|
{% block additional_js %}
|
2024-12-21 01:13:37 +00:00
|
|
|
<script type="module" src="{{ static("bundled/counter/components/ajax-select-index.ts") }}"></script>
|
2024-12-13 23:10:34 +00:00
|
|
|
<script type="module" src="{{ static("bundled/counter/product-list-index.ts") }}"></script>
|
2016-07-27 15:23:02 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-12-14 01:45:11 +00:00
|
|
|
{% block additional_css %}
|
|
|
|
<link rel="stylesheet" href="{{ static("core/components/card.scss") }}">
|
|
|
|
<link rel="stylesheet" href="{{ static("counter/css/admin.scss") }}">
|
2024-12-21 01:13:37 +00:00
|
|
|
<link rel="stylesheet" href="{{ static("bundled/core/components/ajax-select-index.css") }}">
|
|
|
|
<link rel="stylesheet" href="{{ static("core/components/ajax-select.scss") }}">
|
2024-12-14 01:45:11 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-12-13 23:10:34 +00:00
|
|
|
{% block content %}
|
|
|
|
<main x-data="productList">
|
2024-12-21 01:13:37 +00:00
|
|
|
<h4 class="margin-bottom">{% trans %}Filter products{% endtrans %}</h4>
|
2024-12-13 23:36:12 +00:00
|
|
|
<form id="search-form" class="margin-bottom">
|
2024-12-21 01:13:37 +00:00
|
|
|
<div class="row gap-4x">
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
<label for="search-input">{% trans %}Product name{% endtrans %}</label>
|
|
|
|
<input
|
|
|
|
id="search-input"
|
|
|
|
type="text"
|
|
|
|
name="search"
|
|
|
|
x-model.debounce.500ms="search"
|
|
|
|
/>
|
|
|
|
</fieldset>
|
2024-12-22 19:01:23 +00:00
|
|
|
<fieldset class="grow">
|
2024-12-21 01:13:37 +00:00
|
|
|
<legend>{% trans %}Product state{% endtrans %}</legend>
|
|
|
|
<div class="row">
|
|
|
|
<input type="radio" id="filter-active-products" x-model="productStatus" value="active">
|
|
|
|
<label for="filter-active-products">{% trans %}Active products{% endtrans %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<input type="radio" id="filter-inactive-products" x-model="productStatus" value="archived">
|
|
|
|
<label for="filter-inactive-products">{% trans %}Archived products{% endtrans %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<input type="radio" id="filter-all-products" x-model="productStatus" value="both">
|
|
|
|
<label for="filter-all-products">{% trans %}All products{% endtrans %}</label>
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
2024-12-13 23:10:34 +00:00
|
|
|
<fieldset>
|
2024-12-21 01:13:37 +00:00
|
|
|
<label for="type-search-input">{% trans %}Product type{% endtrans %}</label>
|
|
|
|
<product-type-ajax-select
|
|
|
|
id="type-search-input"
|
|
|
|
name="product-type"
|
|
|
|
x-ref="productTypesInput"
|
|
|
|
multiple
|
|
|
|
>
|
|
|
|
</product-type-ajax-select>
|
2024-12-13 23:10:34 +00:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
2024-12-21 01:13:37 +00:00
|
|
|
<h3 class="margin-bottom">{% trans %}Product list{% endtrans %}</h3>
|
2016-07-27 15:23:02 +00:00
|
|
|
|
2024-12-13 23:36:12 +00:00
|
|
|
<div class="row margin-bottom">
|
2024-12-13 23:11:25 +00:00
|
|
|
<a href="{{ url('counter:new_product') }}" class="btn btn-blue">
|
|
|
|
{% trans %}New product{% endtrans %} <i class="fa fa-plus"></i>
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
class="btn btn-blue"
|
|
|
|
@click="downloadCsv()"
|
|
|
|
:disabled="csvLoading"
|
|
|
|
:aria-busy="csvLoading"
|
|
|
|
>
|
|
|
|
{% trans %}Download as cvs{% endtrans %} <i class="fa fa-file-arrow-down"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
2016-07-27 15:23:02 +00:00
|
|
|
|
2024-12-13 23:36:12 +00:00
|
|
|
<div class="aria-busy-grow" :aria-busy="loading">
|
|
|
|
<template x-for="[category, cat_products] of Object.entries(products)" :key="category">
|
|
|
|
<section>
|
2024-12-14 01:45:11 +00:00
|
|
|
<h4 x-text="category" class="margin-bottom"></h4>
|
2024-12-14 02:13:14 +00:00
|
|
|
<div class="product-group">
|
2024-12-13 23:36:12 +00:00
|
|
|
<template x-for="p in cat_products" :key="p.id">
|
2024-12-14 01:45:11 +00:00
|
|
|
<a class="card card-row shadow clickable" :href="p.url">
|
|
|
|
<template x-if="p.icon">
|
|
|
|
<img class="card-image" :src="p.icon" :alt="`icon ${p.name}`">
|
|
|
|
</template>
|
|
|
|
<template x-if="!p.icon">
|
|
|
|
<i class="fa-regular fa-image fa-2x card-image"></i>
|
|
|
|
</template>
|
|
|
|
<span class="card-content">
|
|
|
|
<strong class="card-title" x-text="`${p.name} (${p.code})`"></strong>
|
|
|
|
<p x-text="`${p.selling_price} €`"></p>
|
|
|
|
</span>
|
|
|
|
</a>
|
2024-12-13 23:36:12 +00:00
|
|
|
</template>
|
2024-12-14 01:45:11 +00:00
|
|
|
</div>
|
2024-12-13 23:36:12 +00:00
|
|
|
</section>
|
|
|
|
</template>
|
2024-12-13 23:10:34 +00:00
|
|
|
{{ paginate_alpine("page", "nbPages") }}
|
2024-12-13 23:36:12 +00:00
|
|
|
</div>
|
2024-12-13 23:10:34 +00:00
|
|
|
</main>
|
|
|
|
{% endblock %}
|