fixes, add weight

This commit is contained in:
Ludovic CANDELLIER
2023-08-01 21:55:17 +02:00
parent 5f1ff26196
commit 6f2a985edc
11 changed files with 295 additions and 180 deletions

View File

@@ -1,62 +1,103 @@
<div class="row mb-3">
<div class="col-6">
<div class="row mb-3">
<div class="col-12">
{{ Form::label('article_id', 'Article') }}
@include('components.form.select', ['name' => 'article_id', 'id_name' => 'article_id', 'list' => $articles ?? null, 'value' => $offer['article_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_article'])
</div>
</div>
<div class="col-8">
<div class="row mb-3">
<div class="col-12">
@include('components.form.select', [
'name' => 'article_id',
'id_name' => 'article_id',
'list' => $articles ?? null,
'value' => $offer['article_id'] ?? null,
'with_empty' => '',
'class' => 'select2 select_article',
'label' => 'Article',
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('variation_id', 'Déclinaison') }}
@include('components.form.select', ['name' => 'variation_id', 'id_name' => 'variation_id', 'list' => $variations ?? null, 'value' => $offer['variation_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_variation'])
</div>
</div>
<div class="row mb-3">
<div class="col-4">
@include('components.form.select', [
'name' => 'variation_id',
'id_name' => 'variation_id',
'list' => $variations ?? null,
'value' => $offer['variation_id'] ?? null,
'with_empty' => '',
'class' => 'select2 select_variation',
'label' => __('shop.packages.name'),
'required' => true,
])
</div>
<div class="col-4">
@include('components.form.select', [
'name' => 'tariff_id',
'id_name' => 'tariff_id',
'list' => $tariffs ?? null,
'value' => $offer['tariff_id'] ?? null,
'with_empty' => '',
'class' => 'select2 select_tariffs',
'label' => 'Tarif',
'required' => true,
])
</div>
<div class="col-4">
@include('components.form.input', [
'name' => 'weight',
'value' => $offer['weight'] ?? null,
'label' => 'Poids en g',
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('tariff_id', 'Tarif') }}
@include('components.form.select', ['name' => 'tariff_id', 'id_name' => 'tariff_id', 'list' => $tariffs ?? null, 'value' => $offer['tariff_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_tariffs'])
</div>
</div>
@component('components.card', ['title' => 'Disponibilité'])
<div class="row mb-3">
<div class="col-12 col-xl-6">
{{ Form::label('stock_current', 'Appro immédiate') }}
@include('components.form.inputs.money', ['name' => 'stock_current', 'value' => $offer['stock_current'] ?? 0])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('stock_delayed', 'Appro sur delai') }}
@include('components.form.inputs.money', ['name' => 'stock_delayed', 'value' => $offer['stock_delayed'] ?? 0])
</div>
<div class="col-6">
{{ Form::label('delay_type', 'Délai type') }}
@include('components.form.input', ['name' => 'delay_type', 'value' => $offer['delay_type'] ?? null])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('stock_ondemand', 'Appro sur demande') }}
@include('components.form.toggle', ['name' => 'stock_ondemand', 'value' => $offer['stock_ondemand'] ?? 0])
</div>
<div class="col-6">
{{ Form::label('minimum_ondemand', 'Minimum de quantité') }}
@include('components.form.inputs.money', ['name' => 'minimum_ondemand', 'value' => $offer['minimum_ondemand'] ?? 0])
</div>
</div>
@endcomponent
</div>
<div class="col-6">
@component('components.card', ['title' => 'Previsualisation'])
<div id="preview-article"></div>
<div id="preview-variation"></div>
<div id="preview-tariff"></div>
@endcomponent
</div>
@component('components.card', ['title' => 'Disponibilité', 'class' => 'mt-5'])
<div class="row mb-3 mt-3">
<div class="col-4">
@include('components.form.inputs.money', [
'name' => 'stock_current',
'value' => $offer['stock_current'] ?? 0,
'label' => 'Appro immédiate',
])
</div>
<div class="col-4">
@include('components.form.inputs.money', [
'name' => 'stock_delayed',
'value' => $offer['stock_delayed'] ?? 0,
'label' => 'Appro sur delai',
])
</div>
<div class="col-4">
@include('components.form.input', [
'name' => 'delay_type',
'value' => $offer['delay_type'] ?? null,
'label' => 'Délai type',
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
@include('components.form.toggle', [
'name' => 'stock_ondemand',
'value' => $offer['stock_ondemand'] ?? 0,
'label' => 'Appro sur demande',
'size' => 'md',
])
</div>
<div class="col-6">
@include('components.form.inputs.money', [
'name' => 'minimum_ondemand',
'value' => $offer['minimum_ondemand'] ?? 0,
'label' => 'Minimum de quantité',
])
</div>
</div>
@endcomponent
</div>
<div class="col-4">
@component('components.card', ['title' => 'Previsualisation'])
<div id="preview-article"></div>
<div id="preview-variation"></div>
<div id="preview-tariff"></div>
@endcomponent
</div>
</div>
@@ -67,60 +108,60 @@
@include('load.form.select2')
@push('js')
<script>
function handleArticle() {
$('.select_article').change(function() {
previewArticle($(this).val());
})
}
<script>
function handleArticle() {
$('.select_article').change(function() {
previewArticle($(this).val());
})
}
function previewArticle(id) {
var url = '{{ route('Admin.Shop.Offers.previewArticle') }}/' + id;
$('#preview-article').load(url, function() {
initChevron();
});
}
function previewArticle(id) {
var url = '{{ route('Admin.Shop.Offers.previewArticle') }}/' + id;
$('#preview-article').load(url, function() {
initChevron();
});
}
function handleVariation() {
$('.select_variation').change(function() {
previewVariation($(this).val());
})
}
function handleVariation() {
$('.select_variation').change(function() {
previewVariation($(this).val());
})
}
function previewVariation(id) {
var url = '{{ route('Admin.Shop.Offers.previewVariation') }}/' + id;
$('#preview-variation').load(url, function() {
initChevron();
});
}
function previewVariation(id) {
var url = '{{ route('Admin.Shop.Offers.previewVariation') }}/' + id;
$('#preview-variation').load(url, function() {
initChevron();
});
}
function handleTariff() {
$('.select_tariffs').change(function() {
previewTariff($(this).val());
})
}
function handleTariff() {
$('.select_tariffs').change(function() {
previewTariff($(this).val());
})
}
function previewTariff(id) {
var url = '{{ route('Admin.Shop.Offers.previewTariff') }}/' + id;
$('#preview-tariff').load(url, function() {
initChevron();
});
}
function previewTariff(id) {
var url = '{{ route('Admin.Shop.Offers.previewTariff') }}/' + id;
$('#preview-tariff').load(url, function() {
initChevron();
});
}
function initPreview() {
previewArticle("{{ $offer['article_id'] ?? null }}");
previewVariation("{{ $offer['variation_id'] ?? null }}");
previewTariff("{{ $offer['tariff_id'] ?? null }}");
}
function initPreview() {
previewArticle("{{ $offer['article_id'] ?? null }}");
previewVariation("{{ $offer['variation_id'] ?? null }}");
previewTariff("{{ $offer['tariff_id'] ?? null }}");
}
handleArticle();
handleVariation();
handleTariff();
initChevron();
initSaveForm('#offer-form');
initSelect2();
@if ($offer['id'] ?? false)
initPreview();
@endif
</script>
@endpush
handleArticle();
handleVariation();
handleTariff();
initChevron();
initSaveForm('#offer-form');
initSelect2();
@if ($offer['id'] ?? false)
initPreview();
@endif
</script>
@endpush

View File

@@ -1,29 +1,34 @@
@extends('layout.index', [
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.list'),
'breadcrumb' => [__('shop.offers.title')]
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.list'),
'breadcrumb' => [__('shop.offers.title')]
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Admin.Shop.Offers.index'), 'model' => 'offers', 'with_filters' => true, 'callback' => 'handleOffer();'])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-offers-filters'])
@include('Admin.Shop.Offers.partials.filters', ['model' => 'offers'])
@endcomponent
@endcomponent
@component('components.card')
@include('components.datatable', [
'route' => route('Admin.Shop.Offers.index'),
'model' => 'offers',
'with_filters' => true,
'callback' => 'handleOffer();',
])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-offers-filters'])
@include('Admin.Shop.Offers.partials.filters', ['model' => 'offers'])
@endcomponent
@endcomponent
@endsection
@include('load.form.select2')
@include('load.form.toggle')
@push('js')
<script>
function handleOffer() {
initToggle("{{ route('Admin.Shop.Offers.toggleActive') }}");
}
<script>
function handleOffer() {
initToggle("{{ route('Admin.Shop.Offers.toggleActive') }}");
}
$(document).ready(function () {
initSelect2();
});
</script>
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -1,14 +1,38 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
<label class="col-4">{{ __('shop.article_natures.title') }}</label>
<div class="col-8">
@include('components.form.select', ['name' => 'article_nature_id', 'list' => $article_natures ?? [], 'value' => $filters['article_nature_id'] ?? null, 'class' => 'form-control-sm select2', 'with_empty' => ''])
</div>
</div>
<div class="row mb-3">
<label class="col-4">{{ __('shop.packages.title') }}</label>
<div class="col-8">
@include('components.form.select', ['name' => 'package_id', 'list' => $packages ?? [], 'value' => $filters['package_id'] ?? null, 'class' => 'form-control-sm select2', 'with_empty' => ''])
</div>
</div>
<div class="row mb-3">
<label class="col-4">{{ __('shop.article_natures.title') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'article_nature_id',
'list' => $article_natures ?? [],
'value' => $filters['article_nature_id'] ?? null,
'class' => 'form-control-sm select2',
'with_empty' => '',
])
</div>
</div>
<div class="row mb-3">
<label class="col-4">{{ __('shop.packages.title') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'package_id',
'list' => $packages ?? [],
'value' => $filters['package_id'] ?? null,
'class' => 'form-control-sm select2',
'with_empty' => '',
])
</div>
</div>
<div class="row mb-3">
<label class="col-4">{{ __('shop.prices.title') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'tariff_id',
'list' => $prices ?? [],
'value' => $filters['tariff_id'] ?? null,
'class' => 'form-control-sm select2',
'with_empty' => '',
])
</div>
</div>
</form>

View File

@@ -2,7 +2,8 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div class="content">
<div class="content-overlay"></div>
<img class="content-image card-img-top" src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" alt="{{ $product_name }}">
<img class="content-image card-img-top"
src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" alt="{{ $product_name }}">
<div class="content-details fadeIn-bottom">
<h3 class="content-title d-none"></h3>
<p class="content-text">{!! $article['description'] !!}</p>
@@ -19,14 +20,16 @@
</div>
@include('Shop.Articles.partials.article_' . $product_type)
</a>
@switch ($article_nature)
@switch ($article_nature ?? 0)
@case(1)
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['semences']['id'] ?? false }}">
<button type="button" class="btn btn-link bg-green text-white w-100 basket"
data-id="{{ $article['semences']['id'] ?? false }}">
Ajout rapide
</button>
@break
@case(2)
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['plants']['id'] ?? false }}">
<button type="button" class="btn btn-link bg-green text-white w-100 basket"
data-id="{{ $article['plants']['id'] ?? false }}">
Ajout rapide
</button>
@break

View File

@@ -36,6 +36,7 @@
'name' => 'email',
'value' => $customer['email'] ?? '',
'label' => 'Email',
'required' => true,
])
</div>
<div class="col-6">

View File

@@ -34,7 +34,10 @@
<div class="row d-none" id="address_delivery">
<div class="col-12">
@include('Shop.Customers.partials.address', ['label' => 'Adresse de livraison', 'prefix' => 'delivery_'])
@include('Shop.Customers.partials.address', [
'label' => 'Adresse de livraison',
'prefix' => 'delivery_'
])
</div>
</div>
@@ -50,8 +53,7 @@
</div>
</div>
{!! Form::close() !!}
</form>
@push('js')
<script>

View File

@@ -1,3 +1,5 @@
@include('components.form.label')
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}"
class="{{ $class ?? 'toggle'}}"
value="{{ $val ?? 1}}"