Fixes on adding price & errors

This commit is contained in:
Ludovic CANDELLIER
2021-07-27 17:33:18 +02:00
parent 0d421226fa
commit 734ec87b89
18 changed files with 123 additions and 76 deletions

View File

@@ -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>

View File

@@ -4,26 +4,25 @@
<input type="hidden" name="tariff_id" value="{{ $price_list['tariff_id'] ?? null }}">
<div class="row mb-3">
<div class="col-6">
<div class="col-8">
{{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => $price_list['name'] ?? null, 'required' => true])
</div>
<div class="col-4">
{{ Form::label('status_id', 'Etat') }}
@include('components.select', ['name' => 'status_id', 'list' => $statuses ?? [], 'value' => $price_list['status_id'] ?? null, 'required' => true])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('sale_channel_id', 'Canal de vente') }}
@include('components.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $price_list['sale_channel_id'] ?? null, 'required' => true, 'with_empty' => ''])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => $price_list['name'] ?? null, 'required' => true])
</div>
</div>
@component('components.card', ['title' => 'Prix'])
<table class="table table-bordered table-hover table-striped w-100 mb-0 dataTable">
<table class="table table-bordered table-hover table-striped w-100 mb-0 dataTable" id="prices-table">
<thead>
<tr>
<th>Code</th>
@@ -33,20 +32,37 @@
</thead>
<tbody>
@foreach ($price_list['price_list_values'] as $price_list_value)
<tr>
<td>
@include('components.input', ['name' => 'price_list_values[' . $loop->index . '][code]', 'value' => $price_list_value['name'] ?? null, 'required' => true])
</td>
<td>
@include('components.number', ['name' => 'price_list_values[' . $loop->index . '][quantity]', 'value' => $price_list_value['quantity'] ?? null, 'required' => true, 'meta' => "step = '.01'"])
</td>
<td>
@include('components.money', ['name' => 'price_list_values[' . $loop->index . '][price]', 'value' => $price_list_value['price'] ?? null, 'required' => true])
</td>
</tr>
@include('admin.Shop.PriceListValues.partials.row_price', ['index' => $loop->index])
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="3">
<button type='button' class='btn btn-primary btn-xs' id='add_price'>
Ajouter un seuil
<i class='pl-2 fa fa-plus'></i>
</button>
</td>
</tr>
</tfoot>
</table>
@endcomponent
</form>
</form>
<script>
function handleAddPrice() {
$('#add_price').click( function () {
var index = $('#prices-table tbody tr').length;
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
$("#prices-table").prepend(data);
})
})
}
$(function() {
handleAddPrice();
});
</script>

View File

@@ -2,37 +2,39 @@
<div class="col-6">
<div class="row mb-3">
<div class="col-12">
<div class="col-8">
{{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => $tariff['name'] ?? null, 'required' => true])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('name', 'Canal de vente') }}
@include('components.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $tariff['sale_channel_id'] ?? null, 'required' => true, 'with_empty' => ''])
</div>
<div class="col-6">
<div class="col-4">
{{ Form::label('name', 'Etat') }}
@include('components.select', ['name' => 'status_id', 'list' => $statuses ?? [], 'value' => $tariff['status_id'] ?? null, 'required' => true, 'with_empty' => ''])
</div>
</div>
<div class="row mb-3">
<div class="col-3">
<div class="col-6">
{{ Form::label('name', 'Code') }}
@include('components.input', ['name' => 'code', 'value' => $tariff['code'] ?? null, 'required' => true])
</div>
<div class="col-3">
<div class="col-6">
{{ Form::label('name', 'Ref') }}
@include('components.input', ['name' => 'ref', 'value' => $tariff['ref'] ?? null, 'required' => true])
</div>
<div class="col-6">
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('name', 'Canal de vente par défaut') }}
@include('components.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $tariff['sale_channel_id'] ?? null, 'required' => true, 'with_empty' => ''])
</div>
<div class="col-4">
{{ Form::label('name', 'Unité du tarif') }}
@include('components.select', ['name' => 'tariff_unity_id', 'list' => $tariff_unities ?? [], 'value' => $tariff['tariff_unity_id'] ?? null, 'required' => true, 'with_empty' => ''])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('description', 'Description') }}

View File

@@ -26,13 +26,12 @@
@include('components.save')
@include('boilerplate::load.tinymce')
@include('load.form.editor')
@push('js')
<script>
$(function() {
$('.editor').tinymce({});
initEditor();
});
</script>
@endpush

View File

@@ -5,9 +5,9 @@
@section('content')
{!! Form::open(['route' => 'boilerplate.login', 'method' => 'post', 'autocomplete'=> 'off']) !!}
<div class="row">
<div class="row" style="width: 380px;">
<div class="col-12 text-center">
<img src="/img/logo.png" height="96">
<img src="/img/logo.png" height="128">
</div>
</div>
@@ -26,7 +26,7 @@
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<div class="col-12 col-lg-8">
<div class="checkbox icheck">
<label style="padding-left: 0">
<input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}>
@@ -34,7 +34,7 @@
</label>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 mbs">
<div class="col-12 col-lg-4 mbs">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('boilerplate::auth.login.signin') }}</button>
</div>
</div>

View File

@@ -7,7 +7,7 @@
<h3 class="card-title">{{ $title }}</h3>
@isset($tools)
<div class="card-tools">
{{ $tools }}
{!! $tools !!}
</div>
@endisset
@endisset

View File

@@ -14,8 +14,8 @@
@if (isset($buttons))
{{ $buttons }}
@endif
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-info apply">Apply</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ __('close') }}</button>
<button type="button" class="btn btn-info apply">{{ __('apply') }}</button>
</div>
</div>
</div>

View File

@@ -57,11 +57,11 @@
if (!no_confirm) {
var buttons = {
cancel: {
label: '{{ __('cancel') }}',
label: '{{ __('Annuler') }}',
className: 'btn-secondary'
},
confirm: {
label: '{{ __('save') }}',
label: '{{ __('Sauver') }}',
className: 'btn-success',
callback: function() {
submitModal(form_id);