[WIP] Fixes on Varieties & attributes prices, add uploader widget

This commit is contained in:
Ludovic CANDELLIER
2020-06-07 13:03:23 +02:00
parent 9acf35f5ee
commit 424fb43b20
27 changed files with 242 additions and 237 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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