[WIP] Refactor generic & normal price

This commit is contained in:
Ludovic CANDELLIER
2020-08-31 23:23:55 +02:00
parent c9198de890
commit c025dbb385
18 changed files with 267 additions and 32 deletions

View File

@@ -72,7 +72,7 @@
function load_attribute_values($selector, family_id) {
$.ajax({
url : "{{ route('Shop.Admin.ArticleAttributeValues.getOptionsByFamily') }}",
url : "{{ route('Shop.Admin.PriceFamilyValues.getOptionsByFamily') }}",
method : 'POST',
data: { family_id: family_id },
success : function(data) {

View File

@@ -7,35 +7,39 @@
<div class="row">
<div class="col-lg-1">
{{ Form::label('quantity', 'Qté.') }}<br/>
@include('components.number', ['name' => "prices[$key][quantity]", 'value' => $price['quantity'] ?? 1, 'required' => true, 'class' => 'form-control-sm'])
<div class="col-lg-3">
{{ Form::label('price_generic_id', 'Générique') }}<br/>
@include('components.select-tree', ['name' => "prices[$key][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
</div>
<div class="col-lg-4">
@include('Shop.Admin.Articles.partials.prices.block_attribute', ['attribute' => $price['article_attribute']])
</div>
<div class="col-lg-6">
<div class="col-lg-8">
<div class="row">
<div class="col-2">
{{ Form::label('tax_id', 'TVA') }}<br/>
@include('components.select', ['name' => "prices[$key][tax_id]", 'value' => $price['tax_id'] ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
<div class="col-lg-1">
{{ Form::label('quantity', 'Qté.') }}<br/>
@include('components.number', ['name' => "prices[$key][quantity]", 'value' => $price['quantity'] ?? 1, 'required' => true, 'class' => 'form-control-sm'])
</div>
<div class="col-4">
{{ Form::label('price_generic_id', 'Générique') }}<br/>
@include('components.select', ['name' => "prices[$key][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
<div class="col-lg-6">
@include('Shop.Admin.Articles.partials.prices.block_attribute', ['attribute' => $price['article_attribute'] ?? null])
</div>
<div class="col-3">
{{ Form::label('price', 'Prix HT') }}
@include('components.money', ['name' => "prices[$key][price]", 'value' => $price['price'] ?? 0, 'required' => true, 'class' => 'form-control-sm price-item'])
</div>
<div class="col-lg-5">
<div class="row">
<div class="col-4">
{{ Form::label('tax_id', 'TVA') }}<br/>
@include('components.select', ['name' => "prices[$key][tax_id]", 'value' => $price['tax_id'] ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
</div>
<div class="col-3">
{{ Form::label('price_taxed', 'Prix TTC') }}
@include('components.money', ['name' => "prices[$key][price_taxed]", 'value' => $price['price_taxed'] ?? 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
<div class="col-4">
{{ Form::label('price', 'Prix HT') }}
@include('components.money', ['name' => "prices[$key][price]", 'value' => $price['price'] ?? 0, 'required' => true, 'class' => 'form-control-sm price-item'])
</div>
<div class="col-4">
{{ Form::label('price_taxed', 'Prix TTC') }}
@include('components.money', ['name' => "prices[$key][price_taxed]", 'value' => $price['price_taxed'] ?? 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
</div>
</div>
</div>
</div>
</div>

View File

@@ -7,6 +7,11 @@
<div class="row">
<div class="col-lg-3">
{{ Form::label('price_generic_id', 'Générique') }}<br/>
@include('components.select-tree', ['name' => "prices[0][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
</div>
<div class="col-lg-1">
{{ Form::label('quantity', 'Quantité') }}<br/>
@include('components.number', ['name' => 'prices[0][quantity]', 'value' => $quantity ?? 1, 'required' => true, 'class' => 'form-control-sm'])
@@ -23,11 +28,6 @@
@include('components.select', ['name' => 'prices[0][tax_id]', 'value' => $tax_id ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
</div>
<div class="col-4">
{{ Form::label('price_generic_id', 'Générique') }}<br/>
@include('components.select', ['name' => "prices[0][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
</div>
<div class="col-3">
{{ Form::label('price', 'Prix HT') }}
@include('components.money', ['name' => 'prices[0][price]', 'value' => $price ?? 0, 'required' => true, 'class' => 'form-control-sm price-item'])

View File

@@ -0,0 +1,28 @@
@extends('layout.index', [
'title' => __('article_attributes.title'),
'subtitle' => __('article_attributes.create.title'),
'breadcrumb' => [__('article_attributes.title'), __('article_attributes.create.title')]
])
@include('boilerplate::load.fileinput')
@section('content')
{{ Form::open(['route' => 'Shop.Admin.ArticleAttributes.store', 'id' => 'article-attribute-form', 'autocomplete' => 'off', 'files' => true]) }}
<div class="row">
<div class="col-sm-12 mbl">
<a href="{{ route("Shop.Admin.ArticleAttributes.index") }}" class="btn btn-default">
{{ __('article_attributes.list.title') }}
</a>
<span class="btn-group pull-right">
@include('components.button-save')
</span>
</div>
</div>
@include('Shop.Admin.ArticleAttributeValues.form')
</form>
@endsection

View File

@@ -0,0 +1,29 @@
@extends('layout.index', [
'title' => 'Attributs d\'articles',
'subtitle' => 'Edition d\'un attribut d\'article',
'breadcrumb' => ['Articles']
])
@include('boilerplate::load.fileinput')
@section('content')
{{ Form::open(['route' => 'Shop.Admin.ArticleAttributeValues.update', 'id' => 'article-attribute-form', 'autocomplete' => 'off', 'files' => true]) }}
<div class="row">
<div class="col-sm-12 mbl">
<a href="{{ route("Shop.Admin.ArticleAttributeValues.index") }}" class="btn btn-default">
{{ __('article_attributes.list.title') }}
</a>
<span class="btn-group pull-right">
@include('components.button-save')
</span>
</div>
</div>
<input type="hidden" name="id" value="{{ $id }}">
@include('Shop.Admin.ArticleAttributeValues.form')
</form>
@endsection

View File

@@ -0,0 +1,29 @@
@include('boilerplate::load.tinymce')
<div class="row">
<div class="col-md-8">
{{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => (isset($family['name'])) ? $family['name'] : null, 'required' => true])
{{ Form::label('description', 'Description') }}
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false])
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="float-right mt-3">
@include('components.button-save')
</div>
</div>
</div>
@push('js')
<script>
$(function() {
$('.editor').tinymce({});
});
</script>
@endpush

View File

@@ -0,0 +1,49 @@
@extends('layout.index', [
'title' => __('Shop.article_attribute_families.title'),
'subtitle' => __('Shop.article_attribute_families.list'),
'breadcrumb' => [__('Shop.article_attribute_families.title')]
])
@include('boilerplate::load.select2')
@section('content')
<nav>
<div class="nav nav-tabs">
<a href="#families" data-toggle="tab" class="nav-item nav-link" role="tab" aria-controls="families" aria-selected="true">
{{ __('Shop.article_attribute_families.title') }}
</a>
<a href="#values" data-toggle="tab" class="nav-item nav-link active" role="tab" aria-controls="values" aria-selected="false">
{{ __('Shop.article_attribute_values.title') }}
</a>
</div>
</nav>
<div class="tab-content mb-0">
<div class="tab-pane fade" id="families">
@section('content')
@include('components.datatable', ['route' => route('Shop.Admin.ArticleAttributeFamilies.index'), 'model' => 'ArticleAttributefamilies'])
@endsection
</div>
<div class="tab-pane fade show active" id="values">
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Shop.Admin.ArticleAttributeValues.index'), 'model' => 'articleattributevalues'])
@endcomponent
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-filters'])
@include('Shop.Admin.ArticleAttributeValues.partials.filters')
@endcomponent
@endsection
</div>
</div>
@endsection
@push('scripts')
@include('components.js.datatable', ['route' => route('Shop.Admin.ArticleAttributeFamilies.index'), 'model' => 'ArticleAttributeFamilies'])
@include('components.js.datatable', ['route' => route('Shop.Admin.ArticleAttributeValues.index'), 'model' => 'ArticleAttributeValues'])
@endpush

View File

@@ -0,0 +1,16 @@
@extends('layout.index', [
'title' => __('Shop.article_attribute_values.title'),
'subtitle' => __('Shop.article_attribute_values.list'),
'breadcrumb' => [__('Shop.article_attribute_values.title')]
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Shop.Admin.ArticleAttributeValues.index'), 'model' => 'ArticleAttributeValues'])
@endcomponent
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-filters'])
@include('Shop.Admin.ArticleAttributeValues.partials.filters')
@endcomponent
@endsection

View File

@@ -0,0 +1,9 @@
<form id="filters">
<div class="row">
<label class="col-4">Familles d'attributs</label>
<div class="col-8">
@include('components.select', ['name' => 'article_attribute_family_id', 'list' => (isset($families)) ? $families : [], 'value' => (isset($filters['article_attribute_family_id'])) ? $filters['article_attribute_family_id'] : null, 'class' => 'form-control-sm select2', 'with_empty' => ' '])
</div>
</div>
</form>

View File

@@ -0,0 +1,36 @@
@extends('layout.index', [
'title' => __('products.title'),
'subtitle' => __('products.title'),
'breadcrumb' => [__('products.title')]
])
@section('content')
<form action="{{ route('Shop.Products') }}" method="GET">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="box box-info">
<div class="box-body">
<div class="col-md-6">
<h3>{{ name }}</h3>
<h4>
{{ $product.section.name }}<br>
</h4>
</div>
<div class="col-md-6 text-right">
<h2>{{ $prix_total }} </h2>
<h4>{{ $residence['type_produit']['name'] }}</h4>
</div>
<div class="col-md-12">
@include('Hestimmo.modules.Lot.partials.carousel')
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@@ -1,7 +1,7 @@
@if (isset($list) && count($list))
@foreach($list as $key => $optgroup)
<optgroup label="{{ $optgroup['label'] }}">
@include('components.options', ['list' => $optgroup['options']])
@include('components.options', ['list' => $optgroup['options'] ?? null])
</optgroup>
@endforeach
@endif