224 lines
11 KiB
PHP
224 lines
11 KiB
PHP
@extends('backend.admin-master')
|
||
@section('site-title')
|
||
{{__('Video Gallery')}}
|
||
@endsection
|
||
@section('style')
|
||
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
|
||
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css">
|
||
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.bootstrap.min.css">
|
||
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.jqueryui.min.css">
|
||
<style>
|
||
.dataTables_wrapper .dataTables_paginate .paginate_button{
|
||
padding: 0 !important;
|
||
}
|
||
div.dataTables_wrapper div.dataTables_length select {
|
||
width: 60px;
|
||
display: inline-block;
|
||
}
|
||
</style>
|
||
@endsection
|
||
@section('content')
|
||
<div class="col-lg-12 col-ml-12 padding-bottom-30">
|
||
<div class="row">
|
||
<div class="col-lg-12">
|
||
<div class="margin-top-40"></div>
|
||
<x-error-msg/>
|
||
<x-flash-msg/>
|
||
</div>
|
||
|
||
<div class="col-lg-6 mt-5">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<h4 class="header-title">{{__('Video Gallery')}}</h4>
|
||
<div class="bulk-delete-wrapper">
|
||
<div class="select-box-wrap">
|
||
<select name="bulk_option" id="bulk_option">
|
||
<option value="">{{{__('Bulk Action')}}}</option>
|
||
<option value="delete">{{{__('Delete')}}}</option>
|
||
</select>
|
||
<button class="btn btn-primary btn-sm" id="bulk_delete_btn">{{__('Apply')}}</button>
|
||
</div>
|
||
</div>
|
||
<table class="table table-default" id="all_blog_table">
|
||
<thead>
|
||
<th class="no-sort">
|
||
<div class="mark-all-checkbox">
|
||
<input type="checkbox" class="all-checkbox">
|
||
</div>
|
||
</th>
|
||
<th>{{__('ID')}}</th>
|
||
<th>{{__('Title')}}</th>
|
||
<th>{{__('Action')}}</th>
|
||
</thead>
|
||
<tbody>
|
||
@foreach($all_gallery as $data)
|
||
<tr>
|
||
<td>
|
||
<div class="bulk-checkbox-wrapper">
|
||
<input type="checkbox" class="bulk-checkbox" name="bulk_delete[]" value="{{$data->id}}">
|
||
</div>
|
||
</td>
|
||
<td>{{$data->id}}</td>
|
||
<td>{{$data->title}}</td>
|
||
<td>
|
||
<x-delete-popover :url="route('admin.video.gallery.delete',$data->id)"/>
|
||
<a href="#"
|
||
data-toggle="modal"
|
||
data-target="#testimonial_item_edit_modal"
|
||
class="btn btn-xs btn-primary btn-xs mb-3 mr-1 testimonial_edit_btn"
|
||
data-id="{{$data->id}}"
|
||
data-title="{{$data->title}}"
|
||
data-embedcode="{{$data->embed_code}}"
|
||
data-status="{{$data->status}}"
|
||
>
|
||
<i class="ti-pencil"></i>
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-lg-6 mt-5">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<h4 class="header-title">{{__('Add New Item')}}</h4>
|
||
<form action="{{route('admin.video.gallery.new')}}" method="post" enctype="multipart/form-data">
|
||
@csrf
|
||
<div class="form-group">
|
||
<label for="title">{{__('Title')}}</label>
|
||
<input type="text" name="title" id="title" class="form-control">
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="title">{{__('Video Embed Code')}}</label>
|
||
<textarea name="embed_code" class="form-control" cols="30" rows="5"></textarea>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="status">{{__('Status')}}</label>
|
||
<select name="status" class="form-control">
|
||
<option value="publish">{{__('Publish')}}</option>
|
||
<option value="draft">{{__('Draft')}}</option>
|
||
</select>
|
||
</div>
|
||
<button type="submit" class="btn btn-primary mt-4 pr-4 pl-4">{{__('Save Changes')}}</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="modal fade" id="testimonial_item_edit_modal" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h5 class="modal-title">{{__('Edit Testimonial Item')}}</h5>
|
||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||
</div>
|
||
<form action="{{route('admin.video.gallery.update')}}" id="testimonial_edit_modal_form" method="post" enctype="multipart/form-data">
|
||
<div class="modal-body">
|
||
@csrf
|
||
<input type="hidden" name="id" id="gallery_id">
|
||
|
||
<div class="form-group">
|
||
<label for="title">{{__('Title')}}</label>
|
||
<input type="text" name="title" id="title" class="form-control">
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="title">{{__('Video Embed Code')}}</label>
|
||
<textarea name="embed_code" class="form-control" cols="30" rows="5"></textarea>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="status">{{__('Status')}}</label>
|
||
<select name="status" class="form-control">
|
||
<option value="publish">{{__('Publish')}}</option>
|
||
<option value="draft">{{__('Draft')}}</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{__('Close')}}</button>
|
||
<button type="submit" class="btn btn-primary">{{__('Save Changes')}}</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endsection
|
||
@section('script')
|
||
|
||
<script>
|
||
$(document).ready(function () {
|
||
|
||
$(document).on('click','#bulk_delete_btn',function (e) {
|
||
e.preventDefault();
|
||
|
||
var bulkOption = $('#bulk_option').val();
|
||
var allCheckbox = $('.bulk-checkbox:checked');
|
||
var allIds = [];
|
||
allCheckbox.each(function(index,value){
|
||
allIds.push($(this).val());
|
||
});
|
||
if(allIds != '' && bulkOption == 'delete'){
|
||
$(this).text('{{__('Deleting...')}}');
|
||
$.ajax({
|
||
'type' : "POST",
|
||
'url' : "{{route('admin.video.gallery.bulk.action')}}",
|
||
'data' : {
|
||
_token: "{{csrf_token()}}",
|
||
ids: allIds
|
||
},
|
||
success:function (data) {
|
||
location.reload();
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
|
||
$('.all-checkbox').on('change',function (e) {
|
||
e.preventDefault();
|
||
var value = $('.all-checkbox').is(':checked');
|
||
var allChek = $(this).parent().parent().parent().parent().parent().find('.bulk-checkbox');
|
||
//have write code here fr
|
||
if( value == true){
|
||
allChek.prop('checked',true);
|
||
}else{
|
||
allChek.prop('checked',false);
|
||
}
|
||
});
|
||
|
||
$(document).on('click','.testimonial_edit_btn',function(){
|
||
var el = $(this);
|
||
var id = el.data('id');
|
||
|
||
var form = $('#testimonial_edit_modal_form');
|
||
form.find('#gallery_id').val(id);
|
||
form.find('input[name="title"]').val(el.data('title'));
|
||
form.find('textarea[name="embed_code"]').val(el.data('embedcode'));
|
||
form.find('select[name="status"] option[value="'+el.data('status')+'"]').attr('selected',true);
|
||
});
|
||
});
|
||
</script>
|
||
<!-- Start datatable js -->
|
||
<script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
|
||
<script src="//cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
|
||
<script src="//cdn.datatables.net/1.10.18/js/dataTables.bootstrap4.min.js"></script>
|
||
<script src="//cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
|
||
<script src="//cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap.min.js"></script>
|
||
<script>
|
||
$(document).ready(function() {
|
||
$('.table-wrap > table').DataTable( {
|
||
"order": [[ 1, "desc" ]],
|
||
'columnDefs' : [{
|
||
'targets' : 'no-sort',
|
||
'orderable' : false
|
||
}]
|
||
} );
|
||
} );
|
||
</script>
|
||
@endsection
|