|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/parassaas.edukrypt.in/resources/views/admin/ebook/ |
Upload File : |
@extends('admin.layout')
@section('content')
<!-- begin::main content -->
<main class="main-content">
<div class="container">
<!-- begin::page header -->
<div class="page-header">
<h3>Mapping Ebook List</h3>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ asset('dashboard') }}">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Mapping Ebook List</li>
</ol>
</nav>
</div>
<!-- end::page header -->
<div class="card">
<div class="card-header">
<form action="" method="GET">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" style="width: 300px;" class="form-control pull-left"
name="query" placeholder="Search here....."
value="{{ request()->input('query') }}">
<span class="text-danger">
@error('query')
{{ $message }}
@enderror
</span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<a href="{{ asset('admin/ebook-map-list') }}"
class="btn btn-warning text-white pull-right">
<i class="fa fa-refresh"></i> Reset
</a>
<button type="submit" class="btn text-white btn-primary m-r-10 pull-right">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
</form>
</div>
<div class="card-body">
<?php
$permission = App\Helpers\PermissionActivity::getPermissionByAdminId(session('loggedIn')['id'], 15);
?>
<div class="row">
<div class="col-md-3">
{{-- Video Tag Mapping --}}
<select multiple="multiple" class="form-control" name="tags[]" id="tag">
@if (!empty($tags))
@foreach ($tags as $tag)
<option value="{{ $tag->name }}">{{ $tag->name }}</option>
@endforeach
@endif
</select>
</div>
<div class="col-md-3">
<button id="assignTags" class="btn btn-info pull-left">Assign Tags</button>
</div>
<div class="col-md-6">
@if ($permission == 'delete')
<a href="javascript:;" id="delete_videos" class="btn btn-danger text-white pull-right">
<i class="fa fa-trash-o"></i></a>
<a href="{{ asset('admin/add-mapping-ebook') }}"
class="form-group btn btn-primary text-white pull-right m-r-10">
<i class="fa fa-book"></i> Mapping Ebook
</a>
@endif
</div>
</div>
<div class="table-responsive">
@if (isset($products))
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>
<input class="boxcheckAll" type="checkbox" name="boxcheckAll">
</th>
<th>Id</th>
<th>Name</th>
<th>Public</th>
<th>Type</th>
<th>Path</th>
<th>Tags</th>
<th>size</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@if (!empty($products))
@foreach ($products as $product)
<tr>
<td>
<input class="boxselect" type="checkbox" value="{{ $product->id }}"
name="boxselect[]" />
</td>
<td>{{ $product->id }}</td>
<td>{{ $product->filename }}</td>
<td>{{ $product->public_name }}</td>
<td>{{ $product->type }}</td>
<td>{{ $product->path }}</td>
<td>
@if (!empty($product->tags))
@php
$arrTags = explode(',', $product->tags);
foreach ($arrTags as $arrTag) {
echo "<span class='badge badge-pill badge-secondary'>$arrTag</span>";
}
@endphp
@endif
</td>
<td>{{ $product->size }}</td>
{{-- <td>{{$product->date}}</td> --}}
<td>
<?php
$permission = App\Helpers\PermissionActivity::getPermissionByAdminId(session('loggedIn')['id'], 15);
?>
@if ($permission == 'read')
<a href="{{ asset('admin/view-product/' . $product->id) }}"><i
class="fa fa-eye text-primary"></i></a>
@endif
@if ($permission == 'write')
<a href="{{ asset('admin/view-product/' . $product->id) }}"><i
class="fa fa-eye text-primary"></i></a>
<a href="{{ asset('admin/edit-product/' . $product->id) }}"><i
class="fa fa-edit text-success"></i></a>
@endif
@if ($permission == 'delete')
{{-- <a href="{{asset('admin/view-product/'.$product->id)}}"><i class="fa fa-eye text-primary"></i></a> --}}
{{-- <a href="{{asset('admin/edit-product/'.$product->id)}}"><i class="fa fa-edit text-success"></i></a> --}}
<a href="{{ asset('admin/delete-mapping-ebook/' . $product->etag) }}"
class="delete-confirm"><i
class="fa fa-trash text-danger"></i></a>
@endif
</td>
</tr>
@endforeach
@else
<h1>No Record Found!!</h1>
@endif
</tbody>
</table>
@endif
</div>
<div class="pagination-block">
@if (isset($_GET['query']))
{{ $products->appends(['query' => $_GET['query']])->links('admin.includes.paginationlinks') }}
@else
{{ $products->links('admin.includes.paginationlinks') }}
@endif
<label>Total Record Found- <?php echo count($products); ?></label>
</div>
</div>
</div>
</div>
</main>
<!-- end::main content -->
@endsection
@push('footer-script')
<!-- begin::dataTable -->
<link rel="stylesheet" href="{{ asset('public/admin/vendors/select2/css/select2.min.css') }}" type="text/css">
<script src="{{ asset('public/admin/vendors/select2/js/select2.min.js') }}"></script>
<script src="{{ asset('public/admin/js/examples/datatable.js') }}"></script>
<script>
$(document).ready(function() {
$('#assignTags').click(function() {
var tags = $("#tag").val();
var ebook_ids = [];
$('.boxselect:checked').each(function(i) {
ebook_ids[i] = $(this).val();
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "post",
data: {
'tags': tags,
'ebook_ids': ebook_ids
},
url: "{{ asset('admin/assign-ebook-multiple-tags') }}",
success: function(result) {
if (result)
location.reload();
else
toastr.warning('Please select tags & ebooks!');
// location.reload();
}
});
});
$('#tag').select2({
placeholder: 'Select',
tokenSeparators: [',', ' ']
});
// Select ALL
$('#multialldelete').change(function() {
if ($(this).prop('checked')) {
$(".checkBoxClass").prop('checked', true);
} else {
$(".checkBoxClass").prop('checked', false);
}
//console.log($(".checkBoxClass").val());
});
// Multiple Delete
$('#delete_videos').click(function() {
var ebook_ids = [];
$('.boxselect:checked').each(function(i) {
ebook_ids[i] = $(this).val();
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "POST",
data: {
'ebookids': ebook_ids,
},
url: "{{ asset('admin/delete-mapping-ebook-all') }}",
beforeSend: function() {
$('#delete_videos').html(
'<i class="fa fa-spinner fa-pulse"></i> Please Wait....');
},
success: function(result) {
$('#delete_videos').html(
'<i class="fa fa-trash-o"></i> Multiple Delete');
location.reload();
}
});
});
$('#sync_video').click(function() {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var foldername = $(this).data("foldername");
$.ajax({
type: "GET",
data: {
'foldername': foldername,
},
url: "{{ asset('admin/ebooklistobjects') }}",
beforeSend: function() {
$('#sync_video').html(
'<i class="fa fa-spinner fa-pulse"></i> Please Wait....');
},
success: function(result) {
$('#sync_video').html('<i class="fa fa-refresh"></i> Sync Ebooks');
location.reload();
}
});
});
});
</script>
<!-- end::dataTable -->
@endpush