135 lines
6.7 KiB
PHP
135 lines
6.7 KiB
PHP
<?php echo e(html()->form('POST', route('gallery.store'))->class('needs-validation')->attributes(['novalidate'])->open()); ?>
|
|
|
|
|
|
<?php if(isset($gallery)): ?>
|
|
<?php echo e(html()->hidden('id', $gallery->id)); ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="mb-3">
|
|
<?php echo e(html()->label('Title')->for('title')); ?>
|
|
|
|
<?php echo e(html()->span('*')->class('text-danger')); ?>
|
|
|
|
<?php echo e(html()->text('title')->value($gallery->title ?? old('title'))->class('form-control')->placeholder('Enter Title')->required()); ?>
|
|
|
|
<?php echo e(html()->div('Please enter a title.')->class('invalid-feedback')); ?>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<?php echo e(html()->label('Slug')->for('slug')); ?>
|
|
|
|
<?php echo e(html()->text('slug')->value($gallery->slug ?? old('slug'))->class('form-control')->placeholder('Enter Gallery Slug')); ?>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<?php echo e(html()->label('Image(s) or Video')->for('images')); ?>
|
|
|
|
<?php if (isset($component)) { $__componentOriginal4a95833b519aeb799c35637497d32ce2 = $component; } ?>
|
|
<?php if (isset($attributes)) { $__attributesOriginal4a95833b519aeb799c35637497d32ce2 = $attributes; } ?>
|
|
<?php $component = App\View\Components\ImageInput::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
|
|
<?php $component->withName('image-input'); ?>
|
|
<?php if ($component->shouldRender()): ?>
|
|
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
|
|
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
|
|
<?php $attributes = $attributes->except(\App\View\Components\ImageInput::ignoredParameterNames()); ?>
|
|
<?php endif; ?>
|
|
<?php $component->withAttributes(['editable' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($editable),'id' => 'images','name' => 'images','data' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($editable ? $gallery->getRawOriginal('images') : null),'multiple' => true,'label' => 'Select Image(s) or video']); ?>
|
|
<?php echo $__env->renderComponent(); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__attributesOriginal4a95833b519aeb799c35637497d32ce2)): ?>
|
|
<?php $attributes = $__attributesOriginal4a95833b519aeb799c35637497d32ce2; ?>
|
|
<?php unset($__attributesOriginal4a95833b519aeb799c35637497d32ce2); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__componentOriginal4a95833b519aeb799c35637497d32ce2)): ?>
|
|
<?php $component = $__componentOriginal4a95833b519aeb799c35637497d32ce2; ?>
|
|
<?php unset($__componentOriginal4a95833b519aeb799c35637497d32ce2); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<?php echo e(html()->label('Video Link')->for('slug')); ?>
|
|
|
|
<?php echo e(html()->text('link')->value($gallery->link ?? old('link'))->class('form-control')->placeholder('Enter Youtube video link')); ?>
|
|
|
|
<div class="d-flex flex-wrap mt-1" id="video-preview">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<?php echo e(html()->label('Category')->class('form-label')->for('category_id')); ?>
|
|
|
|
<?php echo e(html()->select('category_id', $categoryOptions)->value($gallery->category_id ?? old('category_id'))->class('form-select choices-select')->placeholder('Select')); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php if (isset($component)) { $__componentOriginal4472fe0a558b38a919fed94c8472a9fd = $component; } ?>
|
|
<?php if (isset($attributes)) { $__attributesOriginal4472fe0a558b38a919fed94c8472a9fd = $attributes; } ?>
|
|
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.form-buttons','data' => ['href' => route('gallery.index'),'label' => isset($gallery) ? 'Update' : 'Create']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
|
|
<?php $component->withName('form-buttons'); ?>
|
|
<?php if ($component->shouldRender()): ?>
|
|
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
|
|
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
|
|
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
|
|
<?php endif; ?>
|
|
<?php $component->withAttributes(['href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('gallery.index')),'label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(isset($gallery) ? 'Update' : 'Create')]); ?>
|
|
<?php echo $__env->renderComponent(); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__attributesOriginal4472fe0a558b38a919fed94c8472a9fd)): ?>
|
|
<?php $attributes = $__attributesOriginal4472fe0a558b38a919fed94c8472a9fd; ?>
|
|
<?php unset($__attributesOriginal4472fe0a558b38a919fed94c8472a9fd); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__componentOriginal4472fe0a558b38a919fed94c8472a9fd)): ?>
|
|
<?php $component = $__componentOriginal4472fe0a558b38a919fed94c8472a9fd; ?>
|
|
<?php unset($__componentOriginal4472fe0a558b38a919fed94c8472a9fd); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php echo e(html()->form()->close()); ?>
|
|
|
|
|
|
|
|
<?php $__env->startPush('js'); ?>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
const route = "<?php echo e(config('app.url')); ?>/files";
|
|
|
|
$(document).on('change input paste cut', '#link', function() {
|
|
const url = $(this).val();
|
|
console.log(url);
|
|
|
|
if (url) {
|
|
if (url.includes("https://www.youtube.com/watch")) {
|
|
const videoId = url.split("v=")[1]?.split("&")[0]; // Get the video ID
|
|
const embedUrl = `https://www.youtube.com/embed/${videoId}`;
|
|
$('#video-preview').html(`
|
|
<iframe width="100%" height="150" src="${embedUrl}" frameborder="0" allowfullscreen></iframe>
|
|
`);
|
|
$('#link').val(embedUrl);
|
|
} else {
|
|
$('#video-preview').html(`
|
|
<iframe src="${url}" width="100%" height="150" frameborder="0"></iframe>
|
|
`);
|
|
}
|
|
} else {
|
|
$('#video-preview').html('');
|
|
}
|
|
});
|
|
|
|
|
|
const isEditable = '<?php echo e($editable); ?>';
|
|
|
|
if (isEditable == '1') {
|
|
$('#link').trigger('change');
|
|
}
|
|
});
|
|
</script>
|
|
<?php $__env->stopPush(); ?>
|
|
<?php /**PATH D:\installed\xampp\htdocs\Consultancy-CCMS\Modules/CCMS\resources/views/gallery/add-gallery-form.blade.php ENDPATH**/ ?>
|