vsmov 1.0.0
This commit is contained in:
109
resources/views/core/base/fields/checklist.blade.php
Normal file
109
resources/views/core/base/fields/checklist.blade.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<!-- checklist -->
|
||||
@php
|
||||
$key_attribute = (new $field['model']())->getKeyName();
|
||||
$field['attribute'] = $field['attribute'] ?? (new $field['model']())->identifiableAttribute();
|
||||
$field['number_of_columns'] = $field['number_of_columns'] ?? 3;
|
||||
|
||||
// calculate the checklist options
|
||||
if (!isset($field['options'])) {
|
||||
$field['options'] = $field['model']
|
||||
::all()
|
||||
->pluck($field['attribute'], $key_attribute)
|
||||
->toArray();
|
||||
} else {
|
||||
$field['options'] = call_user_func($field['options'], $field['model']::query());
|
||||
}
|
||||
|
||||
// calculate the value of the hidden input
|
||||
$field['value'] = old_empty_or_null($field['name'], []) ?? ($field['value'] ?? ($field['default'] ?? []));
|
||||
if (!empty($field['value'])) {
|
||||
if (is_a($field['value'], \Illuminate\Support\Collection::class)) {
|
||||
$field['value'] = $field['value']->pluck($key_attribute)->toArray();
|
||||
} elseif (is_string($field['value'])) {
|
||||
$field['value'] = json_decode($field['value']);
|
||||
}
|
||||
}
|
||||
|
||||
// define the init-function on the wrapper
|
||||
$field['wrapper']['data-init-function'] = $field['wrapper']['data-init-function'] ?? 'bpFieldInitChecklist';
|
||||
@endphp
|
||||
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
@include('crud::fields.inc.translatable_icon')
|
||||
|
||||
<input type="hidden" value='@json($field['value'])'>
|
||||
|
||||
<div class="row">
|
||||
@foreach ($field['options'] as $key => $option)
|
||||
<div class="col-sm-{{ intval(12 / $field['number_of_columns']) }}">
|
||||
<div class="checkbox">
|
||||
<label class="font-weight-normal">
|
||||
<input type="checkbox" value="{{ $key }}" name="{{ $field['name'] }}[]"> {{ $option }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
|
||||
{{-- ########################################## --}}
|
||||
{{-- Extra CSS and JS for this particular field --}}
|
||||
{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
|
||||
{{-- FIELD JS - will be loaded in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
@loadOnce('bpFieldInitChecklist')
|
||||
<script>
|
||||
function bpFieldInitChecklist(element) {
|
||||
var hidden_input = element.find('input[type=hidden]');
|
||||
var selected_options = JSON.parse(hidden_input.val() || '[]');
|
||||
var checkboxes = element.find('input[type=checkbox]');
|
||||
var container = element.find('.row');
|
||||
|
||||
// set the default checked/unchecked states on checklist options
|
||||
checkboxes.each(function(key, option) {
|
||||
var id = $(this).val();
|
||||
|
||||
if (selected_options.map(String).includes(id)) {
|
||||
$(this).prop('checked', 'checked');
|
||||
} else {
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
// when a checkbox is clicked
|
||||
// set the correct value on the hidden input
|
||||
checkboxes.click(function() {
|
||||
var newValue = [];
|
||||
|
||||
checkboxes.each(function() {
|
||||
if ($(this).is(':checked')) {
|
||||
var id = $(this).val();
|
||||
newValue.push(id);
|
||||
}
|
||||
});
|
||||
|
||||
hidden_input.val(JSON.stringify(newValue)).trigger('change');
|
||||
|
||||
});
|
||||
|
||||
hidden_input.on('CrudField:disable', function(e) {
|
||||
checkboxes.attr('disabled', 'disabled');
|
||||
});
|
||||
|
||||
hidden_input.on('CrudField:enable', function(e) {
|
||||
checkboxes.removeAttr('disabled');
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@endLoadOnce
|
||||
@endpush
|
||||
{{-- End of Extra CSS and JS --}}
|
||||
{{-- ########################################## --}}
|
||||
76
resources/views/core/base/fields/ckfinder.blade.php
Normal file
76
resources/views/core/base/fields/ckfinder.blade.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<!-- field_type_name -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
@php
|
||||
$field['has_preview'] = isset($field['has_preview']) ? $field['has_preview'] : false;
|
||||
$field['preview']['width'] = isset($field['preview']['width']) ? $field['preview']['width'] : '90%';
|
||||
$field['preview']['height'] = isset($field['preview']['height']) ? $field['preview']['height'] : '90%';
|
||||
@endphp
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="{{ $field['name'] }}"
|
||||
value="{{ old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : '')) }}"
|
||||
@include('crud::fields.inc.attributes') id="ckfinder-{{ strtolower($field['name']) }}">
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-info"
|
||||
onclick="selectFileWithCKFinder('{{ strtolower($field['name']) }}')">Browse</button>
|
||||
</span>
|
||||
</div>
|
||||
@if ($field['has_preview'] && old($field['name'], isset($entry) ? $entry->{$field['name']} : ''))
|
||||
<img class="mw-100 mt-2 rounded" src="{{ old($field['name'], isset($entry) ? $entry->{$field['name']} : '') }}"
|
||||
id="preview-{{ strtolower($field['name']) }}"
|
||||
style="width: {{ $field['preview']['width'] }};height: {{ $field['preview']['height'] }}">
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
@if ($crud->fieldTypeNotLoaded($field))
|
||||
@php
|
||||
$crud->markFieldTypeAsLoaded($field);
|
||||
@endphp
|
||||
|
||||
{{-- FIELD EXTRA CSS --}}
|
||||
{{-- push things in the after_styles section --}}
|
||||
@push('crud_fields_styles')
|
||||
<!-- no styles -->
|
||||
@endpush
|
||||
|
||||
{{-- FIELD EXTRA JS --}}
|
||||
{{-- push things in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
@include('ckfinder::setup')
|
||||
<script>
|
||||
function selectFileWithCKFinder(elementId) {
|
||||
CKFinder.popup({
|
||||
startupPath: '/images/sherwood-phan-1/',
|
||||
chooseFiles: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
onInit: function(finder) {
|
||||
finder.on('files:choose', function(evt) {
|
||||
var file = evt.data.files.first();
|
||||
var output = document.getElementById('ckfinder-' + elementId);
|
||||
var preview = document.getElementById('preview-' + elementId);
|
||||
if (output) {
|
||||
output.value = file.getUrl();
|
||||
}
|
||||
if (preview) {
|
||||
preview.src = file.getUrl();
|
||||
}
|
||||
});
|
||||
|
||||
finder.on('file:choose:resizedImage', function(evt) {
|
||||
var output = document.getElementById(elementId);
|
||||
output.value = evt.data.resizedUrl;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
91
resources/views/core/base/fields/fields_option.blade.php
Normal file
91
resources/views/core/base/fields/fields_option.blade.php
Normal file
@@ -0,0 +1,91 @@
|
||||
@php
|
||||
$value = isset($field) ? old_empty_or_null($field['name'], '') ?? ($field['value'] ?? null) : null;
|
||||
@endphp
|
||||
|
||||
@php
|
||||
$progress = [
|
||||
'episodes' => 'Tập mới',
|
||||
'status' => 'Trạng thái phim',
|
||||
'episode_time' => 'Thời lượng tập phim',
|
||||
'episode_current' => 'Số tập phim hiện tại',
|
||||
'episode_total' => 'Tổng số tập phim',
|
||||
];
|
||||
|
||||
$info = [
|
||||
'name' => 'Tên phim',
|
||||
'origin_name' => 'Tên gốc phim',
|
||||
'content' => 'Mô tả nội dung phim',
|
||||
'thumb_url' => 'Ảnh Thumb',
|
||||
'poster_url' => 'Ảnh Poster',
|
||||
'trailer_url' => 'Trailer URL',
|
||||
'quality' => 'Chất lượng phim',
|
||||
'language' => 'Ngôn ngữ',
|
||||
'notify' => 'Nội dung thông báo',
|
||||
'showtimes' => 'Giờ chiếu phim',
|
||||
'publish_year' => 'Năm xuất bản',
|
||||
'is_shown_in_theater' => 'Đánh dấu phim chiếu rạp',
|
||||
'is_copyright' => 'Đánh dấu có bản quyền',
|
||||
];
|
||||
|
||||
$relations = [
|
||||
'type' => 'Định dạng phim',
|
||||
'actors' => 'Diễn viên',
|
||||
'directors' => 'Đạo diễn',
|
||||
'categories' => 'Thể loại',
|
||||
'regions' => 'Khu vực',
|
||||
'tags' => 'Từ khóa',
|
||||
'studios' => 'Studio',
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div class="px-3 py-2">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="progress-checkbox" id="progress-all" type="checkbox" checked>
|
||||
<label for="progress-all">Tiến độ phim</label>
|
||||
</div>
|
||||
@foreach ($progress as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check checkbox">
|
||||
<input class="form-check-input progress-checkbox" id="progress-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="progress-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="info-checkbox" id="info-all" type="checkbox" checked>
|
||||
<label for="info-all">Thông tin phim</label>
|
||||
</div>
|
||||
@foreach ($info as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check checkbox">
|
||||
<input class="form-check-input info-checkbox" id="info-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="info-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="relation-checkbox" id="relation-all" type="checkbox" checked>
|
||||
<label for="relation-all">Phân loại</label>
|
||||
</div>
|
||||
@foreach ($relations as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check">
|
||||
<input class="form-check-input relation-checkbox" id="relation-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="relation-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{-- FIELD JS - will be loaded in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
<script>
|
||||
$('.checkall').change(function() {
|
||||
$(`.${$(this).data('target')}`).prop('checked', this.checked);
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
131
resources/views/core/base/fields/page_or_link.blade.php
Normal file
131
resources/views/core/base/fields/page_or_link.blade.php
Normal file
@@ -0,0 +1,131 @@
|
||||
{{-- PAGE OR LINK field --}}
|
||||
{{-- Used in Backpack\MenuCRUD --}}
|
||||
|
||||
<?php
|
||||
$field['allows_null'] = $field['allows_null'] ?? false;
|
||||
$field['name']['type'] = $field['name']['type'] ?? $field['name'][0] ?? 'type';
|
||||
$field['name']['link'] = $field['name']['link'] ?? $field['name'][1] ?? 'link';
|
||||
$field['options']['internal_link'] = $field['options']['internal_link'] ?? trans('backpack::crud.internal_link');
|
||||
$field['options']['external_link'] = $field['options']['external_link'] ?? trans('backpack::crud.external_link');
|
||||
?>
|
||||
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
@include('crud::fields.inc.translatable_icon')
|
||||
|
||||
<div class="row" data-init-function="bpFieldInitPageOrLinkElement">
|
||||
{{-- hidden placeholders for content --}}
|
||||
<input type="hidden" value="{{ $entry->{$field['name']['link']} ?? '' }}" name="{{ $field['name']['link'] }}" />
|
||||
|
||||
<div class="col-sm-3">
|
||||
{{-- type select --}}
|
||||
<select
|
||||
data-identifier="page_or_link_select"
|
||||
name="{!! $field['name']['type'] !!}"
|
||||
@include('crud::fields.inc.attributes')
|
||||
>
|
||||
|
||||
@if ($field['allows_null'])
|
||||
<option value="">-</option>
|
||||
@endif
|
||||
|
||||
@foreach ($field['options'] as $key => $value)
|
||||
<option value="{{ $key }}"
|
||||
@if (isset($entry) && $key === $entry->{$field['name']['type']})
|
||||
selected
|
||||
@endif
|
||||
>{{ $value }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{{-- internal link input --}}
|
||||
<div class="page_or_link_value internal_link {{ isset($entry) && $entry->{$field['name']['type']} === 'internal_link' ? '' : '' }}">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="{{ trans('backpack::crud.internal_link_placeholder', ['url', url(config('backpack.base.route_prefix').'/page')]) }}"
|
||||
for="{{ $field['name']['link'] }}"
|
||||
required
|
||||
|
||||
@if (isset($entry) && $entry->{$field['name']['type']} !== 'internal_link')
|
||||
disabled="disabled"
|
||||
@endif
|
||||
|
||||
@if (isset($entry) && $entry->{$field['name']['type']} === 'internal_link' && $entry->{$field['name']['link']})
|
||||
value="{{ $entry->{$field['name']['link']} }}"
|
||||
@endif
|
||||
>
|
||||
</div>
|
||||
|
||||
{{-- external link input --}}
|
||||
<div class="page_or_link_value external_link {{ isset($entry) && $entry->{$field['name']['type']} === 'external_link' ? '' : 'd-none' }}">
|
||||
<input
|
||||
type="url"
|
||||
class="form-control"
|
||||
placeholder="{{ trans('backpack::crud.page_link_placeholder') }}"
|
||||
for="{{ $field['name']['link'] }}"
|
||||
required
|
||||
|
||||
@if (isset($entry) && $entry->{$field['name']['type']} !== 'external_link')
|
||||
disabled="disabled"
|
||||
@endif
|
||||
|
||||
@if (isset($entry) && $entry->{$field['name']['type']} === 'external_link' && $entry->{$field['name']['link']})
|
||||
value="{{ $entry->{$field['name']['link']} }}"
|
||||
@endif
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
|
||||
{{-- ########################################## --}}
|
||||
{{-- Extra CSS and JS for this particular field --}}
|
||||
{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
|
||||
@if ($crud->fieldTypeNotLoaded($field))
|
||||
@php
|
||||
$crud->markFieldTypeAsLoaded($field);
|
||||
@endphp
|
||||
|
||||
{{-- FIELD JS - will be loaded in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
<script>
|
||||
function bpFieldInitPageOrLinkElement(element) {
|
||||
element = element[0]; // jQuery > Vanilla
|
||||
const select = element.querySelector('select[data-identifier=page_or_link_select]');
|
||||
const values = element.querySelectorAll('.page_or_link_value');
|
||||
// updates hidden fields
|
||||
const updateHidden = () => {
|
||||
let selectedInput = select.value && element.querySelector(`.${select.value}`).firstElementChild;
|
||||
element.querySelectorAll(`input[type="hidden"]`).forEach(hidden => {
|
||||
hidden.value = selectedInput && hidden.getAttribute('name') === selectedInput.getAttribute('for') ? selectedInput.value : '';
|
||||
});
|
||||
}
|
||||
// save input changes to hidden placeholders
|
||||
values.forEach(value => value.firstElementChild.addEventListener('input', updateHidden));
|
||||
// main select change
|
||||
select.addEventListener('change', () => {
|
||||
values.forEach(value => {
|
||||
let isSelected = value.classList.contains(select.value);
|
||||
// toggle visibility and disabled
|
||||
value.classList.toggle('d-none', !isSelected);
|
||||
value.firstElementChild.toggleAttribute('disabled', !isSelected);
|
||||
});
|
||||
// updates hidden fields
|
||||
updateHidden();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@endif
|
||||
{{-- End of Extra CSS and JS --}}
|
||||
{{-- ########################################## --}}
|
||||
@@ -0,0 +1,44 @@
|
||||
<!-- field_type_name -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
@php
|
||||
$field['allows_multiple'] = $field['allows_multiple'] ?? false;
|
||||
$field['options'] = $field['options'] ?? [];
|
||||
$field['value'] = $field['value'] ?? [];
|
||||
|
||||
@endphp
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
<select class="form-control select2-from-array" name="{{ $field['name'] }}[]" @if ($field['allows_multiple']) multiple @endif
|
||||
@include('crud::fields.inc.attributes')>
|
||||
@foreach ($field['options'] as $key => $option)
|
||||
<option value="{{ $key }}" @if (($field['allows_multiple'] && in_array($key, $field['value'])) || $key == $field['value']) selected @endif>{{ $option }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
@if ($crud->fieldTypeNotLoaded($field))
|
||||
@php
|
||||
$crud->markFieldTypeAsLoaded($field);
|
||||
@endphp
|
||||
|
||||
{{-- FIELD EXTRA CSS --}}
|
||||
{{-- push things in the after_styles section --}}
|
||||
@push('crud_fields_styles')
|
||||
<!-- no styles -->
|
||||
@endpush
|
||||
|
||||
{{-- FIELD EXTRA JS --}}
|
||||
{{-- push things in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
<script>
|
||||
$(function() {
|
||||
$(".select2-from-array").select2({});
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
@@ -0,0 +1,48 @@
|
||||
<!-- field_type_name -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
@php
|
||||
$key_attribute = (new $field['model']())->getKeyName();
|
||||
$field['attribute'] = $field['attribute'] ?? (new $field['model']())->identifiableAttribute();
|
||||
|
||||
$selected = $field['model']
|
||||
::whereIn('id', old($field['name'], isset($field['value']) ? $field['value']->pluck('id')->toArray() : []))
|
||||
->pluck($field['attribute'], $key_attribute)
|
||||
->toArray();
|
||||
@endphp
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
<select class="form-control select2-relationship-tags" name="{{ $field['name'] }}[]" multiple @include('crud::fields.inc.attributes')>
|
||||
@foreach ($selected as $option)
|
||||
<option value="{{ $option }}" selected>{{ $option }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
@if ($crud->fieldTypeNotLoaded($field))
|
||||
@php
|
||||
$crud->markFieldTypeAsLoaded($field);
|
||||
@endphp
|
||||
|
||||
{{-- FIELD EXTRA CSS --}}
|
||||
{{-- push things in the after_styles section --}}
|
||||
@push('crud_fields_styles')
|
||||
<!-- no styles -->
|
||||
@endpush
|
||||
|
||||
{{-- FIELD EXTRA JS --}}
|
||||
{{-- push things in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
<script>
|
||||
$(function() {
|
||||
$(".select2-relationship-tags").select2({
|
||||
tags: true
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
44
resources/views/core/base/fields/select2_tags.blade.php
Normal file
44
resources/views/core/base/fields/select2_tags.blade.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<!-- field_type_name -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
|
||||
@php
|
||||
$selected = $field['value'] ?? [];
|
||||
@endphp
|
||||
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
<select class="form-control select2-tags" name="{{ $field['name'] }}[]" multiple @include('crud::fields.inc.attributes')>
|
||||
@foreach ($selected as $option)
|
||||
<option value="{{ $option }}" selected>{{ $option }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
|
||||
@if ($crud->fieldTypeNotLoaded($field))
|
||||
@php
|
||||
$crud->markFieldTypeAsLoaded($field);
|
||||
@endphp
|
||||
|
||||
{{-- FIELD EXTRA CSS --}}
|
||||
{{-- push things in the after_styles section --}}
|
||||
@push('crud_fields_styles')
|
||||
<!-- no styles -->
|
||||
@endpush
|
||||
|
||||
{{-- FIELD EXTRA JS --}}
|
||||
{{-- push things in the after_scripts section --}}
|
||||
@push('crud_fields_scripts')
|
||||
<script>
|
||||
$(function() {
|
||||
$(".select2-tags").select2({
|
||||
tags: true
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
40
resources/views/core/base/fields/select_from_table.blade.php
Normal file
40
resources/views/core/base/fields/select_from_table.blade.php
Normal file
@@ -0,0 +1,40 @@
|
||||
@php
|
||||
$field['allows_null'] = $field['allows_null'] ?? $crud->model::isColumnNullable($field['name']);
|
||||
$field['value'] = old_empty_or_null($field['name'], '') ?? ($field['value'] ?? ($field['default'] ?? ''));
|
||||
$field['multiple'] = $field['allows_multiple'] ?? ($field['multiple'] ?? false);
|
||||
$field['options']['display_by'] = isset($field['options']['display_by']) ? $field['options']['display_by'] : 'name';
|
||||
$field['options']['value_by'] = isset($field['options']['value_by']) ? $field['options']['value_by'] : 'id';
|
||||
$options = \DB::table($field['options']['table'])
|
||||
->pluck($field['options']['display_by'], $field['options']['value_by'])
|
||||
->toArray();
|
||||
@endphp
|
||||
<!-- select from array -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
@include('crud::fields.inc.translatable_icon')
|
||||
@if ($field['multiple'])
|
||||
<input type="hidden" name="{{ $field['name'] }}" value="" @if (in_array('disabled', $field['attributes'] ?? [])) disabled @endif />
|
||||
@endif
|
||||
|
||||
<select name="{{ $field['name'] }}@if ($field['multiple']) [] @endif" @include('crud::fields.inc.attributes')
|
||||
@if ($field['multiple']) multiple bp-field-main-input @endif>
|
||||
|
||||
@if ($field['allows_null'] && !$field['multiple'])
|
||||
<option value="">-</option>
|
||||
@endif
|
||||
@if (count($options))
|
||||
@foreach ($options as $key => $value)
|
||||
@if ($key == $field['value'] || (is_array($field['value']) && in_array($key, $field['value'])))
|
||||
<option value="{{ $key }}" selected>{{ $value }}</option>
|
||||
@else
|
||||
<option value="{{ $key }}">{{ $value }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
30
resources/views/core/base/fields/select_theme.blade.php
Normal file
30
resources/views/core/base/fields/select_theme.blade.php
Normal file
@@ -0,0 +1,30 @@
|
||||
@php
|
||||
$field['value'] = old_empty_or_null($field['name'], '') ?? ($field['value'] ?? ($field['default'] ?? ''));
|
||||
$field['multiple'] = $field['allows_multiple'] ?? ($field['multiple'] ?? false);
|
||||
$options = config('themes', []);
|
||||
@endphp
|
||||
<!-- select from array -->
|
||||
@include('crud::fields.inc.wrapper_start')
|
||||
<label>{!! $field['label'] !!}</label>
|
||||
@include('crud::fields.inc.translatable_icon')
|
||||
@if ($field['multiple'])
|
||||
<input type="hidden" name="{{ $field['name'] }}" value="" @if (in_array('disabled', $field['attributes'] ?? [])) disabled @endif />
|
||||
@endif
|
||||
|
||||
<select name="{{ $field['name'] }}@if ($field['multiple']) [] @endif" @include('crud::fields.inc.attributes')>
|
||||
@if (count($options))
|
||||
@foreach ($options as $key => $value)
|
||||
@if ($key == $field['value'] || (is_array($field['value']) && in_array($key, $field['value'])))
|
||||
<option value="{{ $key }}" selected>{{ $value }}</option>
|
||||
@else
|
||||
<option value="{{ $key }}">{{ $value }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
|
||||
{{-- HINT --}}
|
||||
@if (isset($field['hint']))
|
||||
<p class="help-block">{!! $field['hint'] !!}</p>
|
||||
@endif
|
||||
@include('crud::fields.inc.wrapper_end')
|
||||
@@ -0,0 +1,91 @@
|
||||
@php
|
||||
$value = isset($field) ? old_empty_or_null($field['name'], '') ?? ($field['value'] ?? null) : null;
|
||||
@endphp
|
||||
|
||||
@php
|
||||
$progress = [
|
||||
'episodes' => 'Tập mới',
|
||||
'status' => 'Trạng thái phim',
|
||||
'episode_time' => 'Thời lượng tập phim',
|
||||
'episode_current' => 'Số tập phim hiện tại',
|
||||
'episode_total' => 'Tổng số tập phim',
|
||||
];
|
||||
|
||||
$info = [
|
||||
'name' => 'Tên phim',
|
||||
'origin_name' => 'Tên gốc phim',
|
||||
'content' => 'Mô tả nội dung phim',
|
||||
'thumb_url' => 'Ảnh Thumb',
|
||||
'poster_url' => 'Ảnh Poster',
|
||||
'trailer_url' => 'Trailer URL',
|
||||
'quality' => 'Chất lượng phim',
|
||||
'language' => 'Ngôn ngữ',
|
||||
'notify' => 'Nội dung thông báo',
|
||||
'showtimes' => 'Giờ chiếu phim',
|
||||
'publish_year' => 'Năm xuất bản',
|
||||
'is_shown_in_theater' => 'Đánh dấu phim chiếu rạp',
|
||||
'is_copyright' => 'Đánh dấu có bản quyền',
|
||||
];
|
||||
|
||||
$relations = [
|
||||
'type' => 'Định dạng phim',
|
||||
'actors' => 'Diễn viên',
|
||||
'directors' => 'Đạo diễn',
|
||||
'categories' => 'Thể loại',
|
||||
'regions' => 'Khu vực',
|
||||
'tags' => 'Từ khóa',
|
||||
'studios' => 'Studio',
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div class="px-3 py-2">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="progress-checkbox" id="progress-all" type="checkbox">
|
||||
<label for="progress-all">Tiến độ phim</label>
|
||||
</div>
|
||||
@foreach ($progress as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check checkbox">
|
||||
<input class="form-check-input progress-checkbox" id="progress-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="progress-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="info-checkbox" id="info-all" type="checkbox">
|
||||
<label for="info-all">Thông tin phim</label>
|
||||
</div>
|
||||
@foreach ($info as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check checkbox">
|
||||
<input class="form-check-input info-checkbox" id="info-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="info-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 px-0">
|
||||
<input class="checkall" data-target="relation-checkbox" id="relation-all" type="checkbox">
|
||||
<label for="relation-all">Phân loại</label>
|
||||
</div>
|
||||
@foreach ($relations as $key => $option)
|
||||
<div class="col-12 col-md-6 form-check">
|
||||
<input class="form-check-input relation-checkbox" id="relation-{{ $loop->index }}" type="checkbox"
|
||||
name="fields[]" value="{{ $key }}" @if (is_null($value) || in_array($key, $value)) checked @endif>
|
||||
<label class="d-inline" for="relation-{{ $loop->index }}">{{ $option }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{-- FIELD JS - will be loaded in the after_scripts section --}}
|
||||
@push('after_scripts')
|
||||
<script>
|
||||
$('.checkall').change(function() {
|
||||
$(`.${$(this).data('target')}`).prop('checked', this.checked);
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user