309 lines
18 KiB
PHP
309 lines
18 KiB
PHP
@extends('layouts.masterbeta')
|
|
|
|
@section('title', 'Click ERP - SMS Sender IDs')
|
|
|
|
@push('styles')
|
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
|
<style>
|
|
/* Keep your existing styles here... */
|
|
|
|
/* Select2 Bootstrap 5 / Custom tweaks */
|
|
.select2-container .select2-selection--single {
|
|
height: 38px;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.375rem;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
|
height: 36px;
|
|
}
|
|
|
|
.network-badge { font-size: 0.65rem; padding: 0.2rem 0.4rem; border-radius: 4px; border: 1px solid #e2e8f0; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
|
|
.net-approved { background-color: rgba(16, 185, 129, 0.1); color: #10b981; border-color: rgba(16, 185, 129, 0.2); }
|
|
.net-pending { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; border-color: rgba(245, 158, 11, 0.2); }
|
|
.net-rejected { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
|
|
|
|
.sender-id-text { font-family: monospace; font-size: 1.1rem; letter-spacing: 1px; color: #111425; }
|
|
</style>
|
|
@endpush
|
|
|
|
@section('breadcrumbs')
|
|
<a href="{{ url('/') }}" class="text-secondary text-decoration-none"><i class="bi bi-house me-2"></i></a>
|
|
<i class="bi bi-chevron-right text-secondary me-2" style="font-size: 0.8rem;"></i>
|
|
<a href="#" class="text-secondary text-decoration-none me-2" style="font-size: 0.95rem;">Operations</a>
|
|
<i class="bi bi-chevron-right text-secondary me-2" style="font-size: 0.8rem;"></i>
|
|
<span class="fw-bold" style="font-size: 0.95rem;">Sender IDs</span>
|
|
@endsection
|
|
|
|
@section('content')
|
|
<!-- Page Header -->
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<div>
|
|
<h4 class="fw-bold mb-1">SMS Sender IDs</h4>
|
|
<p class="text-secondary mb-0" style="font-size: 0.9rem;">Manage alphanumeric masks, shortcodes, and MNO registration statuses.</p>
|
|
</div>
|
|
<button class="btn text-white fw-bold d-flex align-items-center" style="background-color: #5c4df0; border-radius: 8px;" id="btnOpenSenderModal">
|
|
<i class="bi bi-plus-lg me-2"></i> Add Sender ID
|
|
</button>
|
|
</div>
|
|
|
|
<!-- KPIs -->
|
|
<!-- KPIs -->
|
|
<div class="row g-4 mb-4">
|
|
<div class="col-xl-3 col-md-6">
|
|
<div class="content-card p-3 h-100 border-start border-4 border-0" style="border-left-color: #5c4df0 !important;">
|
|
<div class="text-secondary fw-bold mb-1" style="font-size: 0.75rem; letter-spacing: 0.5px;">TOTAL SENDER IDs</div>
|
|
<h3 class="fw-bold mb-0">{{ $totalCount }}</h3>
|
|
</div>
|
|
</div>
|
|
<div class="col-xl-3 col-md-6">
|
|
<div class="content-card p-3 h-100 border-start border-4 border-0" style="border-left-color: #10b981 !important;">
|
|
<div class="text-secondary fw-bold mb-1" style="font-size: 0.75rem; letter-spacing: 0.5px;">FULLY APPROVED</div>
|
|
<h3 class="fw-bold mb-0">{{ $approvedCount }}</h3>
|
|
</div>
|
|
</div>
|
|
<div class="col-xl-3 col-md-6">
|
|
<div class="content-card p-3 h-100 border-start border-4 border-0" style="border-left-color: #f59e0b !important;">
|
|
<div class="text-secondary fw-bold mb-1" style="font-size: 0.75rem; letter-spacing: 0.5px;">APPLIED</div>
|
|
<h3 class="fw-bold mb-0">{{ $pendingCount }}</h3>
|
|
</div>
|
|
</div>
|
|
<div class="col-xl-3 col-md-6">
|
|
<div class="content-card p-3 h-100 border-start border-4 border-0" style="border-left-color: #ef4444 !important;">
|
|
<div class="text-secondary fw-bold mb-1" style="font-size: 0.75rem; letter-spacing: 0.5px;">REJECTED / BLOCKED</div>
|
|
<h3 class="fw-bold mb-0">{{ $rejectedCount }}</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Data Table -->
|
|
<div class="content-card">
|
|
<div class="p-3 border-bottom bg-light bg-opacity-50">
|
|
<form action="{{ route('senderids.index') }}" method="GET">
|
|
<div class="row g-3">
|
|
<div class="col-md-5">
|
|
<div class="input-group">
|
|
<span class="input-group-text bg-white border-end-0 text-secondary"><i class="bi bi-search"></i></span>
|
|
<input type="text" name="search" value="{{ request('search') }}" class="form-control bg-white border-start-0 ps-0" placeholder="Search by sender ID, MNO, or supplier...">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<select name="direct_mno" class="form-select bg-white" onchange="this.form.submit()">
|
|
<option value="">Direct MNO: All</option>
|
|
<option value="YES" {{ request('direct_mno') == 'YES' ? 'selected' : '' }}>YES</option>
|
|
<option value="NO" {{ request('direct_mno') == 'NO' ? 'selected' : '' }}>NO</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<select name="status" class="form-select bg-white" onchange="this.form.submit()">
|
|
<option value="">Status: All</option>
|
|
<option value="Approved" {{ request('status') == 'Approved' ? 'selected' : '' }}>Approved</option>
|
|
<option value="Applied" {{ request('status') == 'Applied' ? 'selected' : '' }}>Applied</option>
|
|
<option value="Rejected" {{ request('status') == 'Rejected' ? 'selected' : '' }}>Rejected</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<button type="submit" class="btn text-white w-100" style="background-color: #5c4df0;">
|
|
<i class="bi bi-funnel"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-custom table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Sender ID</th>
|
|
<th>Direct MNO</th>
|
|
<th>MNO/Supplier</th>
|
|
<th>Type & Bind</th>
|
|
<th>Status</th>
|
|
<th class="text-end">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($senderIds as $sender)
|
|
<tr>
|
|
<td>
|
|
<div class="sender-id-text fw-bold">{{ $sender->senderid }}</div>
|
|
<div class="text-secondary mt-1" style="font-size: 0.75rem;">Created: {{ $sender->created_at ? $sender->created_at->format('M d, Y') : 'N/A' }}</div>
|
|
</td>
|
|
<td>
|
|
@if($sender->direct_mno == 'YES')
|
|
<span class="badge bg-primary bg-opacity-10 text-primary border">YES</span>
|
|
@else
|
|
<span class="badge bg-secondary bg-opacity-10 text-secondary border">NO</span>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
@if($sender->direct_mno == 'YES')
|
|
<div class="fw-medium">{{ $sender->mno_name ?? 'N/A' }}</div>
|
|
<div class="text-muted small">MNO Name</div>
|
|
@else
|
|
<div class="fw-medium">{{ $sender->supplier_name ?? 'N/A' }}</div>
|
|
<div class="text-muted small">Supplier</div>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<div class="fw-medium">{{ $sender->type ?? 'N/A' }}</div>
|
|
<div class="text-muted small">Bind: {{ $sender->bind_name ?? 'default' }}</div>
|
|
</td>
|
|
<td>
|
|
@php
|
|
$statusClass = 'bg-secondary text-secondary';
|
|
$icon = 'bi-dash-circle';
|
|
if($sender->status == 'APPROVED') { $statusClass = 'bg-success text-success'; $icon = 'bi-check-all'; }
|
|
elseif($sender->status == 'PENDING') { $statusClass = 'bg-warning text-warning'; $icon = 'bi-hourglass-split'; }
|
|
elseif($sender->status == 'REJECTED') { $statusClass = 'bg-danger text-danger'; $icon = 'bi-x-octagon'; }
|
|
@endphp
|
|
<span class="badge {{ $statusClass }} bg-opacity-10 px-2 py-1"><i class="bi {{ $icon }} me-1"></i>{{ $sender->status }}</span>
|
|
</td>
|
|
<td class="text-end">
|
|
<button class="btn btn-sm btn-light text-primary me-1 btn-edit-sender"
|
|
data-id="{{ $sender->id }}"
|
|
data-senderid="{{ $sender->senderid }}"
|
|
data-direct_mno="{{ $sender->direct_mno }}"
|
|
data-mno_name="{{ $sender->mno_name }}"
|
|
data-supplier_name="{{ $sender->supplier_name }}"
|
|
data-type="{{ $sender->type }}"
|
|
data-bind_name="{{ $sender->bind_name }}"
|
|
data-status="{{ $sender->status }}"
|
|
data-remarks="{{ $sender->remarks }}">
|
|
<i class="bi bi-pencil"></i>
|
|
</button>
|
|
<form action="{{ route('senderids.destroy', $sender->id) }}" method="POST" class="d-inline">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-light text-danger" onclick="return confirm('Are you sure you want to delete this Sender ID?')">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="text-center py-4 text-secondary">No Sender IDs found.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
<div class="d-flex justify-content-end mt-3">
|
|
{{ $senderIds->links('pagination::bootstrap-5') }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('modals')
|
|
<!-- SENDER ID MODAL -->
|
|
<div class="modal fade" id="senderModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header bg-light">
|
|
<h5 class="modal-title fw-bold" id="senderModalTitle">Add Sender ID</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
|
|
<form id="senderForm" method="POST" action="{{ route('senderids.store') ?? '#' }}">
|
|
@csrf
|
|
<div class="modal-body p-4">
|
|
<input type="hidden" id="senderRecordId" name="id">
|
|
<div id="senderIdModalAlert"></div>
|
|
|
|
<div class="row g-3">
|
|
<!-- Sender ID -->
|
|
<div class="col-md-6">
|
|
<label class="form-label text-secondary fw-semibold small">Sender ID *</label>
|
|
<input type="text" name="senderid" id="edit_senderid" class="form-control" required placeholder="e.g. CLICK_SMS" maxlength="20">
|
|
</div>
|
|
|
|
<!-- Direct MNO Toggle -->
|
|
<div class="col-md-6">
|
|
<label class="form-label text-secondary fw-semibold small">Direct MNO? *</label>
|
|
<select name="direct_mno" id="edit_direct_mno" class="form-select" required>
|
|
<option value="YES" selected>YES</option>
|
|
<option value="NO">NO</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- MNO Name (Visible by default) -->
|
|
<div class="col-md-12" id="wrapper_mno_name">
|
|
<label class="form-label text-secondary fw-semibold small">MNO Name *</label>
|
|
<select name="mno_name" id="edit_mno_name" class="form-select">
|
|
<option value="">Select Network Operator</option>
|
|
@foreach($networkOperators as $mno)
|
|
<option value="{{ $mno->name }}">{{ $mno->name }} ({{ $mno->country }})</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Supplier Name (Hidden by default) -->
|
|
<div class="col-md-12" id="wrapper_supplier_name" style="display: none;">
|
|
<label class="form-label text-secondary fw-semibold small">Supplier / Aggregator Name *</label>
|
|
<select name="supplier_name" id="edit_supplier_name" class="form-select">
|
|
<option value="">Select Supplier</option>
|
|
@foreach($clients as $client)
|
|
<option value="{{ $client->name }}">{{ $client->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Type & Bind Name -->
|
|
<div class="col-md-6">
|
|
<label class="form-label text-secondary fw-semibold small">Type</label>
|
|
<select name="type" id="edit_type" class="form-select">
|
|
<option value="Alphanumeric">Alphanumeric</option>
|
|
<option value="Numeric">Numeric</option>
|
|
<option value="Shortcode">Shortcode</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label text-secondary fw-semibold small">Bind Name</label>
|
|
<input type="text" name="bind_name" id="edit_bind_name" class="form-control" value="default" maxlength="50">
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div class="col-md-12">
|
|
<label class="form-label text-secondary fw-semibold small">Status</label>
|
|
<select name="status" class="form-select">
|
|
<option value="" selected>-- Select --</option>
|
|
<option value="Applied to MNO">Applied to MNO</option>
|
|
<option value="Applied to Aggregator">Applied to Aggregator</option>
|
|
<option value="Approved on MNO">Approved on MNO</option>
|
|
<option value="Approved on Aggregator">Approved on Aggregator</option>
|
|
<option value="Active">Active</option>
|
|
<option value="Pending">Pending</option>
|
|
<option value="Inactive">Inactive</option>
|
|
<option value="Rejected">REJECTED</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Remarks -->
|
|
<div class="col-12">
|
|
<label class="form-label text-secondary fw-semibold small">Remarks</label>
|
|
<textarea name="remarks" id="edit_remarks" class="form-control" rows="2" placeholder="Optional notes..."></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-outline-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn text-white fw-bold btn-sm px-4" style="background-color: #5c4df0;" id="btnSubmitSender">
|
|
Save Sender ID
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endpush
|
|
|
|
@push('scripts')
|
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
|
<script src="{{ asset('public/assets/js/sender-ids.js') }}"></script>
|
|
<script>
|
|
|
|
</script>
|
|
@endpush |