[WIP] Fixes on Varieties & attributes prices, add uploader widget
This commit is contained in:
@@ -7,10 +7,8 @@
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Botanic.Admin.Varieties.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
|
||||
<input type="hidden" name="id" id="id" value="{{ $id }}">
|
||||
@include('Botanic.Admin.Varieties.form')
|
||||
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ Form::label('genre', 'Espèce') }}
|
||||
@include('components.select', ['name' => 'specie_id', 'list' => $species, 'value' => isset($specie_id) ? $specie_id : null, 'required' => false])
|
||||
@include('components.select', ['name' => 'specie_id', 'list' => $species, 'value' => isset($specie_id) ? $specie_id : null, 'class' => 'select2 form-control', 'required' => false])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
@include('components.uploader.widget', ['images' => $media])
|
||||
@include('components.uploader.widget', ['delete_url' => route('Botanic.Admin.Varieties.deleteImage') ])
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<div class="col-md-12 col-lg-4 row-lot-photo m-top-8">
|
||||
|
||||
<button type="button" class="btn btn-danger delete-lot-photo-btn"><i class="fa fa-minus-circle"></i></button>
|
||||
|
||||
<div class="thumbnail">
|
||||
<img src="/storage/{{ $photo['filepath'] }}/{{ $photo['uuid'] }}.{{ $photo['filetype'] }}" alt="...">
|
||||
<div class="caption">
|
||||
<h3>{{ $photo['title'] }}</h3>
|
||||
<p>Poids : {{ $photo['filesize'] }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,15 +0,0 @@
|
||||
<div class="col-md-12 col-lg-4 row-new-lot-photo row-lot-photo m-top-8">
|
||||
|
||||
<p>
|
||||
<button type="button" class="btn btn-danger delete-new-lot-photo-btn"><i class="fa fa-minus-circle"></i></button>
|
||||
Photo <span class="row-photo-number"></span>
|
||||
</p>
|
||||
|
||||
<input name="lot_photos[][file]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
|
||||
<label>Titre</label>
|
||||
<input name="lot_photos[][title]" type="text" class="form-control">
|
||||
|
||||
<label>Type de photo</label>
|
||||
@include('components.select',['name' => 'lot_photos[][type_photo_id]' , 'list' => $type_photos])
|
||||
|
||||
</div>
|
||||
@@ -1,41 +0,0 @@
|
||||
@if (isset($photos) && count($photos))
|
||||
<table class="table table-striped table-hover va-middle" id="photos-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Photo</th>
|
||||
<th>Type</th>
|
||||
<th>Titre</th>
|
||||
<th>Poids</th>
|
||||
<th style="min-width: 82px; max-width: 82px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($photos as $photo)
|
||||
<tr>
|
||||
<td>
|
||||
<img src="/storage/{{ $photo['filepath'] }}/{{ $photo['uuid'] }}.{{ $photo['filetype'] }}" width="64">
|
||||
</td>
|
||||
<td>
|
||||
{{ $photo['type_photo']['nom'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $photo['title'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $photo['filesize'] }}
|
||||
</td>
|
||||
<td>
|
||||
<!--
|
||||
<a href="{{ route('Hestimmo.LotPhotos.edit', $photo['id']) }}" class="btn btn-sm btn-primary">
|
||||
<span class="fa fa-eye"></span>
|
||||
</a>
|
||||
-->
|
||||
<a href="{{ route('Hestimmo.LotPhotos.destroy', $photo['id']) }}" class="btn btn-sm btn-danger destroy">
|
||||
<span class="fa fa-trash"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
@@ -1,69 +0,0 @@
|
||||
<div class="col-12 row-new-price row-price">
|
||||
|
||||
<input type="hidden" name="prices[][id]" value="">
|
||||
|
||||
<div class="card card-light">
|
||||
<div class="card-header">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][tax_id]', 'value' => (isset($tax_id)) ? $tax_id : null, 'list' => isset($taxes) ? $taxes : null, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
{{ Form::label('price', 'Prix HT') }}
|
||||
@include('components.money', ['name' => 'prices[][price}', 'value' => (isset($price)) ? $price : 0, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
{{ Form::label('price_taxed', 'Prix TTC') }}
|
||||
@include('components.money', ['name' => 'prices[][price_taxed]', 'value' => (isset($price_ht)) ? $price_ht : 0, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<br/>
|
||||
<button class="btn btn-primary btn-xs add-new-attribute mt-1" href="#attributes" type="button">
|
||||
Ajout d'un attribut
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<button type="button" class="btn btn-danger delete-new-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer">
|
||||
<i class="fa-2x fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-none" id="attributes">
|
||||
<div class="card-body">
|
||||
|
||||
<div id="append_attribute" class="row">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row row-new-attribute row-attribute">
|
||||
<div class="col-xs-3 col-md-2">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.input', ['name' => 'prices[][quantity][]', 'value' => (isset($quantity)) ? $quantity : 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-4">
|
||||
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][attribute_family_id][]', 'value' => (isset($attribute_value['attribute_family_id'])) ? $attribute_value['attribute_family_id'] : null, 'list' => $attribute_families, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-xs-5 col-md-4">
|
||||
{{ Form::label('attribute_value_id', 'Valeur') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][attribute_value_id][]', 'value' => (isset($attribute_value['id'])) ? $attribute_value['id'] : null, 'list' => (isset($attribute_values)) ? $attribute_values : null, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,6 +46,6 @@
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@include('components.uploader.widget', ['images' => isset($media) ? $media : null])
|
||||
@include('components.uploader.widget', ['delete_url' => route('Shop.Admin.Articles.deleteImage') ])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
@include('Shop.Admin.Articles.partials.block_price_new')
|
||||
@include('Shop.Admin.Articles.partials.prices.block_price_new')
|
||||
|
||||
<div id="append_price" class="row">
|
||||
@include('Shop.Admin.Articles.partials.list-prices')
|
||||
@include('Shop.Admin.Articles.partials.prices.list-prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary add-new-price">Ajouter un tarif <i class="fa fa-plus"></i></button>
|
||||
<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_append_attribute();
|
||||
}
|
||||
|
||||
$("#append_price").appender({
|
||||
@@ -28,18 +29,21 @@
|
||||
function append_attribute() {
|
||||
}
|
||||
|
||||
$("#append_attribute").appender({
|
||||
rowSection: '.row-new-attribute',
|
||||
type: '.row-attribute',
|
||||
addBtn: '.add-new-attribute',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-attribute-number',
|
||||
deleteBtn: '.delete-new-attribute-btn',
|
||||
callback: append_attribute,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
function handle_append_attribute(selector) {
|
||||
console.log('handle_append_attribute');
|
||||
$("#append_attribute").appender({
|
||||
rowSection: '.row-new-attribute',
|
||||
type: '.row-attribute',
|
||||
addBtn: '.add-new-attribute',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-attribute-number',
|
||||
deleteBtn: '.delete-new-attribute-btn',
|
||||
callback: append_attribute,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<div id="attributes" class="appender" data-id="">
|
||||
@include('Shop.Admin.Articles.partials.prices.block_attribute_new')
|
||||
<div id="append_attribute"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="row row-new-attribute row-attribute">
|
||||
<div class="col-xs-3 col-lg-2">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.input', ['name' => 'prices[][quantity][]', 'value' => (isset($quantity)) ? $quantity : 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
<div class="col-xs-4 col-lg-4">
|
||||
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][attribute_family_id][]', 'value' => (isset($attribute_value['attribute_family_id'])) ? $attribute_value['attribute_family_id'] : null, 'list' => $attribute_families, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-xs-5 col-lg-4">
|
||||
{{ Form::label('attribute_value_id', 'Valeur') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][attribute_value_id][]', 'value' => (isset($attribute_value['id'])) ? $attribute_value['id'] : null, 'list' => (isset($attribute_values)) ? $attribute_values : null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,50 @@
|
||||
<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-lg-2">
|
||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[][tax_id]', 'value' => (isset($tax_id)) ? $tax_id : null, 'list' => isset($taxes) ? $taxes : null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.number', ['name' => 'prices[][quantity}', 'value' => (isset($quantity)) ? $quantity : 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
{{ Form::label('price', 'Prix HT') }}
|
||||
@include('components.money', ['name' => 'prices[][price}', 'value' => (isset($price)) ? $price : 0, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
{{ Form::label('price_taxed', 'Prix TTC') }}
|
||||
@include('components.money', ['name' => 'prices[][price_taxed]', 'value' => (isset($price_ht)) ? $price_ht : 0, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
<br/>
|
||||
<button class="btn btn-primary btn-xs add-new-attribute mt-1" href="#attributes" type="button">
|
||||
Ajout d'un attribut
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 text-right">
|
||||
<button type="button" class="btn btn-danger delete-new-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer">
|
||||
<i class="fa-2x fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@include('Shop.Admin.Articles.partials.prices.attributes')
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
{{ include("Shop._partials.sections")}}
|
||||
|
||||
<div id="_mobile_cart"></div>
|
||||
<div id="_mobile_seach_widget"></div>
|
||||
<div id="_mobile_user_info"></div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="col row-image"></div>
|
||||
|
||||
TEST
|
||||
<button type="button" class="btn btn-danger delete-image-btn"><i class="fa fa-minus-circle"></i></button>
|
||||
|
||||
<div class="thumbnail">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<label>Titre</label>
|
||||
<input name="images[][title]" type="text" class="form-control">
|
||||
<label>Titre</label>
|
||||
<input name="images[][title]" type="text" class="form-control">
|
||||
|
||||
<label>Type de photo</label>
|
||||
@include('components.select',['name' => 'images[][type_image_id]' , 'list' => isset($type_images) ? $type_images : null])
|
||||
<label>Type de photo</label>
|
||||
@include('components.select',['name' => 'images[][type_image_id]' , 'list' => isset($type_images) ? $type_images : null])
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
@foreach($images as $key => $image)
|
||||
<figure class="mr-2">
|
||||
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
||||
<figcaption class="text-center pt-2">
|
||||
<button type="button" class="btn btn-xs btn-outline-secondary">
|
||||
<i class="fas fa-expand-alt"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-outline-danger">
|
||||
<i class="fas fa-trash" data-index="{{ $key }}"></i>
|
||||
</button>
|
||||
</figcaption>
|
||||
</figure>
|
||||
@endforeach
|
||||
|
||||
<script>
|
||||
handleDeleteImages();
|
||||
handleEnlargeImages();
|
||||
</script>
|
||||
@@ -1,34 +1,48 @@
|
||||
@if ($images)
|
||||
<div class="row" id="uploader-mini-gallery">
|
||||
@foreach($images as $image)
|
||||
<figure class="mr-2">
|
||||
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
||||
<figcaption class="text-center pt-2">
|
||||
<button type="button" class="btn btn-xs btn-outline-secondary">
|
||||
<i class="fas fa-expand-alt" data-id="{{ $image['id'] }}"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-outline-danger">
|
||||
<i class="fas fa-trash" data-id="{{ $image['id'] }}"></i>
|
||||
</button>
|
||||
</figcaption>
|
||||
</figure>
|
||||
@endforeach
|
||||
<div class="row" id="uploader-mini-gallery"></div>
|
||||
|
||||
<div class="modal fade" id="mini-gallery-lightbox" tabindex="-1" role="dialog" aria-labelledby="mini-gallery-lightbox" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="mini-gallery-title-lightbox"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<img src="" id="mini-gallery-img-lightbox" class="img-fluid" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#uploader-mini-gallery .fa-trash').click(function() {
|
||||
id = $(this).data('id');
|
||||
console.log(id);
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: {{ route('Botanic.Admin.Varieties.deleteImage') }},
|
||||
data: {id: id},
|
||||
success: function(data) {
|
||||
source = data;
|
||||
}
|
||||
});
|
||||
})
|
||||
function handleDeleteImages() {
|
||||
$('#uploader-mini-gallery .fa-trash').click(function() {
|
||||
id = $('#id').val();
|
||||
index = $(this).data('index');
|
||||
console.log(id);
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: "{{ $delete_url }}",
|
||||
data: {
|
||||
id: id,
|
||||
index: index
|
||||
},
|
||||
success: function(data) {
|
||||
loadImages();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function handleEnlargeImages() {
|
||||
$('#uploader-mini-gallery .fa-expand-alt').click(function() {
|
||||
$img = $(this).parents('figure').find('.img-thumbnail');
|
||||
url = $img.attr('src');
|
||||
console.log(url);
|
||||
$('#mini-gallery-img-lightbox').attr('src', url);
|
||||
$('#mini-gallery-lightbox').modal('show');
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -2,15 +2,20 @@
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Photos</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-xs btn-primary add-image pull-right">Ajout <i class="fa fa-plus"></i></button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pb-0">
|
||||
@include('components.uploader.mini-gallery', ['images' => $images])
|
||||
<div class="card-body pt-3 pb-0">
|
||||
@if (isset($id))
|
||||
@include('components.uploader.mini-gallery')
|
||||
@endif
|
||||
|
||||
<div id="uploader-new-images"></div>
|
||||
@include('components.uploader.block_image_new', ['name' => 'images[]', 'required' => true])
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-xs btn-primary add-image pull-right">Ajout <i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
@@ -30,5 +35,15 @@
|
||||
callback: append_image,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
function loadImages()
|
||||
{
|
||||
$gallery = $("#uploader-mini-gallery");
|
||||
if ($gallery) {
|
||||
$gallery.load("{{ route('Botanic.Admin.Varieties.getImages', ['id' => (isset($id)) ? $id : false]) }}");
|
||||
}
|
||||
}
|
||||
|
||||
loadImages();
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user