view pages added

This commit is contained in:
erishBRBS 2025-06-12 14:20:52 +08:00
parent 164728d79e
commit ef9d24c9cf
14 changed files with 218 additions and 36 deletions

View File

@ -3,9 +3,53 @@
namespace App\Livewire\Buttons;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
class ViewCardType extends Component
{
public $uuid;
public $code,
$name,
$description,
$image,
$virtual_card_font_color,
$bg_image,
$id_number,
$id_number_description,
$terms_and_conditions,
$faqs;
public function mount($uuid)
{
$this->uuid = $uuid;
$token = Session::get('user.access_token');
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)->get(config('services.backend_api.url') . "/api/cms/cardType/{$uuid}");
if ($response->successful()) {
$cardType = $response->json('data');
$this->code = $cardType['code'] ?? '';
$this->name = $cardType['name'] ?? '';
$this->description = $cardType['description'] ?? '';
$this->image = $cardType['image'] ?? '';
$this->virtual_card_font_color = $cardType['virtual_card_font_color'] ?? '';
$this->bg_image = $cardType['bg_image'] ?? '';
$this->id_number = $cardType['id_number'] ?? '';
$this->id_number_description = $cardType['id_number_description'] ?? '';
$this->terms_and_conditions = $cardType['terms_and_conditions'] ?? '';
$this->faqs = $cardType['faqs'] ?? '';
} else {
$this->addError('card types', 'Failed to fetch card type data.');
}
}
public function render()
{
return view('livewire.buttons.view-card-type');

View File

@ -5,6 +5,7 @@ namespace App\Livewire\Buttons;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Carbon\Carbon;
class ViewPromotion extends Component
{

View File

@ -3,9 +3,40 @@
namespace App\Livewire\Buttons;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Session as SessionFacade;
class ViewTermsAndPrivacy extends Component
{
public $uuid;
public $title,
$details,
$type;
public function mount($uuid)
{
$this->uuid = $uuid;
$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/{$uuid}");
if ($response->successful()) {
$termsAndPrivacy = $response->json('data');
$this->type = $termsAndPrivacy['type'] ?? '';
$this->title = $termsAndPrivacy['title'] ?? '';
$this->details = $termsAndPrivacy['details'] ?? '';
} else {
$this->addError('terms and privacy', 'Failed to fetch terms and privacy data.');
}
}
public function render()
{
return view('livewire.buttons.view-terms-and-privacy');

View File

@ -3,9 +3,41 @@
namespace App\Livewire\Buttons;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
class ViewTopUp extends Component
{
public $uuid;
public $fee_code,
$name,
$type,
$amount;
public function mount($uuid)
{
$this->uuid = $uuid;
$token = Session::get('user.access_token');
if (!$token) {
$this->addError('users', 'No access token found.');
return;
}
$response = Http::withToken($token)->get(config('services.backend_api.url') . "/api/cms/topUp/{$uuid}");
if ($response->successful()) {
$topUp = $response->json('data');
$this->fee_code = $topUp['fee_code'] ?? '';
$this->name = $topUp['name'] ?? '';
$this->type = $topUp['type'] ?? '';
$this->amount = $topUp['amount'] ?? 0;
} else {
$this->addError('top ups', 'Failed to fetch top up data.');
}
}
public function render()
{
return view('livewire.buttons.view-top-up');

View File

@ -35,6 +35,7 @@ class Header extends Component
if ($response->successful()) {
Session::forget('user');
session()->flash('success', 'Logout successfully.');
return redirect()->route('login');
} else {
// Optional: flash an error or handle it

View File

@ -10,6 +10,17 @@ use Illuminate\Support\Facades\Session;
class LoginForm extends Component
{
public $username, $password;
public $showForgotUsernameModal = false;
public function forgotUsername()
{
$this->showForgotUsernameModal = true;
}
public function closeForgotUsernameModal()
{
$this->showForgotUsernameModal = false;
}
public function submit()
{
@ -17,32 +28,31 @@ class LoginForm extends Component
'username' => 'required|string',
'password' => 'required|string',
]);
try {
$response = Http::post(config('services.backend_api.url') . '/api/cms/login_password', [
'username' => $this->username,
'password' => $this->password,
]);
$data = $response->json();
if ($response->successful() && $data['code'] === 200) {
$isPasswordChange = $data['data']['prompt_password'] ?? 0;
Session::put('user', [
'admin' => $data['data']['admin'] ?? null,
'access_token' => $data['data']['token'] ?? null,
'is_passwordChange' => $isPasswordChange,
'admin_uuid' => $data['data']['admin_uuid'] ?? null,
]);
if ($isPasswordChange) {
return $this->redirect('change-password');
} else {
return $this->redirect('/main/profile');
}
if ($response->successful() && $data['code'] === 200) {
$isPasswordChange = $data['data']['prompt_password'] ?? 0;
Session::put('user', [
'admin' => $data['data']['admin'] ?? null,
'access_token' => $data['data']['token'] ?? null,
'is_passwordChange' => $isPasswordChange,
'admin_uuid' => $data['data']['admin_uuid'] ?? null,
]);
if ($isPasswordChange) {
return $this->redirect('change-password');
} else {
return $this->redirect('/main/profile');
}
} else {
$message = $data['message'] ?? 'Login request failed. Please try again.';
$this->addError('username', $message);
@ -50,12 +60,10 @@ class LoginForm extends Component
} catch (\Exception $e) {
$this->addError('username', 'An error : ' . $e->getMessage());
}
}
public function render()
{
return view('livewire.auth.login-form'); // This will point to the resource/views/livewire/auth/login-form.blade.php component
}
}
}

View File

@ -42,7 +42,7 @@ class TermsAndPrivacy extends Component
'tp_uuid' => $termsAndPrivacy['tp_uuid'],
'title' => $termsAndPrivacy['title'],
'details' => $termsAndPrivacy['details'],
'type' => $termsAndPrivacy['type'],
'type' => $termsAndPrivacy['type'] == 1 ? 'Terms' : 'Privacy',
];
});

View File

@ -22,10 +22,10 @@
</div>
<div class="flex items-center justify-between text-sm mb-4">
<a href="#" class="text-blue-600 hover:underline" wire:click.prevent="forgotUsername">Forgot Username</a>
<button href="#" class="text-blue-600 hover:underline" wire:click.prevent="forgotUsername">Forgot Username & Password</button>
</div>
<button type="submit" class="w-full bg-orange-600 font-bold hover:bg-orange-400 text-white py-2 rounded-md">Log in</button>
<button type="submit" class="w-full bg-orange-600 font-bold hover:bg-orange-400 text-white py-2 rounded-md">Log in</button>
<!-- <a href="/main/profile" class="block text-center w-full bg-orange-600 font-bold hover:bg-orange-400 text-white py-2 rounded-md">Log in</a> -->
@ -39,4 +39,24 @@
By logging in, you agree to Unioil's Terms of Service, Privacy Policy, and Content Policies. | © 2025 Unioil. All Rights Reserved.
</footer>
</div>
</div>
@if ($showForgotUsernameModal)
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50">
<div class="bg-white rounded-lg shadow-lg w-full max-w-md p-6 relative">
<h2 class="text-lg font-bold mb-4">Forgot Username & Password</h2>
<p class="text-sm text-gray-600 mb-4">
To have your account information sent to you, please contact the Unioil Admin via email at:
<a href="mailto: grmontino@unioil.com" class="text-blue-600 hover:underline">
grmontino@unioil.com
</a>
</p>
<div class="flex justify-end">
<button wire:click="closeForgotUsernameModal" class="bg-orange-600 hover:bg-orange-400 text-white px-4 py-2 rounded-md text-sm font-bold">
Close
</button>
</div>
</div>
</div>
@endif
</div>

View File

@ -47,10 +47,6 @@
</select>
</div>
<!-- Title -->
<div class="flex items-center gap-2">
<label class="w-40">Title:</label>

View File

@ -17,8 +17,34 @@
</div>
<!-- Page Title -->
<h3 class="text-5xl font-semibold text-gray-800 mt-4">View Card Type</h3>
<h3 class="text-5xl font-semibold text-gray-800 mt-4">Card Type Details</h3>
<!-- Bottom border -->
<div class="border-b border-gray-300 mt-5"></div>
<div class="mt-10">
<div class="p-6 mt-10 max-w-5xl mx-auto bg-white rounded-md shadow-md">
<div>
<h4 class="font-bold mb-5 text-2xl">Details</h4>
</div>
<div>
<h4 class="font-bold mb-5 text-2xl"> Card Details</h4>
<p><span class="font-semibold">Card Code:</span> {{$code}}</p>
<p><span class="font-semibold">Card Type Description:</span> {{$name}}</p>
<p><span class="font-semibold">Card Type Short Description:</span> {{$description}}</p>
<p><span class="font-semibold">Card Type Image:</span> <img src="{{ $image }}" alt="Cover Type Image"></p>
<p><span class="font-semibold">Virtual Card Font Color:</span> {{$virtual_card_font_color}}</p>
<p><span class="font-semibold">Card Type Cover Image:</span><img src="{{ $image }}" alt="Card Type Cover Image"></p>
<p><span class="font-semibold">ID Number Required:</span> {{$id_number}}</p>
<p><span class="font-semibold">ID Number Description:</span> {{$id_number_description}}</p>
</div>
<div>
<h4 class="font-bold mt-10 mb-5 text-2xl">Data Privacy Details</h4>
<p><span class="font-semibold">Terms and Conditions:</span> {{$terms_and_conditions}}</p>
<p><span class="font-semibold">FAQs:</span> {{$faqs}}</p>
</div>
</div>
</div>
</div>

View File

@ -25,8 +25,8 @@
<div class="mt-10">
<div class="p-6 mt-10 max-w-5xl mx-auto bg-white rounded-md shadow-md">
<div>
{{$image}}
<div class="mb-6">
<img src="{{ $image }}" alt="Photo Slider Image">
</div>
<div>
<h4 class="font-bold mb-5 text-2xl">Content Details</h4>

View File

@ -25,8 +25,8 @@
<div class="mt-10">
<div class="p-6 mt-10 max-w-5xl mx-auto bg-white rounded-md shadow-md">
<div>
{{$image}}
<div class="mb-6">
<img src="{{ $image }}" alt="Promo Image">
</div>
<div>
<h4 class="font-bold mb-5 text-2xl">Details</h4>

View File

@ -17,8 +17,20 @@
</div>
<!-- Page Title -->
<h3 class="text-5xl font-semibold text-gray-800 mt-4">View Terms and Privacy</h3>
<h3 class="text-5xl font-semibold text-gray-800 mt-4">Terms and Privacy Details</h3>
<!-- Bottom border -->
<div class="border-b border-gray-300 mt-5"></div>
<div class="mt-10">
<div class="p-6 mt-10 max-w-5xl mx-auto bg-white rounded-md shadow-md">
<div>
<h4 class="font-bold mb-5 text-2xl">Details</h4>
<p><span class="font-semibold">Title:</span> {{$title}}</p>
<p><span class="font-semibold">Details:</span> {{$details}}</p>
</div>
</div>
</div>
</div>

View File

@ -17,8 +17,19 @@
</div>
<!-- Page Title -->
<h3 class="text-5xl font-semibold text-gray-800 mt-4">View Top Up</h3>
<h3 class="text-5xl font-semibold text-gray-800 mt-4">Top Up Details</h3>
<!-- Bottom border -->
<div class="border-b border-gray-300 mt-5"></div>
</div>
<div class="mt-10">
<div class="p-6 mt-10 max-w-5xl mx-auto bg-white rounded-md shadow-md">
<div>
<h4 class="font-bold mb-5 text-2xl">Content Details</h4>
<p><span class="font-semibold">Fee Code:</span> {{$fee_code}}</p>
<p><span class="font-semibold">Name:</span> {{$name}}</p>
<p><span class="font-semibold">Value:</span> {{$amount}}</p>
<p><span class="font-semibold">Type:</span> {{$type}}</p>
</div>
</div>