Add preview from father, add new features
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
<input type="hidden" name="id" id="id" value="{{ $id }}">
|
||||
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
|
||||
|
||||
@include('Shop.Admin.Articles.form')
|
||||
</form>
|
||||
|
||||
@@ -4,53 +4,58 @@
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
{{ Form::label('ref', 'Référence') }}<br>
|
||||
@include('components.input', ['name' => 'ref', 'value' => isset($ref) ? $ref : null])
|
||||
@include('components.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{{ Form::label('model', 'Familles de produit') }}<br>
|
||||
@include('components.select', ['name' => 'product_type', 'id_name' => 'product_type', 'list' => $models_options, 'value' => isset($product_type) ? $product_type : null, 'class' => 'select2 form-control'])
|
||||
@include('components.select', ['name' => 'product_type', 'id_name' => 'product_type', 'list' => $models_options, 'value' => $article['product_type'] ?? null, 'class' => 'select2 form-control'])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ Form::label('model_id', 'Produit') }}<br>
|
||||
@include('components.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => isset($product_id) ? $product_id : null, 'class' => 'select2 form-control'])
|
||||
@include('components.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => $article['product_id'] ?? null, 'class' => 'select2 form-control'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
{{ Form::label('name', 'Nom') }}<br>
|
||||
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
||||
@include('components.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{{ Form::label('family_id', 'Famille d\'articles') }}<br>
|
||||
@include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => isset($article_family_id) ? $article_family_id : null, 'class' => 'select2 form-control'])
|
||||
@include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => $article['article_family_id'] ?? null, 'class' => 'select2 form-control'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
{{ Form::label('categories', 'Rayons') }}<br>
|
||||
@include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => isset($categories) ? $categories : null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||
@include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => $article['categories'] ?? null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
{{ Form::label('tags', 'Tags') }}<br>
|
||||
@include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||
@include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => $article['tags'] ?? null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
{{ Form::label('description', 'Description') }}
|
||||
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => true])
|
||||
@if (!empty($article['product']['description']))
|
||||
@component('components.layout.box-collapse', ['id' => 'product_description', 'title' => 'Description produit'])
|
||||
{{ $article['product']['description'] }}
|
||||
@endcomponent
|
||||
@endif
|
||||
@include('components.textarea', ['name' => 'description', 'value' => $article['description'] ?? null, 'class' => 'editor', 'required' => true])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@include('components.uploader.widget', ['load_url' => route('Shop.Admin.Articles.getImages', ['id' => (isset($id)) ? $id : false]), 'delete_url' => route('Shop.Admin.Articles.deleteImage') ])
|
||||
@include('components.uploader.widget', ['load_url' => route('Shop.Admin.Articles.getImages', ['id' => $article['id'] ?? false]), 'delete_url' => route('Shop.Admin.Articles.deleteImage'), 'title' => 'Photos' ])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $prices['prices'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $prices['generics'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $article['prices']['prices'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $article['prices']['generics'] ?? null])
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="datatable-export-buttons">
|
||||
|
||||
@include('components.datatables.buttons.print')
|
||||
|
||||
@if (isset($with_exports) && $with_exports)
|
||||
@include('components.datatables.buttons.download')
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@@ -38,7 +38,11 @@
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
// line.remove();
|
||||
table.draw();
|
||||
@if (isset($delete_callback))
|
||||
{{ $delete_callback }}
|
||||
@else
|
||||
table.draw();
|
||||
@endif
|
||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@include('load.autocomplete')
|
||||
@include('load.form.autocomplete')
|
||||
|
||||
<input type="hidden" name="{{ $name }}_id" id="{{ $name }}_id" value="{{ $data['id'] ?? null }}">
|
||||
<input type="text" name="{{ $name }}_name" class="form-control autocomplete" value="{{ $data['name'] ?? ''}}" data-url="{{ $url ?? ''}}" data-field="{{ $name }}_id" autocomplete="off">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@include('load.datepicker')
|
||||
@include('load.form.datepicker')
|
||||
|
||||
<div class="input-group date" data-target-input="nearest">
|
||||
@include('components.input', ['class' => 'datepicker', 'meta' => 'data-target="#'.str_slug($name).'"', 'placeholder' => App\Repositories\Core\DateTime::getLocaleFormatDate() ])
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
@if(!defined('LOAD_EDITOR'))
|
||||
@include('load.editor')
|
||||
@include('load.form.editor.editor')
|
||||
@push('js')
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@include('components.input', ['type' => 'number', 'meta' => "step = '.01'"])
|
||||
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="button" aria-haspopup="true" aria-expanded="false">
|
||||
<button class="btn bg-light" type="button" aria-haspopup="false" aria-expanded="false">
|
||||
%
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
</select>
|
||||
|
||||
@if(!defined('LOAD_SELECT2'))
|
||||
@include('load.select2')
|
||||
@include('load.form.select2')
|
||||
@endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}" class="{{ $class ?? 'toggle'}}" value="{{ $val ?? 1}}" data-toggle="toggle" data-on="{{ $on ?? __('yes') }}" data-off="{{ $off ?? __('no') }}" data-onstyle="{{ $onstyle ?? 'outline-success'}}" data-offstyle="{{ $offstyle ?? 'outline-danger'}}" data-size="{{ $size ?? 'sm' }}" @if ( (isset($value) && isset($val) && ($value == $val)) || (!isset($val) && isset($value) && $value)) checked @endif {{ $disabled ?? ''}} {{ $meta ?? ''}} >
|
||||
<input type="hidden" name="{{ $name ?? ''}}" value="0">
|
||||
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}" class="{{ $class ?? 'toggle'}}" value="{{ $val ?? 1}}" data-toggle="toggle" data-on="{{ $on ?? __('yes') }}" data-off="{{ $off ?? __('no') }}" data-onstyle="{{ $onstyle ?? 'outline-success'}}" data-offstyle="{{ $offstyle ?? 'outline-danger'}}" data-size="{{ $size ?? '' }}" @if ( (isset($value) && isset($val) && ($value == $val)) || (!isset($val) && isset($value) && $value)) checked @endif {{ $disabled ?? ''}} {{ $meta ?? ''}} >
|
||||
|
||||
@include('load.toggle')
|
||||
@include('load.form.toggle')
|
||||
@@ -5,7 +5,7 @@
|
||||
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#{{ $id }}" aria-expanded="false" aria-controls="{{ $id }}">
|
||||
<i class="fa fa-chevron-right"></i>
|
||||
</button>
|
||||
{!! $title !!}
|
||||
{!! $title ?? null !!}
|
||||
@if (isset($required) && $required)
|
||||
<sup>*</sup>
|
||||
@endif
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div class="col row-new-image row-image mt-3 mb-2">
|
||||
<div class="col {{ $prefix ?? '' }}row-new-image row-image mt-3 mb-2">
|
||||
|
||||
<p>
|
||||
<button type="button" class="btn btn-danger delete-new-image-btn"><i class="fa fa-minus-circle"></i></button>
|
||||
Photo <span class="row-image-number"></span>
|
||||
<button type="button" class="btn btn-danger {{ $prefix ?? '' }}delete-new-image-btn"><i class="fa fa-minus-circle"></i></button>
|
||||
Photo <span class="{{ $prefix ?? '' }}row-image-number"></span>
|
||||
</p>
|
||||
|
||||
<input name="images[]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
|
||||
<input name="{{ $prefix ?? '' }}images[]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
@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>
|
||||
@if ($can_edit ?? true)
|
||||
<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>
|
||||
@endif
|
||||
</figure>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<script>
|
||||
handleDeleteImages();
|
||||
handleEnlargeImages();
|
||||
</script>
|
||||
@if ($can_edit ?? true)
|
||||
<script>
|
||||
{{ $prefix ?? '' }}handleDeleteImages();
|
||||
{{ $prefix ?? '' }}handleEnlargeImages();
|
||||
</script>
|
||||
@endif
|
||||
@@ -1,14 +1,14 @@
|
||||
<div class="row" id="uploader-mini-gallery"></div>
|
||||
<div class="row" id="{{ $prefix ?? '' }}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 fade" id="{{ $prefix ?? '' }}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>
|
||||
<h5 class="modal-title"></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" >
|
||||
<img src="" class="img-fluid lightbox" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function handleDeleteImages() {
|
||||
$('#uploader-mini-gallery .fa-trash').click(function() {
|
||||
function {{ $prefix ?? '' }}handleDeleteImages() {
|
||||
$('#{{ $prefix ?? '' }}uploader-mini-gallery .fa-trash').click(function() {
|
||||
id = $('#id').val();
|
||||
index = $(this).data('index');
|
||||
console.log(id);
|
||||
@@ -35,13 +35,13 @@
|
||||
})
|
||||
}
|
||||
|
||||
function handleEnlargeImages() {
|
||||
$('#uploader-mini-gallery .fa-expand-alt').click(function() {
|
||||
function {{ $prefix ?? '' }}handleEnlargeImages() {
|
||||
$('#{{ $prefix ?? '' }}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');
|
||||
$('#{{ $prefix ?? '' }}mini-gallery-lightbox .lightbox').attr('src', url);
|
||||
$('#{{ $prefix ?? '' }}mini-gallery-lightbox').modal('show');
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,51 +2,57 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Photos</h3>
|
||||
<h3 class="card-title">{{ $title }}</h3>
|
||||
<div class="card-tools">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-3 pb-0">
|
||||
@if (isset($id))
|
||||
@if (isset($article['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>
|
||||
@if ($can_edit ?? true)
|
||||
<div id="{{ $prefix ?? '' }}uploader-new-images"></div>
|
||||
@include('components.uploader.block_image_new', ['name' => 'images[]', 'required' => true])
|
||||
@endif
|
||||
</div>
|
||||
@if ($can_edit ?? true)
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-xs btn-primary {{ $prefix ?? '' }}add-image pull-right">Ajout <i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function append_image() {
|
||||
$("#uploader-new-images .file").fileinput();
|
||||
$("#uploader-new-images .file").focus();
|
||||
function {{ $prefix ?? '' }}append_image() {
|
||||
$("#{{ $prefix ?? '' }}uploader-new-images .file").fileinput();
|
||||
$("#{{ $prefix ?? '' }}uploader-new-images .file").focus();
|
||||
}
|
||||
|
||||
$("#uploader-new-images").appender({
|
||||
rowSection: '.row-new-image',
|
||||
type: '.row-image',
|
||||
addBtn: '.add-image',
|
||||
$("#{{ $prefix ?? '' }}uploader-new-images").appender({
|
||||
rowSection: '.{{ $prefix ?? '' }}row-new-image',
|
||||
type: '.{{ $prefix ?? '' }}row-image',
|
||||
addBtn: '.{{ $prefix ?? '' }}add-image',
|
||||
appendEffect: 'fade',
|
||||
addClass: 'animated fadeIn',
|
||||
rowNumber: '.row-image-number',
|
||||
deleteBtn: '.delete-new-image-btn',
|
||||
callback: append_image,
|
||||
rowNumber: '.{{ $prefix ?? '' }}row-image-number',
|
||||
deleteBtn: '.{{ $prefix ?? '' }}delete-new-image-btn',
|
||||
callback: {{ $prefix ?? '' }}append_image,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
function loadImages()
|
||||
{
|
||||
$gallery = $("#uploader-mini-gallery");
|
||||
$gallery = $("#{{ $prefix ?? '' }}uploader-mini-gallery");
|
||||
if ($gallery) {
|
||||
$gallery.load("{{ $load_url }}");
|
||||
}
|
||||
}
|
||||
|
||||
loadImages();
|
||||
$(function() {
|
||||
loadImages();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
TEST
|
||||
@component('components.layout.box-collapse', ['title' => __('person_in_charge'), 'id' => 'form-contact'])
|
||||
TEST
|
||||
@endcomponent
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="{{ route('admin') }}"><i class="fa fa-cog"></i> Accès à l'administration</a>
|
||||
|
||||
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
||||
Déconnexion
|
||||
|
||||
77
resources/views/load/form/appender.blade.php
Normal file
77
resources/views/load/form/appender.blade.php
Normal file
@@ -0,0 +1,77 @@
|
||||
@if(!defined('LOAD_APPENDER'))
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
(function ($) {
|
||||
$.fn.appender = function (settings) {
|
||||
let appendArea = this;
|
||||
let rowHtml = $(settings.rowSection)[0].outerHTML;
|
||||
|
||||
settings.hideSection ? $(settings.rowSection).remove() : "";
|
||||
|
||||
let rowCounter = 1;
|
||||
|
||||
if (settings.rowNumberStart) {
|
||||
rowCounter = Number(settings.rowNumberStart);
|
||||
}
|
||||
|
||||
$(document).on('click', settings.addBtn, function (event) {
|
||||
$(appendArea).append(rowHtml);
|
||||
|
||||
if (settings.appendEffect === 'fade') {
|
||||
$(settings.rowSection).last().hide().fadeIn();
|
||||
} else if (settings.appendEffect === 'slide') {
|
||||
$(settings.rowSection).last().hide().slideDown(200);
|
||||
}
|
||||
|
||||
$(settings.rowSection).last().addClass(settings.addClass);
|
||||
|
||||
$(settings.rowNumber).last().text(rowCounter);
|
||||
|
||||
type = (settings.type) ? settings.type : settings.rowSection;
|
||||
|
||||
$(type).each(function(rowIndex) {
|
||||
$(this).find('input[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('select[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('textarea[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('.appender').each(function() {
|
||||
$(this).data('id',rowIndex);
|
||||
});
|
||||
});
|
||||
|
||||
rowCounter++;
|
||||
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (settings.deleteBtn) {
|
||||
$(document).on('click', settings.deleteBtn, function (e) {
|
||||
$(e.target).closest(settings.rowSection).remove();
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_APPENDER', true))
|
||||
@endif
|
||||
6
resources/views/load/form/builder/formbuilder.blade.php
Normal file
6
resources/views/load/form/builder/formbuilder.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@if(!defined('LOAD_FORMBUILDER'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/formBuilder/form-builder.min.js') }}"></script>
|
||||
@endpush
|
||||
@php(define('LOAD_FORMBUILDER', true))
|
||||
@endif
|
||||
9
resources/views/load/form/builder/formio.blade.php
Normal file
9
resources/views/load/form/builder/formio.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@if(!defined('LOAD_FORMIOJS'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/formiojs/formio.full.min.css') }}">
|
||||
@endpush
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/formiojs/formio.full.min.js') }}"></script>
|
||||
@endpush
|
||||
@php(define('LOAD_FORMIOJS', true))
|
||||
@endif
|
||||
39
resources/views/load/form/check_fields.blade.php
Normal file
39
resources/views/load/form/check_fields.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
function checkCollapsedFields(selector)
|
||||
{
|
||||
var fields = selector + ' input,' + selector + ' textarea,' + selector + ' select';
|
||||
console.log(fields);
|
||||
|
||||
var nb_fields = $(fields).length;
|
||||
console.log(nb_fields);
|
||||
var nb_required = $(fields).filter('[required]').length;
|
||||
console.log(nb_required);
|
||||
var nb_filled = 0;
|
||||
var nb_necessary = 0;
|
||||
|
||||
$(fields).each(function(i, field){
|
||||
if ($(field).val() != '')
|
||||
{
|
||||
nb_filled++;
|
||||
}
|
||||
});
|
||||
|
||||
$(fields).filter('[required]').each(function(i, required){
|
||||
if ($(required).val() != '')
|
||||
{
|
||||
nb_necessary++;
|
||||
}
|
||||
});
|
||||
|
||||
var result = nb_filled + " / " + nb_fields;
|
||||
result = result + " | " + nb_necessary + " / " + nb_required;
|
||||
|
||||
console.log(result);
|
||||
|
||||
var check = $(selector).parent().find('.check');
|
||||
console.log(check);
|
||||
|
||||
// $(selector).parent().find('.check').html(result);
|
||||
if (nb_necessary < nb_required) {
|
||||
$(selector).collapse('show');
|
||||
}
|
||||
}
|
||||
22
resources/views/load/form/color.blade.php
Normal file
22
resources/views/load/form/color.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@if(!defined('LOAD_COLOR'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/jquery-minicolors/jquery.minicolors.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
function initColor(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.color' : sel;
|
||||
var settings = {
|
||||
position: 'bottom left',
|
||||
theme: 'bootstrap'
|
||||
};
|
||||
$(selector).minicolors(settings);
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/jquery-minicolors/jquery.minicolors.css') }}">
|
||||
@endpush
|
||||
@php(define('LOAD_COLOR', true))
|
||||
@endif
|
||||
25
resources/views/load/form/duallist.blade.php
Normal file
25
resources/views/load/form/duallist.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@if(!defined('LOAD_DUALLIST'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
function initDualList(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.duallist' : sel;
|
||||
var settings = {
|
||||
nonSelectedListLabel: 'Non-selected',
|
||||
selectedListLabel: 'Selected',
|
||||
preserveSelectionOnMove: 'moved',
|
||||
moveOnSelect: true,
|
||||
nonSelectedFilter: ''
|
||||
};
|
||||
$(selector).bootstrapDualListbox(settings);
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css') }}">
|
||||
@endpush
|
||||
@php(define('LOAD_DUALLIST', true))
|
||||
@endif
|
||||
15
resources/views/load/form/editor/editor.blade.php
Normal file
15
resources/views/load/form/editor/editor.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
@if(!defined('LOAD_EDITOR'))
|
||||
|
||||
@include('load.form.editor.tinymce')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function initEditor(selector) {
|
||||
var selector = '.editor';
|
||||
$(selector).tinymce({});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_EDITOR', true))
|
||||
@endif
|
||||
41
resources/views/load/form/editor/tinymce.blade.php
Normal file
41
resources/views/load/form/editor/tinymce.blade.php
Normal file
@@ -0,0 +1,41 @@
|
||||
@if(!defined('LOAD_TINYMCE'))
|
||||
@push('js')
|
||||
<script src="{!! mix('/js/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script>
|
||||
tinymce.defaultSettings = {
|
||||
plugins: "autoresize fullscreen codemirror link lists table media image imagetools paste customalign stickytoolbar",
|
||||
toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
|
||||
contextmenu: "link image imagetools table spellchecker bold italic underline",
|
||||
sticky_toolbar_container: '.tox-editor-header',
|
||||
toolbar_drawer: "sliding",
|
||||
sticky_offset: $('nav.main-header').outerHeight(),
|
||||
codemirror: { config: { theme: 'storm' } },
|
||||
menubar: false,
|
||||
removed_menuitems: 'newdocument',
|
||||
remove_linebreaks: false,
|
||||
forced_root_block: false,
|
||||
force_p_newlines: true,
|
||||
relative_urls: false,
|
||||
verify_html: false,
|
||||
branding: false,
|
||||
statusbar: false,
|
||||
browser_spellcheck: true,
|
||||
encoding: 'UTF-8',
|
||||
image_uploadtab: false,
|
||||
paste_preprocess: function(plugin, args) {
|
||||
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
|
||||
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
|
||||
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s| |<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
|
||||
},
|
||||
skin : "boilerplate",
|
||||
language: '{{ App::getLocale() }}'
|
||||
};
|
||||
|
||||
function initEditor(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
|
||||
$(selector).tinymce({});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_TINYMCE', true))
|
||||
@endif
|
||||
18
resources/views/load/form/select2.blade.php
Normal file
18
resources/views/load/form/select2.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@if(!defined('LOAD_SELECT2'))
|
||||
@push('scripts')
|
||||
<script src="{!! mix('/js/select2/select2.full.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script src="{!! asset('/assets/vendor/boilerplate/js/select2/i18n/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||
<script>
|
||||
function initSelect2() {
|
||||
$(".select2").select2({
|
||||
placeholder: "{{ __('select_a_value') }}",
|
||||
allowClear: false,
|
||||
width: {
|
||||
value: '100%'
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_SELECT2', true))
|
||||
@endif
|
||||
25
resources/views/load/form/set_options.blade.php
Normal file
25
resources/views/load/form/set_options.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@if(!defined('LOAD_SET_OPTIONS'))
|
||||
@push('js')
|
||||
<script>
|
||||
function setOptions(selector,data,selected,all) {
|
||||
// console.log(data);
|
||||
console.log(selector);
|
||||
var $el = $(selector);
|
||||
$el.empty(); // remove old options
|
||||
if (all) {
|
||||
$el.append($("<option></option>").attr("value",'').text('{{ __("all") }}'));
|
||||
}
|
||||
$.each(data, function(key, name) {
|
||||
if (key != null) {
|
||||
if (key == selected) {
|
||||
$el.append($("<option selected='selected'></option>").attr("value", key).text(name));
|
||||
} else {
|
||||
$el.append($("<option></option>").attr("value", key).text(name));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_SET_OPTIONS', true))
|
||||
@endif
|
||||
34
resources/views/load/form/toggle.blade.php
Normal file
34
resources/views/load/form/toggle.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
@if(!defined('LOAD_TOGGLE'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
function initToggle(url, sel, data, callback) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.toggle' : sel;
|
||||
if (typeof(data) == 'undefined') {
|
||||
var data = {};
|
||||
}
|
||||
$(selector).bootstrapToggle();
|
||||
|
||||
$('input' + selector).change(function() {
|
||||
console.log($(this));
|
||||
data['id'] = $(this).data('id');
|
||||
data['active'] = $(this).is(':checked');
|
||||
if (data['id'] && (typeof(url) != 'undefined') && (url != '')) {
|
||||
var dataJson = Object.assign({}, data);
|
||||
$.post(url, dataJson);
|
||||
}
|
||||
if (typeof(callback) != 'undefined') {
|
||||
eval(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css') }}">
|
||||
@endpush
|
||||
@php(define('LOAD_TOGGLE', true))
|
||||
@endif
|
||||
25
resources/views/load/form/upload/fileinput.blade.php
Normal file
25
resources/views/load/form/upload/fileinput.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@if(!defined('LOAD_FILEINPUT'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{!! mix('/js/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="{!! mix('/js/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
@if(App::getLocale() !== 'en')
|
||||
<script src="{!! asset('/assets/vendor/boilerplate/js/fileinput/locales/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||
<script>
|
||||
$.fn.fileinput.defaults.language = '{{ config('boilerplate.app.locale') }}';
|
||||
</script>
|
||||
@endif
|
||||
@endpush
|
||||
<script>
|
||||
function initUpload(selector) {
|
||||
var selector = '.file';
|
||||
$(selector).fileinput({
|
||||
showCaption: false,
|
||||
dropZoneEnabled: false,
|
||||
showUpload: false,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@php(define('LOAD_FILEINPUT', true))
|
||||
@endif
|
||||
29
resources/views/load/form/upload/upload.blade.php
Normal file
29
resources/views/load/form/upload/upload.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@if(!defined('LOAD_FILEINPUT'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{!! mix('/js/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
|
||||
@endpush
|
||||
|
||||
@push('js')
|
||||
<script src="{!! mix('/js/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
@if(App::getLocale() !== 'en')
|
||||
<script src="{!! asset('/assets/vendor/boilerplate/js/fileinput/locales/' . App::getLocale() . '.js') !!}"></script>
|
||||
<script>
|
||||
$.fn.fileinput.defaults.language = '{{ App::getLocale() }}';
|
||||
</script>
|
||||
@endif
|
||||
|
||||
<script>
|
||||
function initUpload(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.file' : sel;
|
||||
$(selector).fileinput({
|
||||
showCaption: false,
|
||||
dropZoneEnabled: false,
|
||||
showUpload: false,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_FILEINPUT', true))
|
||||
@endif
|
||||
16
resources/views/load/form/url.blade.php
Normal file
16
resources/views/load/form/url.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@if(!defined('LOAD_URL'))
|
||||
@include('load.layout.modal')
|
||||
@push('js')
|
||||
<script>
|
||||
function initLoadUrl(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.btn-web' : sel;
|
||||
|
||||
$(selector).off().click(function() {
|
||||
var url = $(this).closest('.input-group').find('.url').val();
|
||||
viewModal(url);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_URL', true))
|
||||
@endif
|
||||
114
resources/views/load/layout/modal.blade.php
Normal file
114
resources/views/load/layout/modal.blade.php
Normal file
@@ -0,0 +1,114 @@
|
||||
@if(!defined('LOAD_MODAL'))
|
||||
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
function openModal(title, form_id, url_open, url_save, callback, size, no_confirm) {
|
||||
var status = 0;
|
||||
var dialog = bootbox.dialog({
|
||||
title: title,
|
||||
message: '<p><i class="fa fa-spin fa-spinner"></i> {{ __('loading') }} ...</p>',
|
||||
size: size ? size : 'large',
|
||||
scrollable: true,
|
||||
onHide: function(e) {
|
||||
console.log(status);
|
||||
},
|
||||
buttons: buildModalButtons(form_id, no_confirm)
|
||||
});
|
||||
|
||||
/*
|
||||
changeModalContent(dialog, url_open);
|
||||
var callback = handlePostModal(form_id,url_save, callback);
|
||||
handlePostModal(form_id,url_save, callback);
|
||||
*/
|
||||
|
||||
dialog.init(function() {
|
||||
$.get(url_open, function(data) {
|
||||
dialog.find('.bootbox-body').html(data);
|
||||
handlePostModal(form_id,url_save, callback);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function changeModalContent(dialog, url, callback) {
|
||||
dialog.init(function() {
|
||||
$.get(url, function(data) {
|
||||
dialog.find('.bootbox-body').html(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function viewModal(url, size, title) {
|
||||
var dialog = bootbox.dialog({
|
||||
title: title ? title : 'Web viewer',
|
||||
message: '<iframe style="border:0;" src="' + url + '" height="400" width="100%"></iframe>',
|
||||
size: size ? size : 'xl',
|
||||
scrollable: true,
|
||||
});
|
||||
}
|
||||
|
||||
function buildModalButtons(form_id, no_confirm) {
|
||||
if (!no_confirm) {
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: '{{ __('cancel') }}',
|
||||
className: 'btn-secondary'
|
||||
},
|
||||
confirm: {
|
||||
label: '{{ __('save') }}',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
submitModal(form_id);
|
||||
}
|
||||
},
|
||||
};
|
||||
} else {
|
||||
buttons = '';
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
|
||||
function submitModal(form_id) {
|
||||
/*
|
||||
var data = $(form_id).serialize();
|
||||
$.post(url_save, data)
|
||||
.done(function(data) {
|
||||
if (callback) {
|
||||
eval(callback);
|
||||
}
|
||||
});
|
||||
*/
|
||||
if (typeof(tinyMCE) != 'undefined') {
|
||||
tinyMCE.triggerSave();
|
||||
}
|
||||
var oForm = 'form' + form_id;
|
||||
$(oForm).submit();
|
||||
status = 1;
|
||||
}
|
||||
|
||||
function handlePostModal(form_id,url_save, callback) {
|
||||
var oForm = 'form'+form_id;
|
||||
$(oForm).submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: url_save,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: function (data) {
|
||||
if (callback) {
|
||||
eval(callback);
|
||||
}
|
||||
},
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_MODAL', true))
|
||||
@endif
|
||||
29
resources/views/load/layout/nicescroll.blade.php
Normal file
29
resources/views/load/layout/nicescroll.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@if(!defined('LOAD_NICESCROLL'))
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{ asset('/assets/plugins/jquery.slimscroll.min.js') }}"></script>
|
||||
<script>
|
||||
function initScroll(selector) {
|
||||
var selector = (typeof(selector) == 'undefined') ? '.nicescrollable' : selector;
|
||||
|
||||
$(selector).niceScroll({
|
||||
horizrailenabled: false,
|
||||
cursorborder: "0",
|
||||
cursorwidth: "8px",
|
||||
cursorcolor: "#fff",
|
||||
zindex: "5555",
|
||||
autohidemode: true,
|
||||
bouncescroll: true,
|
||||
mousescrollstep: 40,
|
||||
scrollspeed: 100,
|
||||
background: "#cdcdcd",
|
||||
cursoropacitymin: 0.3,
|
||||
cursoropacitymax: 0.7,
|
||||
cursorborderradius: 0,
|
||||
railpadding: {top:0,right:1,left:0,bottom:0}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_NICESCROLL', true))
|
||||
@endif
|
||||
6
resources/views/load/layout/slimscroll.blade.php
Normal file
6
resources/views/load/layout/slimscroll.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@if(!defined('LOAD_SLIMSCROLL'))
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{ asset('/assets/plugins/jquery.slimscroll.min.js') }}"></script>
|
||||
@endpush
|
||||
@php(define('LOAD_SLIMSCROLL', true))
|
||||
@endif
|
||||
39
resources/views/load/layout/tabs.blade.php
Normal file
39
resources/views/load/layout/tabs.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
@if(!defined('LOAD_TABS'))
|
||||
@push('scripts')
|
||||
|
||||
<script>
|
||||
function addTab(name, id, txt, url) {
|
||||
|
||||
var navContainer = $('#'+name);
|
||||
var tabContainer = $('#'+name + '-tab');
|
||||
var newTab = name + '-' + id;
|
||||
var newTabId = '#' + newTab;
|
||||
// create the tab
|
||||
$('<a href="'+newTabId+'" data-toggle="tab" class="nav-item nav-link" role="tab">'+txt+'</a>').appendTo(navContainer);
|
||||
|
||||
var url_open = url + id;
|
||||
|
||||
$.get(url_open, function(content) {
|
||||
$('<div class="tab-pane fade pt-0 pb-0" id="'+newTab+'"><div class="card mb-0 card-outline card-info"><div class="card-body">'+content+'</div></div></div>').appendTo(tabContainer);
|
||||
|
||||
// make the new tab active
|
||||
// console.log('#' + tabname + ' .nav-item a:last');
|
||||
// $('#' + tabname + ' .nav-item a:last').tab('show');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function removeTab(name, id) {
|
||||
var tabId = '#' + name + '-' + id;
|
||||
// console.log('#' + name + "a[href='" + tabId + "'])");
|
||||
$('#' + name + " a[href='" + tabId + "']").remove();
|
||||
// console.log('remove ' + tabId);
|
||||
$(tabId).remove();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_TABS', true))
|
||||
@endif
|
||||
Reference in New Issue
Block a user