Rename Admin views directory, add some functions on models
This commit is contained in:
13
resources/views/Admin/Shop/PriceListValues/create.blade.php
Normal file
13
resources/views/Admin/Shop/PriceListValues/create.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('price_generics.title'),
|
||||
'subtitle' => __('price_generics.create.title'),
|
||||
'breadcrumb' => [__('price_generics.title'), __('price_generics.create.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Admin.Shop.PriceGenerics.store', 'id' => 'price-generic-form', 'autocomplete' => 'off']) }}
|
||||
@include('Admin.Shop.PriceGenerics.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
14
resources/views/Admin/Shop/PriceListValues/edit.blade.php
Normal file
14
resources/views/Admin/Shop/PriceListValues/edit.blade.php
Normal file
@@ -0,0 +1,14 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('price_generics.title'),
|
||||
'subtitle' => __('price_generics.edit.title'),
|
||||
'breadcrumb' => [__('price_generics.title'), __('price_generics.edit.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Admin.Shop.PriceGenerics.store', 'id' => 'price-generic-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" value="{{ $generic['id'] }}">
|
||||
@include('Admin.Shop.PriceGenerics.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
17
resources/views/Admin/Shop/PriceListValues/form.blade.php
Normal file
17
resources/views/Admin/Shop/PriceListValues/form.blade.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('name', 'Catégorie') }}
|
||||
@include('components.select', ['name' => 'category_id', 'list' => $categories, 'value' => $generic['category_id'] ?? null, 'required' => true])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('name', 'Nom') }}
|
||||
@include('components.input', ['name' => 'name', 'value' => $generic['name'] ?? null, 'required' => true])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Admin.Shop.PriceGenerics.partials.prices', ['prices' => $generic['prices'] ?? null ])
|
||||
|
||||
@include('components.save')
|
||||
13
resources/views/Admin/Shop/PriceListValues/list.blade.php
Normal file
13
resources/views/Admin/Shop/PriceListValues/list.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('price_generics.title'),
|
||||
'subtitle' => __('price_generics.list.title'),
|
||||
'breadcrumb' => [__('price_generics.title')]
|
||||
])
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Admin.Shop.PriceGenerics.index'), 'model' => 'price_generics', 'with_filters' => true])
|
||||
|
||||
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-price_generics-filters'])
|
||||
@include('Admin.Shop.PriceGenerics.partials.filters')
|
||||
@endcomponent
|
||||
|
||||
@endsection
|
||||
@@ -0,0 +1,80 @@
|
||||
<div class="col-12 row-price">
|
||||
|
||||
<input type="hidden" name="prices[{{ $key }}][id]" value="@if (isset($price['id'])){{ $price['id'] }}@endif" class="price_id">
|
||||
|
||||
<div class="card card-light">
|
||||
<div class="card-body pt-2">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-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-lg-3">
|
||||
{{ Form::label('package_id', 'Type Package') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[$key][package_id]",
|
||||
'value' => $price['package_id'] ?? null,
|
||||
'list' => $packages ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm packages w-100',
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
{{ Form::label('package_qty', 'Pack Qté') }}<br/>
|
||||
@include('components.number', [
|
||||
'name' => "prices[$key][package_quantity]",
|
||||
'value' => $price['package_quantity'] ?? null,
|
||||
'required' => true,
|
||||
'class' => 'form-control-sm',
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
{{ Form::label('unity_id', 'Unité') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[$key][unity_id]",
|
||||
'value' => $price['unity_id'] ?? null,
|
||||
'list' => $unities ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm unities w-100',
|
||||
'with_empty' => ''
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<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-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 class="col-1 text-right">
|
||||
<br/>
|
||||
<button type="button" class="btn btn-xs btn-danger delete-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,73 @@
|
||||
<div class="col-12 row-new-price row-price">
|
||||
|
||||
<input type="hidden" name="prices[][id]" value="">
|
||||
|
||||
<div class="card card-light">
|
||||
<div class="card-body pt-2">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-1">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.number', ['name' => 'prices[0][quantity]', 'value' => $quantity ?? 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
{{ Form::label('package_id', 'Unité') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[0][package_id]', 'value' => $package_id ?? null, 'list' => $packages ?? null, 'required' => true, 'class' => 'select2 form-control-sm w-100'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
{{ Form::label('package_qty', 'Pack Qté') }}<br/>
|
||||
@include('components.number', [
|
||||
'name' => "prices[0][package_quantity]",
|
||||
'value' => $price['package_quantity'] ?? null,
|
||||
'required' => true,
|
||||
'class' => 'form-control-sm',
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
{{ Form::label('unity_id', 'Unité') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[0][unity_id]",
|
||||
'value' => $price['unity_id'] ?? null,
|
||||
'list' => $unities ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm unities w-100',
|
||||
'with_empty' => ''
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||
@include('components.select', ['name' => "prices[0][tax_id]", 'value' => $price['tax_id'] ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
{{ Form::label('price', 'Prix HT') }}
|
||||
@include('components.money', ['name' => "prices[0][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[0][price_taxed]", 'value' => $price['price_taxed'] ?? 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-1 text-right">
|
||||
<br/>
|
||||
<button type="button" class="btn btn-xs btn-danger delete-new-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<form id="price_generics-filters">
|
||||
<div class="row">
|
||||
<label class="col-4">Catégories</label>
|
||||
<div class="col-8">
|
||||
@include('components.select', ['name' => 'category_id', 'list' => (isset($categories)) ? $categories : [], 'value' => (isset($filters['category_id'])) ? $filters['category_id'] : null, 'class' => 'form-control-sm select2', 'with_empty' => ' '])
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,16 @@
|
||||
@if (isset($prices) && (count($prices)))
|
||||
@for ($i = 0; $i < count($prices); $i++)
|
||||
@include('Admin.Shop.PriceGenerics.partials.block_price', ['key' => $i, 'price' => $prices[$i]])
|
||||
@endfor
|
||||
@endif
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(function () {
|
||||
handle_delete_price();
|
||||
handle_prices();
|
||||
handle_prices_taxed();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
@include('Admin.Shop.PriceGenerics.partials.block_price_new')
|
||||
|
||||
<div id="append_price" class="row">
|
||||
@include('Admin.Shop.PriceGenerics.partials.list-prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-primary add-new-price">Ajouter un tarif <i class="fa fa-plus"></i></button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
function append_price() {
|
||||
handle_prices();
|
||||
handle_prices_taxed();
|
||||
handle_change_package();
|
||||
// handle_append_attribute();
|
||||
// $('.select2').select2();
|
||||
}
|
||||
|
||||
$("#append_price").appender({
|
||||
rowSection: '.row-new-price',
|
||||
type: '.row-price',
|
||||
addBtn: '.add-new-price',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-price-number',
|
||||
deleteBtn: '.delete-new-price-btn',
|
||||
callback: append_price,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
|
||||
function handle_delete_price() {
|
||||
$('.delete-price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-price');
|
||||
var id = $selector.find('.price_id').val();
|
||||
|
||||
confirm_delete(id, laroute.route('Admin.Shop.PriceGenericValues.destroy', {id : id}), function() {
|
||||
$selector.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handle_prices() {
|
||||
$('.price-item').change(function() {
|
||||
$col_tax = $(this).parent().prev();
|
||||
tax_selected = $col_tax.find('select option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
price_taxed = price_taxed.toFixed(2);
|
||||
$(this).parent().parent().find('.price-taxed-item').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price-taxed-item').change(function() {
|
||||
$col_tax = $(this).parent().prev().prev();
|
||||
tax_selected = $col_tax.find('select option:selected').text();
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
price = price.toFixed(2);
|
||||
$(this).parent().parent().find('.price-item').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function handle_change_package() {
|
||||
$('.packages').change( function() {
|
||||
var package_id = $(this).val();
|
||||
var $package = $(this);
|
||||
var $parent = $package.parent().parent();
|
||||
var $selector = $parent.find('.unities');
|
||||
load_unities($selector, package_id);
|
||||
});
|
||||
}
|
||||
|
||||
function init_unities() {
|
||||
$('.packages').each( function() {
|
||||
var package_id = $(this).val();
|
||||
var $package = $(this);
|
||||
var $parent = $package.parent().parent();
|
||||
var $selector = $parent.find('.unities');
|
||||
load_unities($selector, package_id);
|
||||
value_id = $selector.data('id');
|
||||
$selector.val(value_id).trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function load_unities($selector, package_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Admin.Shop.Unities.getOptionsByPackage') }}",
|
||||
method : 'POST',
|
||||
data: { package_id: package_id },
|
||||
success : function(data) {
|
||||
setOptions($selector, data);
|
||||
// $selector.empty().select2({data: data});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,12 @@
|
||||
<tr>
|
||||
<input type="hidden" name="price_list_values[{{ $index }}][id]" value="{{ $price_list_value['id'] ?? null }}">
|
||||
<td>
|
||||
@include('components.input', ['name' => 'price_list_values[' . $index . '][code]', 'value' => $price_list_value['code'] ?? null, 'required' => true])
|
||||
</td>
|
||||
<td>
|
||||
@include('components.number', ['name' => 'price_list_values[' . $index . '][quantity]', 'value' => $price_list_value['quantity'] ?? null, 'required' => true, 'meta' => "step = '.01'"])
|
||||
</td>
|
||||
<td>
|
||||
@include('components.money', ['name' => 'price_list_values[' . $index . '][price]', 'value' => $price_list_value['price'] ?? null, 'required' => true])
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,29 @@
|
||||
@if (count($generic['prices'] ?? []))
|
||||
<table class="table table-bordered table-hover table-striped w-100 mb-0 dataTable">
|
||||
<input type="hidden" name="price_generics[0]" value="{{ $generic['id'] }}">
|
||||
<thead>
|
||||
<th>
|
||||
<button type="button" class="btn btn-xs btn-danger delete-generic-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer" data-id="{{ $generic['id'] }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
|
||||
{{ $generic['category']['name'] ?? null }}
|
||||
</th>
|
||||
@foreach ($generic['prices'] as $price)
|
||||
<th>
|
||||
{{ $price['quantity'] ?? null }} {{ $price['unity_id'] ?? null }}
|
||||
</th>
|
||||
@endforeach
|
||||
</thead>
|
||||
<tr>
|
||||
<td>
|
||||
{{ $generic['name'] ?? null }}
|
||||
</td>
|
||||
@foreach ($generic['prices'] as $price)
|
||||
<td>
|
||||
{{ $price['price_taxed'] ?? null }}
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
36
resources/views/Admin/Shop/PriceListValues/show.blade.php
Normal file
36
resources/views/Admin/Shop/PriceListValues/show.blade.php
Normal 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
|
||||
Reference in New Issue
Block a user