api get all endpoints integrated

This commit is contained in:
erishBRBS 2025-05-16 17:24:16 +08:00
parent 0f2e429676
commit eebdeb9074
29 changed files with 633 additions and 83 deletions

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,45 @@ class Branch extends Component
public function loadBranches()
{
$this->branches = collect(json_decode(file_get_contents(storage_path('app/branches.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/getbranches');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']); this gets the data
// Properly use collect to handle the response data
$this->branches = collect($response->json()['data'])
->map(function ($branches) {
//returns null
return [
'station_uuid' => $branches['station_uuid'],
'station_code' => $branches['code'],
'station_name' => $branches['description'],
'branch' => $branches['city'],
'created_at' => $branches['created_at'],
'created_by' => $branches['created_by'],
'modified_by' => $branches['modified_by'],
'date_modified' => $branches['modified_at'], // ✅ correct spelling
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load branches.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -2,22 +2,85 @@
namespace App\Livewire\Buttons;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Component;
class CreateUser extends Component
{
public $username, $first_name, $last_name, $email, $status = 'active', $role = 'admin', $default_password;
public $username;
public $firstname;
public $lastname;
public $email;
public $status = 'active';
public $role = 'admin';
public $default_password = '';
public function generatePassword()
{
$this->default_password = bin2hex(random_bytes(4));
try {
// Get the access token from the session
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
// Make the request to generate the password
$response = Http::withToken($token)
->post(config('services.backend_api.url') . '/api/cms/generatePassword');
// Check if the request was successful
if ($response->successful()) {
// Retrieve the password from the response
$this->default_password = $response->json()['data']['password'];
} else {
$this->addError('users', 'Failed to generate password.');
}
} catch (\Exception $e) {
// Handle any exceptions that occur during the request
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function submit()
{
return redirect()->to('/main/user-management');
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)->post(config('services.backend_api.url') . '/api/cms/admin', [
'username' => $this->username,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'status' => $this->status,
'role' => $this->role,
'password' => $this->default_password,
]);
//handle backend response
if ($response->status() === 422) {
$errors = $response->json('data');
foreach ($errors as $field => $messages) {
$this->addError($field, $messages[0]);
}
return;
}
if ($response->successful()) {
session()->flash('success', 'User created successfully.');
return redirect('/main/user-management');
} else {
$this->addError('users', 'Failed to create user.');
}
}
public function cancel()
{
return redirect()->to('/main/user-management');
@ -28,5 +91,3 @@ class CreateUser extends Component
return view('livewire.buttons.create-user');
}
}

View File

@ -33,7 +33,9 @@ class CardMember extends Component
// dd($response->json());
if ($response->successful()) {
// Properly use collect to handle the response data
$this->cardMembers = collect($response->json()['data'])->map(function ($cardMembers) {
$this->cardMembers = collect($response->json()['data'])
->filter(function ($cardMembers) {return $cardMembers['is_locked'] == 0;})
->map(function ($cardMembers) {
return [
'lcard_uuid' => $cardMembers['lcard_uuid'],
'card_number' => $cardMembers['card_number'],
@ -46,7 +48,7 @@ class CardMember extends Component
});
} else {
$this->addError('users', 'Failed to load users.');
$this->addError('users', 'Failed to load card members.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,8 +19,41 @@ class CardType extends Component
public function loadCardTypes()
{
// Load card types from JSON file
$this->cardTypes = collect(json_decode(file_get_contents(storage_path('app/card-types.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/cardType');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->cardTypes = collect($response->json()['data'])
->map(function ($cardTypes) {
return [
'cardtype_uuid' => $cardTypes['cardtype_uuid'],
'code' => $cardTypes['code'],
'name' => $cardTypes['name'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load top-up.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -4,6 +4,8 @@ namespace App\Livewire\Components;
use Livewire\Component;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
class Table extends Component
{
@ -24,7 +26,12 @@ class Table extends Component
public $sortDirection = 'asc';
public bool $hasSearch = true;
public $rowKey = 'id';
//Update and Delete endpoints
public $updateEndpoint = '';
public $deleteEndpoint = '';
// Data identifier
public $rowKey = 'id';
public $startDate;
public $endDate;
@ -39,34 +46,61 @@ class Table extends Component
public $modalMode = 'view';
public $modalData = [];
public function mount($columns, $rows, $addRoute = null, $rowKey = 'id')
{
$this->columns = $columns;
$this->rows = collect($rows)->map(function ($row) {
return is_array($row) ? $row : (array) $row;
})->values()->all();
$this->addRoute = $addRoute;
$this->rowKey = $rowKey;
Log::info("Initial rows count: " . count($this->rows));
}
public function mount($columns, $rows, $addRoute = null, $rowKey = 'id')
{
$this->columns = $columns;
$this->rows = collect($rows)->map(function ($row) {
return is_array($row) ? $row : (array) $row;
})->values()->all();
$this->addRoute = $addRoute;
$this->rowKey = $rowKey;
// Log::info("Initial rows count: " . count($this->rows));
}
public function viewRow($id)
{
$this->modalData = collect($this->rows)->firstWhere($this->rowKey, $id) ?? [];
$this->modalMode = 'view';
$this->showModal = true;
}
public function viewRow($id)
{
$this->modalData = collect($this->rows)->firstWhere($this->rowKey, $id) ?? [];
$this->modalMode = 'view';
$this->showModal = true;
}
public function editRow($id)
{
$this->modalData = collect($this->rows)->firstWhere('id', $id) ?? [];
$this->modalData = collect($this->rows)->firstWhere($this->rowKey, $id) ?? [];
$this->modalMode = 'edit';
$this->showModal = true;
}
public function saveRow()
{
$token = Session::get('user')['access_token'] ?? null;
$url = rtrim(config('services.backend_api.url'), '/') . '/' . $this->updateEndpoint . '/' . $this->modalData[$this->rowKey];
try {
$response = Http::withToken($token)->put($url, $this->modalData);
if ($response->successful()) {
$this->closeModal();
$this->fetchData();
} else {
$errors = $response->json('errors') ?? [];
foreach ($errors as $field => $messages) {
$this->addError("modalData.$field", is_array($messages) ? $messages[0] : $messages);
}
}
} catch (\Exception $e) {
logger()->error('SaveRow error: ' . $e->getMessage());
$this->addError('modalData', 'Something went wrong. Please try again.');
}
}
public function closeModal()
{
$this->showModal = false;
@ -212,4 +246,4 @@ public function viewRow($id)
'renderKey' => $this->renderKey,
]);
}
}
}

View File

@ -3,14 +3,17 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Session;
class Header extends Component
{
public function selectPage($page)
public $user;
public function mount()
{
$this->dispatch('navigate-to-page', page: $page);
$this->user = Session::get('user');
}
public function render()
{
return view('livewire.header.header');

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Http;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,48 @@ class LockedAccount extends Component
public function loadLockedAccounts()
{
$this->lockedAccounts = collect(json_decode(file_get_contents(storage_path('app/locked-accounts.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/member?_locked=1');
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->lockedAccounts = collect($response->json()['data'])
->filter(function ($lockedAccounts) {return (int) $lockedAccounts['is_locked'] == 1;})
->map(function ($lockedAccounts) {
return [
'lcard_uuid' => $lockedAccounts['lcard_uuid'],
'card_number' => $lockedAccounts['card_number'],
'firstname' => $lockedAccounts['firstname'],
'lastname' => $lockedAccounts['lastname'],
'birthdate' => $lockedAccounts['birthdate'],
'cardtype_id' => $lockedAccounts['card_type'],
'status' => $lockedAccounts['status'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load locked accounts.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -24,9 +24,10 @@ class LoginForm extends Component
'password' => $this->password,
]);
$json = $response->json();
// dd($json);
$json = $response->json();
// dd($json);
if ($response->successful()) {
if ($json['code'] === 200) {
@ -46,7 +47,7 @@ class LoginForm extends Component
$this->addError('username', $message);
}
} catch (\Exception $e) {
$this->addError('username', 'An error occurred: ' . $e->getMessage());
$this->addError('username', 'An error : ' . $e->getMessage());
}
}

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,46 @@ class MobileUsageReport extends Component
public function loadMobileUsageReport()
{
$this->mobileUsageReport = collect(json_decode(file_get_contents(storage_path('app/mobile-usage.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/reportMobileUsage');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->mobileUsageReport = collect($response->json()['data'])
->map(function ($mobileUsageReport) {
// dd($this->mobileUsageReport);
return [
'mba_id' => $mobileUsageReport['mba_id'],
'date' => $mobileUsageReport['date'],
'active' => $mobileUsageReport['active'],
'inactive' => $mobileUsageReport['inactive'],
'locked' => $mobileUsageReport['locked'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load mobile usage report.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,37 @@ class PhotoSlider extends Component
public function loadPhotoSliders()
{
$this->photoSliders = collect(json_decode(file_get_contents(storage_path('app/photo-sliders.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/photoSlider');
// dd($response->json());
if ($response->successful()) {
// Properly use collect to handle the response data
$this->photoSliders = collect($response->json()['data'])
->map(function ($photoSliders) {
return [
'photoslider_uuid' => $photoSliders['photoslider_uuid'],
'title' => $photoSliders['title'],
'promotion_id' => $photoSliders['type'],
'date_start' => $photoSliders['date_start'],
'date_end' => $photoSliders['date_end'],
];
});
} else {
$this->addError('users', 'Failed to load photo sliders.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,40 @@ class Promotion extends Component
public function loadPromotions()
{
$this->promotions = collect(json_decode(file_get_contents(storage_path('app/promotions.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/promotion');
// dd($response->json());
if ($response->successful()) {
// Properly use collect to handle the response data
$this->promotions = collect($response->json()['data'])
->map(function ($promotions) {
return [
'promotion_uuid' => $promotions['promotion_uuid'],
'title' => $promotions['title'],
'type' => $promotions['promo_type']['name'],
'date_start' => $promotions['date_start'],
'date_end' => $promotions['date_end'],
'status' => $promotions['status'],
];
});
} else {
$this->addError('users', 'Failed to load promotions.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,45 @@ class Station extends Component
public function loadStations()
{
$this->stations = collect(json_decode(file_get_contents(storage_path('app/stations.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/getStations');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']); this gets the data
// Properly use collect to handle the response data
$this->stations = collect($response->json()['data'])
->map(function ($stations) {
//returns null
return [
'station_uuid' => $stations['station_uuid'],
'station_code' => $stations['code'],
'station_name' => $stations['description'],
'branch' => $stations['city'],
'created_at' => $stations['created_at'],
'created_by' => $stations['created_by'],
'modified_by' => $stations['modified_by'],
'date_modified' => $stations['modified_at'], // ✅ correct spelling
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load stations.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -4,6 +4,8 @@ namespace App\Livewire;
use Livewire\Component;
use Livewire\Attributes\Layout; // Required for layout declaration
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
class StationRatingReport extends Component
@ -17,7 +19,47 @@ class StationRatingReport extends Component
public function loadStationRating()
{
$this->stationRating = collect(json_decode(file_get_contents(storage_path('app/station-rating.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/reportStationRatings');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->stationRating = collect($response->json()['data'])
->map(function ($stationRating) {
// dd($this->stationRating);
return [
'rating_uuid' => $stationRating['rating_uuid'],
'date' => $stationRating['date'],
'card_number' => $stationRating['card_number'],
'invoice' => $stationRating['invoice'],
'station' => $stationRating['station'],
'rating' => $stationRating['rate'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load top-up.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,8 +19,42 @@ class TermsAndPrivacy extends Component
public function loadTermsAndPrivacy()
{
// Load card types from JSON file
$this->termsAndPrivacy = collect(json_decode(file_get_contents(storage_path('app/terms-privacy.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/TermsAndPrivacy');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->termsAndPrivacy = collect($response->json()['data'])
->map(function ($termsAndPrivacy) {
return [
'tp_uuid' => $termsAndPrivacy['tp_uuid'],
'title' => $termsAndPrivacy['title'],
'details' => $termsAndPrivacy['details'],
'type' => $termsAndPrivacy['type'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load terms and privacy.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -3,6 +3,8 @@
namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout; // Required for layout declaration
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
@ -17,7 +19,42 @@ class TopUp extends Component
public function loadTopUp()
{
$this->topUp = collect(json_decode(file_get_contents(storage_path('app/top-up.json')), true));
try {
$token = Session::get('user')['access_token'] ?? null;
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)
->get(config('services.backend_api.url') . '/api/cms/topUp');
// dd($response->json());
if ($response->successful()) {
// dd($response->json()['data']);
// Properly use collect to handle the response data
$this->topUp = collect($response->json()['data'])
->map(function ($topUp) {
return [
'topup_uuid' => $topUp['topup_uuid'],
'fee_code' => $topUp['fee_code'],
'name' => $topUp['name'],
'amount' => $topUp['amount'],
'type' => $topUp['type'],
];
});
// dd($this->loadLockedAccounts());
} else {
$this->addError('users', 'Failed to load top-up.');
}
} catch (\Exception $e) {
$this->addError('users', 'Error: ' . $e->getMessage());
}
}
public function render()

View File

@ -37,6 +37,6 @@ return [
'backend_api' => [
'url' => env('BACKEND_API_URL'),
],
],
];

View File

@ -3,12 +3,13 @@
@include('livewire.about-us.top-nav.card-type')
<livewire:components.table
:columns="[
['label' => 'Card Type Code', 'field' => 'card_type_code'],
['label' => 'Card Type Description', 'field' => 'card_type_description'],
['label' => 'Card Type Code', 'field' => 'code'],
['label' => 'Card Type Description', 'field' => 'name'],
]"
:rows="$cardTypes"
:hasActions="true"
:isViewPage="false"
:addRoute="route('card-type-create')"
:rowKey="'cardtype_uuid'"
/>
</div>

View File

@ -12,5 +12,6 @@
:hasActions="true"
:isViewPage="false"
:addRoute="route('terms-and-privacy-create')"
:rowKey="'tp_uuid'"
/>
</div>

View File

@ -12,8 +12,8 @@
</a>
<x-heroicon-o-chevron-right class="w-3 h-3" />
<span>
Create User
</span>
Create User
</span>
</div>
<!-- Page Title -->
@ -30,25 +30,40 @@
<div class="flex items-center gap-2">
<label class="w-40">Username:</label>
<input type="text" wire:model="username" class="flex-1 border rounded px-3 py-2" placeholder="User name">
<button class="bg-orange-500 text-white px-3 py-1 rounded">Copy</button>
@error('username')
<span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
<button
class="px-4 py-2 bg-orange-500 text-white rounded hover:bg-orange-600"
x-data
@click="navigator.clipboard.writeText($el.previousElementSibling.value).then(() => alert('Copied!'))">Copy</button>
</div>
<!-- First Name -->
<div class="flex items-center gap-2">
<label class="w-40">First Name:</label>
<input type="text" wire:model="first_name" class="flex-1 border rounded px-3 py-2" placeholder="First Name">
<input type="text" wire:model="firstname" class="flex-1 border rounded px-3 py-2" placeholder="First Name">
@error('firstname')
<span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
<!-- Last Name -->
<div class="flex items-center gap-2">
<label class="w-40">Last Name:</label>
<input type="text" wire:model="last_name" class="flex-1 border rounded px-3 py-2" placeholder="Last Name">
<input type="text" wire:model="lastname" class="flex-1 border rounded px-3 py-2" placeholder="Last Name">
@error('lastname')
<span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
<!-- Email -->
<div class="flex items-center gap-2">
<label class="w-40">Email Address:</label>
<input type="email" wire:model="email" class="flex-1 border rounded px-3 py-2" placeholder="Email Address">
@error('email')
<span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
<!-- Status -->
@ -76,10 +91,36 @@
<!-- Password -->
<div class="flex items-center gap-2">
<label class="w-40">Default Password:</label>
<input type="text" wire:model="default_password" class="flex-1 border rounded px-3 py-2" placeholder="Default Password">
<button wire:click="generatePassword" class="bg-orange-500 text-white px-3 py-1 rounded">Generate</button>
<button class="bg-orange-500 text-white px-3 py-1 rounded">Copy</button>
<!-- Display the password returned -->
<input type="text"
wire:model="default_password"
readonly
class="flex-1 border rounded px-3 py-2 bg-gray-100"
value="{{ $default_password }}">
@error('password')
<span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
<!-- Generate button -->
<button type="button"
wire:click="generatePassword"
class="px-4 py-2 bg-orange-500 text-white rounded hover:bg-orange-600">
Generate
</button>
<!-- Copy button -->
<button type="button"
x-data
@click="navigator.clipboard.writeText($el.previousElementSibling.previousElementSibling.value).then(() => alert('Copied!'))"
class="px-4 py-2 bg-orange-500 text-white rounded hover:bg-orange-600">
Copy
</button>
</div>
</div>
<!-- Submit / Cancel -->
@ -88,4 +129,4 @@
<button wire:click="submit" class="px-4 py-2 bg-orange-500 text-white rounded hover:bg-orange-600">Submit</button>
</div>
</div>
</div>
</div>

View File

@ -42,10 +42,7 @@
Export
</button>
@else
<!-- Default button or anything else you want here -->
<button class="bg-gray-600 text-white px-4 py-2 rounded">
Default Action
</button>
@endif
</div>
@ -189,7 +186,7 @@
<h2 class="text-lg font-semibold">
{{ $modalMode === 'view' ? 'View Details' : 'Edit Details' }}
</h2>
<button wire:click="closeModal" class="text-gray-600 hover:text-gray-800">×</button>
<button wire:click="closeModal" class="text-gray-600 hover:text-gray-800">X</button>
</div>
<!-- Modal Body -->

View File

@ -5,7 +5,7 @@
<div class="relative" x-data="{ open: false }">
<button @click="open = !open" class="flex items-center space-x-2 focus:outline-none">
<x-heroicon-s-user-circle class="w-7 h-7" />
<span class="text-white text-sm">LBTek Systems</span>
<span class="text-white text-sm">{{ $user['admin']['name'] }}</span>
<svg :class="{ 'rotate-180': open }" class="w-4 h-4 transform transition-transform duration-200" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>

View File

@ -4,14 +4,15 @@
<livewire:components.table
:columns="[
['label' => 'Title', 'field' => 'title'],
['label' => 'Type', 'field' => 'type'],
['label' => 'Start Date', 'field' => 'start_date'],
['label' => 'End Date', 'field' => 'end_date'],
['label' => 'Type', 'field' => 'promotion_id'],
['label' => 'Start Date', 'field' => 'date_start'],
['label' => 'End Date', 'field' => 'date_end'],
]"
:rows="$photoSliders"
:hasCheckbox="true"
:hasActions="true"
:isViewPage="false"
:addRoute="route('photo-slider-create')"
:rowKey="'photoslider_uuid'"
/>
</div>

View File

@ -4,10 +4,10 @@
<livewire:components.table
:columns="[
['label' => 'Card Number', 'field' => 'card_number'],
['label' => 'First Name', 'field' => 'first_name'],
['label' => 'Last Name', 'field' => 'last_name'],
['label' => 'Birthday', 'field' => 'birthday'],
['label' => 'Card Type', 'field' => 'card_type'],
['label' => 'First Name', 'field' => 'firstname'],
['label' => 'Last Name', 'field' => 'lastname'],
['label' => 'Birthday', 'field' => 'birthdate'],
['label' => 'Card Type', 'field' => 'cardtype_id'],
['label' => 'Status', 'field' => 'status'],
]"
:rows="$lockedAccounts"
@ -17,5 +17,6 @@
:hasDelete="false"
:hasAddButton="false"
:hasExportButton="false"
:rowKey="'lcard_uuid'"
/>
</div>

View File

@ -1,12 +1,14 @@
<div>
{{-- Top Nav --}}
@include('livewire.promotion.top-nav.promotion')
<livewire:components.table
:columns="[
['label' => 'Title', 'field' => 'title'],
['label' => 'Type', 'field' => 'type'],
['label' => 'Start Date', 'field' => 'start_date'],
['label' => 'End Date', 'field' => 'end_date'],
['label' => 'Start Date', 'field' => 'date_start'],
['label' => 'End Date', 'field' => 'date_end'],
['label' => 'Status', 'field' => 'status'],
]"
:rows="$promotions"
@ -14,5 +16,6 @@
:hasActions="true"
:isViewPage="false"
:addRoute="route('promotion-create')"
:rowKey="'promotion_uuid'"
/>
</div>

View File

@ -4,9 +4,9 @@
<livewire:components.table
:columns="[
['label' => 'Date', 'field' => 'date'],
['label' => 'Active Registered Users', 'field' => 'active_registered_users'],
['label' => 'Inactive Registered Users', 'field' => 'inactive_registered_users'],
['label' => 'Locked Registered Users', 'field' => 'locked_registered_users'],
['label' => 'Active Registered Users', 'field' => 'active'],
['label' => 'Inactive Registered Users', 'field' => 'inactive'],
['label' => 'Locked Registered Users', 'field' => 'locked'],
]"
:rows="$mobileUsageReport"
:hasSearch="false"
@ -15,5 +15,7 @@
:hasDelete="false"
:hasAddButton="false"
:isViewPage="false"
:rowKey="'mba_id'"
/>
</div>
</div>

View File

@ -1,11 +1,13 @@
<div>
{{-- Top Nav --}}
@include('livewire.report.top-nav.station-rating-report')
<livewire:components.table
:columns="[
['label' => 'Transaction Date & Time', 'field' => 'transaction_date_time'],
['label' => 'Transaction Date & Time', 'field' => 'date'],
['label' => 'Card Number', 'field' => 'card_number'],
['label' => 'Sales Invoice', 'field' => 'sales_invoice'],
['label' => 'Sales Invoice', 'field' => 'invoice'],
['label' => 'Station', 'field' => 'station'],
['label' => 'Ratings', 'field' => 'rating'],
]"
@ -16,5 +18,6 @@
:hasDelete="false"
:hasAddButton="false"
:isViewPage="false"
:rowKey="'rating_uuid'"
/>
</div>

View File

@ -5,8 +5,8 @@
:columns="[
['label' => 'Station Code', 'field' => 'station_code'],
['label' => 'Station Name', 'field' => 'station_name'],
['label' => 'Branch Name', 'field' => 'branch_name'],
['label' => 'Date Created', 'field' => 'date_created'],
['label' => 'Branch Name', 'field' => 'branch'],
['label' => 'Date Created', 'field' => 'created_at'],
['label' => 'Created By', 'field' => 'created_by'],
['label' => 'Modified By', 'field' => 'modified_by'],
['label' => 'Date Modified', 'field' => 'date_modified'],
@ -15,5 +15,7 @@
:hasActions="true"
:isViewPage="false"
:addRoute="route('station-create')"
:hasDelete="false" />
:hasDelete="false"
:rowKey="'station_uuid'"
/>
</div>

View File

@ -3,14 +3,15 @@
@include('livewire.top-up.top-nav.top-up')
<livewire:components.table
:columns="[
['label' => 'Free Code', 'field' => 'free_code'],
['label' => 'Fee Code', 'field' => 'fee_code'],
['label' => 'Name', 'field' => 'name'],
['label' => 'Value', 'field' => 'value'],
['label' => 'Value', 'field' => 'amount'],
['label' => 'Type', 'field' => 'type'],
]"
:rows="$topUp"
:hasActions="true"
:isViewPage="false"
:addRoute="route('top-up-create')"
:rowKey="'topup_uuid'"
/>
</div>

View File

@ -1,6 +1,20 @@
<div>
@include('livewire.user-management.top-nav.user-management')
@if (session()->has('success'))
<div
x-data="{ show: true }"
x-init="setTimeout(() => show = false, 3000)"
x-show="show"
x-transition
class="text-2xl text-green-700 px-4 py-2 rounded mb-4"
>
{{ session('success') }}
</div>
@endif
<livewire:components.table
:columns="[
['label' => 'Username', 'field' => 'username'],
@ -17,5 +31,6 @@
:hasActions="true"
:isViewPage="false"
:rowKey="'admin_uuid'"
:updateEndpoint="'api/cms/admin'"
/>
</div>