first change
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
{{ html()->form('POST', route('gallery.store'))->class('needs-validation')->attributes(['novalidate'])->open() }}
|
||||
|
||||
@isset($gallery)
|
||||
{{ html()->hidden('id', $gallery->id) }}
|
||||
@endisset
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="mb-3">
|
||||
{{ html()->label('Title')->for('title') }}
|
||||
{{ html()->span('*')->class('text-danger') }}
|
||||
{{ html()->text('title')->value($gallery->title ?? old('title'))->class('form-control')->placeholder('Enter Title')->required() }}
|
||||
{{ html()->div('Please enter a title.')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
{{ html()->label('Slug')->for('slug') }}
|
||||
{{ html()->text('slug')->value($gallery->slug ?? old('slug'))->class('form-control')->placeholder('Enter Gallery Slug') }}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
{{ html()->label('Image(s) or Video')->for('images') }}
|
||||
<x-image-input :editable="$editable" id="images" name="images" :data="$editable ? $gallery->getRawOriginal('images') : null" :multiple="true"
|
||||
label="Select Image(s) or video" />
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
{{ html()->label('Video Link')->for('slug') }}
|
||||
{{ 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">
|
||||
{{ html()->label('Category')->class('form-label')->for('category_id') }}
|
||||
{{ html()->select('category_id', $categoryOptions)->value($gallery->category_id ?? old('category_id'))->class('form-select choices-select')->placeholder('Select') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<x-form-buttons :href="route('gallery.index')" :label="isset($gallery) ? 'Update' : 'Create'" />
|
||||
</div>
|
||||
</div>
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
|
||||
@push('js')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
const route = "{{ 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 = '{{ $editable }}';
|
||||
|
||||
if (isEditable == '1') {
|
||||
$('#link').trigger('change');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
@@ -0,0 +1,10 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="{{ route('gallery.index', $id) }}" class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
|
||||
<a data-link="{{ route('gallery.toggle', $id) }}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Toggle" data-status="{{ $status == 1 ? 'Draft' : 'Published' }}"
|
||||
class="link-info fs-15 toggle-item"><i class="{{ $status == 1 ? 'ri-toggle-line' : 'ri-toggle-fill' }}"></i></a>
|
||||
|
||||
<a href="javascript:void(0);" data-link="{{ route('gallery.destroy', $id) }}" class="link-danger fs-15 remove-item"><i
|
||||
class="ri-delete-bin-line"></i>
|
||||
</a>
|
||||
</div>
|
50
Modules/CCMS/resources/views/gallery/index.blade.php
Normal file
50
Modules/CCMS/resources/views/gallery/index.blade.php
Normal file
@@ -0,0 +1,50 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
@if ($errors->any())
|
||||
<x-flash-message type="danger" :messages="$errors->all()" />
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-xl-3">
|
||||
<div class="card profile-card">
|
||||
@include('ccms::gallery.add-gallery-form')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-xl-8 col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'S.N',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
],
|
||||
['title' => 'Image(s)', 'data' => 'images', 'name' => 'images'],
|
||||
['title' => 'Category', 'data' => 'category_id', 'name' => 'category_id'],
|
||||
['title' => 'Name', 'data' => 'title', 'name' => 'title'],
|
||||
['title' => 'Link', 'data' => 'link', 'name' => 'link'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
[
|
||||
'title' => 'Action',
|
||||
'data' => 'action',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-data-table-script :route="route('gallery.index')" :reorder="route('gallery.reorder')" :columns="$columns" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
Reference in New Issue
Block a user