bug fixes, leave managment refactoring, report points

This commit is contained in:
Kwesi Banson
2026-11-03 12:05:59 +00:00
parent 965892ac62
commit b393dcdf0e
14 changed files with 144 additions and 117 deletions

View File

@@ -79,8 +79,9 @@ class NetworkOperatorsController extends Controller
$request->validate([
'name' => 'required|string|max:200',
'country' => 'required|string',
'contract_auto_renew' => 'required|boolean',
'next_renewal_date' => 'nullable|required_if:contract_auto_renew,0|date',
'connection_status' => 'required|string',
// 'contract_auto_renew' => 'required|boolean',
// 'next_renewal_date' => 'nullable|required_if:contract_auto_renew,0|date',
]);
$operator->update([
@@ -109,7 +110,7 @@ class NetworkOperatorsController extends Controller
return response()->json(['message' => 'MNO Partner updated successfully!']);
}
// Fetch single record JSON for editing modal
public function getJson($id)
{
$operator = NetworkOperator::findOrFail($id);
@@ -118,8 +119,6 @@ class NetworkOperatorsController extends Controller
public function show($id)
{
$operator = NetworkOperator::findOrFail($id);
// Fetch all services for the dropdown
$allServices = \App\Models\Service::orderBy('name')->get();
$staffMembers = \App\Models\StaffMember::orderBy('name')->get();
@@ -134,13 +133,9 @@ class NetworkOperatorsController extends Controller
'required',
'string',
function ($attribute, $value, $fail) {
// 1. Check if valid IP Address (IPv4 or IPv6)
$isIp = filter_var($value, FILTER_VALIDATE_IP);
// 2. Check if valid Domain Name (e.g., smpp.operator.com)
$isDomain = preg_match('/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i', $value);
// 3. Check if valid CIDR Subnet (e.g., 196.200.15.0/24)
$isDomain = preg_match('/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i', $value);
$isSubnet = preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}\/([0-9]|[1-2][0-9]|3[0-2])$/', $value);
if (!$isIp && !$isDomain && !$isSubnet) {
@@ -192,7 +187,7 @@ class NetworkOperatorsController extends Controller
\App\Models\MnoNote::create([
'mno_id' => $operatorId,
'services' => $request->services ?? '',
'user_id' => auth()->id(), // Automatically assign the logged-in user
'user_id' => auth()->id(),
'notes_body' => $request->notes_body,
]);