<?php $__env->startSection('title', __('locale.menu.SMS History')); ?>
<?php $__env->startSection('vendor-style'); ?>
<link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/tables/datatable/dataTables.bootstrap5.min.css'))); ?>">
<link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/tables/datatable/responsive.bootstrap5.min.css'))); ?>">
<link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/tables/datatable/buttons.bootstrap5.min.css'))); ?>">
<link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/extensions/sweetalert2.min.css'))); ?>">
<link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/pickers/flatpickr/flatpickr.min.css'))); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-style'); ?>
<link rel="stylesheet" href="<?php echo e(asset(mix('css/base/plugins/forms/pickers/form-flat-pickr.css'))); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<!-- Basic table -->
<section id="datatables-basic">
<div class="mb-3 mt-2">
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view sms_history')): ?>
<div class="btn-group">
<button
class="btn btn-primary fw-bold dropdown-toggle"
type="button"
id="bulk_actions"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<?php echo e(__('locale.labels.actions')); ?>
</button>
<div class="dropdown-menu" aria-labelledby="bulk_actions">
<a class="dropdown-item bulk-delete" href="#"><i data-feather="trash"></i> <?php echo e(__('locale.datatables.bulk_delete')); ?></a>
</div>
</div>
<?php endif; ?>
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view sms_history')): ?>
<div class="btn-group">
<a href="#" class="btn btn-info waves-light waves-effect fw-bold mx-1" data-bs-toggle="modal" data-bs-target="#exportData"> <?php echo e(__('locale.buttons.export')); ?> <i data-feather="file-text"></i></a>
</div>
<div class="modal fade" id="exportData" tabindex="-1" role="dialog" aria-labelledby="addSendingSever" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel33"><?php echo e(__('locale.buttons.export')); ?></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="<?php echo e(route('admin.reports.export')); ?>" method="post">
<?php echo csrf_field(); ?>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="mb-1">
<label for="start-date-picker" class="form-label"><?php echo e(__('locale.labels.start_time')); ?>:</label>
<input type="text" id="start-date-picker" name="start_date" class="form-control date_picker" placeholder="YYYY-MM-DD"/>
</div>
</div>
<div class="col-md-6">
<div class="mb-1">
<label for="start-time-picker" class="form-label"></label>
<input type="text" id="start-time-picker" class="form-control time_picker text-left" name="start_time" placeholder="HH:MM"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-1">
<label for="end-date-picker" class="form-label"><?php echo e(__('locale.labels.end_time')); ?>:</label>
<input type="text" id="end-date-picker" name="end_date" class="form-control date_picker" placeholder="YYYY-MM-DD"/>
</div>
</div>
<div class="col-md-6">
<div class="mb-1">
<label for="end-time-picker" class="form-label"></label>
<input type="text" id="end-time-picker" class="form-control time_picker text-left" name="end_time" placeholder="HH:MM"/>
</div>
</div>
</div>
<div class="mb-1">
<label class="form-label"><?php echo e(__('locale.labels.direction')); ?>: </label>
<select class="form-select" name="direction">
<option value="from"><?php echo e(__('locale.labels.outgoing')); ?></option>
<option value="to"><?php echo e(__('locale.labels.incoming')); ?></option>
<option value="api"><?php echo e(__('locale.labels.api')); ?></option>
</select>
</div>
<div class="mb-1">
<label class="form-label"><?php echo e(__('locale.labels.type')); ?>: </label>
<select class="form-select" name="type">
<option value="plain"><?php echo e(__('locale.labels.plain')); ?></option>
<option value="voice"><?php echo e(__('locale.labels.voice')); ?></option>
<option value="mms"><?php echo e(__('locale.labels.mms')); ?></option>
<option value="whatsapp"><?php echo e(__('locale.labels.whatsapp')); ?></option>
</select>
</div>
<div class="mb-1">
<label class="form-label"><?php echo e(__('locale.labels.status')); ?>: </label>
<input type="text" name="status" class="form-control">
</div>
<div class="mb-1">
<label class="form-label"><?php echo e(__('locale.labels.to')); ?>: </label>
<input type="text" name="to" class="form-control">
</div>
<div class="mb-1">
<label class="form-label"><?php echo e(__('locale.labels.from')); ?>: </label>
<input type="text" name="from" class="form-control">
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary"><i data-feather="file-text"></i> <?php echo e(__('locale.labels.generate')); ?></button>
</div>
</form>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<table class="table datatables-basic">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th><?php echo e(__('locale.labels.date')); ?></th>
<th><?php echo e(__('locale.menu.Customer')); ?> </th>
<th><?php echo e(__('locale.labels.direction')); ?> </th>
<th><?php echo e(__('locale.labels.type')); ?> </th>
<th><?php echo e(__('locale.labels.from')); ?></th>
<th><?php echo e(__('locale.labels.to')); ?></th>
<th><?php echo e(__('locale.labels.cost')); ?></th>
<th><?php echo e(__('locale.labels.sending_server')); ?></th>
<th><?php echo e(__('locale.labels.status')); ?></th>
<th><?php echo e(__('locale.labels.actions')); ?></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</section>
<!--/ Basic table -->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('vendor-script'); ?>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/jquery.dataTables.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/dataTables.bootstrap5.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/dataTables.responsive.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/responsive.bootstrap5.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/datatables.checkboxes.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/datatables.buttons.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/buttons.html5.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/tables/datatable/dataTables.rowGroup.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/pickers/flatpickr/flatpickr.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/extensions/sweetalert2.all.min.js'))); ?>"></script>
<script src="<?php echo e(asset(mix('vendors/js/extensions/polyfill.min.js'))); ?>"></script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script'); ?>
<script>
$(document).ready(function () {
"use strict"
let datePicker = $('.date_picker'),
timePicker = $('.time_picker');
if (datePicker.length) {
datePicker.flatpickr({
maxDate: "today",
dateFormat: "Y-m-d",
});
}
if (timePicker.length) {
timePicker.flatpickr({
enableTime: true,
noCalendar: true,
dateFormat: "H:i",
});
}
//show response message
function showResponseMessage(data) {
if (data.status === 'success') {
toastr['success'](data.message, '<?php echo e(__('locale.labels.success')); ?>!!', {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
dataListView.draw();
} else {
toastr['warning']("<?php echo e(__('locale.exceptions.something_went_wrong')); ?>", '<?php echo e(__('locale.labels.warning')); ?>!', {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
}
}
// init table dom
let Table = $("table");
// init list view datatable
let dataListView = $('.datatables-basic').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "<?php echo e(route('admin.reports.search.all')); ?>",
"dataType": "json",
"type": "POST",
"data": {_token: "<?php echo e(csrf_token()); ?>"}
},
"columns": [
{"data": 'responsive_id', orderable: false, searchable: false},
{"data": "uid"},
{"data": "uid"},
{"data": "created_at"},
{"data": "user_id"},
{"data": "send_by"},
{"data": "sms_type"},
{"data": "from"},
{"data": "to"},
{"data": "cost"},
{"data": "sending_server_id", orderable: false, searchable: false},
{"data": "status"},
{"data": "action", orderable: false, searchable: false}
],
searchDelay: 1500,
columnDefs: [
{
// For Responsive
className: 'control',
orderable: false,
responsivePriority: 2,
targets: 0
},
{
// For Checkboxes
targets: 1,
orderable: false,
responsivePriority: 3,
render: function (data) {
return (
'<div class="form-check"> <input class="form-check-input dt-checkboxes" type="checkbox" value="" id="' +
data +
'" /><label class="form-check-label" for="' +
data +
'"></label></div>'
);
},
checkboxes: {
selectAllRender:
'<div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="checkboxSelectAll" /><label class="form-check-label" for="checkboxSelectAll"></label></div>',
selectRow: true
}
},
{
targets: 2,
visible: false
},
{
// Avatar image/badge, Name and post
targets: 4,
responsivePriority: 1,
render: function (data, type, full) {
let $user_img = full['avatar'],
$name = full['user_id'],
$email = full['email'];
let $output = '<img src="' + $user_img + '" alt="Avatar" width="32" height="32">';
let colorClass = $user_img === '' ? ' bg-light-' + $state + ' ' : '';
// Creates full output for row
return '<div class="d-flex justify-content-left align-items-center">' +
'<div class="avatar ' +
colorClass +
' me-1">' +
$output +
'</div>' +
'<div class="d-flex flex-column">' +
'<span class="emp_name text-truncate fw-bold">' +
$name +
'</span>' +
'<small class="emp_post text-truncate text-muted">' +
$email +
'</small>' +
'</div>' +
'</div>';
}
},
{
// Actions
targets: -1,
title: '<?php echo e(__('locale.labels.actions')); ?>',
orderable: false,
render: function (data, type, full) {
return (
'<span class="action-delete text-danger pe-1 cursor-pointer" data-id=' + full['uid'] + '>' +
feather.icons['trash'].toSvg({class: 'font-medium-4'}) +
'</span>' +
'<span class="action-view text-primary pe-1 cursor-pointer" data-id=' + full['uid'] + '>' +
feather.icons['eye'].toSvg({class: 'font-medium-4'}) +
'</span>'
);
}
}
],
dom: '<"d-flex justify-content-between align-items-center mx-0 row"<"col-sm-12 col-md-6"l><"col-sm-12 col-md-6"f>>t<"d-flex justify-content-between mx-0 row"<"col-sm-12 col-md-6"i><"col-sm-12 col-md-6"p>>',
language: {
paginate: {
// remove previous & next text from pagination
previous: ' ',
next: ' '
},
sLengthMenu: "_MENU_",
sZeroRecords: "<?php echo e(__('locale.datatables.no_results')); ?>",
sSearch: "<?php echo e(__('locale.datatables.search')); ?>",
sProcessing: "<?php echo e(__('locale.datatables.processing')); ?>",
sInfo: "<?php echo e(__('locale.datatables.showing_entries', ['start' => '_START_', 'end' => '_END_', 'total' => '_TOTAL_'])); ?>"
},
responsive: {
details: {
type: 'column',
renderer: function (api, rowIdx, columns) {
let data = $.map(columns, function (col) {
return col.title !== '' // ? Do not show row in modal popup if title is blank (for check box)
? '<tr data-dt-row="' +
col.rowIdx +
'" data-dt-column="' +
col.columnIndex +
'">' +
'<td>' +
col.title +
':' +
'</td> ' +
'<td>' +
col.data +
'</td>' +
'</tr>'
: '';
}).join('');
return data ? $('<table class="table"/>').append('<tbody>' + data + '</tbody>') : false;
}
}
},
aLengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
select: {
style: "multi"
},
order: [[2, "desc"]],
displayLength: 10,
});
// On view
Table.delegate(".action-view", "click", function (e) {
e.stopPropagation();
let id = $(this).data('id');
$.ajax({
url: "<?php echo e(url(config('app.admin_path').'/reports')); ?>" + '/' + id + '/view',
type: "POST",
data: {
_token: "<?php echo e(csrf_token()); ?>"
},
success: function (data) {
Swal.fire({
html: `<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td width="35%"><?php echo e(__('locale.labels.from')); ?></td>
<td>` + data.data.from + `</td>
</tr>
<tr>
<td width="35%"><?php echo e(__('locale.labels.to')); ?></td>
<td>` + data.data.to + `</td>
</tr>
<tr>
<td width="35%"><?php echo e(__('locale.labels.message')); ?></td>
<td>` + data.data.message + `</td>
</tr>
<tr>
<td width="35%"><?php echo e(__('locale.labels.type')); ?></td>
<td>` + data.data.sms_type + `</td>
</tr>
<tr>
<td width="35%"><?php echo e(__('locale.labels.status')); ?></td>
<td>` + data.data.status + `</td>
</tr>
<tr>
<td width="35%"><?php echo e(__('locale.labels.cost')); ?></td>
<td>` + data.data.cost + `</td>
</tr>
</tbody>
</table>
</div>
`
})
},
error: function (reject) {
if (reject.status === 422) {
let errors = reject.responseJSON.errors;
$.each(errors, function (key, value) {
toastr['warning'](value[0], "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
});
} else {
toastr['warning'](reject.responseJSON.message, "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
}
}
})
});
// On Delete
Table.delegate(".action-delete", "click", function (e) {
e.stopPropagation();
let id = $(this).data('id');
Swal.fire({
title: "<?php echo e(__('locale.labels.are_you_sure')); ?>",
text: "<?php echo e(__('locale.labels.able_to_revert')); ?>",
icon: 'warning',
showCancelButton: true,
confirmButtonText: "<?php echo e(__('locale.labels.delete_it')); ?>",
customClass: {
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-outline-danger ms-1'
},
buttonsStyling: false,
}).then(function (result) {
if (result.value) {
$.ajax({
url: "<?php echo e(url(config('app.admin_path').'/reports')); ?>" + '/' + id + '/destroy',
type: "POST",
data: {
_token: "<?php echo e(csrf_token()); ?>"
},
success: function (data) {
showResponseMessage(data);
},
error: function (reject) {
if (reject.status === 422) {
let errors = reject.responseJSON.errors;
$.each(errors, function (key, value) {
toastr['warning'](value[0], "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
});
} else {
toastr['warning'](reject.responseJSON.message, "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
}
}
})
}
})
});
//Bulk Delete
$(".bulk-delete").on('click', function (e) {
e.preventDefault();
Swal.fire({
title: "<?php echo e(__('locale.labels.are_you_sure')); ?>",
text: "<?php echo e(__('locale.campaigns.delete_sms')); ?>",
icon: 'warning',
showCancelButton: true,
confirmButtonText: "<?php echo e(__('locale.labels.delete_selected')); ?>",
customClass: {
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-outline-danger ms-1'
},
buttonsStyling: false,
}).then(function (result) {
if (result.value) {
let sms_ids = [];
let rows_selected = dataListView.column(1).checkboxes.selected();
$.each(rows_selected, function (index, rowId) {
sms_ids.push(rowId)
});
if (sms_ids.length > 0) {
$.ajax({
url: "<?php echo e(route('admin.reports.batch_action')); ?>",
type: "POST",
data: {
_token: "<?php echo e(csrf_token()); ?>",
action: 'destroy',
ids: sms_ids
},
success: function (data) {
showResponseMessage(data);
},
error: function (reject) {
if (reject.status === 422) {
let errors = reject.responseJSON.errors;
$.each(errors, function (key, value) {
toastr['warning'](value[0], "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
});
} else {
toastr['warning'](reject.responseJSON.message, "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
}
}
})
} else {
toastr['warning']("<?php echo e(__('locale.labels.at_least_one_data')); ?>", "<?php echo e(__('locale.labels.attention')); ?>", {
closeButton: true,
positionClass: 'toast-top-right',
progressBar: true,
newestOnTop: true,
rtl: isRtl
});
}
}
})
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts/contentLayoutMaster', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bouloter/sms/resources/views/admin/Reports/all_messages.blade.php ENDPATH**/ ?>