latest commit
This commit is contained in:
parent
6c47477da1
commit
3cbf077990
|
@ -8205,12 +8205,12 @@
|
|||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.2"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
|
@ -24,9 +24,15 @@
|
|||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('error_username'))
|
||||
<span style="color: red;">{{ session('error_username') }}</span>
|
||||
@if (session('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
@if (session('prompt_password'))
|
||||
<div class="alert alert-warning">
|
||||
You must change your password. <a href="{{ route('change.password.form') }}">Change Password</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('login') }}">
|
||||
|
@ -34,13 +40,17 @@
|
|||
<div class="mb-3">
|
||||
<label for="username" class="form-label fw-semibold" style="font-size: 13px; color: #003366;">Enter Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="superadmin" value="{{ old('username') }}" required>
|
||||
@error('username')
|
||||
<div style="color: red; font-size: 0.875em;">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label fw-semibold" style="font-size: 13px; color: #003366;">Enter Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="••••••••" required>
|
||||
@error('password')
|
||||
<div style="color: red; font-size: 0.875em;">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-6">
|
||||
<a href="#" class="text-decoration-none text-primary" data-bs-toggle="modal" data-bs-target="#forgotPasswordModal">Forgot Username</a>
|
||||
|
@ -72,6 +82,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Include Bootstrap 5 JS for modal functionality -->
|
||||
<!-- Include Bootstrap JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
@endsection
|
|
@ -3,21 +3,10 @@
|
|||
@section('page_title', 'User Management')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$users = [
|
||||
['id' => 1, 'username' => 'superadmin', 'firstName' => 'Maryse', 'lastName' => 'Howe', 'role' => 'Admin', 'email' => 'maryse.howe@qqq.com', 'status' => 'Inctive'],
|
||||
['id' => 2, 'username' => 'superadmin1', 'firstName' => 'Joseph', 'lastName' => 'Sazon', 'role' => 'Admin', 'email' => 'mis.specialist@unioil.com', 'status' => 'Active'],
|
||||
['id' => 3, 'username' => 'graxia', 'firstName' => 'Graxia', 'lastName' => 'Montino', 'role' => 'Admin', 'email' => 'business.analyst@unioil.com', 'status' => 'Inctive'],
|
||||
['id' => 4, 'username' => 'cinerosimo', 'firstName' => 'Cine', 'lastName' => 'Rosimo', 'role' => 'Admin', 'email' => 'frosimo1@yopmail.com', 'status' => 'Active'],
|
||||
['id' => 5, 'username' => 'graxia5', 'firstName' => 'Graxia', 'lastName' => 'Montino', 'role' => 'Admin', 'email' => 'business.analyst@unioil.com', 'status' => 'Inctive'],
|
||||
['id' => 6, 'username' => 'graxia6', 'firstName' => 'Graxia', 'lastName' => 'Montino', 'role' => 'Admin', 'email' => 'business.analyst@unioil.com', 'status' => 'Inctive'],
|
||||
['id' => 7, 'username' => 'graxia7', 'firstName' => 'Graxia', 'lastName' => 'Montino', 'role' => 'Admin', 'email' => 'business.analyst@unioil.com', 'status' => 'Active']
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div id="user-table">
|
||||
@include('components.table-component', [
|
||||
'pageTitle' => 'User Management',
|
||||
'data' => $users,
|
||||
'data' => [],
|
||||
'columns' => [
|
||||
['name' => 'Username', 'key' => 'username', 'sortable' => true],
|
||||
['name' => 'First Name', 'key' => 'firstName', 'sortable' => true],
|
||||
|
@ -34,4 +23,54 @@
|
|||
'showEditModal' => true,
|
||||
'showViewModal' => true
|
||||
])
|
||||
<div id="no-data-message" style="display: none; text-align: center; margin-top: 20px;">
|
||||
<p>No Data Found</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const apiBaseUrl = '{{ config('app.api_base_url') }}'; // Fetch base URL from config/app.php
|
||||
const apiEndpoint = `${apiBaseUrl}/api/cms/admin`; // Construct the full API URL
|
||||
|
||||
fetch(apiEndpoint, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Bearer ' + localStorage.getItem('token') // Adjust if authentication is needed
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const noDataMessage = document.getElementById('no-data-message');
|
||||
const tableComponent = document.querySelector('table-component');
|
||||
|
||||
if (data.data && Array.isArray(data.data) && data.data.length > 0) {
|
||||
const users = data.data.map(admin => ({
|
||||
id: admin.admin_id,
|
||||
username: admin.username,
|
||||
firstName: admin.firstname,
|
||||
lastName: admin.lastname,
|
||||
role: 'Admin', // Adjust if the API provides roles
|
||||
email: admin.email,
|
||||
status: admin.is_active ? 'Active' : 'Inactive'
|
||||
}));
|
||||
|
||||
// Update the table component with the fetched data
|
||||
if (tableComponent) {
|
||||
tableComponent.setAttribute('data', JSON.stringify(users));
|
||||
}
|
||||
noDataMessage.style.display = 'none'; // Hide the message
|
||||
} else {
|
||||
console.log('No data found or invalid response:', data);
|
||||
noDataMessage.style.display = 'block'; // Show the message
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching data:', error);
|
||||
const noDataMessage = document.getElementById('no-data-message');
|
||||
noDataMessage.style.display = 'block'; // Show the message on error
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -11,25 +11,15 @@ Route::get('/', function () {
|
|||
return redirect()->route('login');
|
||||
});
|
||||
|
||||
// Show login form
|
||||
|
||||
Route::get('/login', [AuthController::class, 'showLoginForm'])->name('login');
|
||||
|
||||
// Handle login form submission
|
||||
Route::post('/login', [AuthController::class, 'login'])->name('login');
|
||||
|
||||
// Show change password form
|
||||
Route::get('/change-password', [AuthController::class, 'showChangePasswordForm'])->name('password.change.form');
|
||||
|
||||
// Handle change password form submission
|
||||
Route::post('/change-password', [AuthController::class, 'changePassword'])->name('password.change');
|
||||
|
||||
// Redirect to my-profile (adjust as needed)
|
||||
Route::get('/my-profile', [AuthController::class, 'showMyProfile'])->name('my-profile')->middleware('auth');
|
||||
// Handle logout
|
||||
Route::post('/logout', [AuthController::class, 'logout'])->name('logout');
|
||||
|
||||
|
||||
|
||||
Route::get('/dashboard', function () {
|
||||
return view('dashboard');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue