<?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.admin.header','data' => []]); ?>
<?php $component->withName('admin.header'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
<?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.admin.sidebar','data' => []]); ?>
<?php $component->withName('admin.sidebar'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
<style>
.input-field .img-upload-btn
{
margin: 10px;
}
td.col-img
{
display: flex;
}
td.col-img h6
{
position: relative;
margin: 10px 0px 0px 10px !important;
}
</style>
<div class="main-content">
<div class="graph-card card-table" id="TestiList">
<div class="card-head">
<div class="text-content">
<h5>Testimonials</h5>
</div>
<div class="card-drp">
<div class="btn-content btn-group" role="group" aria-label="Basic example">
<?php if(Auth::user()->type == 'admin'): ?>
<a href="add_testimonial"><button type="button" class="btn active">Add New</button></a>
<?php endif; ?>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive table-scroll">
<table class="table-management">
<thead>
<tr>
<th>#</th>
<th>Testimonial Text</th>
<th>Rating</th>
<th>Status</th>
<th>Image</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $testimonials; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $testi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td>
<?php echo e($testi->testimonial_id); ?>
</td>
<td>
<?php echo Str::of($testi->testimonial_text)->limit(40); ?>
</td>
<td>
<?php echo e($testi->testimonial_rating); ?>
</td>
<td>
<?php if($testi->testimonial_status == 1): ?>
<h6>Active</h6>
<?php else: ?>
<h6>Un Active</h6>
<?php endif; ?>
</td>
<td>
<?php if(!empty($testi->client_image)): ?>
<img src="<?php echo e(asset('storage/images/'.$testi->client_image)); ?>">
<?php endif; ?>
</td>
<td>
<button class="refresh-btn edit-btnn" data-tooltip="Edit" data-testimonial_id="<?php echo e($testi->testimonial_id); ?>"
data-client_name="<?php echo e($testi->client_name); ?>"
data-client_position="<?php echo e($testi->client_position); ?>"
data-client_image="<?php echo e($testi->client_image); ?>"
data-testimonial_text="<?php echo e($testi->testimonial_text); ?>"
data-testimonial_rating="<?php echo e($testi->testimonial_rating); ?>"
data-testimonial_status="<?php echo e($testi->testimonial_status); ?>">
<i class="fa-regular fa-pencil"></i>
</button>
<!-- <button class="delete-btn btn_del" value="<?php echo e($testi->testimonial_id); ?>" data-tooltip="Delete">
<i class="fa-regular fa-xmark"></i>
</button> -->
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<div class="pagination">
</div>
</div>
</div>
</div>
<!-- Model Start Here -->
<div class="modal fade" id="edit-testi" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="edit-dialogLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<form id="update-form">
<?php echo csrf_field(); ?>
<div class="modal-header">
<h5 class="modal-title" id="edit-dialogLabel">Update Testimonial</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="form-content">
<div class="row">
<div class="col-12">
<input type="hidden" name="TestiId" id="TestiId">
</div>
<div class="col-12">
<div class="input-field">
<label for="">Client Name</label>
<input class="custom-input" type="text" name="ClientName" id="ClientName" value="">
</div>
</div>
<div class="col-12">
<div class="input-field">
<label for="">Client Position</label>
<input class="custom-input" type="text" name="ClientPosition" id="ClientPosition" value="">
</div>
</div>
<div class="col-12">
<div class="input-field">
<label for="">Testimonial Text</label>
<textarea class="custom-input ckeditor" type="text" name="TestiText" id="TestiText"></textarea>
</div>
</div>
<div class="col-12">
<div class="input-field">
<label for="">Client Rating</label>
<select name="ClientRating" class="form-control custom-input" id="ClientRating">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
</div>
<div class="col-12">
<div class="input-field">
<label for="">Testimonial Status</label>
<select name="TestimonialStatus" class="form-control custom-input" id="TestimonialStatus">
<option value="1">Active</option>
<option value="0">Un-Active</option>
</select>
</div>
</div>
<div class="col-12">
<div class="input-field">
<label for="">Change Client Image</label>
<div class="img-upload-wrapper">
<input class="img-upload" type="file" name="UpdtClientImg" id="modal-avatar-upload">
<input class="img-upload" type="hidden" name="PrevClientImg" id="PrevClientImg">
<!-- <img class="img-fluid avatar-img" src="images/placeholder.jpg" alt="" > -->
</div>
<div class="btn-wrapper">
<label class="btn img-upload-btn" for="modal-avatar-upload">Select
Image</label>
</div>
<label for="vehicle1">Remove Client Image</label>
<div class="custom-checkbox">
<input type="checkbox" id="removeImg" name="removeImg">
<span class="checkmark"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-cancel" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-process">Update Changes</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(".edit-btnn").click(function () {
$("#edit-testi").modal('show');
var id = $(this).data('testimonial_id');
var name = $(this).data('client_name');
var position = $(this).data('client_position');
var image = $(this).data('client_image');
var text = $(this).data('testimonial_text');
var rating = $(this).data('testimonial_rating');
var status = $(this).data('testimonial_status');
CKEDITOR.instances['TestiText'].setData(text);
$("#TestiId").val(id);
$("#ClientName").val(name);
$("#ClientPosition").val(position);
$("#ClientRating").val(rating);
$("#TestimonialStatus").val(status);
$("#PrevClientImg").val(image);
})
</script>
<!-- Model End Here -->
<!-- Update Work Start Here -->
<script>
$(document).ready(function(){
$("#update-form").on('submit',function(e){
e.preventDefault();
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
var data = new FormData(this);
$.ajax({
url: "update_testimonial",
method: "POST",
data: data,
cache: false,
contentType: false,
processData: false,
success:function(data)
{
if($.isEmptyObject(data.error))
{
toastr.success(data.success,"Updated",{timeOut: 1500});
document.getElementById('update-form').reset();
$("#edit-testi").modal('hide');
$("#TestiList").load(location.href+" #TestiList>*","");
}
else if(data.error.TestiText)
{
toastr.error(data.error.TestiText,"Error",{timeOut: 1500});
return false;
}
else if(data.error.ClientRating)
{
toastr.error(data.error.ClientRating,"Error",{timeOut: 1500});
return false;
}
else if(data.error.UpdtClientImg)
{
toastr.error(data.error.UpdtClientImg,"Error",{timeOut: 1500});
return false;
}
else if(data.error.UpdtClientImg[1])
{
toastr.error(data.error.UpdtClientImg[1],"Error",{timeOut: 1500});
return false;
}
},
error:function()
{
toastr.error("SomeThing Went Wrong...","Error");
return false;
},
});
});
});
</script>
<!-- Update Work End Here -->
<!-- Delete Work Start Here -->
<script>
$(document).ready(function(){
$('body').on('click', '.btn_del', function(e){
e.preventDefault();
var id = $(this).val();
$.ajax({
url: "delete_testimonial",
method: "GET",
data: {'id': id},
cache: false,
success:function()
{
toastr.success("Testimonial Deleted Successfuly","Deleted",{timeOut: 1500});
$("#TestiList").load(location.href+" #TestiList>*","");
},
error:function()
{
toastr.error("SomeThing Went Wrong...","Error");
return false;
},
});
});
});
</script>
<!-- Delete Work End Here -->
<?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.admin.footer','data' => []]); ?>
<?php $component->withName('admin.footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?><?php /**PATH /home/wpdeatle/public_html/easy-buyer/resources/views/admin/testimonial.blade.php ENDPATH**/ ?>