added messages list, new client form, logic for client Apps plus others

This commit is contained in:
Kwesi Banson Jnr
2026-03-22 22:29:28 +00:00
parent c68c007945
commit 4ab0fda326
858 changed files with 242393 additions and 337 deletions

View File

@@ -0,0 +1,225 @@
@extends('layouts.master')
@section('page-title')
{{ $page_title }}
@endsection
@section('page-css')
<!-- <link href="https://unpkg.com/tabulator-tables@6.4.0/dist/css/tabulator.min.css" rel="stylesheet"> -->
<link href="{{ url('public/libs/tabulator-master/dist/css/tabulator_bootstrap5.css') }}" rel="stylesheet">
@endsetion
@section('content')
<section class="traffic-hero mb-4">
<div class="row g-4 align-items-end">
<div class="col-lg-8">
<div class="text-uppercase small fw-semibold opacity-75 mb-2">SMS Traffic Monitoring</div>
<!-- <h1 class="display-6 fw-semibold mb-3">Track every message your team sends.</h1>
<p class="fs-5 opacity-75 mb-0">
Search sent SMS, review delivery outcomes, inspect failed attempts, and give clients a fast audit trail for every campaign.
</p> -->
</div>
<div class="col-lg-4"></div>
</div>
</section>
<section class="row g-4">
<div class="col-xl-9">
<div class="filter-card mb-4">
<div class="d-flex flex-column flex-lg-row align-items-lg-center justify-content-between gap-3 mb-3">
<div>
<h2 class="h4 mb-1">Sent SMS list</h2>
<!-- <p class="text-secondary mb-0">Filter messages by date, sender, recipient, or delivery state.</p> -->
</div>
<!-- <div class="d-flex flex-wrap gap-2">
<button class="btn btn-ghost px-4"><i class="bi bi-download me-2"></i>Export CSV</button>
<button class="btn btn-click px-4"><i class="bi bi-funnel me-2"></i>Apply filters</button>
</div> -->
</div>
<div class="row g-3">
<div class="col-md-12">
<div class="float-end">
<label for="search" class="form-label fw-semibold">Search</label>
<input id="search" type="text" class="form-control" placeholder="Phone, sender ID, text">
</div>
</div>
</div>
</div>
<div class="traffic-table-card">
<div class="p-1">
<button id="download-pdf" class="btn btn-danger"><i class="bi bi-file-pdf-fill me-2"></i> Export PDF</button>
<button id="download-xlsx" class="btn btn-success"><i class="bi bi-file-excel-fill me-2"></i> Export Excel</button>
</div>
<div id="message-table"></div>
</div>
</div>
<div class="col-xl-3">
<aside class="detail-card">
<h2 class="h5 mb-3">Recent activity</h2>
<div class="timeline-item pt-0 mt-0 border-0">
<div class="fw-semibold">Sender ID approved</div>
<div class="muted-label">CLICKINFO added </div>
<div class="small text-secondary mt-1">09:04</div>
</div>
<div class="timeline-item">
<div class="fw-semibold">Campaign completed</div>
<div class="muted-label">[campaign name] batch finished</div>
<div class="small text-secondary mt-1">08:41</div>
</div>
</aside>
</div>
</section>
@endsection
@section('page-js')
<!-- <script src="https://unpkg.com/tabulator-tables@6.4.0/dist/js/tabulator.min.js"></script> -->
<script src="{{ url('public/libs/tabulator-master/dist/js/tabulator.min.js') }}"></script>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js"></script>
<script type="text/javascript" src="https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@2.3.1/build/global/luxon.min.js"></script>
<script>
// var table = new Tabulator("#message-table", {
// ajaxURL: base_url + "/client-traffic-tabulator/",
// ajaxResponse: function(url, params, response) {
// return response.content;
// },
// columns: [
// {title: "Sender ID", field: "from"},
// {title: "Msisdn", field: "to"},
// {title: "Message", field: "message"},
// {title: "Status", field: "status"},
// {title: "Delivery Status", field: "deliveryStatus"},
// // {title: "Created At", field: "createdAt"},
// {title:"Date Created ", field:"createdAt", formatter:"datetime", formatterParams:{
// inputFormat: "iso",
// outputFormat: "dd-MM-yyyy HH:mm:ss",
// invalidPlaceholder: "(invalid date)"
// }}
// ],
// });
// document.getElementById("download-pdf").addEventListener("click", function(){
// table.download("pdf", "messages.pdf", {
// orientation:"portrait", // portrait or landscape
// title:"Messages Export", // document title
// });
// });
// document.getElementById("download-xlsx").addEventListener("click", function(){
// table.download("xlsx", "messages.xlsx", {sheetName:"Messages"});
// });
</script>
<script>
function statusDesign (cell, formatterParams){
var value = cell.getValue();
// if(value === 'Approved'){
// console.log(value !== null);
if (value !== null) {
if(value.includes('SENT')){
return "<span style='color:#3FB449; font-weight:bold;'>" + value + "</span>";
}
// else if(value.includes('Active')){
// return "<span style='color:#3FB449; font-weight:bold;'>" + value + "</span>";
// }
else{
return "<span style='color:#E4A11B;'>" + value + "</span>";
}
}
}
var table = new Tabulator("#message-table", {
ajaxURL: base_url + "/client-traffic-tabulator/",
ajaxParams: {size: 20},
pagination: "remote",
paginationSize: 20,
paginationDataSent: {
"page": "page",
"size": "size"
},
paginationDataReceived: {
"last_page": "totalPages",
"data": "content",
"current_page": "number",
"total": "totalElements"
},
ajaxResponse: function(url, params, response) {
return response.content;
},
columns: [
{title: "Sender", field: "from"},
{title: "Msisdn", field: "to"},
// {title: "Message", field: "message"},
{title:"Message", field:"message" ,formatter:"textarea"},
// {title: "Status", field: "status"},
{title: "Delivery Status", field: "deliveryStatus", formatter: statusDesign},
// {title: "Created At", field: "createdAt"},
{title:"Date Created ", field:"createdAt", formatter:"datetime", formatterParams:{
inputFormat: "iso",
outputFormat: "dd-MM-yyyy HH:mm:ss",
invalidPlaceholder: "(invalid date)"
}}
],
});
</script>
<script>
// var table = new Tabulator("#message-table", {
// ajaxURL: base_url + "/client-traffic-tabulator/",
// pagination: "remote",
// paginationSize: 20,
// paginationDataSent: {
// "page": "page",
// "size": "size"
// },
// paginationDataReceived: {
// "last_page": "totalPages",
// "data": "content",
// "current_page": "number",
// "total": "totalElements"
// },
// // Sorting configuration
// ajaxSorting: true,
// sortMode: "remote",
// ajaxRequestFunc: function(url, config, params) {
// let query = {
// page: params.page - 1,
// size: params.size,
// };
// if (params.sorters && params.sorters.length > 0) {
// let sorter = params.sorters[0];
// query.sort = sorter.field + "," + sorter.dir;
// // Laravel/Spring style: ?sort=createdAt,asc
// }
// // Build query string
// let qs = Object.keys(query)
// .map(k => encodeURIComponent(k) + "=" + encodeURIComponent(query[k]))
// .join("&");
// return url + "?" + qs;
// },
// ajaxResponse: function(url, params, response) {
// return response.content;
// },
// columns: [
// {title: "ID", field: "id", sorter: "number"},
// {title: "Client ID", field: "clientId", sorter: "number"},
// {title: "From", field: "from", sorter: "string"},
// {title: "To", field: "to", sorter: "string"},
// {title: "Message", field: "message", sorter: "string"},
// {title: "Status", field: "status", sorter: "string"},
// {title: "Delivery Status", field: "deliveryStatus", sorter: "string"},
// {title: "Created At", field: "createdAt", sorter: "datetime"},
// ],
// });
</script>
@endsection