diff --git a/app/Models/NetworkOps.php b/app/Models/NetworkOps.php index b162af5..7ac1e5a 100755 --- a/app/Models/NetworkOps.php +++ b/app/Models/NetworkOps.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Casts\Attribute; class NetworkOps extends Model { @@ -12,4 +13,17 @@ class NetworkOps extends Model public function account_manager_info(){ return $this->hasOne('App\Models\StaffMember', 'id', 'account_manager_id'); } + /* + public function setBuyingRateAttribute($value) + { + $cleanValue = filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); + $this->attributes['buying_rate'] = $cleanValue; + } + */ + protected function buyingRate(): Attribute + { + return Attribute::make( + set: fn (string $value) => filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) + ); + } } diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 95cd427..403128f 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -94,7 +94,7 @@ id="email" name="email" value="{{ old('email') }}" - placeholder="staff@luspa.gov.gh" + placeholder="staff@click-mobile.com" required autofocus> diff --git a/resources/views/clients/index.blade.php b/resources/views/clients/index.blade.php index fb38f61..0c46367 100644 --- a/resources/views/clients/index.blade.php +++ b/resources/views/clients/index.blade.php @@ -105,7 +105,6 @@ @endsection - @push('modals') @include('clients.partials.create') @endpush @@ -135,6 +134,44 @@ let page = $(this).data('page'); if (page) fetchClients(page); }); + // --------------------------------------------------------- + // 1. CREATE BUTTON (Open Modal) + // --------------------------------------------------------- + $('#btnOpenClientModal').on('click', function(e) { + e.preventDefault(); + // Replace '#createClientModal' with the actual ID of the modal in your clients.partials.create file + $('#createClientModal').modal('show'); + }); + + // --------------------------------------------------------- + // 2. VIEW BUTTON (Event Delegation for AJAX buttons) + // --------------------------------------------------------- + $(document).on('click', '.btn-view-client', function(e) { + e.preventDefault(); + let clientId = $(this).data('id'); + + // OPTION A: Redirect to a view page + window.location.href = base_url + "/clients/" + clientId; + + // OPTION B: If you are using a View Modal instead, uncomment this: + // fetchClientDetailsForView(clientId); + // $('#viewClientModal').modal('show'); + }); + + // --------------------------------------------------------- + // 3. EDIT BUTTON (Event Delegation for AJAX buttons) + // --------------------------------------------------------- + $(document).on('click', '.btn-edit-client', function(e) { + e.preventDefault(); + let clientId = $(this).data('id'); + + // OPTION A: Redirect to an edit page + window.location.href = base_url + "/clients/" + clientId + "/edit"; + + // OPTION B: If you are using an Edit Modal instead, uncomment this: + // fetchClientDetailsForEdit(clientId); + // $('#editClientModal').modal('show'); + }); // AJAX Fetch Function function fetchClients(page = 1) {