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() {

View File

@@ -1 +1,3 @@
@foreach ($delivery_types as $delivery_type)
@endforeach

View File

@@ -1,90 +1,100 @@
<!DOCTYPE html>
<html lang="{{ App::getLocale() }}" dir="@lang('boilerplate::layout.direction')">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $title ?? '' }} | {{ config('app.name') }}</title>
<link rel="shortcut icon" href="{{ config('boilerplate.theme.favicon') ?? mix('favicon.svg', '/assets/vendor/boilerplate') }}">
@stack('plugin-css')
<link rel="stylesheet" href="{{ mix('/plugins/fontawesome/fontawesome.min.css', '/assets/vendor/boilerplate') }}">
<link rel="stylesheet" href="{{ mix('/adminlte.min.css', '/assets/vendor/boilerplate') }}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $title ?? '' }} | {{ config('app.name') }}</title>
<link rel="shortcut icon"
href="{{ config('boilerplate.theme.favicon') ?? mix('favicon.svg', '/assets/vendor/boilerplate') }}">
@stack('plugin-css')
<link rel="stylesheet" href="{{ mix('/plugins/fontawesome/fontawesome.min.css', '/assets/vendor/boilerplate') }}">
<link rel="stylesheet" href="{{ mix('/adminlte.min.css', '/assets/vendor/boilerplate') }}">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/assets/fonts/glyphicons/glyphicons.min.css">
@stack('css')
<link rel="stylesheet" href="/assets/css/main.min.css?{{ time() }}">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="/assets/fonts/glyphicons/glyphicons.min.css">
@stack('css')
<link rel="stylesheet" href="/assets/css/main.min.css?{{ time() }}">
</head>
<body class="layout-fixed layout-navbar-fixed sidebar-mini{{ setting('darkmode', false) && config('boilerplate.theme.darkmode') ? ' dark-mode accent-light' : '' }}{{ setting('sidebar-collapsed', false) ? ' sidebar-collapse' : '' }}">
<div class="wrapper">
@include('layout.header')
@include('boilerplate::layout.mainsidebar')
<div class="content-wrapper">
@include('layout.contentheader')
<section class="content">
<div class="container-fluid">
@yield('content')
</div>
</section>
</div>
@includeWhen(config('boilerplate.theme.footer.visible', true), 'layout.footer')
<aside class="control-sidebar control-sidebar-{{ config('boilerplate.theme.sidebar.type') }} elevation-{{ config('boilerplate.theme.sidebar.shadow') }}">
<button class="btn btn-sm" data-widget="control-sidebar"><span class="fa fa-times"></span></button>
<div class="control-sidebar-content">
<div class="p-3">
@yield('right-sidebar')
</div>
</div>
</aside>
<div class="control-sidebar-bg"></div>
</div>
<body
class="layout-fixed layout-navbar-fixed sidebar-mini{{ setting('darkmode', false) && config('boilerplate.theme.darkmode') ? ' dark-mode accent-light' : '' }}{{ setting('sidebar-collapsed', false) ? ' sidebar-collapse' : '' }}">
<div class="wrapper">
@include('layout.header')
@include('boilerplate::layout.mainsidebar')
<div class="content-wrapper">
@include('layout.contentheader')
<section class="content">
<div class="container-fluid">
@yield('content')
</div>
</section>
</div>
@includeWhen(config('boilerplate.theme.footer.visible', true), 'layout.footer')
<aside
class="control-sidebar control-sidebar-{{ config('boilerplate.theme.sidebar.type') }} elevation-{{ config('boilerplate.theme.sidebar.shadow') }}">
<button class="btn btn-sm" data-widget="control-sidebar"><span class="fa fa-times"></span></button>
<div class="control-sidebar-content">
<div class="p-3">
@yield('right-sidebar')
</div>
</div>
</aside>
<div class="control-sidebar-bg"></div>
</div>
<script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/admin-lte.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="/assets/js/main.min.js?{{ time() }}"></script>
<script>
// initScroll('.sidebar');
$('.sidebar').addClass('overflow-y');
<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js') }}"></script>
<script src="/assets/js/main.min.js?{{ time() }}"></script>
$.ajaxSetup({headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'}});
bootbox.setLocale('{{ App::getLocale() }}');
<script>
// initScroll('.sidebar');
$('.sidebar').addClass('overflow-y');
var bpRoutes = {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
bootbox.setLocale('{{ App::getLocale() }}');
var bpRoutes = {
settings: "{{ route('boilerplate.user.settings', null, false) }}",
}
var session = {
keepalive: "{{ route('boilerplate.keepalive', null, false) }}",
expire: {{ time() + config('session.lifetime') * 60 }},
lifetime: {{ config('session.lifetime') * 60 }},
id: "{{ session()->getId() }}"
}
</script>
var session = {
keepalive: "{{ route('boilerplate.keepalive', null, false) }}",
expire: {{ time() + config('session.lifetime') * 60 }},
lifetime: {{ config('session.lifetime') * 60 }},
id: "{{ session()->getId() }}"
}
</script>
@if(Session::has('growl'))
<script>
$(function() {
@if(is_array(Session::get('growl')))
growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}");
@else
growl("{{Session::get('growl')}}");
@endif
});
</script>
@endif
@if (Session::has('growl'))
<script>
$(function() {
@if (is_array(Session::get('growl')))
growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}");
@else
growl("{{ Session::get('growl') }}");
@endif
});
</script>
@endif
@stack('scripts')
@stack('js')
@stack('scripts')
@stack('js')
</body>
</html>