world set up and idea in place
This commit is contained in:
parent
ba12204842
commit
21906d8c27
3 changed files with 10 additions and 3 deletions
|
@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use \Illuminate\Contracts\View\View;
|
use \Illuminate\Contracts\View\View;
|
||||||
use \Illuminate\Http\RedirectResponse;
|
use \Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +30,7 @@ use \Illuminate\Http\RedirectResponse;
|
||||||
*/
|
*/
|
||||||
class AssetModelsController extends Controller
|
class AssetModelsController extends Controller
|
||||||
{
|
{
|
||||||
|
protected MessageBag $validatorErrors;
|
||||||
/**
|
/**
|
||||||
* Returns a view that invokes the ajax tables which actually contains
|
* Returns a view that invokes the ajax tables which actually contains
|
||||||
* the content for the accessories listing, which is generated in getDatatable.
|
* the content for the accessories listing, which is generated in getDatatable.
|
||||||
|
@ -158,7 +160,8 @@ class AssetModelsController extends Controller
|
||||||
|
|
||||||
if ($this->shouldAddDefaultValues($request->input())) {
|
if ($this->shouldAddDefaultValues($request->input())) {
|
||||||
if (!$this->assignCustomFieldsDefaultValues($model, $request->input('default_values'))) {
|
if (!$this->assignCustomFieldsDefaultValues($model, $request->input('default_values'))) {
|
||||||
return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.fieldset_default_value.error'));
|
//return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.fieldset_default_value.error'));
|
||||||
|
return redirect()->back()->withErrors($this->validatorErrors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +487,7 @@ class AssetModelsController extends Controller
|
||||||
$validator = Validator::make($data, $rules);
|
$validator = Validator::make($data, $rules);
|
||||||
|
|
||||||
if($validator->fails()){
|
if($validator->fails()){
|
||||||
|
$this->validatorErrors = $validator->messages();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<span>
|
<span>
|
||||||
|
|
||||||
<div class="form-group{{ $errors->has('custom_fieldset') ? ' has-error' : '' }}">
|
<div class="form-group{{ $errors->has('custom_fieldset') ? ' has-error' : '' }}">
|
||||||
<label for="custom_fieldset" class="col-md-3 control-label">
|
<label for="custom_fieldset" class="col-md-3 control-label">
|
||||||
{{ trans('admin/models/general.fieldset') }}
|
{{ trans('admin/models/general.fieldset') }}
|
||||||
|
@ -22,6 +21,10 @@
|
||||||
@if ($this->fields)
|
@if ($this->fields)
|
||||||
|
|
||||||
@foreach ($this->fields as $field)
|
@foreach ($this->fields as $field)
|
||||||
|
@dump($errors)
|
||||||
|
@if($errors->has($field->db_column_name()))
|
||||||
|
"poop"
|
||||||
|
@endif
|
||||||
<div class="form-group" wire:key="field-{{ $field->id }}">
|
<div class="form-group" wire:key="field-{{ $field->id }}">
|
||||||
|
|
||||||
<label class="col-md-3 control-label{{ $errors->has($field->name) ? ' has-error' : '' }}">{{ $field->name }}</label>
|
<label class="col-md-3 control-label{{ $errors->has($field->name) ? ' has-error' : '' }}">{{ $field->name }}</label>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<!-- Custom Fieldset -->
|
<!-- Custom Fieldset -->
|
||||||
<!-- If $item->id is null we are cloning the model and we need the $model_id variable -->
|
<!-- If $item->id is null we are cloning the model and we need the $model_id variable -->
|
||||||
@livewire('custom-field-set-default-values-for-model',["model_id" => $item->id ?? $model_id ?? null ])
|
@livewire('custom-field-set-default-values-for-model', ["model_id" => $item->id ?? $model_id ?? null, "errors" => $errors])
|
||||||
|
|
||||||
@include ('partials.forms.edit.notes')
|
@include ('partials.forms.edit.notes')
|
||||||
@include ('partials.forms.edit.requestable', ['requestable_text' => trans('admin/models/general.requestable')])
|
@include ('partials.forms.edit.requestable', ['requestable_text' => trans('admin/models/general.requestable')])
|
||||||
|
|
Loading…
Add table
Reference in a new issue