add validator, optimizations

This commit is contained in:
ludo
2023-11-13 23:03:12 +01:00
parent 23ac0cedad
commit b86b043604
16 changed files with 207 additions and 230 deletions

View File

@@ -1,13 +1,9 @@
@extends('layout.index', [
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.add'),
'breadcrumb' => [__('shop.articles.title'), __('shop.articles.add')]
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.add'),
'breadcrumb' => [__('shop.articles.title'), __('shop.articles.add')],
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
@include('Admin.Shop.Articles.form')
</form>
@include('Admin.Shop.Articles.form')
@endsection

View File

@@ -1,15 +1,9 @@
@extends('layout.index', [
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.edit'),
'breadcrumb' => [__('shop.articles.title'), __('shop.articles.edit')]
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.edit'),
'breadcrumb' => [__('shop.articles.title'), __('shop.articles.edit')],
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
@include('Admin.Shop.Articles.form')
{{ Form::close() }}
@include('Admin.Shop.Articles.form')
@endsection

View File

@@ -1,10 +1,9 @@
<div class="row mt-3">
<div class="col-12">
@include('Admin.Shop.Articles.partials.characteristics')
</div>
</div>
{{ Form::open(['route' => 'Admin.Shop.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
@include('Admin.Shop.Articles.partials.characteristics')
{{ Form::close() }}
@include('components.save')
<x-save />
@include('load.form.appender')
@include('load.form.editor')
@@ -17,20 +16,22 @@
@include('load.layout.modal')
@push('js')
<script>
$(function() {
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreArticlePost', '#article-form') !!}
$('.active-checkbox').bootstrapToggle();
$('.active-checkbox').off('change').on('change', function(e) {
var id = $('#id').val();
// handleAdmin.toggle(id, $(this).prop('checked'));
});
<script>
$(function() {
initChevron();
initEditor();
initSaveForm('#article-form');
initSelect2();
$('.active-checkbox').bootstrapToggle();
$('.active-checkbox').off('change').on('change', function(e) {
var id = $('#id').val();
// handleAdmin.toggle(id, $(this).prop('checked'));
});
});
</script>
@endpush
initChevron();
initEditor();
initSaveForm('#article-form');
initSelect2();
});
</script>
@endpush

View File

@@ -166,18 +166,17 @@
var product_type = $(this).val();
switch (product_type) {
case 'App\\Models\\Botanic\\Specie':
var url = '{{ route('Admin.Botanic.Species.getSelect') }}';
var url = "{{ route('Admin.Botanic.Species.getSelect') }}";
break;
case 'App\\Models\\Botanic\\Variety':
var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}';
var url = "{{ route('Admin.Botanic.Varieties.getSelect') }}";
break;
case 'App\\Models\\Shop\\Merchandise':
var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}';
var url = "{{ route('Admin.Shop.Merchandises.getSelect') }}";
break;
}
loadProducts(url);
var url = '{{ route('Admin.Shop.ArticleNatures.getOptions') }}';
loadArticleNatures(url);
loadArticleNatures("{{ route('Admin.Shop.ArticleNatures.getOptions') }}");
});
function loadArticleNatures(url) {

View File

@@ -1,13 +1,9 @@
@extends('layout.index', [
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.add'),
'breadcrumb' => [__('shop.offers.title'), __('shop.offers.add')]
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.add'),
'breadcrumb' => [__('shop.offers.title'), __('shop.offers.add')],
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Offers.store', 'id' => 'offer-form', 'autocomplete' => 'off']) }}
@include('Admin.Shop.Offers.form')
</form>
@include('Admin.Shop.Offers.form')
@endsection

View File

@@ -1,14 +1,9 @@
@extends('layout.index', [
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.edit'),
'breadcrumb' => [__('shop.offers.title'), __('shop.offers.edit')]
'title' => __('shop.offers.title'),
'subtitle' => __('shop.offers.edit'),
'breadcrumb' => [__('shop.offers.title'), __('shop.offers.edit')],
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Offers.store', 'id' => 'offer-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $offer['id'] }}">
@include('Admin.Shop.Offers.form')
</form>
@include('Admin.Shop.Offers.form')
@endsection

View File

@@ -1,3 +1,6 @@
{{ Form::open(['route' => 'Admin.Shop.Offers.store', 'id' => 'offer-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $offer['id'] }}">
<div class="row mb-3">
<div class="col-8">
<div class="row mb-3">
@@ -103,13 +106,16 @@
</div>
@include('components.save')
{{ form::close() }}
<x-save />
@include('load.layout.chevron')
@include('load.form.save')
@include('load.form.select2')
@push('js')
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreOfferPost', '#offer-form') !!}
<script>
function handleArticle() {
$('.select_article').change(function() {