This commit is contained in:
parent
06b6967285
commit
ef64b06977
|
|
@ -1,4 +1,7 @@
|
|||
<x-admin::form.row :title="$title" :required="$required">
|
||||
<input type="text" name="{{ $name }}" class="form-control wp-{{ $width }} {{ $class }}" value="{{ $value }}" placeholder="{{ $title }}">
|
||||
<input type="text" name="{{ $name }}" class="form-control wp-{{ $width }} {{ $errors->has($name) ? 'is-invalid' : '' }}" value="{{ $value }}" placeholder="{{ $title }}">
|
||||
@if ($errors->has($name))
|
||||
<span class="invalid-feedback" role="alert">{{ $errors->first($name) }}</span>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</x-admin::form.row>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
@section('content')
|
||||
<div id="category-app" class="card">
|
||||
<div class="card-header">
|
||||
编辑分类
|
||||
</div>
|
||||
<div class="card-header">编辑分类</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ admin_route($category->id ? 'categories.update' : 'categories.store', $category) }}"
|
||||
method="POST">
|
||||
|
|
@ -14,18 +12,20 @@
|
|||
@method($category->id ? 'PUT' : 'POST')
|
||||
<input type="hidden" name="_redirect" value="{{ $_redirect }}">
|
||||
|
||||
@foreach (locales() as $index => $locale)
|
||||
{{-- <input type="hidden" name="descriptions[{{ $index }}][locale]" value="{{ $locale['code'] }}"> --}}
|
||||
@endforeach
|
||||
@if (session('success'))
|
||||
<x-admin-alert type="success" msg="{{ session('success') }}" class="mt-4"/>
|
||||
@endif
|
||||
|
||||
<x-admin-form-input-locale name="descriptions.*.name" title="名称" :value="$descriptions" required />
|
||||
<x-admin-form-input-locale name="descriptions.*.content" title="内容" :value="$descriptions" />
|
||||
|
||||
{{-- <x-admin-form-select title="上级分类" name="parent_id" :value="old('parent_id', $category->parent_id ?? 0)" :options="$categories->toArray()" key="id" label="name" /> --}}
|
||||
|
||||
<x-admin::form.row title="上级分类">
|
||||
@php
|
||||
$_parent_id = old('parent_id', $category->parent_id ?? 0);
|
||||
@endphp
|
||||
<select name="parent_id" id="" class="form-control short">
|
||||
<select name="parent_id" id="" class="form-control short wp-400">
|
||||
<option value="0">--请选择--</option>
|
||||
@foreach ($categories as $_category)
|
||||
<option value="{{ $_category->id }}" {{ $_parent_id == $_category->id ? 'selected' : '' }}>
|
||||
|
|
@ -38,8 +38,7 @@
|
|||
<x-admin-form-switch title="状态" name="active" :value="old('active', $category->active ?? 1)" />
|
||||
|
||||
<x-admin::form.row>
|
||||
<button type="submit" class="btn btn-primary">保存</button>
|
||||
<a href="{{ $_redirect }}" class="btn btn-outline-secondary">返回</a>
|
||||
<button type="submit" class="btn btn-primary mt-3">保存</button>
|
||||
</x-admin::form.row>
|
||||
</form>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@
|
|||
<x-admin-form-input
|
||||
:name="$column['name']"
|
||||
:title="$column['label']"
|
||||
:class="$errors->has($column['name']) ? 'is-invalid' : ''"
|
||||
{{-- :class="$errors->has($column['name']) ? 'is-invalid' : ''" --}}
|
||||
:required="$column['required'] ? true : false"
|
||||
:value="old($column['name'], $column['value'] ?? '')">
|
||||
@if (isset($column['description']))
|
||||
<div class="help-text font-size-12 lh-base">{{ $column['description'] }}</div>
|
||||
@endif
|
||||
@if ($errors->has($column['name']))
|
||||
{{-- @if ($errors->has($column['name']))
|
||||
<span class="invalid-feedback" role="alert">{{ $errors->first($column['name']) }}</span>
|
||||
@endif
|
||||
@endif --}}
|
||||
</x-admin-form-input>
|
||||
@endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue