update project with laravel base project
This commit is contained in:
parent
39729a02ef
commit
0aab2213ae
27 changed files with 1307 additions and 428 deletions
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
|
|
@ -15,4 +18,111 @@ class Controller extends BaseController
|
|||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
|
||||
/**
|
||||
* Build Search query on specified fields
|
||||
* splitting search into words or using whole sentence
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query The eloquent query builder.
|
||||
* @param string $search The query string.
|
||||
* @param callable $searchQuery The query string.
|
||||
* @param string ...$fields Either a simple array or a string
|
||||
* in case of a string the two fields
|
||||
* would be concatenate to make the search.
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
protected function searchQuery(
|
||||
Builder $query,
|
||||
string $search,
|
||||
callable $searchQuery = null,
|
||||
string ...$fields
|
||||
): Builder {
|
||||
if (count($fields)) {
|
||||
// Search using words.
|
||||
$words = explode(' ', $search);
|
||||
$query->where(function ($query) use ($searchQuery, $words, $search, $fields) {
|
||||
foreach ($words as $word) {
|
||||
if (!strlen($word)) {
|
||||
continue;
|
||||
}
|
||||
$this->searchOnFields($query, $word, $fields);
|
||||
} //end foreach
|
||||
// Search whole using whole sentence.
|
||||
$this->searchOnFields($query, $search, $fields);
|
||||
if ($searchQuery) {
|
||||
$searchQuery($query);
|
||||
}
|
||||
});
|
||||
} //end if
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build query search on all fields
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $search
|
||||
* @param array $fields
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
private function searchOnFields(Builder $query, string $search, array $fields): Builder
|
||||
{
|
||||
$table = $query->getModel()->getTable();
|
||||
foreach ($fields as $f) {
|
||||
$f = str_replace('?', '\?', $f);
|
||||
if (is_array($f)) {
|
||||
$query->orWhereRaw(
|
||||
sprintf("UPPER(CONCAT(%s)) LIKE UPPER(?)", collect($f)->map(function ($q) use ($table) {
|
||||
return "`$table`.`$q`";
|
||||
})->implode(', \' \', ')),
|
||||
['%' . filter_var($search, FILTER_SANITIZE_STRING) . '%']
|
||||
);
|
||||
} else {
|
||||
$query->orWhereRaw(
|
||||
"UPPER(`$table`.`$f`) LIKE UPPER(?)",
|
||||
['%' . filter_var($search, FILTER_SANITIZE_STRING) . '%']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort columns with a query
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param array $ignore
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
protected function sortQuery(Builder $query, array $ignore = []): Builder
|
||||
{
|
||||
$rName = request()->route()->getName();
|
||||
$table = $query->getModel()->getTable();
|
||||
if (request()->sort_col) {
|
||||
Session::put("$rName.sort_col", request()->sort_col);
|
||||
Session::put("$rName.sorted", true);
|
||||
}
|
||||
if (request()->sort_way) {
|
||||
Session::put("$rName.sort_way", request()->sort_way);
|
||||
Session::put("$rName.sorted", true);
|
||||
}
|
||||
if (request()->rst) {
|
||||
Session::remove("$rName.sorted");
|
||||
Session::remove("$rName.sort_col");
|
||||
Session::remove("$rName.sort_way");
|
||||
}
|
||||
if (request()->sort_col and request()->sort_way and Schema::hasColumn($table, request()->sort_col)) {
|
||||
if (
|
||||
!isset($ignore) or
|
||||
(isset($ignore) and !in_array(request()->sort_col, $ignore))
|
||||
) {
|
||||
$query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way);
|
||||
}
|
||||
} elseif (Schema::hasColumn($table, 'order')) {
|
||||
$query = $query->orderBy('order', 'ASC');
|
||||
Session::put("$rName.sort_col", 'order');
|
||||
Session::put("$rName.sort_way", 'asc');
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
app/Providers/ViewServiceProvider.php
Normal file
20
app/Providers/ViewServiceProvider.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ViewServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Set default view of the paginator.
|
||||
Paginator::defaultView('modules.pagination');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,8 @@
|
|||
{
|
||||
"name": "ldc/ldccrmv2",
|
||||
"type": "project",
|
||||
"version": "3.0.5",
|
||||
"version": "3.1.0",
|
||||
"description": "LDC CRM V2 - revamped",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Romain Bonhomme",
|
||||
"email": "romain.bonhomme@ldc.fr"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Bridier",
|
||||
"email": "vicent.bridier@ldc.fr",
|
||||
"homepage": "https://bridier.me"
|
||||
},
|
||||
{
|
||||
"name": "Jérémy Munsch",
|
||||
"email": "jeremy.munsch@ldc.fr",
|
||||
"homepage": "https://jeremydev.ovh"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7",
|
||||
|
|
@ -27,6 +11,7 @@
|
|||
"ext-json": "*",
|
||||
"arondeparon/laravel-request-sanitizer": "^3.1",
|
||||
"axlon/laravel-postal-code-validation": "^3.2",
|
||||
"diglactic/laravel-breadcrumbs": "^8.1",
|
||||
"doctrine/dbal": "^3.0",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
|
|
|
|||
73
composer.lock
generated
73
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "26e67a9e2292d81339b64ea6fd14f70e",
|
||||
"content-hash": "a5401fb9f430fb3c6a18523161e4e1c6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "arondeparon/laravel-request-sanitizer",
|
||||
|
|
@ -253,6 +253,77 @@
|
|||
],
|
||||
"time": "2021-08-15T20:50:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "diglactic/laravel-breadcrumbs",
|
||||
"version": "v8.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/diglactic/laravel-breadcrumbs.git",
|
||||
"reference": "f72a78eb3e26aea507d7888a65f15e5790864e21"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/diglactic/laravel-breadcrumbs/zipball/f72a78eb3e26aea507d7888a65f15e5790864e21",
|
||||
"reference": "f72a78eb3e26aea507d7888a65f15e5790864e21",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"facade/ignition-contracts": "^1.0",
|
||||
"laravel/framework": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"davejamesmiller/laravel-breadcrumbs": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0",
|
||||
"php-coveralls/php-coveralls": "^2.4",
|
||||
"phpunit/phpunit": "^8.5 || ^9.5",
|
||||
"spatie/phpunit-snapshot-assertions": "^2.2 || ^4.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Diglactic\\Breadcrumbs\\ServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Breadcrumbs": "Diglactic\\Breadcrumbs\\Breadcrumbs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Diglactic\\Breadcrumbs\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sheng Slogar",
|
||||
"email": "sheng@diglactic.com",
|
||||
"role": "Maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Dave James Miller",
|
||||
"email": "dave@davejamesmiller.com",
|
||||
"role": "Original Creator"
|
||||
}
|
||||
],
|
||||
"description": "A simple Laravel-style way to create breadcrumbs.",
|
||||
"homepage": "https://github.com/diglactic/laravel-breadcrumbs",
|
||||
"keywords": [
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/diglactic/laravel-breadcrumbs/issues",
|
||||
"source": "https://github.com/diglactic/laravel-breadcrumbs/tree/v8.1.1"
|
||||
},
|
||||
"time": "2023-04-17T23:24:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "2.2.0",
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ return [
|
|||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
App\Providers\ViewServiceProvider::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
77
config/breadcrumbs.php
Normal file
77
config/breadcrumbs.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Choose a view to display when Breadcrumbs::render() is called.
|
||||
| Built in templates are:
|
||||
|
|
||||
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
|
||||
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
|
||||
| - 'breadcrumbs::bulma' - Bulma
|
||||
| - 'breadcrumbs::foundation6' - Foundation 6
|
||||
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
|
||||
| - 'breadcrumbs::materialize' - Materialize
|
||||
| - 'breadcrumbs::tailwind' - Tailwind CSS
|
||||
| - 'breadcrumbs::uikit' - UIkit
|
||||
|
|
||||
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
||||
|
|
||||
*/
|
||||
|
||||
'view' => 'breadcrumbs/layout',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Breadcrumbs File(s)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The file(s) where breadcrumbs are defined. e.g.
|
||||
|
|
||||
| - base_path('routes/breadcrumbs.php')
|
||||
| - glob(base_path('breadcrumbs/*.php'))
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => [
|
||||
base_path('routes/breadcrumbs.php'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exceptions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determine when to throw an exception.
|
||||
|
|
||||
*/
|
||||
|
||||
// * When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
|
||||
'unnamed-route-exception' => true,
|
||||
|
||||
// * When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException)
|
||||
'missing-route-bound-breadcrumb-exception' => true,
|
||||
|
||||
// * When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException)
|
||||
'invalid-named-breadcrumb-exception' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Classes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Subclass the default classes for more advanced customisations.
|
||||
|
|
||||
*/
|
||||
|
||||
// * Manager
|
||||
'manager-class' => Diglactic\Breadcrumbs\Manager::class,
|
||||
|
||||
// * Generator
|
||||
'generator-class' => Diglactic\Breadcrumbs\Generator::class,
|
||||
|
||||
];
|
||||
925
package-lock.json
generated
925
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,7 +10,12 @@
|
|||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||
"axios": "^0.21",
|
||||
"bootstrap": "^5.3.0",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"laravel-mix": "^6.0.6",
|
||||
"laravel-mix-clean": "^0.1.0",
|
||||
|
|
|
|||
3
resources/js/back.js
vendored
3
resources/js/back.js
vendored
|
|
@ -1,4 +1,5 @@
|
|||
require('./bootstrap');
|
||||
require('./utilities/bootstrap');
|
||||
require('./utilities/fontawesome');
|
||||
|
||||
require('./pages/customer.delete')
|
||||
require('./pages/service.index')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
window._ = require('lodash');
|
||||
import axios from "axios";
|
||||
import * as bootstrap from "bootstrap";
|
||||
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
|
|
@ -6,7 +8,8 @@ window._ = require('lodash');
|
|||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
window.axios = require('axios');
|
||||
window.axios = axios;
|
||||
window.bootstrap = bootstrap;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
||||
63
resources/js/utilities/fontawesome.js
vendored
Normal file
63
resources/js/utilities/fontawesome.js
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import { dom, library, config } from "@fortawesome/fontawesome-svg-core";
|
||||
import {
|
||||
faEraser,
|
||||
faArrowLeftLong,
|
||||
faPlus,
|
||||
faTrash,
|
||||
faEye,
|
||||
faFolderOpen,
|
||||
faCrop,
|
||||
faQuestionCircle,
|
||||
faCheck,
|
||||
faUndoAlt,
|
||||
faRedoAlt,
|
||||
faSyncAlt,
|
||||
faSearchPlus,
|
||||
faSearchMinus,
|
||||
faArrowLeft,
|
||||
faArrowRight,
|
||||
faArrowUp,
|
||||
faArrowDown,
|
||||
faArrowsAltH,
|
||||
faArrowsAltV,
|
||||
faWandMagic,
|
||||
faPencil,
|
||||
faTimes,
|
||||
faBackspace,
|
||||
faSearch,
|
||||
faArrowRightFromBracket,
|
||||
faArrowAltCircleDown,
|
||||
faArrowAltCircleUp,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
config.autoReplaceSvg = false;
|
||||
library.add(faEraser);
|
||||
library.add(faArrowLeftLong);
|
||||
library.add(faPlus);
|
||||
library.add(faTrash);
|
||||
library.add(faEye);
|
||||
library.add(faFolderOpen);
|
||||
library.add(faCrop);
|
||||
library.add(faQuestionCircle);
|
||||
library.add(faCheck);
|
||||
library.add(faUndoAlt);
|
||||
library.add(faRedoAlt);
|
||||
library.add(faSyncAlt);
|
||||
library.add(faSearchPlus);
|
||||
library.add(faSearchMinus);
|
||||
library.add(faArrowLeft);
|
||||
library.add(faArrowRight);
|
||||
library.add(faArrowUp);
|
||||
library.add(faArrowDown);
|
||||
library.add(faArrowsAltH);
|
||||
library.add(faArrowsAltV);
|
||||
library.add(faWandMagic);
|
||||
library.add(faPencil);
|
||||
library.add(faTimes);
|
||||
library.add(faBackspace);
|
||||
library.add(faSearch);
|
||||
library.add(faArrowRightFromBracket);
|
||||
library.add(faArrowAltCircleDown);
|
||||
library.add(faArrowAltCircleUp);
|
||||
|
||||
dom.watch();
|
||||
12
resources/views/breadcrumbs/breadcrumb-body.blade.php
Normal file
12
resources/views/breadcrumbs/breadcrumb-body.blade.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
@hasSection('breadcrumb')
|
||||
@if(Breadcrumbs::exists(app()->view->getSections()['breadcrumb']))
|
||||
{{ call_user_func_array('Breadcrumbs::render', array_merge(
|
||||
[app()->view->getSections()['breadcrumb']],
|
||||
!empty($brParam) ? (is_array($brParam) ? $brParam : [$brParam]) : []
|
||||
)) }}
|
||||
@endif
|
||||
@elseif(request()->route() != null)
|
||||
@if(Breadcrumbs::exists(request()->route()->getName()))
|
||||
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||
@endif
|
||||
@endif
|
||||
9
resources/views/breadcrumbs/breadcrumb-head.blade.php
Normal file
9
resources/views/breadcrumbs/breadcrumb-head.blade.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
@hasSection('breadcrumb')
|
||||
@if(Breadcrumbs::exists(app()->view->getSections()['breadcrumb']))
|
||||
{{ Breadcrumbs::view('breadcrumbs::json-ld', app()->view->getSections()['breadcrumb'], $brParam ?? null) }}
|
||||
@endif
|
||||
@elseif(request()->route() != null)
|
||||
@if (Breadcrumbs::exists(request()->route()->getName()))
|
||||
{{ Breadcrumbs::view('breadcrumbs::json-ld', request()->route()->getName()) }}
|
||||
@endif
|
||||
@endif
|
||||
15
resources/views/breadcrumbs/layout.blade.php
Normal file
15
resources/views/breadcrumbs/layout.blade.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@if (count($breadcrumbs))
|
||||
<ol class="breadcrumb flex-nowrap w-100 m-0">
|
||||
@foreach ($breadcrumbs as $breadcrumb)
|
||||
<li class="breadcrumb-item btn-games d-flex align-items-center flex-grow-1 active text-dark h2 m-0 fw-bold">
|
||||
@if ($breadcrumb->url && !$loop->last)
|
||||
<a class="text-decoration-none text-primary" href="{{ $breadcrumb->url }}">
|
||||
{{ $breadcrumb->title }}
|
||||
</a>
|
||||
@else
|
||||
{{ $breadcrumb->title }}
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
@endif
|
||||
45
resources/views/modules/flash-messages.blade.php
Normal file
45
resources/views/modules/flash-messages.blade.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
@if(!request()->routeIs('login'))
|
||||
@if ($message = Session::get('success', Session::get('bo.success')))
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<strong>{!! nl2br(e($message)) !!}</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('Fermer') }}"></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($message = Session::get('error', Session::get('bo.error')))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>{!! nl2br(e($message)) !!}</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('Fermer') }}"></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($message = Session::get('warning', Session::get('bo.warning')))
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
<strong>{!! nl2br(e($message)) !!}</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('Fermer') }}"></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($message = Session::get('info', Session::get('bo.info')))
|
||||
<div class="alert alert-info alert-dismissible fade show" role="alert">
|
||||
<strong>{!! nl2br(e($message)) !!}</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('Fermer') }}"></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
@if ($errors->any())
|
||||
<ul class="list-unstyled">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('Fermer') }}"></button>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
8
resources/views/modules/input-error.blade.php
Normal file
8
resources/views/modules/input-error.blade.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
@if($errors->has($inputName))
|
||||
<div class="col-12">
|
||||
<small class="text-danger">{{ implode(',', $errors->get($inputName)) }}</small>
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($helper))
|
||||
<small @if(isset($helperId)) id="{{ $helperId }}" @endif class="form-text text-muted">{{ $helper }}</small>
|
||||
@endif
|
||||
60
resources/views/modules/pagination.blade.php
Normal file
60
resources/views/modules/pagination.blade.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
@if ($paginator->hasPages())
|
||||
<nav>
|
||||
<ul class="pagination d-flex justify-content-center align-items-center my-3">
|
||||
{{-- Previous page link --}}
|
||||
@if ($paginator->onFirstPage())
|
||||
<li class="page-item disabled" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('Page précédente') }}" aria-disabled="true" aria-label="@lang('Page précédente')">
|
||||
<span class="page-link" aria-hidden="true">‹</span>
|
||||
</li>
|
||||
@else
|
||||
<li class="page-item">
|
||||
<a class="page-link" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('Page précédente') }}" href="{{ $paginator->previousPageUrl() }}"
|
||||
rel="prev" aria-label="@lang('Page précédente')">‹</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
{{-- Pagination Elements --}}
|
||||
@foreach ($elements as $element)
|
||||
{{-- "Three Dots" Separator --}}
|
||||
@if (is_string($element))
|
||||
<li class="page-item disabled" aria-disabled="true"><span
|
||||
class="page-link">{{ $element }}</span></li>
|
||||
@endif
|
||||
|
||||
{{-- Array Of Links --}}
|
||||
@if (is_array($element))
|
||||
@foreach ($element as $page => $url)
|
||||
@if ($page == $paginator->currentPage())
|
||||
<li class="page-item active" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('Page actuelle') }}" aria-current="page">
|
||||
<span class="page-link">{{ $page }}</span>
|
||||
</li>
|
||||
@else
|
||||
<li class="page-item">
|
||||
<a class="page-link" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('Page n°:id', ['id' => $page]) }}"
|
||||
href="{{ $url }}">{{ $page }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
{{-- Next page link --}}
|
||||
@if ($paginator->hasMorePages())
|
||||
<li class="page-item">
|
||||
<a class="page-link" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Page suivante') }}"
|
||||
href="{{ $paginator->nextPageUrl() }}" rel="next"
|
||||
aria-label="@lang('Page suivante')">›</a>
|
||||
</li>
|
||||
@else
|
||||
<li class="page-item disabled" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('Page suivante') }}" aria-disabled="true" aria-label="@lang('Page suivante')">
|
||||
<span class="page-link" aria-hidden="true">›</span>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</nav>
|
||||
@endif
|
||||
46
resources/views/modules/search-bar.blade.php
Normal file
46
resources/views/modules/search-bar.blade.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@php
|
||||
$iArgs = [];
|
||||
if(request()->sort_col) {
|
||||
$iArgs['sort_col'] = request()->sort_col;
|
||||
}
|
||||
|
||||
if(request()->search) {
|
||||
$iArgs['search'] = request()->sort_way;
|
||||
}
|
||||
@endphp
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<form id="searchForm" action="/{{ request()->path() }}">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="searchField">{{ $searchFields }}</label>
|
||||
@if(request()->sort_col)
|
||||
<input class="d-none" type="text" name="sort_col" value="{{ request()->sort_col }}">
|
||||
@endif
|
||||
@if(request()->sort_way)
|
||||
<input class="d-none" type="text" name="sort_way" value="{{ request()->sort_way }}">
|
||||
@endif
|
||||
@if(request()->rangefilter)
|
||||
<input class="d-none" type="text" name="rangefilter" value="{{ request()->rangefilter }}">
|
||||
@endif
|
||||
@if(request()->group)
|
||||
<input class="d-none" type="text" name="group" value="{{ request()->group }}">
|
||||
@endif
|
||||
<input type="search" id="searchField" name="search" class="form-control" value="{{ request()->search }}" placeholder="{{ __('Vos mots clés ici...') }}"/>
|
||||
<button type="submit" class="btn btn-primary" data-bs-toggle="tooltip" title="{{ __('Lancer la recherche') }}">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
<button id="searchDelete" type="button" class="btn btn-danger" data-bs-toggle="tooltip" title="{{ __('Supprimer la recherche') }}">
|
||||
<i class="fas fa-backspace"></i>
|
||||
</button>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('searchDelete').addEventListener('click', function (e) {
|
||||
document.getElementById('searchField').value = '';
|
||||
document.getElementById('searchForm').submit();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
89
resources/views/modules/table-col-sorter.blade.php
Normal file
89
resources/views/modules/table-col-sorter.blade.php
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
@php
|
||||
$route = request()->route();
|
||||
$routeName = $route->getName();
|
||||
$rst = !is_null(request()->rst) || !Session::has("$routeName.sorted");
|
||||
$noOrder = !empty($noOrder);
|
||||
$noOrder = $noOrder || (Session::get("$routeName.sort_col") !== 'order' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way")));
|
||||
$noOrder = $noOrder || !empty(request()->search);
|
||||
$ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
|
||||
@endphp
|
||||
<tr>
|
||||
@foreach($cols as $col => $colname)
|
||||
@php
|
||||
$iArgs = ['sort_col' => $col];
|
||||
if(request()->search) {
|
||||
$iArgs['search'] = request()->search;
|
||||
}
|
||||
@endphp
|
||||
{{-- NO Sort for order column --}}
|
||||
@if($col === 'order' or in_array($col, $ignore))
|
||||
@if(!$noOrder or $rst)
|
||||
@if ($col === 'multi_pdf')
|
||||
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
|
||||
<span>{{ $colname }}</span>
|
||||
<a class="btn btn-sm btn-outline-dark"
|
||||
href="{{ route('products.multipdf.show') }}"
|
||||
target="_blank"
|
||||
data-bs="tooltip"
|
||||
title="{{ __('Générer le .pdf de la sélection') }}">
|
||||
<i class="fa fa-print"></i>
|
||||
</a>
|
||||
<a class="btn btn-sm btn-outline-dark"
|
||||
href="{{ route('products.multipdf.destroy') }}"
|
||||
data-bs="tooltip"
|
||||
title="{{ __('Supprimer la sélection') }}">
|
||||
<i class="fa fa-delete-left"></i>
|
||||
</a>
|
||||
</th>
|
||||
@else
|
||||
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
|
||||
<span>{{ $colname }}</span>
|
||||
</th>
|
||||
@endif
|
||||
@endif
|
||||
@continue
|
||||
@endif
|
||||
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
|
||||
<span class="text-nowrap">
|
||||
{{ $colname }}
|
||||
</span>
|
||||
@if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'desc' and session("$routeName.sort_col") === $col))
|
||||
<a class="text-decoration-none"
|
||||
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'asc', 'rst' => null])) }}">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
title="{{ __('Trier :name dans l\'ordre ascendant', ['name' => Str::lower($colname)]) }}"
|
||||
data-bs="tooltip">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
@if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'asc' and session("$routeName.sort_col") === $col))
|
||||
<a class="text-decoration-none"
|
||||
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'desc', 'rst' => null])) }}">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
title="{{ __('Trier :name dans l\'ordre descendant', ['name' => Str::lower($colname)]) }}"
|
||||
data-bs="tooltip">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
@endforeach
|
||||
{{-- Buttons Col --}}
|
||||
<th class="text-end" scope="col">
|
||||
@if($noOrder and !$rst)
|
||||
<a class="btn btn-sm btn-danger"
|
||||
href="{{ request()->fullUrlWithQuery(['sort_col' => null, 'sort_way' => null, 'rst' => true, 'search' => null]) }}"
|
||||
data-bs="tooltip"
|
||||
title="{{ __('Effacer le tri') }}">
|
||||
<i class="fa fa-eraser"></i>
|
||||
</a>
|
||||
@else
|
||||
<span data-bs="tooltip" data-bs-placement="top" title="{{ __('Ici, les flèches sont utilisées pour trier et non pour filtrer') }}">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
15
resources/views/partials/inputs/bigint-foreign-id.blade.php
Normal file
15
resources/views/partials/inputs/bigint-foreign-id.blade.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@if(!empty($label))
|
||||
<label for="{{ $name }}" class="col-form-label"><b>{{ $label }} *</b></label>
|
||||
@endif
|
||||
<select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($label))required @endif>
|
||||
@foreach ($associatedModels as $associatedModel)
|
||||
<option value="{{ $associatedModel->id }}" @if (old($name, $model->{$name} ?? 1) == $associatedModel->id) selected @endif>
|
||||
{{ $associatedModel->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => "{{ $id }}Help",
|
||||
'helper' => $helper
|
||||
])
|
||||
30
resources/views/partials/inputs/int-number.blade.php
Normal file
30
resources/views/partials/inputs/int-number.blade.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
@if(!empty($label))
|
||||
<label for="{{ $id }}" class="col-form-label">
|
||||
<b>{{ $label }} {{ $required ? '*' : '' }}</b>
|
||||
</label>
|
||||
@endif
|
||||
<input
|
||||
id="{{ $id }}"
|
||||
name="{{ $name }}"
|
||||
type="number"
|
||||
value="{{ old($name, $model->{$name} ?? 0) }}"
|
||||
class="form-control"
|
||||
aria-describedby="{{ $id }}Help"
|
||||
step="1"
|
||||
@if(!empty($max))
|
||||
max="{{ $max }}"
|
||||
@else
|
||||
max="{{ !empty($unsigned) ? '4294967295' : '2147483647' }}"
|
||||
@endif
|
||||
@if(isset($min))
|
||||
min="{{ $min }}"
|
||||
@else
|
||||
min="{{ !empty($unsigned) ? '0' : '-2147483648' }}"
|
||||
@endif
|
||||
@if(!empty($required))required @endif
|
||||
>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => '{{ $id }}Help',
|
||||
'helper' => $helper
|
||||
])
|
||||
12
resources/views/partials/inputs/pivot-taggable.blade.php
Normal file
12
resources/views/partials/inputs/pivot-taggable.blade.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
@php
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'value' => old($name, $model->{$name} ?? []),
|
||||
'itemLimit' => $itemLimit,
|
||||
'itemsList' => $itemsList,
|
||||
'placeholder' => $placeholder,
|
||||
'errors' => $errors->getBag('default')->getMessages()
|
||||
];
|
||||
@endphp
|
||||
<div class="belongs-to-many-dropdown" data-json='@json($data)'></div>
|
||||
@include('modules.input-error', ['helper' => $helper, 'inputName' => $name])
|
||||
15
resources/views/partials/inputs/select-enum.blade.php
Normal file
15
resources/views/partials/inputs/select-enum.blade.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@if(!empty($label))
|
||||
<label for="{{ $name }}" class="col-form-label"><b>{{ $label }}@if(!empty($required)) * @endif</b></label>
|
||||
@endif
|
||||
<select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($require))required @endif>
|
||||
@foreach ($associatedModels as $associatedModel)
|
||||
<option value="{{ $associatedModel->value}}" @if (old($name, $model->{$name}->value ?? $value ?? 1) == $associatedModel->value) selected @endif>
|
||||
{{ $associatedModel->label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => "{{ $id }}Help",
|
||||
'helper' => $helper
|
||||
])
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
@php
|
||||
$data = [
|
||||
"name" => $name,
|
||||
"label" => $label ?? "",
|
||||
"value" => $value ?? [],
|
||||
"placeholder" => $placeholder ?? "",
|
||||
"itemsSelected" => $itemsSelected,
|
||||
"itemsList" => $itemsList,
|
||||
"itemLimit" => $itemLimit,
|
||||
"showSpecificItem" => $showSpecificItem ?? null,
|
||||
"errors" => $errors->getBag("default")->getMessages() ?? [],
|
||||
'helper' => $helper ?? "",
|
||||
'simpleComponent' => $simpleComponent ?? false
|
||||
];
|
||||
@endphp
|
||||
<div class="select-multiple-enum" data-json='@json($data)'></div>
|
||||
27
resources/views/partials/inputs/varchar-multiline.blade.php
Normal file
27
resources/views/partials/inputs/varchar-multiline.blade.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{{-- $id : id de l'input --}}
|
||||
{{-- $label : Libellé de l'input --}}
|
||||
{{-- $name : name de l'input --}}
|
||||
{{-- $model : instance du model --}}
|
||||
{{-- $required : l'input est obligatoire ? (true/false) --}}
|
||||
{{-- $placeholder : texte visible dans l'input lorsque son contenu est vide --}}
|
||||
{{-- $helper : texte visible en dessous de l'input --}}
|
||||
<label for="{{ $id }}" class="col-form-label">
|
||||
<b>{{ $label }} {{ $required ? '*' : '' }}</b>
|
||||
</label>
|
||||
@php
|
||||
$data = [
|
||||
'id' => $id,
|
||||
'class' => 'form-control',
|
||||
'name' => $name,
|
||||
'placeholder' => $placeholder,
|
||||
'ariaDescribedby' => "{$id}Help",
|
||||
'required' => $required,
|
||||
'value' => old($name, $model->{$name} ?? '')
|
||||
];
|
||||
@endphp
|
||||
<div id="input-text-auto" data-json='@json($data)'></div>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => "{$id}Help",
|
||||
'helper' => $helper
|
||||
])
|
||||
15
resources/views/partials/inputs/varchar-picture.blade.php
Normal file
15
resources/views/partials/inputs/varchar-picture.blade.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@php
|
||||
$data = [
|
||||
"id" => $id,
|
||||
"name" => $name,
|
||||
"helper" => $helper,
|
||||
"width" => $width,
|
||||
"height" => $height,
|
||||
"value" => $model->{$name} ?? "",
|
||||
"preview" => $preview ?? false,
|
||||
"browseEvent" => $browseEvent ?? false,
|
||||
"required" => $required ?? false,
|
||||
];
|
||||
@endphp
|
||||
<div class="image-input" data-json='@json($data)'></div>
|
||||
@include("modules.input-error", ["inputName" => $name, "helper" => null])
|
||||
19
resources/views/partials/inputs/varchar.blade.php
Normal file
19
resources/views/partials/inputs/varchar.blade.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
@if(!empty($label))
|
||||
<label for="{{ $id }}" class="col-form-label">
|
||||
<b>{{ $label }} {{ $required ? '*' : '' }}</b>
|
||||
</label>
|
||||
@endif
|
||||
@if(!empty($hasWordCounter ?? false))
|
||||
<div class="word-counter" data-json='@json(['id' => $id])'></div>
|
||||
@endif
|
||||
<input name="{{ $name }}" type="text" value="{{ old($name, $model->{$name} ?? '') }}" class="form-control need-word-counter @error($name) is-invalid @enderror"
|
||||
id="{{ $id }}"
|
||||
aria-describedby="{{ $id }}Help"
|
||||
placeholder="{{ $placeholder ?? __('Un nom beau et explicite') }}"
|
||||
@if(!empty($required))required @endif
|
||||
>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => '{{ $id }}Help',
|
||||
'helper' => $helper
|
||||
])
|
||||
Loading…
Add table
Reference in a new issue