Fixed missing validations, some wording, SearchBelongsToDropdownComponent old values
This commit is contained in:
parent
0633d6ebef
commit
c16871abb0
16 changed files with 31 additions and 39 deletions
|
|
@ -156,14 +156,14 @@ class InvoiceController extends Controller
|
|||
->route('bo.invoices.edit', $invoice)
|
||||
->with('success', __(
|
||||
'crud.messages.has_been_updated',
|
||||
['model' => Str::singular(__('models.classes.invoices'))]
|
||||
['model' => __('models.classes.invoices')]
|
||||
));
|
||||
} //end if
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', __(
|
||||
'crud.messages.cannot_be_updated',
|
||||
['model' => Str::singular(__('models.classes.invoices'))]
|
||||
['model' => __('models.classes.invoices')]
|
||||
));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class StoreBrandRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'name' => 'required|string|min:3|max:255',
|
||||
'sites' => 'nullable|array',
|
||||
'sites.*.id' => 'required|exists:sites,id'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ class StoreInformationRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string|max:255',
|
||||
'message' => 'required|string|max:255',
|
||||
'title' => 'required|string|min:3|max:255',
|
||||
'message' => 'required|string|min:3|max:255',
|
||||
'type' => [
|
||||
'required',
|
||||
Rule::in(collect(InfoColorsEnum::cases())->pluck('value')->all()),
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ class StorePackageRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'amount' => 'required|numeric|regex:/^\d+(\.\d{1,2})?$/',
|
||||
'name' => 'required|string|min:3|max:255',
|
||||
'amount' => 'required|numeric|min:0|regex:/^\d+(\.\d{1,2})?$/',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
namespace App\Http\Requests\Bo\TicketTypes;
|
||||
|
||||
use App\Enums\Tickets\TicketTypeEnum;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Validation\Rules\Enum;
|
||||
|
||||
class UpdateTicketTypeRequest extends FormRequest
|
||||
{
|
||||
|
|
@ -27,7 +25,6 @@ class UpdateTicketTypeRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => ['required', new Enum(TicketTypeEnum::class)],
|
||||
'template' => 'required|string|min:3|max:255',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
:placeholder="intPlaceholder"
|
||||
:required="intRequired"
|
||||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
v-model="intValue"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -80,18 +79,6 @@ export default defineComponent({
|
|||
};
|
||||
},
|
||||
methods: {
|
||||
onBlur() {
|
||||
const el = textarea.value;
|
||||
if (!el) {
|
||||
throw new Error("undefined textarea element");
|
||||
}
|
||||
// * Remove every new line char
|
||||
el.value = el.value.replace(/[\n\r]/g, "");
|
||||
this.$nextTick(() => {
|
||||
el.style.height = "auto";
|
||||
el.style.height = `${el.scrollHeight}px`;
|
||||
});
|
||||
},
|
||||
onInput() {
|
||||
const el = textarea.value;
|
||||
if (!el) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
'helper' => __('Séléctionnez les sites à associer à cet utilisateur (minimum 0, maximum :max)', [
|
||||
'max' => count($siteModels)
|
||||
]),
|
||||
'required' => true,
|
||||
'required' => false,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('layout.app', ['brParam' => $invoiceModel])
|
||||
|
||||
@section('title', __('Création d\'un :model', ['model' => Str::singular(__('models.classes.invoices'))]))
|
||||
@section('description', __('Création d\'un tout nouveau :model', ['model' => Str::singular(__('models.classes.invoices'))]))
|
||||
@section('title', __('Création d\'un :model', ['model' => __('models.classes.invoices')]))
|
||||
@section('description', __('Création d\'un tout nouveau :model', ['model' => __('models.classes.invoices')]))
|
||||
@section('breadcrumb', request()->route()->getName())
|
||||
|
||||
@section('content')
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
class="btn btn-primary"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => Str::singular(__('models.classes.invoices'))]) }}">
|
||||
title="{{ __('crud.helpers.save_model', ['model' => __('models.classes.invoices')]) }}">
|
||||
{{ __('crud.actions.save') }}
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
class="btn btn-primary"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => Str::singular(__('models.classes.invoices'))]) }}">
|
||||
title="{{ __('crud.helpers.save_model', ['model' => __('models.classes.invoices')]) }}">
|
||||
{{ __('crud.actions.save') }}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@if($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened)
|
||||
@if($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened || $invoiceModel->status === null)
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
class="btn btn-primary float-right"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ __('crud.helpers.create_model', ['model' => Str::singular(__('models.classes.invoices'))]) }}">
|
||||
title="{{ __('crud.helpers.create_model', ['model' => __('models.classes.invoices')]) }}">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
</tbody>
|
||||
@else
|
||||
<tr>
|
||||
<td class="text-center fw-bold border-0">{{ __('crud.other.no_model_found', ['model' => Str::singular(__('models.classes.invoices'))]) }}</td>
|
||||
<td class="text-center fw-bold border-0">{{ __('crud.other.no_model_found', ['model' => __('models.classes.invoices')]) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('layout.app', ['brParam' => $invoiceModel])
|
||||
|
||||
@section('title', __('Aperçu d\'un :model', ['model' => Str::singular(__('models.classes.invoices'))]))
|
||||
@section('description', __('Aperçu d\'un :model déjà existant', ['model' => Str::singular(__('models.classes.invoices'))]))
|
||||
@section('title', __('Aperçu d\'un :model', ['model' => __('models.classes.invoices')]))
|
||||
@section('description', __('Aperçu d\'un :model déjà existant', ['model' => __('models.classes.invoices')]))
|
||||
@section('breadcrumb', request()->route()->getName())
|
||||
|
||||
@section('content')
|
||||
|
|
|
|||
|
|
@ -48,13 +48,12 @@
|
|||
'name' => 'amount',
|
||||
'required' => true,
|
||||
'model' => $packageModel ?? null,
|
||||
'helper' => __('validation.between.numeric', [
|
||||
'helper' => __('validation.min.numeric', [
|
||||
'attribute' => __(':field du :model', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.amount.day')),
|
||||
'model' => Str::singular(__('models.classes.packages')),
|
||||
]),
|
||||
'min' => 0,
|
||||
'max' => 10.000,
|
||||
]),
|
||||
'step' => 0.01
|
||||
])
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
'min' => 0,
|
||||
'max' => count($userModels),
|
||||
]),
|
||||
'required' => true,
|
||||
'required' => false,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<div class="row">
|
||||
{{-- ROLE --}}
|
||||
{{-- TYPE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ trans_choice('models.classes.ticket_types', 1) }}</legend>
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
]),
|
||||
'name' => 'type',
|
||||
'model' => $ticketTypeModel ?? null,
|
||||
'required' => true,
|
||||
'required' => false,
|
||||
'disabled' => $ticketTypeModel ? true : false,
|
||||
'associatedModels' => \App\Enums\Tickets\TicketTypeEnum::toArray(),
|
||||
'helper' => __('crud.minicrud.enum_select', [
|
||||
'enum' => trans_choice('models.classes.ticket_types', 1),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,14 @@
|
|||
<b>{{ $label }} {{ $required ? '*' : '' }}</b>
|
||||
</label>
|
||||
@php
|
||||
if (old($name)) {
|
||||
$model = $targetModel::find(old($name, []));
|
||||
$modelSelected = [
|
||||
'id' => $model->id,
|
||||
'name' => $model->name,
|
||||
'value' => $model->id,
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'readonly' => $readonly,
|
||||
'name' => $name,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@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>
|
||||
<select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($require))required @endif @if(!empty($disabled))disabled @endif>
|
||||
@foreach ($associatedModels as $associatedModel)
|
||||
<option value="{{ $associatedModel->value}}" @if (old($name, $model->{$name}->value ?? $value ?? Arr::first($associatedModels)->value) == $associatedModel->value) selected @endif>
|
||||
{{ $associatedModel->label }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue