Compare commits
42 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa2579bb58 | ||
|
|
fa19add314 | ||
|
|
d9834acbe0 | ||
|
|
aca6082fc3 | ||
|
|
6fc7ce4144 | ||
|
|
c5b0154a78 | ||
|
|
d9855a6aa7 | ||
|
|
b5851d75b4 | ||
|
|
919550c1f2 | ||
|
|
ade271b88b | ||
|
|
d67440770a | ||
|
|
39ff3e0fd8 | ||
|
|
202fcf73c9 | ||
|
|
706fb14dff | ||
|
|
d0b5805676 | ||
|
|
34d919ee69 | ||
|
|
0e504be45f | ||
|
|
42f3f08172 | ||
|
|
597f5f91cf | ||
|
|
eeea8014d0 | ||
|
|
051cb55324 | ||
|
|
b49d34ee07 | ||
|
|
8be12b6e9e | ||
|
|
39631fb272 | ||
|
|
cfe84bb9f8 | ||
|
|
bc0c018995 | ||
|
|
7be9395ae4 | ||
|
|
ded2a8da88 | ||
|
|
b569e4ae43 | ||
|
|
b08b0d49cc | ||
|
|
adf5717110 | ||
|
|
0121ee8bdb | ||
|
|
5f372c71cd | ||
|
|
ffe16335e5 | ||
|
|
14cc8dd5b3 | ||
|
|
ebc8e37b28 | ||
|
|
3f3ab0df5e | ||
|
|
1342a97f9c | ||
|
|
a60e562ce8 | ||
|
|
5ace87520e | ||
|
|
ea9924faa1 | ||
|
|
ddc9b57c5f |
35 changed files with 3539 additions and 3484 deletions
|
|
@ -2,6 +2,7 @@ FROM composer:2.8 AS vendor
|
|||
|
||||
ARG GITLAB_USER
|
||||
ARG GITLAB_PASSWORD
|
||||
ARG PHP_8_5_TAG=latest
|
||||
|
||||
COPY database/ database/
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ RUN npm config set @ldc-web:registry https://lab.s-web.fr/api/v4/packages/npm/
|
|||
RUN npm config set -- '//lab.s-web.fr/api/v4/packages/npm/:_authToken' "${GITLAB_PASSWORD}"
|
||||
RUN npm ci && npm run prod
|
||||
|
||||
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.3:170625-101047
|
||||
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/uwil-production-8.5:${PHP_8_5_TAG}
|
||||
|
||||
ARG USER=www-data
|
||||
|
||||
|
|
|
|||
23
RGPD.md
23
RGPD.md
|
|
@ -1,23 +0,0 @@
|
|||
# RGPD
|
||||
|
||||
## Site
|
||||
|
||||
### En base de données
|
||||
|
||||
| Table | Colonne | Contenu | Utilisation |
|
||||
| --- | --- | --- | --- |
|
||||
| app_users | email | Identifiant de l'utilisateur (appli) | Connexion à l'appli |
|
||||
| app_users | lastname | Nom de l'utilisateur (appli) | Affichage sur l'appli |
|
||||
| app_users | firstname | Prénom de l'utilisateur (appli) | Affichage sur l'appli |
|
||||
| --- | --- | --- | --- |
|
||||
| contacts | email | Adresse mail du client | Recontacter si besoin |
|
||||
| contacts | lastname | Nom du client | Identifier la personne |
|
||||
| contacts | firstname | Prénom du client | Identifier la personne |
|
||||
| contacts | phone | Téléphone du client | Recontacter si besoin |
|
||||
| contacts | data | Tableau d'informations sur la rencontre et les intérêts | Analyser et répondre au besoin |
|
||||
| contacts | notes | Contenu en plus de data | Infos plus précises sur le client |
|
||||
| contacts | visits | Tableau de dates et de notes | Suivi de la rencontre avec le client |
|
||||
| --- | --- | --- | --- |
|
||||
| users | first_name | Prénom | Affichage à différents endroits du BO |
|
||||
| users | last_name | Nom | Affichage à différents endroits du BO |
|
||||
| users | email | Adresse mail | Identifiant, sert à la connexion au BO |
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum AppUserRolesEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Documents;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum LangEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Documents;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum TypeEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Formularies;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum InputStatusEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use App\Lib\Inputs\InputRadio;
|
|||
use App\Lib\Inputs\InputSelect;
|
||||
use App\Lib\Inputs\InputSelectMultiple;
|
||||
use App\Lib\Inputs\InputText;
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum InputTypeEnum: int
|
||||
{
|
||||
|
|
|
|||
21
app/Enums/ItemsPerPaginationEnum.php
Normal file
21
app/Enums/ItemsPerPaginationEnum.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
/**
|
||||
* Defines the available pagination page size options.
|
||||
*/
|
||||
enum ItemsPerPaginationEnum: int
|
||||
{
|
||||
use BaseEnum;
|
||||
|
||||
case five = 5;
|
||||
case twelve = 12;
|
||||
case twentyfive = 25;
|
||||
case fifty = 50;
|
||||
case onehundred = 100;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum SettingTypesEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum UserRolesEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class AppUserController extends Controller
|
|||
public function create(AppUser $app_user): \Illuminate\View\View
|
||||
{
|
||||
$directories = Directory::renderDirectories(
|
||||
Directory::query()->where('needAuthorization', 1)->orderBy('name', 'ASC')->get()
|
||||
Directory::query()->where('needAuthorization', 1)->orderBy('name', 'asc')->get()
|
||||
);
|
||||
|
||||
return view('bo.pages.app_users.create', [
|
||||
|
|
@ -119,7 +119,7 @@ class AppUserController extends Controller
|
|||
public function edit(AppUser $app_user): \Illuminate\View\View
|
||||
{
|
||||
$directories = Directory::renderDirectories(
|
||||
Directory::query()->where('needAuthorization', 1)->orderBy('name', 'ASC')->get()
|
||||
Directory::query()->where('needAuthorization', 1)->orderBy('name', 'asc')->get()
|
||||
);
|
||||
// @phpstan-ignore assign.propertyReadOnly
|
||||
$app_user->directories = Directory::renderDirectories($app_user->directories);
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ class DirectoriesController extends Controller
|
|||
return Directory::query()
|
||||
->where('tenant_id', \tenant()->getKey())
|
||||
->withCount('documents')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('order', 'asc')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class DocumentController extends Controller
|
|||
public function index(Request $request): \Illuminate\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = Document::query();
|
||||
$query = Document::query()->with(['directory', 'parentDocument']);
|
||||
$tags = Tag::get();
|
||||
|
||||
if ($request->search) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ class SettingController extends Controller
|
|||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$directories = Directory::renderDirectories(Directory::query()->whereNull('directory_id')->get());
|
||||
$directories = Directory::renderDirectories(
|
||||
Directory::query()->whereNull('directory_id')->with('parent')->get(),
|
||||
);
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = Setting::query();
|
||||
|
|
@ -57,7 +59,9 @@ class SettingController extends Controller
|
|||
*/
|
||||
public function edit(Setting $setting): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$directories = Directory::renderDirectories(Directory::query()->whereNull('directory_id')->get());
|
||||
$directories = Directory::renderDirectories(
|
||||
Directory::query()->whereNull('directory_id')->with('parent')->get(),
|
||||
);
|
||||
|
||||
return view('bo.pages.settings.edit', ['settingModel' => $setting, 'directories' => $directories]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class UserController extends Controller
|
|||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $userModels */
|
||||
$userModels = User::query();
|
||||
$userModels = User::query()->with('tenants');
|
||||
|
||||
/** @var string $search Search field */
|
||||
$search = $request->search;
|
||||
|
|
@ -69,7 +69,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function create(User $user): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$tenants = Tenant::query()->orderBy('name', 'ASC')->get();
|
||||
$tenants = Tenant::query()->orderBy('name', 'asc')->get();
|
||||
return view('bo.pages.users.create', ['userModel' => $user, 'tenants' => $tenants]);
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function edit(User $user): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$tenants = Tenant::query()->orderBy('name', 'ASC')->get();
|
||||
$tenants = Tenant::query()->orderBy('name', 'asc')->get();
|
||||
return view('bo.pages.users.edit', ['userModel' => $user, 'tenants' => $tenants]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\ItemsPerPaginationEnum;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
|
|
@ -11,7 +12,6 @@ use Illuminate\Support\Facades\Cache;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
use Uwil\LaravelCommon\Enums\ItemsPerPaginationEnum;
|
||||
use Uwil\LaravelCommon\Helpers\ToolboxHelper;
|
||||
|
||||
class Controller extends BaseController
|
||||
|
|
@ -124,15 +124,15 @@ class Controller extends BaseController
|
|||
);
|
||||
}
|
||||
} elseif (Schema::hasColumn($table, 'order')) {
|
||||
$query = $query->orderBy('order', 'ASC');
|
||||
$query = $query->orderBy('order', 'asc');
|
||||
Session::put("$rName.sort_col", 'order');
|
||||
Session::put("$rName.sort_way", 'asc');
|
||||
} elseif (Schema::hasColumn($table, 'updated_at')) {
|
||||
$query = $query->orderBy('updated_at', 'DESC');
|
||||
$query = $query->orderBy('updated_at', 'desc');
|
||||
Session::put("$rName.sort_col", 'updated_at');
|
||||
Session::put("$rName.sort_way", 'desc');
|
||||
} elseif (Schema::hasColumn($table, 'created_at')) {
|
||||
$query = $query->orderBy('created_at', 'DESC');
|
||||
$query = $query->orderBy('created_at', 'desc');
|
||||
Session::put("$rName.sort_col", 'created_at');
|
||||
Session::put("$rName.sort_way", 'desc');
|
||||
}
|
||||
|
|
@ -142,8 +142,8 @@ class Controller extends BaseController
|
|||
/**
|
||||
* Customize pagination with cache or config (default).
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \Uwil\LaravelCommon\Enums\ItemsPerPaginationEnum|null $pagination
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \App\Enums\ItemsPerPaginationEnum|null $pagination
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
*/
|
||||
protected function paginate(
|
||||
|
|
@ -156,7 +156,7 @@ class Controller extends BaseController
|
|||
$pagination = ToolboxHelper::getValidatedEnum(
|
||||
Cache::get($cacheKey, $pagination->value()),
|
||||
'pagination',
|
||||
'\Uwil\LaravelCommon\Enums\ItemsPerPaginationEnum',
|
||||
'\App\Enums\ItemsPerPaginationEnum',
|
||||
);
|
||||
if (Cache::get($cacheKey) !== $pagination) {
|
||||
Cache::put($cacheKey, $pagination);
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
namespace App\Http\Requests\Bo\Settings;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Uwil\LaravelCommon\Traits\Requests\HasPicture;
|
||||
|
||||
class UpdateSettingRequest extends FormRequest
|
||||
{
|
||||
|
|
@ -68,7 +68,8 @@ class UpdateSettingRequest extends FormRequest
|
|||
$this->key === "Button3"
|
||||
) {
|
||||
$buttonsNullable = 0;
|
||||
$buttons = Setting::where('key', 'Button1')
|
||||
$buttons = Setting::query()
|
||||
->where('key', 'Button1')
|
||||
->orWhere('key', 'Button2')
|
||||
->orWhere('key', 'Button3')
|
||||
->get();
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class Directory extends Model
|
|||
public static function getChildrenDirectories(): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Collection $directories */
|
||||
$directories = Directory::query()->orderBy('order', 'ASC')->get();
|
||||
$directories = Directory::query()->orderBy('order', 'asc')->get();
|
||||
// @phpstan-ignore argument.type
|
||||
$directoriesFiltered = $directories->filter(function (Directory $directory) {
|
||||
if ($directory->children->count() === 0) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Uwil\LaravelCommon\Helpers\FileHelper;
|
|||
/**
|
||||
* @property integer $id Settings id.
|
||||
* @property string $key Settings key.
|
||||
* @property string $value Settings value.
|
||||
* @property string|null $value Settings value.
|
||||
* @property string|null $tenant_id Associated tenant.
|
||||
* @property \App\Enums\SettingTypesEnum $type Settings type.
|
||||
* @property-read \Carbon\Carbon $created_at Created date.
|
||||
|
|
|
|||
|
|
@ -44,6 +44,18 @@ class User extends Authenticatable
|
|||
'role' => UserRolesEnum::class
|
||||
];
|
||||
|
||||
// * METHODS.
|
||||
|
||||
/**
|
||||
* Get the password for the user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthPassword(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ViewServiceProvider extends ServiceProvider
|
|||
if (!app()->runningInConsole()) {
|
||||
// * FORCE BOOTSTRAP PAGINATOR (or custom if in front)
|
||||
// Early boot, request wont be filled as expected.
|
||||
if (collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo') {
|
||||
if (in_array('bo', explode('/', \request()->getPathInfo()))) {
|
||||
Paginator::defaultview('bo.modules.pagination');
|
||||
} else {
|
||||
Paginator::useBootstrap();
|
||||
|
|
|
|||
|
|
@ -1,263 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits\Enums;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait BaseEnum
|
||||
{
|
||||
// * GENERIC METHODS
|
||||
|
||||
/**
|
||||
* Get enum value.
|
||||
*
|
||||
* @return string|integer
|
||||
*/
|
||||
public function value(): string|int
|
||||
{
|
||||
return self::toValues()[$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum label.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function label(): string
|
||||
{
|
||||
return self::toLabels()[$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function name(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
// * STATIC FETCH METHODS
|
||||
|
||||
/**
|
||||
* Get enum labels.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function toLabels(): array
|
||||
{
|
||||
if (empty(self::getCache('labels'))) {
|
||||
$labels = self::getLabelsConstant();
|
||||
self::setCache('labels', \collect(self::cases())
|
||||
->mapWithKeys(function ($enum) use ($labels) {
|
||||
if (!\is_null($labels) and !isset($labels[$enum->name])) {
|
||||
throw new \Error('Missing definition label ' . self::class . " for {$enum->name}");
|
||||
}
|
||||
return [$enum->name => \trans(
|
||||
!\is_null($labels) ? $labels[$enum->name] : Str::ucfirst($enum->name)
|
||||
)];
|
||||
})->all());
|
||||
}
|
||||
return self::getCache('labels');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum values.
|
||||
*
|
||||
* @return array<integer|string>
|
||||
*/
|
||||
public static function toValues(): array
|
||||
{
|
||||
if (empty(self::getCache('values'))) {
|
||||
self::setCache('values', \collect(self::cases())
|
||||
->mapWithKeys(fn($enum) => [$enum->name => $enum->value])->all());
|
||||
}
|
||||
return self::getCache('values');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enums.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function all(): array
|
||||
{
|
||||
return self::cases();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enums.
|
||||
*
|
||||
* @return array<self>
|
||||
*/
|
||||
public static function toArray(): array
|
||||
{
|
||||
if (empty(self::getCache('enums'))) {
|
||||
$definitions = self::getCustomDefinitions();
|
||||
self::setCache('enums', \collect(self::cases())
|
||||
->mapWithKeys(function ($enum) use ($definitions) {
|
||||
$baseArray = [
|
||||
'name' => $enum->name,
|
||||
'label' => $enum->label(),
|
||||
'value' => $enum->value,
|
||||
];
|
||||
foreach ($definitions as $index => $elements) {
|
||||
$index = Str::lower(Str::singular($index));
|
||||
if (!isset($elements[$enum->name])) {
|
||||
throw new \Error("Missing definition {$index} " . self::class . " for {$enum->name}");
|
||||
}
|
||||
$baseArray[$index] = $elements[$enum->name];
|
||||
}
|
||||
return [$enum->name => (object) $baseArray];
|
||||
})->all());
|
||||
}
|
||||
return self::getCache('enums');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch enum using value.
|
||||
*
|
||||
* @param self|integer|string $value
|
||||
* @param string $field
|
||||
* @return self|null
|
||||
*/
|
||||
public static function make(self|int|string $value, string $field = 'value'): self|null
|
||||
{
|
||||
if ($field === "label") {
|
||||
$enumLabels = array_change_key_case(array_flip(self::toLabels()), CASE_LOWER);
|
||||
$value = (isset($enumLabels[strtolower($value)])) ? $enumLabels[strtolower($value)] : false;
|
||||
$field = 'name';
|
||||
}
|
||||
return !\is_object($value) ?
|
||||
\collect(self::cases())->keyBy($field)->get($value) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if 2 enum are equals.
|
||||
*
|
||||
* @param object ...$others
|
||||
* @return boolean
|
||||
* @throws \Error If provided element are not enums that extends BaseEnum.
|
||||
*/
|
||||
public function equals(object ...$others): bool
|
||||
{
|
||||
foreach ($others as $other) {
|
||||
if (!\in_array(BaseEnum::class, \class_uses_recursive($other))) {
|
||||
throw new \Error(__METHOD__ .
|
||||
' requires $enum to use ' . BaseEnum::class);
|
||||
}
|
||||
if (
|
||||
get_class($this) === get_class($other)
|
||||
&& $this->value === $other->value
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to json.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
||||
// * CACHE
|
||||
|
||||
/**
|
||||
* Get cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @return array
|
||||
*/
|
||||
private static function getCache(string $index): array
|
||||
{
|
||||
self::initCache();
|
||||
if (!isset($GLOBALS[self::class]['props'][$index])) {
|
||||
$GLOBALS[self::class]['props'][$index] = [];
|
||||
}
|
||||
return $GLOBALS[self::class]['props'][$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @param array $items
|
||||
* @return void
|
||||
*/
|
||||
private static function setCache(string $index, array $items): void
|
||||
{
|
||||
self::initCache();
|
||||
if (!isset($GLOBALS[self::class]['props'][$index])) {
|
||||
$GLOBALS[self::class]['props'][$index] = [];
|
||||
}
|
||||
$GLOBALS[self::class]['props'][$index] = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init cache if needed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function initCache(): void
|
||||
{
|
||||
if (!isset($GLOBALS[self::class])) {
|
||||
$GLOBALS[self::class] = [
|
||||
'props' => [
|
||||
'enums' => [],
|
||||
'values' => [],
|
||||
'labels' => []
|
||||
],
|
||||
'customProps' => null
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// * PRIVATE
|
||||
|
||||
/**
|
||||
* Fetch the LABELS constant if exists.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private static function getLabelsConstant(): array|null
|
||||
{
|
||||
$class_name = self::class;
|
||||
try {
|
||||
$constant_reflex = new \ReflectionClassConstant($class_name, 'LABELS');
|
||||
return $constant_reflex->getValue();
|
||||
} catch (\ReflectionException $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom constants.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getCustomDefinitions(): array
|
||||
{
|
||||
// ? Has custom props in cache ?
|
||||
if (!isset($GLOBALS[self::class]) or \is_null($GLOBALS[self::class]['customProps'])) {
|
||||
$names = \collect(self::cases())->keyBy('name');
|
||||
|
||||
$GLOBALS[self::class]['customProps'] = \collect((new \ReflectionClass(self::class))->getConstants())
|
||||
->filter(function (mixed $constant, string $key) use ($names) {
|
||||
if ($key === 'LABELS' or !\is_array($constant)) {
|
||||
return false;
|
||||
}
|
||||
return \collect($constant)->keys()
|
||||
->filter(fn(string $name) => $names->has($name))->count();
|
||||
})->all();
|
||||
}
|
||||
return $GLOBALS[self::class]['customProps'];
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ trait IsRelatedToTenant
|
|||
* @return \Closure
|
||||
*/
|
||||
public static function whereTenantQuery(
|
||||
\App\Models\Tenant|\Stancl\Tenancy\Contracts\Tenant $tenantModel = null
|
||||
\App\Models\Tenant|\Stancl\Tenancy\Contracts\Tenant|null $tenantModel = null
|
||||
): \Closure {
|
||||
return function ($query) use ($tenantModel) {
|
||||
$tenant = $tenantModel ?: (!\is_null(\tenant()) ? \tenant() : Tenant::first());
|
||||
|
|
|
|||
|
|
@ -1,189 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits\Requests;
|
||||
|
||||
use Uwil\LaravelCommon\Helpers\ToolboxHelper;
|
||||
|
||||
/**
|
||||
* ! This assumes file system is using local storage
|
||||
*/
|
||||
trait HasPicture
|
||||
{
|
||||
/**
|
||||
* Minimum width
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $minWidth = 400;
|
||||
|
||||
/**
|
||||
* Maximum width
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $maxWidth = 1800;
|
||||
|
||||
/**
|
||||
* Minimum height
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $minHeight = 300;
|
||||
|
||||
/**
|
||||
* Maximum height
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $maxHeight = 1800;
|
||||
|
||||
/**
|
||||
* Image rules
|
||||
*
|
||||
* @param string $name
|
||||
* @param integer|null $minWidth
|
||||
* @param integer|null $minHeight
|
||||
* @param integer|null $maxWidth
|
||||
* @param integer|null $maxHeight
|
||||
* @param boolean $nullable
|
||||
* @param integer|null $size
|
||||
* @param string|null $requiredWith
|
||||
* @param string|null $requiredWithout
|
||||
* @return array
|
||||
*/
|
||||
public function pictureRules(
|
||||
string $name = 'picture',
|
||||
?int $minWidth = null,
|
||||
?int $minHeight = null,
|
||||
?int $maxWidth = null,
|
||||
?int $maxHeight = null,
|
||||
bool $nullable = false,
|
||||
?int $size = null,
|
||||
?string $requiredWith = null,
|
||||
?string $requiredWithout = null,
|
||||
): array {
|
||||
$dimensions = (object) [
|
||||
'minWidth' => $minWidth ?? $this->minWidth,
|
||||
'minHeight' => $minHeight ?? $this->minHeight,
|
||||
'maxWidth' => $maxWidth ?? $this->maxWidth,
|
||||
'maxHeight' => $maxHeight ?? $this->maxHeight
|
||||
];
|
||||
return [
|
||||
$name => [
|
||||
!$nullable ? 'required' : 'nullable',
|
||||
(strlen($requiredWith)) ? 'required_with:' . $requiredWith : '',
|
||||
(strlen($requiredWithout)) ? 'required_without:' . $requiredWithout : '',
|
||||
($size) ? 'max:' . $size : '',
|
||||
function (string $attribute, $value, callable $fail) use ($dimensions) {
|
||||
ToolboxHelper::validatePicture($attribute, $value, $fail, $dimensions);
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Images rules
|
||||
*
|
||||
* @param string $name
|
||||
* @param integer|null $minWidth
|
||||
* @param integer|null $minHeight
|
||||
* @param integer|null $maxWidth
|
||||
* @param integer|null $maxHeight
|
||||
* @param integer $limitMin
|
||||
* @param integer $limitMax
|
||||
* @param boolean $nullable
|
||||
* @return array
|
||||
*/
|
||||
public function picturesRules(
|
||||
string $name = 'pictures',
|
||||
?int $minWidth = null,
|
||||
?int $minHeight = null,
|
||||
?int $maxWidth = null,
|
||||
?int $maxHeight = null,
|
||||
int $limitMin = 1,
|
||||
int $limitMax = 5,
|
||||
bool $nullable = false
|
||||
): array {
|
||||
$sizes = (object) [
|
||||
'minWidth' => $minWidth ?? $this->minWidth,
|
||||
'minHeight' => $minHeight ?? $this->minHeight,
|
||||
'maxWidth' => $maxWidth ?? $this->maxWidth,
|
||||
'maxHeight' => $maxHeight ?? $this->maxHeight,
|
||||
];
|
||||
return [
|
||||
$name => [!$nullable ? 'required' : 'nullable', 'array', "between:{$limitMin},{$limitMax}"],
|
||||
"{$name}Validate" => "required_with:{$name}|array",
|
||||
"{$name}Validate.*" => [
|
||||
'required',
|
||||
function (string $attribute, $value, callable $fail) use ($sizes) {
|
||||
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges products pictures fields with request data
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
protected function mergePicture(string $name = 'picture'): void
|
||||
{
|
||||
$picturePath = $this->{$name};
|
||||
if (is_string($picturePath)) {
|
||||
$this->merge(["{$name}Validate" => []]);
|
||||
// ! Empty picture.
|
||||
if ($picturePath === 'false') {
|
||||
// * Empty picture and exit
|
||||
$this->merge([$name => []]);
|
||||
return;
|
||||
}
|
||||
$decodedPath = \urldecode($picturePath);
|
||||
$this->merge([
|
||||
"{$name}Validate" => array_merge(
|
||||
$this->{"{$name}Validate"},
|
||||
[\public_path(ltrim($decodedPath, '/'))]
|
||||
)
|
||||
]);
|
||||
$changedPicture = ltrim($decodedPath, '/');
|
||||
$this->merge([
|
||||
$name => $changedPicture
|
||||
]);
|
||||
} //end if
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges products pictures fields with request data
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
protected function mergePictures(string $name = 'pictures'): void
|
||||
{
|
||||
$pictures = $this->{$name};
|
||||
if (is_array($pictures)) {
|
||||
$this->merge(["{$name}Validate" => []]);
|
||||
foreach ($pictures as $key => $picturePath) {
|
||||
// ! Empty picture.
|
||||
if ($picturePath === 'false') {
|
||||
// * Empty picture and exit
|
||||
$this->merge([$name => []]);
|
||||
return;
|
||||
}
|
||||
$decodedPath = \urldecode($picturePath);
|
||||
$this->merge([
|
||||
"{$name}Validate" => array_merge(
|
||||
$this->{"{$name}Validate"},
|
||||
[\public_path(ltrim($decodedPath, '/'))]
|
||||
)
|
||||
]);
|
||||
$changedPicture = $this->{$name};
|
||||
$changedPicture[$key] = ltrim($decodedPath, '/');
|
||||
$this->merge([
|
||||
$name => $changedPicture
|
||||
]);
|
||||
}
|
||||
} //end if
|
||||
}
|
||||
}
|
||||
|
|
@ -8,35 +8,35 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.3",
|
||||
"24slides/laravel-saml2": "^2.4",
|
||||
"diglactic/laravel-breadcrumbs": "^10.0",
|
||||
"php": "^8.5",
|
||||
"scaler-tech/laravel-saml2": "^2.5",
|
||||
"diglactic/laravel-breadcrumbs": "^10.1",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"google/cloud-vision": "^0.25.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/image-resizer": "^3.1.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10",
|
||||
"kwaadpepper/image-resizer": "^4.0.0",
|
||||
"laravel/framework": "^13.0",
|
||||
"laravel/tinker": "^3.0",
|
||||
"laravel/ui": "^4.0",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"maatwebsite/excel": "^4.0",
|
||||
"mews/purifier": "^3.3",
|
||||
"pion/laravel-chunk-upload": "^1.5",
|
||||
"sentry/sentry-laravel": "^4.3",
|
||||
"stancl/tenancy": "^3.9",
|
||||
"usmanhalalit/laracsv": "^2.0",
|
||||
"uwil/admin-secure-laravel": "^5.0",
|
||||
"uwil/k8s-laravel": "^2.0",
|
||||
"uwil/laravel-common": "^3.1"
|
||||
"uwil/laravel-k8s": "^4.0",
|
||||
"uwil/laravel-common": "4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"kitloong/laravel-migrations-generator": "^7.1",
|
||||
"larastan/larastan": "^3.4",
|
||||
"larastan/larastan": "^3.10",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3",
|
||||
"slevomat/coding-standard": "^8.17",
|
||||
"phpunit/phpunit": "^12.5.12",
|
||||
"slevomat/coding-standard": "^8.29",
|
||||
"spatie/laravel-ignition": "^2.9"
|
||||
},
|
||||
"repositories": [
|
||||
|
|
|
|||
4233
composer.lock
generated
4233
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -169,7 +169,6 @@ return [
|
|||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
Uwil\K8S\Laravel\K8SServiceProvider::class,
|
||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@ spec:
|
|||
imagePullSecrets:
|
||||
- name: docker-registry-credentials
|
||||
securityContext:
|
||||
runAsUser: 33
|
||||
runAsGroup: 33
|
||||
fsGroup: 33
|
||||
runAsUser: 82
|
||||
runAsGroup: 82
|
||||
fsGroup: 82
|
||||
fsGroupChangePolicy: "OnRootMismatch"
|
||||
volumes:
|
||||
- name: storage
|
||||
|
|
@ -191,8 +191,8 @@ spec:
|
|||
persistentVolumeClaim:
|
||||
claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage
|
||||
securityContext:
|
||||
runAsUser: 33
|
||||
runAsGroup: 33
|
||||
fsGroup: 33
|
||||
runAsUser: 82
|
||||
runAsGroup: 82
|
||||
fsGroup: 82
|
||||
fsGroupChangePolicy: "OnRootMismatch"
|
||||
restartPolicy: OnFailure
|
||||
|
|
|
|||
2156
package-lock.json
generated
2156
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -42,6 +42,7 @@
|
|||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"laravel-vite-plugin": "^0.8.1",
|
||||
"meow": "^9.0.0",
|
||||
"postcss-discard-comments": "^6.0.2",
|
||||
"resolve-url-loader": "^5.0.0",
|
||||
"resumablejs": "^1.1.0",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<button
|
||||
v-if="intDisplay[item.id]"
|
||||
@click="displayList($event, item.id)"
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
class="btn btn-sm btn-outline-dark h-auto"
|
||||
:title="trans.methods.__('Dérouler la liste')"
|
||||
data-bs="tooltip"
|
||||
>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
<button
|
||||
v-else
|
||||
@click="displayList($event, item.id)"
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
class="btn btn-sm btn-outline-dark h-auto"
|
||||
:title="trans.methods.__('Rouler la liste')"
|
||||
data-bs="tooltip"
|
||||
>
|
||||
|
|
@ -200,10 +200,8 @@ function recursiveDir(list: DirectoryObject[], parent: number | null = null) {
|
|||
|
||||
/** Check depth before the move. */
|
||||
function beforeMove({
|
||||
dragItem,
|
||||
pathTo,
|
||||
}: {
|
||||
dragItem: DirectoryObject;
|
||||
pathTo: number[];
|
||||
}) {
|
||||
if (pathTo.length == 4) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<nav class="pagination-custom d-flex justify-content-between align-items-center">
|
||||
{{-- SELECT ITEMS PER PAGE --}}
|
||||
@if ($paginator->total() > \Uwil\LaravelCommon\Enums\ItemsPerPaginationEnum::five->value())
|
||||
@if ($paginator->total() > \App\Enums\ItemsPerPaginationEnum::five->value())
|
||||
<div class="dropup-center dropup d-flex justify-content-center align-items-center input-group w-fit">
|
||||
<span class="btn-md input-group-text" data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
title="{{ __('crud.pagination.paginate_list') }}">
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
{{ Cache::get('pagination.' .Str::slug(request()->route()->getName())) }}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@foreach (\Uwil\LaravelCommon\Enums\ItemsPerPaginationEnum::toArray() as $itemsPerPaginationEnum)
|
||||
@foreach (\App\Enums\ItemsPerPaginationEnum::toArray() as $itemsPerPaginationEnum)
|
||||
<li>
|
||||
<a class="dropdown-item text-center"
|
||||
href="{{ request()->fullUrlWithQuery(['pagination' => $itemsPerPaginationEnum->value]) }}">
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ $ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
|
|||
<a class="text-decoration-none ms-1"
|
||||
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'asc', 'rst' => null])) }}">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
class="btn btn-sm btn-outline-dark h-auto"
|
||||
title="{{ __('Trier :name dans l\'ordre croissant', ['name' => Str::lower($colname)]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
|
|
@ -45,7 +45,7 @@ $ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
|
|||
<a class="text-decoration-none ms-1"
|
||||
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'desc', 'rst' => null])) }}">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
class="btn btn-sm btn-outline-dark h-auto"
|
||||
title="{{ __('Trier :name dans l\'ordre décroissant', ['name' => Str::lower($colname)]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
</td>
|
||||
<td class="text-center align-middle">
|
||||
<a href="{{ route('bo.directories.edit', ['tenant' => \tenant(), 'directory' => $documentModel->directory_id]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark"
|
||||
<button class="btn btn-sm btn-outline-dark h-auto"
|
||||
title="{{ __('Accéder au dossier associé') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
{{ $documentModel->directory->name['fr'] }}
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<td class="text-center align-middle">
|
||||
@if(!is_null($documentModel->document_id))
|
||||
<a href="{{ route('bo.documents.edit', ['tenant' => \tenant(), 'document' => $documentModel->document_id]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark"
|
||||
<button class="btn btn-sm btn-outline-dark h-auto"
|
||||
title="{{ __('Accéder au document associé') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
{{ $documentModel->parentDocument->title }}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
@case(\App\Enums\SettingTypesEnum::directory)
|
||||
@if ($settingModel->value != null)
|
||||
<a href="{{ route('bo.directories.edit', ['tenant' => \tenant(), 'directory' => $settingModel]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark"
|
||||
<button class="btn btn-sm btn-outline-dark h-auto"
|
||||
title="{{ __('Accéder au dossier associé') }}" data-bs-toggle="tooltip">
|
||||
@foreach ($directories as $directory)
|
||||
@if ($directory->id == $settingModel->value)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue