diff --git a/php_code/.env b/php_code/.env index 5195f955..599be8f7 100644 --- a/php_code/.env +++ b/php_code/.env @@ -2,7 +2,7 @@ APP_NAME=lupmisBackend APP_ENV=local APP_KEY=base64:pmEAeuW8clKrfKKjcMWylo68exoDO/Xr2hUhXvB7dS0= APP_DEBUG=true -APP_URL=http://localhost:9031 +APP_URL=http:https://lupmis4luspa.org LOG_CHANNEL=daily LUPMISAPIKEY=1c46538c712e9b5b diff --git a/php_code/app/Http/Controllers/AdminController.php b/php_code/app/Http/Controllers/AdminController.php index 043b3a0a..a070e4ae 100644 --- a/php_code/app/Http/Controllers/AdminController.php +++ b/php_code/app/Http/Controllers/AdminController.php @@ -10,24 +10,35 @@ use Illuminate\Support\Collection; class AdminController extends Controller { public function index(){ - $users_url = "user_mgt/get_all_users.php"; - $data = ['api_token' => env('LUPMISAPIKEY')]; + if (session('current_user.user_type') == 'district_user') { + $users_url = "user_mgt/get_all_users_by_district.php"; + $data = ['district_id' => session('district_id'), 'api_token' => env('LUPMISAPIKEY')]; + } + elseif(session('current_user.user_type') == 'regional_user'){ + $users_url = "user_mgt/get_all_users_by_district.php"; + $data = ['region_id' => session('region_id'), 'api_token' => env('LUPMISAPIKEY')]; + } + else{ + $users_url = "user_mgt/get_all_users.php"; + $data = ['api_token' => env('LUPMISAPIKEY')]; + } + // dd($users_url); $result = ApiCalls::CurlPost(json_encode($data), $users_url); + $users_arr = json_decode($result, true); - if ($users_arr['success'] == false) { - return redirect->back(); + // dd($users_arr); + if ($users_arr == null || $users_arr['success'] == false) { + return redirect()->back()->withErrors('Your request cannot be handled at this time. Try again later'); } $regions_url = "user_mgt/get_all_regions.php"; $data = ['api_token' => env('LUPMISAPIKEY')]; $result = ApiCalls::CurlPost(json_encode($data), $regions_url); $regions_arr = json_decode($result, true); - if ($regions_arr['success'] == false) { - return redirect->back(); + if ($regions_arr == null || $regions_arr['success'] == false) { + return redirect->back()->withErrors('Your request cannot be handled at this time. Try again later'); } - - // 2. Define pagination parameters $perPage = 15; $search = request()->input('search'); if ($search) { @@ -48,22 +59,20 @@ class AdminController extends Controller $currentPage = LengthAwarePaginator::resolveCurrentPage() ?: 1; $offset = ($currentPage - 1) * $perPage; - // 3. Slice the array to get the items for the current page $currentPageItems = array_slice($filteredData, $offset, $perPage); - - // 4. Create the LengthAwarePaginator instance $paginatedItems = new LengthAwarePaginator( - $currentPageItems, // Items for the current page - count($filteredData), // Total number of items - $perPage, // Items per page - $currentPage, // Current page number - ['path' => request()->url(), 'query' => request()->query()] // Options to preserve query strings and path + $currentPageItems, + count($filteredData), + $perPage, + $currentPage, + ['path' => request()->url(), 'query' => request()->query()] ); $user_type_arr = [ 'district_user' => 'District User', 'regional_user' => 'Regional User', 'national_user' => 'National User' ]; + // dump($users_arr['data']); $data = [ 'page_title' => 'User Admin', 'users_arr' => $users_arr['data'], @@ -71,8 +80,7 @@ class AdminController extends Controller 'user_type_arr' => $user_type_arr, 'items' => $paginatedItems ]; - // dump($data); - // 5. Pass the paginator instance to your view + return view('admin.paginated', $data); // return view('admin.home', $data); @@ -109,7 +117,7 @@ class AdminController extends Controller return view('admin.home', $data); } public function districtparams(){ - + /* $url = "user_mgt/get_district_parameters.php"; $data = json_encode([ 'district_id' => 171, @@ -117,11 +125,12 @@ class AdminController extends Controller ]); $result = ApiCalls::CurlPost($data, $url); $result = json_decode($result, true); - // dd($result); + dd($result); + */ $data = [ - 'page_title' => "Page Under Development" + 'page_title' => "District Parameters" ]; - return view('common.notready', $data); + return view('admin.district_params', $data); } public function luspaparams(){ $data = [ @@ -129,6 +138,12 @@ class AdminController extends Controller ]; return view('common.notready', $data); } + public function systempermissions(){ + $data = [ + 'page_title' => "System Permissions" + ]; + return view('admin.system-permissions', $data); + } public function districts($reqion_id){ // return response()->json(['request' => $reqion_id]); $url = "user_mgt/get_district_by_region_id.php"; diff --git a/php_code/app/Http/Controllers/LandingpageController.php b/php_code/app/Http/Controllers/LandingpageController.php index 155e4a13..d76a4266 100644 --- a/php_code/app/Http/Controllers/LandingpageController.php +++ b/php_code/app/Http/Controllers/LandingpageController.php @@ -12,6 +12,7 @@ class LandingpageController extends Controller $data = [ 'page_title' => 'Landing Page' ]; + // dump(session('current_user')); return view('landing', $data); } diff --git a/php_code/app/Http/Controllers/PermitsController.php b/php_code/app/Http/Controllers/PermitsController.php index 69607420..6960e947 100644 --- a/php_code/app/Http/Controllers/PermitsController.php +++ b/php_code/app/Http/Controllers/PermitsController.php @@ -27,6 +27,23 @@ class PermitsController extends Controller ]; return view('permits.dashboard', $data); } + public function settings(){ + //pull email address, sms configs, + /* + $url = "permit/get_applications_by_district.php"; + $data = json_encode([ + 'district_id' => session('current_user.district_id'), + 'api_token' => env('LUPMISAPIKEY') + ]); + $result = ApiCalls::CurlPost($data, $url); + $result = json_decode($result, true); + */ + $data = [ + 'page_title' => 'Permits Settings', + // 'permits_arr' => $result + ]; + return view('permits.district-settings', $data); + } public function statusIndex($status){ $url = "permit/get_applications_by_district.php"; @@ -58,10 +75,11 @@ class PermitsController extends Controller ]); $result = ApiCalls::CurlPost($data, $url); $result = json_decode($result, true); - // dump($result); + $allowed_users_to_comment = ['PPD Head', 'Works Department Head', 'luspa-it-head']; $data = [ 'page_title' => 'Permits Details', 'permit_arr' => $result['data'][0], + 'allowed_users_to_comment' => $allowed_users_to_comment ]; return view('permits.show', $data); } @@ -69,7 +87,6 @@ class PermitsController extends Controller } public function viewPdf($filename){ - // Ensure the file exists and is in the correct storage sub-directory $path = storage_path('app/public/site_plans/' . $filename); if (!Storage::disk('public')->exists('site_plans/' . $filename)) { diff --git a/php_code/app/Http/Controllers/UserloginController.php b/php_code/app/Http/Controllers/UserloginController.php index 62ba61c5..df36c7e5 100644 --- a/php_code/app/Http/Controllers/UserloginController.php +++ b/php_code/app/Http/Controllers/UserloginController.php @@ -25,6 +25,27 @@ class UserloginController extends Controller $check_user_url = 'auth/auth_user.php'; $data = ['user' => $request->username, 'pass' => $request->password, 'api_token' => env('LUPMISAPIKEY')]; $check_user = ApiCalls::CurlPost(json_encode($data), $check_user_url); + /* + "success" : true, "data" : { + "ua_id":28,"user_id":"71c1f2bd-e85b-4c2a-b559-536731ea1a92", + "username":"kwesilupmis", + "title":"Mr","full_name":"Kwesi banson jnr", + "ua_position":"luspa-it-head", + "email":"kwesibanson@yahoo.com", + "phone":"0204040805","gender":null, + "is_disabled":"true", + "is_logged_in":0,"is_password_changed":"false","password_hint":"none", + "created_by_id":null,"created_date":"2026-03-10T07:09:38.815762", + "updated_by_id":"71c1f2bd-e85b-4c2a-b559-536731ea1a92", + "updated_date":"2026-05-06T10:26:09.191289", + "allowed_apps":"drawing-tools, permit-tools, admin-gui", + "region_id":10, + "district_id":122 + } + + */ + + if($check_user == false){ return redirect("user-login")->withErrors(array("System not available at the moment. Try again later!"))->withInput(); } @@ -32,6 +53,9 @@ class UserloginController extends Controller if($result['success'] == false){ return redirect("user-login")->withErrors(array("Incorrect Email/Password. Check and try again!"))->withInput(); } + if($result['data']['is_disabled'] == true){ + ##return redirect("user-login")->withErrors(array("Your Account has been disabled. Contact your administrator!"))->withInput(); + } $logged_in = $result['data']; $request->session()->regenerate(true); @@ -41,6 +65,7 @@ class UserloginController extends Controller $request->session()->put('current_user.title', $logged_in['title']); $request->session()->put('current_user.full_name', $logged_in['full_name']); $request->session()->put('current_user.email', $logged_in['email']); + $request->session()->put('current_user.user_type', $logged_in['user_type']); $request->session()->put('current_user.phone', $logged_in['phone']); $request->session()->put('current_user.allowed_apps', $logged_in['allowed_apps']); $request->session()->put('current_user.ua_position', $logged_in['ua_position']); diff --git a/php_code/app/Http/Controllers/UsersController.php b/php_code/app/Http/Controllers/UsersController.php index 5e769c46..7e54f72f 100644 --- a/php_code/app/Http/Controllers/UsersController.php +++ b/php_code/app/Http/Controllers/UsersController.php @@ -7,18 +7,80 @@ use Session; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; use App\Mail\UserAccountsMail; +use App\Mail\PasswordResetMail; use Illuminate\Support\Str; class UsersController extends Controller { public function index(){ - $data = [ 'page_title' => 'Users Page ' ]; return view('users.index', $data); } + public function reset(){ + $data = [ + 'page_title' => 'Password Reset Page' + ]; + return view('user-auth.reset', $data); + } + public function check_reset_email(Request $request){ + // code... + // dd('foo bar'); + $url = "user_mgt/get_user_by_user_id.php"; + $user_id = "34ba702b-18f8-4d85-948d-8c55e8500f32"; + $data = json_encode([ + 'user_id' => "34ba702b-18f8-4d85-948d-8c55e8500f32",// $id, + 'api_token' => env('LUPMISAPIKEY')// make the API token a constant + ]); + $result = ApiCalls::CurlPost($data, $url); + $result = json_decode($result, true); + + // dd($result); + $recipientEmail = $result['data']['email']; + $fullname = $result['data']['full_name']; + $phone = $result['data']['phone']; + //send reset link email + //baduhupir@mailinator.com + $reset_link = env('APP_URL') . "/reset-auth/" . $user_id; + Mail::to($recipientEmail)->send(new PasswordResetMail($fullname, $reset_link)); + + return redirect(url('reset-notice')); //get + // return redirect(url('new-password-form')); + + } + public function reset_notice(Request $request){ + + + return view('user-auth.email-notice'); + + } + public function show_new_passform(Request $request){ + // code...show_new_passform + // dd('foo bar show new pass'); + dump($request->all()); + $data = [ + 'page_title' => 'New Password Form' + ]; + return view('user-auth.password', $data); + } + + public function handle_reset(Request $request){ + // code...show_new_passform + // dd('foo bar handle reset'); + + return redirect(url('reset-success')); //get + } + public function reset_success(Request $request){ + // code...show_new_passform + // dd('foo bar handle reset'); + $data = [ + 'page_title' => 'New Password Success' + ]; + return view('user-auth.password-success', $data); + } + public function edit($id){ $url = "user_mgt/get_user_by_user_id.php"; @@ -94,13 +156,13 @@ class UsersController extends Controller 'password_hint' => 'none', 'phone' => $request['phone'], 'gender' => $request['gender'], - 'user_type' => 'District User', + 'user_type' => $request['user_type'], 'pass' => $password, 'region_id' => $request['region_id'], 'district_id' => $request['districtid'], 'api_token' => env('LUPMISAPIKEY'), //'1c46538c712e9b5b' // make the API token a constant ]); - + // dd($data); $result = ApiCalls::CurlPost($data, $url); $result = json_decode($result, true); \Log::info("Your Password is $password"); @@ -116,10 +178,11 @@ class UsersController extends Controller 'recipient' => $request['phone'], 'message' => $sms_message ]; - $sms_result = SmsLibrary::SendMnotitySms($sms_data); + + #$sms_result = SmsLibrary::SendMnotitySms($sms_data); // will send this the API \Log::info("SMS Body : $sms_message"); - \Log::info("SMS API Response : $sms_result"); + #\Log::info("SMS API Response : $sms_result"); if (request()->expectsJson()) { return response()->json($result); @@ -131,11 +194,10 @@ class UsersController extends Controller // return ['success' => true]; // dd($request->all()); - - $data = json_encode([ + $user_data = [ 'full_name' => $request['full_name'], 'username' => $request['username'], - 'ua_position' => $request['ua_position'], + // 'ua_position' => $request['ua_position'], 'user_id' => $request['user_id'], 'email' => $request['email'], 'title' => $request['title'], @@ -144,7 +206,11 @@ class UsersController extends Controller 'gender' => $request['gender'], 'user_type' => 'District User', 'api_token' => env('LUPMISAPIKEY'), - ]); + ]; + if ($request->has('expire_password')) { + $user_data['is_password_changed'] = 'NO'; + } + $data = json_encode($user_data); $result = ApiCalls::CurlPost($data, $url); $result = json_decode($result, true); // dd($result); diff --git a/php_code/app/Mail/PasswordResetMail.php b/php_code/app/Mail/PasswordResetMail.php new file mode 100644 index 00000000..fe1c58a7 --- /dev/null +++ b/php_code/app/Mail/PasswordResetMail.php @@ -0,0 +1,58 @@ +fullname = $fullname; + $this->reset_url = $reset_url; + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + return new Envelope( + subject: 'Password Reset Mail', + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + return new Content( + view: 'emails.reset-link', + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/php_code/config/session.php b/php_code/config/session.php index ba0aa60b..94d6de30 100644 --- a/php_code/config/session.php +++ b/php_code/config/session.php @@ -34,7 +34,9 @@ return [ 'lifetime' => (int) env('SESSION_LIFETIME', 120), - 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), + //'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), + 'expire_on_close' => true, + /* |-------------------------------------------------------------------------- diff --git a/php_code/info.md b/php_code/info.md index 6c1bdb37..53f5aee6 100644 --- a/php_code/info.md +++ b/php_code/info.md @@ -1,3 +1,7 @@ +# Acounts +- assiamah/win +- kwesilupmis/7aa0478bce + composer create-project laravel/laravel:^11.0 my-laravel-11-project chmod -R 0777 storage/ chmod -R 0777 bootstrap/ diff --git a/php_code/public/assets/css/params.css b/php_code/public/assets/css/params.css new file mode 100644 index 00000000..ca876074 --- /dev/null +++ b/php_code/public/assets/css/params.css @@ -0,0 +1,1006 @@ +/* Custom CSS for LUPMIS 2.0 Permit System */ + +/* Header Styles */ +.header-bg { + background: linear-gradient(135deg, #3b7fb3 0%, #4c84af 100%); +} + +.version { + background-color: rgba(255, 255, 255, 0.2); + padding: 2px 8px; + border-radius: 4px; + font-size: 0.8rem; +} + +/* Navigation Styles */ +.navbar { + border-bottom: 1px solid #dee2e6; +} + +.nav-link.active { + color: #3b7fb3 !important; + font-weight: 500; +} + +.user-avatar { + width: 40px; + height: 40px; + background: linear-gradient(135deg, #8b5cf6, #3b82f6); + border-radius: 50%; +} + +/* Filter Tabs */ +.filter-tabs { + display: flex; + gap: 0; +} + +.filter-btn { + padding: 8px 20px; + border: 1px solid #dee2e6; + background: white; + color: #6c757d; + border-radius: 0; + cursor: pointer; + transition: all 0.3s ease; +} + +.filter-btn:first-child { + border-radius: 6px 0 0 6px; +} + +.filter-btn:last-child { + border-radius: 0 6px 6px 0; +} + +.filter-btn.active { + background-color: #3b7fb3; + color: white; + border-color: #3b7fb3; +} + +.filter-btn:hover:not(.active) { + background-color: #f8f9fa; +} + +/* Table Styles */ +.table tbody tr { + cursor: pointer; + transition: background-color 0.2s ease; +} + +.table tbody tr:hover { + background-color: #f8f9fa; +} + +/* Eligibility Page Styles */ +.requirement-card { + background: #f8f9fa; + border-radius: 12px; + padding: 30px; + margin-bottom: 20px; + position: relative; + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.requirement-card:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); +} + +.card-icon { + width: 60px; + height: 60px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto 20px auto; +} + +.commercial-icon { + background-color: #3b7fb3; + color: white; +} + +.residential-icon { + background-color: #3b7fb3; + color: white; +} + +.card-title { + font-size: 1.5rem; + font-weight: bold; + color: #2c3e50; + text-align: center; + margin-bottom: 8px; +} + +.card-subtitle { + color: #22d3ee; + text-align: center; + margin-bottom: 30px; +} + +.requirement-list { + margin-bottom: 30px; +} + +.requirement-item { + display: flex; + align-items: flex-start; + margin-bottom: 20px; +} + +.requirement-number { + background-color: #22d3ee; + color: white; + width: 30px; + height: 30px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + margin-right: 15px; + flex-shrink: 0; +} + +.requirement-details h4 { + color: #2c3e50; + font-size: 1rem; + font-weight: bold; + margin-bottom: 5px; +} + +.requirement-details p { + color: #6c757d; + margin-bottom: 0; + font-size: 0.9rem; +} + +.start-application-btn { + background-color: #3b7fb3; + border-color: #3b7fb3; + width: 100%; + padding: 12px; + font-weight: 500; + border-radius: 8px; +} + +.start-application-btn:hover { + background-color: #357a8a; + border-color: #357a8a; +} + +/* Form Styles */ +.form-section { + background: white; + padding: 20px 0; +} + +.section-title { + font-size: 1.5rem; + font-weight: bold; + color: #2c3e50; + margin-bottom: 20px; + padding-bottom: 10px; + border-bottom: 2px solid #e9ecef; +} + +.form-label { + font-weight: 500; + color: #495057; + margin-bottom: 8px; +} + +.form-control, +.form-select { + padding: 12px 15px; + border: 1px solid #ced4da; + border-radius: 6px; + font-size: 0.95rem; +} + +.form-control:focus, +.form-select:focus { + border-color: #3b7fb3; + box-shadow: 0 0 0 0.2rem rgba(74, 144, 164, 0.25); +} + +.form-actions { + margin-top: 40px; + text-align: right; +} + +/* Upload Documents Styles */ +.upload-area { + border: 2px dashed #3b7fb3; + border-radius: 12px; + padding: 60px 40px; + text-align: center; + background-color: #f8f9fa; + cursor: pointer; + transition: all 0.3s ease; +} + +.upload-area:hover { + border-color: #357a8a; + background-color: #f1f3f4; +} + +.upload-icon i { + font-size: 3rem; + color: #3b7fb3; + margin-bottom: 20px; +} + +.upload-text { + font-size: 1.1rem; + color: #495057; +} + +.upload-formats { + font-size: 0.9rem; +} + +.upload-section { + margin-bottom: 30px; +} + +.upload-section-title { + font-size: 1.2rem; + font-weight: 600; + color: #2c3e50; + margin-bottom: 15px; +} + +.file-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px 15px; + border: 1px solid #dee2e6; + border-radius: 8px; + background-color: white; +} + +.file-item.uploading { + background-color: #f8f9fa; +} + +.file-item.uploaded { + background-color: #d1eddb; + border-color: #badbcc; +} + +.file-name { + font-weight: 500; + color: #495057; +} + +.progress { + height: 4px; + background-color: #e9ecef; +} + +.progress-bar { + background-color: #3b7fb3; +} + +/* Payment Styles */ +.fee-summary, +.payment-methods { + background: white; + padding: 30px; + border-radius: 12px; + border: 1px solid #dee2e6; +} + +.fee-section-title { + font-size: 1.4rem; + font-weight: bold; + color: #2c3e50; + margin-bottom: 25px; +} + +.fee-item { + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: 15px 0; + border-bottom: 1px solid #e9ecef; +} + +.fee-item:last-child { + border-bottom: none; +} + +.fee-total { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20px 0 0 0; + border-top: 2px solid #3b7fb3; + margin-top: 15px; +} + +.fee-name { + font-size: 1.1rem; + font-weight: 600; + color: #2c3e50; + margin-bottom: 5px; +} + +.fee-description { + font-size: 0.9rem; + color: #6c757d; + margin-bottom: 0; +} + +.fee-amount { + font-size: 1.1rem; + font-weight: bold; + color: #2c3e50; +} + +.payment-subtitle { + color: #6c757d; + margin-bottom: 25px; +} + +.payment-option { + border: 2px solid #dee2e6; + border-radius: 8px; + padding: 20px; + text-align: center; + cursor: pointer; + transition: all 0.3s ease; + background: white; +} + +.payment-option:hover { + border-color: #3b7fb3; + transform: translateY(-2px); +} + +.payment-option.selected { + border-color: #3b7fb3; + background-color: rgba(74, 144, 164, 0.1); +} + +.payment-logo { + max-width: 80px; + height: 40px; + margin-bottom: 10px; +} + +.payment-icon i { + font-size: 2rem; + color: #3b7fb3; + margin-bottom: 10px; +} + +.payment-name { + font-weight: 500; + color: #495057; + font-size: 0.9rem; +} + +/* Thank You Page Styles */ +.thank-you-content { + max-width: 600px; + margin: 80px auto; +} + +.application-details { + background: #f8f9fa; + padding: 30px; + border-radius: 12px; + margin: 40px 0; +} + +.status-badge { + background-color: #fff3cd; + color: #856404; + padding: 8px 16px; + border-radius: 20px; + font-weight: 500; + display: inline-block; +} + +.action-buttons { + margin-top: 40px; +} + +/* View Application Styles */ +.map-container { + background: #f8f9fa; + border-radius: 8px; + overflow: hidden; + border: 1px solid #dee2e6; +} + +.details-section { + background: white; + padding: 25px; + border-radius: 8px; + border: 1px solid #dee2e6; + margin-bottom: 20px; +} + +.detail-label { + font-weight: 600; + color: #495057; + margin-bottom: 5px; +} + +.detail-value { + color: #6c757d; + margin-bottom: 15px; +} + +.remarks-section { + background: white; + padding: 25px; + border-radius: 8px; + border: 1px solid #dee2e6; + position: sticky; + top: 20px; +} + +/* Responsive Design */ +@media (max-width: 768px) { + .requirement-card { + padding: 20px; + } + + .upload-area { + padding: 40px 20px; + } + + .fee-summary, + .payment-methods { + padding: 20px; + } + + .form-actions { + text-align: center; + } + + .form-actions .btn { + width: 100%; + margin-bottom: 10px; + } +} + +/* Utility Classes */ +.text-primary { + color: #3b7fb3 !important; +} + +.bg-primary { + background-color: #3b7fb3 !important; +} + +.btn-primary { + background-color: #3b7fb3; + border-color: #3b7fb3; +} + +.btn-primary:hover { + background-color: #357a8a; + border-color: #357a8a; +} + +/* Selection Card Styling */ +.selection-card { + border-radius: 16px; + background: linear-gradient(135deg, #ffffff 0%, #f8fdff 100%); + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.selection-card:hover { + transform: translateY(-2px); + box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15) !important; +} + +/* Select Fields Styling */ +.form-select { + border: 2px solid #e9ecef; + padding: 0.75rem 2.5rem 0.75rem 1rem; + font-size: 0.95rem; + border-radius: 10px; + transition: all 0.3s ease; + background-color: #fff; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233b7fb3' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 1rem center; + background-size: 16px 12px; + cursor: pointer; +} + +.form-select-lg { + padding: 1rem 2.5rem 1rem 1.25rem; + font-size: 1.05rem; + border-radius: 12px; +} + +.form-select:focus { + border-color: #3b7fb3; + box-shadow: 0 0 0 0.25rem rgba(59, 127, 179, 0.15); + outline: none; + background-color: #fff; +} + +.form-select:hover:not(:disabled) { + border-color: #3b7fb3; + background-color: #f8f9fa; +} + +.form-select:disabled { + background-color: #f8f9fa; + cursor: not-allowed; + opacity: 0.6; +} + +.form-label { + color: #495057; + font-size: 0.95rem; + margin-bottom: 0.75rem; + display: block; +} + +.form-label i { + color: #3b7fb3; +} + +/* Requirements Section Styling */ +#requirementsSection .card-header { + background: linear-gradient(135deg, #3b7fb3 0%, #4c84af 100%) !important; + border-radius: 16px 16px 0 0 !important; +} + +#requirementsSection .card { + border-radius: 16px; + animation: slideUp 0.5s ease-out; +} + +.requirements-list-container { + min-height: 200px; +} + +.requirement-detail-item { + padding: 1.25rem; + margin-bottom: 1rem; + background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%); + border-left: 4px solid #3b7fb3; + border-radius: 8px; + transition: all 0.3s ease; +} + +.requirement-detail-item:hover { + transform: translateX(5px); + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1); +} + +.requirement-detail-item h5 { + color: #3b7fb3; + font-weight: 600; + margin-bottom: 0.5rem; + display: flex; + align-items: center; + gap: 0.5rem; +} + +.requirement-detail-item p { + color: #6c757d; + margin: 0; + line-height: 1.6; +} + +.requirement-number-badge { + width: 32px; + height: 32px; + background: linear-gradient(135deg, #3b7fb3 0%, #4c84af 100%); + color: white; + border-radius: 50%; + display: inline-flex; + align-items: center; + justify-content: center; + font-weight: bold; + font-size: 0.9rem; +} + +/* Animations */ +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideUp { + from { + opacity: 0; + transform: translateY(30px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +/* Store Settings Page Styles */ +.settings-card { + background: white; + border: 1px solid #dee2e6; + border-radius: 12px; + padding: 25px; + cursor: pointer; + transition: all 0.3s ease; + height: 100%; +} + +.settings-card:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); +} + +.settings-card .card-icon { + width: 40px; + height: 40px; + background-color: #f8f9fa; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin: 0; +} + +.settings-card .card-icon i { + font-size: 1.25rem; + color: #3b7fb3; +} + +.settings-card .card-title { + font-size: 1.1rem; + font-weight: 600; + color: #2c3e50; + text-align: left; + margin-bottom: 8px; +} + +.settings-card .card-description { + font-size: 0.9rem; + color: #6c757d; + text-align: left; + line-height: 1.5; +} + +/* Responsive adjustments for settings grid */ +@media (max-width: 991px) { + .settings-grid .col-lg-4 { + flex: 0 0 50%; + max-width: 50%; + } +} + +@media (max-width: 767px) { + .settings-grid .col-md-6 { + flex: 0 0 100%; + max-width: 100%; + } + + .container[style*="padding: 40px"] { + padding: 20px !important; + } +} + +/* Store Settings Page - Header Styles */ +.store-settings-header { + background: white; + border-bottom: 1px solid #dee2e6; +} + +.store-settings-header .back-button { + color: #3b7fb3; + font-size: 1rem; + padding: 0; + background: none; + border: none; + transition: color 0.3s ease; +} + +.store-settings-header .back-button:hover { + color: #357a8a; + text-decoration: none; +} + +.store-settings-header .back-button:focus { + outline: 2px solid #3b7fb3; + outline-offset: 2px; +} + +.store-settings-header h1 { + font-size: 2rem; + font-weight: 600; + color: #2c3e50; +} + +.store-settings-header .store-info { + display: flex; + align-items: center; +} + +.store-settings-header .store-logo { + width: 50px; + height: 50px; + background-color: #f8f9fa; + border-radius: 8px; + display: flex; + align-items: center; + justify-content: center; +} + +.store-settings-header .search-settings { + padding-left: 38px; + border: 1px solid #dee2e6; + border-radius: 8px; + transition: all 0.3s ease; +} + +.store-settings-header .search-settings:focus { + border-color: #3b7fb3; + box-shadow: 0 0 0 0.2rem rgba(59, 127, 179, 0.15); + outline: none; +} + +.store-settings-header .search-settings:hover { + border-color: #3b7fb3; +} + +/* Store Settings Page - Settings Cards Styles */ +.settings-section .settings-card { + background: white; + border: 1px solid #dee2e6; + border-radius: 12px; + padding: 25px; + cursor: pointer; + transition: all 0.3s ease; + height: 100%; + display: flex; + flex-direction: column; +} + +.settings-section .settings-card:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); + border-color: #3b7fb3; +} + +.settings-section .settings-card:focus { + outline: 2px solid #3b7fb3; + outline-offset: 2px; +} + +.settings-section .settings-card .card-icon { + width: 40px; + height: 40px; + background-color: #f8f9fa; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin: 0; +} + +.settings-section .settings-card .card-icon i { + font-size: 1.25rem; + color: #3b7fb3; +} + +.settings-section .settings-card .card-title { + font-size: 1.1rem; + font-weight: 600; + color: #2c3e50; + text-align: left; + margin-bottom: 8px; +} + +.settings-section .settings-card .card-description { + font-size: 0.9rem; + color: #6c757d; + text-align: left; + line-height: 1.5; + margin: 0; +} + +/* Store Settings Page - Integration Cards Styles */ +.integrations-section .integration-card { + background: white; + border: 1px solid #dee2e6; + border-radius: 12px; + padding: 25px; + cursor: pointer; + transition: all 0.3s ease; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; +} + +.integrations-section .integration-card:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); + border-color: #3b7fb3; +} + +.integrations-section .integration-card:focus { + outline: 2px solid #3b7fb3; + outline-offset: 2px; +} + +.integrations-section .integration-logo { + height: 60px; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 15px; +} + +.integrations-section .integration-logo i { + font-size: 3.5rem; +} + +.integrations-section .integration-name { + font-size: 1.1rem; + font-weight: 600; + color: #2c3e50; + margin-bottom: 10px; +} + +.integrations-section .integration-description { + font-size: 0.9rem; + color: #6c757d; + line-height: 1.5; + margin-bottom: 20px; + flex-grow: 1; +} + +.integrations-section .connect-btn { + background-color: #3b7fb3; + color: white; + border: none; + padding: 10px 24px; + border-radius: 8px; + font-weight: 500; + transition: all 0.3s ease; + width: 100%; +} + +.integrations-section .connect-btn:hover { + background-color: #357a8a; + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(59, 127, 179, 0.3); +} + +.integrations-section .connect-btn:focus { + outline: 2px solid #3b7fb3; + outline-offset: 2px; +} + +.integrations-section .connected-status { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; +} + +.integrations-section .connected-badge { + background-color: #d1eddb; + color: #0f5132; + padding: 6px 16px; + border-radius: 20px; + font-size: 0.875rem; + font-weight: 500; + display: inline-flex; + align-items: center; + gap: 6px; +} + +.integrations-section .connected-badge i { + color: #198754; + font-size: 0.5rem; +} + +.integrations-section .disconnect-btn { + background: none; + border: none; + color: #dc3545; + padding: 8px 16px; + border-radius: 6px; + font-weight: 500; + transition: all 0.3s ease; + width: 100%; +} + +.integrations-section .disconnect-btn:hover { + background-color: #f8d7da; + color: #b02a37; +} + +.integrations-section .disconnect-btn:focus { + outline: 2px solid #dc3545; + outline-offset: 2px; +} + +/* Store Settings Page - Responsive Styles */ +@media (max-width: 991px) { + .settings-grid .col-lg-4, + .integrations-grid .col-lg-4 { + flex: 0 0 50%; + max-width: 50%; + } +} + +@media (max-width: 767px) { + .store-settings-header .container { + padding: 20px !important; + } + + .store-settings-header h1 { + font-size: 1.5rem; + } + + .settings-grid .col-md-6, + .integrations-grid .col-md-6 { + flex: 0 0 100%; + max-width: 100%; + } + + .settings-section .settings-card, + .integrations-section .integration-card { + padding: 20px; + } + + .container[style*="padding: 40px"] { + padding: 20px !important; + } + + .settings-section, + .integrations-section { + margin-bottom: 30px !important; + } +} + +@media (max-width: 575px) { + .store-settings-header .back-button { + font-size: 0.9rem; + } + + .store-settings-header h1 { + font-size: 1.25rem; + } + + .store-settings-header .store-logo { + width: 40px; + height: 40px; + } + + .settings-section .settings-card .card-title, + .integrations-section .integration-name { + font-size: 1rem; + } + + .settings-section .settings-card .card-description, + .integrations-section .integration-description { + font-size: 0.85rem; + } +} diff --git a/php_code/public/assets/images/logos/epa-logo.png b/php_code/public/assets/images/logos/epa-logo.png new file mode 100644 index 00000000..e9537bde Binary files /dev/null and b/php_code/public/assets/images/logos/epa-logo.png differ diff --git a/php_code/public/assets/images/logos/geology.png b/php_code/public/assets/images/logos/geology.png new file mode 100644 index 00000000..12f84dcd Binary files /dev/null and b/php_code/public/assets/images/logos/geology.png differ diff --git a/php_code/public/assets/images/logos/gss-logo.png b/php_code/public/assets/images/logos/gss-logo.png new file mode 100644 index 00000000..149baadb Binary files /dev/null and b/php_code/public/assets/images/logos/gss-logo.png differ diff --git a/php_code/public/assets/images/logos/landscommission-logo.jpg b/php_code/public/assets/images/logos/landscommission-logo.jpg new file mode 100644 index 00000000..afb8e841 Binary files /dev/null and b/php_code/public/assets/images/logos/landscommission-logo.jpg differ diff --git a/php_code/public/assets/images/logos/mlgrd-logo.jpeg b/php_code/public/assets/images/logos/mlgrd-logo.jpeg new file mode 100644 index 00000000..19474651 Binary files /dev/null and b/php_code/public/assets/images/logos/mlgrd-logo.jpeg differ diff --git a/php_code/public/assets/images/logos/nadmo.png b/php_code/public/assets/images/logos/nadmo.png new file mode 100644 index 00000000..575d62c2 Binary files /dev/null and b/php_code/public/assets/images/logos/nadmo.png differ diff --git a/php_code/public/assets/js/all_pages.js b/php_code/public/assets/js/all_pages.js new file mode 100644 index 00000000..b4c918ee --- /dev/null +++ b/php_code/public/assets/js/all_pages.js @@ -0,0 +1,98 @@ +$(document).ready(function(){ + $('.profileLink').click(function(evt){ + evt.preventDefault(); + $.ajax({ + type: "GET", + url: base_url + '/users/getprofile', + processData: false, + contentType: false, + async: false, + success: function (data){ + console.log(data); + if (data.code === 1) { + console.log(data['user_details']); + + $('.userId').val(data['user_details']['user_id']); + $('.userName').val(data['user_details']['username']); + $('.userFullName').val(data['user_details']['full_name']); + $('.userEmail').val(data['user_details']['email']); + $('.userPhone').val(data['user_details']['phone']); + $('.userDesignation').val(data['user_details']['ua_position']); + $('.userDateAdded').val(data['user_details']['created_date']); + // $('.userEmail').val(data['user_details']['email']); + $('#profileModal').modal('show'); + + + } + else if (data.code > 1) { + $.alert({ + title: 'Alert!', + content: data.msg, + }); + } + else { + $.alert({ + title: 'Alert!', + content: 'Your request could not be handled. Try again !', + }); + + } + } + }); + + }); + $('#profileModalSubmitBtn').click(function(evt){ + evt.preventDefault(evt); + console.log('info'); + $('#successArea').addClass('d-none'); + $('#errorsArea').removeClass('d-none'); + var formData = new FormData($('#userProfileForm')[0]); + $.ajax({ + url: base_url + '/profileupdate', + type: 'POST', + data: formData, + processData: false, + contentType: false, + beforeSend: function() { + $('#successArea').text(""); + $('#successArea').text("Please wait ... profile update in progress!"); + }, + success: function(data) { + if (data['success'] == true) { + $('#successArea').removeClass('d-none'); + $('#errorsArea').addClass('d-none'); + + $('#successArea').text(""); + $('#successArea').text("Profile successfully updated!"); + // location.reload(); + $.alert({ + title: 'Alert!', + content: 'Profile successfully updated!', + }); + setTimeout(function() { + //location.reload(); // Reloads the current page + }, 2000); + } + else{ + $('#successArea').addClass('d-none'); + $('#errorArea').removeClass('d-none'); + $('#errorArea').text(""); + $('#errorArea').text("Profile could not be updated!"); + $.alert({ + title: 'Alert!', + content: 'Profile could not updated!', + }); + } + }, + error: function(xhr, status, error) { + console.error('Error:', error); + $('#successArea').text(error); + $('#successArea').text(error); + $.alert({ + title: 'Alert!', + content: error, + }); + } + }); + }); + }); \ No newline at end of file diff --git a/php_code/public/assets/js/districtparams.js b/php_code/public/assets/js/districtparams.js index c5a80b29..b6a3cccc 100644 --- a/php_code/public/assets/js/districtparams.js +++ b/php_code/public/assets/js/districtparams.js @@ -1,228 +1,3 @@ -// Store Settings Page JavaScript - -// Back button functionality -function goBack() { - if (window.history.length > 1) { - window.history.back(); - } else { - window.location.href = "index.html"; - } -} - -// Search functionality -document.addEventListener("DOMContentLoaded", function () { - const searchInput = document.getElementById("searchInput"); - - if (searchInput) { - searchInput.addEventListener("input", function (e) { - const searchQuery = e.target.value.toLowerCase().trim(); - - // Get all settings cards - const settingsCards = document.querySelectorAll(".settings-grid .col-12"); - // Get all integration cards - const integrationCards = document.querySelectorAll( - ".integrations-grid .col-12" - ); - - // Filter settings cards - settingsCards.forEach((cardCol) => { - const card = cardCol.querySelector(".settings-card"); - const title = card - .querySelector(".card-title") - .textContent.toLowerCase(); - const description = card - .querySelector(".card-description") - .textContent.toLowerCase(); - - if ( - title.includes(searchQuery) || - description.includes(searchQuery) || - searchQuery === "" - ) { - cardCol.style.display = ""; - } else { - cardCol.style.display = "none"; - } - }); - - // Filter integration cards - integrationCards.forEach((cardCol) => { - const card = cardCol.querySelector(".integration-card"); - const title = card - .querySelector(".integration-name") - .textContent.toLowerCase(); - const description = card - .querySelector(".integration-description") - .textContent.toLowerCase(); - - if ( - title.includes(searchQuery) || - description.includes(searchQuery) || - searchQuery === "" - ) { - cardCol.style.display = ""; - } else { - cardCol.style.display = "none"; - } - }); - }); - } - - // Integration connect/disconnect functionality - const integrationCards = document.querySelectorAll(".integration-card"); - - integrationCards.forEach((card) => { - const connectBtn = card.querySelector(".connect-btn"); - const disconnectBtn = card.querySelector(".disconnect-btn"); - - // Handle Connect button click - if (connectBtn) { - connectBtn.addEventListener("click", function () { - // Create connected status elements - const connectedStatus = document.createElement("div"); - connectedStatus.className = "connected-status"; - - const badge = document.createElement("span"); - badge.className = "badge connected-badge mb-2"; - badge.innerHTML = - ' Connected'; - - const newDisconnectBtn = document.createElement("button"); - newDisconnectBtn.className = "btn disconnect-btn"; - newDisconnectBtn.textContent = "Disconnect"; - - connectedStatus.appendChild(badge); - connectedStatus.appendChild(newDisconnectBtn); - - // Replace connect button with connected status - connectBtn.replaceWith(connectedStatus); - - // Add event listener to new disconnect button - newDisconnectBtn.addEventListener("click", function () { - // Show confirmation dialog - const integrationName = - card.querySelector(".integration-name").textContent; - if ( - confirm(`Are you sure you want to disconnect ${integrationName}?`) - ) { - // Create new connect button - const newConnectBtn = document.createElement("button"); - newConnectBtn.className = "btn connect-btn"; - newConnectBtn.innerHTML = - 'Connect '; - - // Replace connected status with connect button - connectedStatus.replaceWith(newConnectBtn); - - // Add event listener to new connect button - newConnectBtn.addEventListener("click", function () { - // Recursively handle connect (reuse the same logic) - newConnectBtn.click(); - }); - - // Re-attach the connect handler - attachConnectHandler(newConnectBtn, card); - } - }); - }); - } - - // Handle Disconnect button click - if (disconnectBtn) { - disconnectBtn.addEventListener("click", function () { - const integrationName = - card.querySelector(".integration-name").textContent; - if ( - confirm(`Are you sure you want to disconnect ${integrationName}?`) - ) { - const connectedStatus = card.querySelector(".connected-status"); - - // Create new connect button - const newConnectBtn = document.createElement("button"); - newConnectBtn.className = "btn connect-btn"; - newConnectBtn.innerHTML = - 'Connect '; - - // Replace connected status with connect button - connectedStatus.replaceWith(newConnectBtn); - - // Add event listener to new connect button - attachConnectHandler(newConnectBtn, card); - } - }); - } - }); - - // Helper function to attach connect handler - function attachConnectHandler(button, card) { - button.addEventListener("click", function () { - // Create connected status elements - const connectedStatus = document.createElement("div"); - connectedStatus.className = "connected-status"; - - const badge = document.createElement("span"); - badge.className = "badge connected-badge mb-2"; - badge.innerHTML = - ' Connected'; - - const newDisconnectBtn = document.createElement("button"); - newDisconnectBtn.className = "btn disconnect-btn"; - newDisconnectBtn.textContent = "Disconnect"; - - connectedStatus.appendChild(badge); - connectedStatus.appendChild(newDisconnectBtn); - - // Replace connect button with connected status - button.replaceWith(connectedStatus); - - // Add event listener to new disconnect button - newDisconnectBtn.addEventListener("click", function () { - const integrationName = - card.querySelector(".integration-name").textContent; - if ( - confirm(`Are you sure you want to disconnect ${integrationName}?`) - ) { - // Create new connect button - const newConnectBtn = document.createElement("button"); - newConnectBtn.className = "btn connect-btn"; - newConnectBtn.innerHTML = - 'Connect '; - - // Replace connected status with connect button - connectedStatus.replaceWith(newConnectBtn); - - // Re-attach the connect handler - attachConnectHandler(newConnectBtn, card); - } - }); - }); - } - - // Settings card click navigation - const settingsCards = document.querySelectorAll(".settings-card"); - - settingsCards.forEach((card) => { - card.style.cursor = "pointer"; - - card.addEventListener("click", function () { - const title = card.querySelector(".card-title").textContent; - - // Map settings to placeholder pages (can be updated later) - const settingsMap = { - General: "#general-settings", - "Billing Plan": "#billing-settings", - Team: "#team-settings", - "SMS Settings": "#sms-settings", - "Web Tracking Installation": "#tracking-settings", - }; - - const targetPage = settingsMap[title]; - if (targetPage) { - // For now, just show an alert (can be replaced with actual navigation) - console.log(`Navigating to ${title} settings...`); - // Uncomment the line below when actual pages are created - // window.location.href = targetPage; - } - }); - }); -}); +$(document).ready(function(){ +console.log('log'); +}); \ No newline at end of file diff --git a/php_code/public/assets/js/districtparams.js.bak b/php_code/public/assets/js/districtparams.js.bak new file mode 100644 index 00000000..c9f98936 --- /dev/null +++ b/php_code/public/assets/js/districtparams.js.bak @@ -0,0 +1,229 @@ +// Store Settings Page JavaScript + +// Back button functionality +function goBack() { + if (window.history.length > 1) { + window.history.back(); + } else { + window.location.href = "index.html"; + } +} + +// Search functionality +document.addEventListener("DOMContentLoaded", function () { + const searchInput = document.getElementById("searchInput"); + + if (searchInput) { + searchInput.addEventListener("input", function (e) { + const searchQuery = e.target.value.toLowerCase().trim(); + + // Get all settings cards + const settingsCards = document.querySelectorAll(".settings-grid .col-12"); + // Get all integration cards + const integrationCards = document.querySelectorAll( + ".integrations-grid .col-12" + ); + + // Filter settings cards + settingsCards.forEach((cardCol) => { + const card = cardCol.querySelector(".settings-card"); + const title = card + .querySelector(".card-title") + .textContent.toLowerCase(); + const description = card + .querySelector(".card-description") + .textContent.toLowerCase(); + + if ( + title.includes(searchQuery) || + description.includes(searchQuery) || + searchQuery === "" + ) { + cardCol.style.display = ""; + } else { + cardCol.style.display = "none"; + } + }); + + // Filter integration cards + integrationCards.forEach((cardCol) => { + const card = cardCol.querySelector(".integration-card"); + const title = card + .querySelector(".integration-name") + .textContent.toLowerCase(); + const description = card + .querySelector(".integration-description") + .textContent.toLowerCase(); + + if ( + title.includes(searchQuery) || + description.includes(searchQuery) || + searchQuery === "" + ) { + cardCol.style.display = ""; + } else { + cardCol.style.display = "none"; + } + }); + }); + } + + // Integration connect/disconnect functionality + const integrationCards = document.querySelectorAll(".integration-card"); + + integrationCards.forEach((card) => { + const connectBtn = card.querySelector(".connect-btn"); + const disconnectBtn = card.querySelector(".disconnect-btn"); + + // Handle Connect button click + if (connectBtn) { + connectBtn.addEventListener("click", function () { + // Create connected status elements + const connectedStatus = document.createElement("div"); + connectedStatus.className = "connected-status"; + + const badge = document.createElement("span"); + badge.className = "badge connected-badge mb-2"; + badge.innerHTML = + ' Connected'; + + const newDisconnectBtn = document.createElement("button"); + newDisconnectBtn.className = "btn disconnect-btn"; + newDisconnectBtn.textContent = "Disconnect"; + + connectedStatus.appendChild(badge); + connectedStatus.appendChild(newDisconnectBtn); + + // Replace connect button with connected status + connectBtn.replaceWith(connectedStatus); + + // Add event listener to new disconnect button + newDisconnectBtn.addEventListener("click", function () { + // Show confirmation dialog + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Add event listener to new connect button + newConnectBtn.addEventListener("click", function () { + // Recursively handle connect (reuse the same logic) + newConnectBtn.click(); + }); + + // Re-attach the connect handler + attachConnectHandler(newConnectBtn, card); + } + }); + }); + } + + // Handle Disconnect button click + if (disconnectBtn) { + disconnectBtn.addEventListener("click", function () { + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + const connectedStatus = card.querySelector(".connected-status"); + + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Add event listener to new connect button + attachConnectHandler(newConnectBtn, card); + } + }); + } + }); + + // Helper function to attach connect handler + function attachConnectHandler(button, card) { + button.addEventListener("click", function () { + // Create connected status elements + const connectedStatus = document.createElement("div"); + connectedStatus.className = "connected-status"; + + const badge = document.createElement("span"); + badge.className = "badge connected-badge mb-2"; + badge.innerHTML = + ' Connected'; + + const newDisconnectBtn = document.createElement("button"); + newDisconnectBtn.className = "btn disconnect-btn"; + newDisconnectBtn.textContent = "Disconnect"; + + connectedStatus.appendChild(badge); + connectedStatus.appendChild(newDisconnectBtn); + + // Replace connect button with connected status + button.replaceWith(connectedStatus); + + // Add event listener to new disconnect button + newDisconnectBtn.addEventListener("click", function () { + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Re-attach the connect handler + attachConnectHandler(newConnectBtn, card); + } + }); + }); + } + + // Settings card click navigation + const settingsCards = document.querySelectorAll(".settings-card"); + + settingsCards.forEach((card) => { + card.style.cursor = "pointer"; + + card.addEventListener("click", function () { + const title = card.querySelector(".card-title").textContent; + console.log(title); + + // Map settings to placeholder pages (can be updated later) + const settingsMap = { + General: "#general-settings", + "Billing Plan": "#billing-settings", + Team: "#team-settings", + "SMS Settings": "#sms-settings", + "Web Tracking Installation": "#tracking-settings", + }; + + const targetPage = settingsMap[title]; + if (targetPage) { + // For now, just show an alert (can be replaced with actual navigation) + console.log(`Navigating to ${title} settings...`); + // Uncomment the line below when actual pages are created + // window.location.href = targetPage; + } + }); + }); +}); diff --git a/php_code/public/assets/js/params.js b/php_code/public/assets/js/params.js new file mode 100644 index 00000000..cdd97596 --- /dev/null +++ b/php_code/public/assets/js/params.js @@ -0,0 +1,230 @@ +// Store Settings Page JavaScript + +// Back button functionality +function goBack() { + if (window.history.length > 1) { + window.history.back(); + } else { + window.location.href = ""; + } +} + +// Search functionality +document.addEventListener("DOMContentLoaded", function () { + const searchInput = document.getElementById("searchInput"); + + if (searchInput) { + searchInput.addEventListener("input", function (e) { + const searchQuery = e.target.value.toLowerCase().trim(); + + // Get all settings cards + const settingsCards = document.querySelectorAll(".settings-grid .col-12"); + // Get all integration cards + const integrationCards = document.querySelectorAll( + ".integrations-grid .col-12" + ); + + // Filter settings cards + settingsCards.forEach((cardCol) => { + const card = cardCol.querySelector(".settings-card"); + const title = card + .querySelector(".card-title") + .textContent.toLowerCase(); + const description = card + .querySelector(".card-description") + .textContent.toLowerCase(); + + if ( + title.includes(searchQuery) || + description.includes(searchQuery) || + searchQuery === "" + ) { + cardCol.style.display = ""; + } else { + cardCol.style.display = "none"; + } + }); + + // Filter integration cards + integrationCards.forEach((cardCol) => { + const card = cardCol.querySelector(".integration-card"); + const title = card + .querySelector(".integration-name") + .textContent.toLowerCase(); + const description = card + .querySelector(".integration-description") + .textContent.toLowerCase(); + + if ( + title.includes(searchQuery) || + description.includes(searchQuery) || + searchQuery === "" + ) { + cardCol.style.display = ""; + } else { + cardCol.style.display = "none"; + } + }); + }); + } + + // Integration connect/disconnect functionality + const integrationCards = document.querySelectorAll(".integration-card"); + + integrationCards.forEach((card) => { + const connectBtn = card.querySelector(".connect-btn"); + const disconnectBtn = card.querySelector(".disconnect-btn"); + + // Handle Connect button click + if (connectBtn) { + connectBtn.addEventListener("click", function () { + // Create connected status elements + const connectedStatus = document.createElement("div"); + connectedStatus.className = "connected-status"; + + const badge = document.createElement("span"); + badge.className = "badge connected-badge mb-2"; + badge.innerHTML = + ' Connected'; + + const newDisconnectBtn = document.createElement("button"); + newDisconnectBtn.className = "btn disconnect-btn"; + newDisconnectBtn.textContent = "Disconnect"; + + connectedStatus.appendChild(badge); + connectedStatus.appendChild(newDisconnectBtn); + + // Replace connect button with connected status + connectBtn.replaceWith(connectedStatus); + + // Add event listener to new disconnect button + newDisconnectBtn.addEventListener("click", function () { + // Show confirmation dialog + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Add event listener to new connect button + newConnectBtn.addEventListener("click", function () { + // Recursively handle connect (reuse the same logic) + newConnectBtn.click(); + }); + + // Re-attach the connect handler + attachConnectHandler(newConnectBtn, card); + } + }); + }); + } + + // Handle Disconnect button click + if (disconnectBtn) { + disconnectBtn.addEventListener("click", function () { + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + const connectedStatus = card.querySelector(".connected-status"); + + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Add event listener to new connect button + attachConnectHandler(newConnectBtn, card); + } + }); + } + }); + + // Helper function to attach connect handler + function attachConnectHandler(button, card) { + button.addEventListener("click", function () { + // Create connected status elements + const connectedStatus = document.createElement("div"); + connectedStatus.className = "connected-status"; + + const badge = document.createElement("span"); + badge.className = "badge connected-badge mb-2"; + badge.innerHTML = + ' Connected'; + + const newDisconnectBtn = document.createElement("button"); + newDisconnectBtn.className = "btn disconnect-btn"; + newDisconnectBtn.textContent = "Disconnect"; + + connectedStatus.appendChild(badge); + connectedStatus.appendChild(newDisconnectBtn); + + // Replace connect button with connected status + button.replaceWith(connectedStatus); + + // Add event listener to new disconnect button + newDisconnectBtn.addEventListener("click", function () { + const integrationName = + card.querySelector(".integration-name").textContent; + if ( + confirm(`Are you sure you want to disconnect ${integrationName}?`) + ) { + // Create new connect button + const newConnectBtn = document.createElement("button"); + newConnectBtn.className = "btn connect-btn"; + newConnectBtn.innerHTML = + 'Connect '; + + // Replace connected status with connect button + connectedStatus.replaceWith(newConnectBtn); + + // Re-attach the connect handler + attachConnectHandler(newConnectBtn, card); + } + }); + }); + } + + // Settings card click navigation + const settingsCards = document.querySelectorAll(".settings-card"); + + settingsCards.forEach((card) => { + card.style.cursor = "pointer"; + + card.addEventListener("click", function () { + const title = card.querySelector(".card-title").textContent; + console.log(title); + window.location.href = "/admin/permissions"; + + // Map settings to placeholder pages (can be updated later) + // const settingsMap = { + // General: "#general-settings", + // "Billing Plan": "#billing-settings", + // Team: "#team-settings", + // "SMS Settings": "#sms-settings", + // "Web Tracking Installation": "#tracking-settings", + // }; + + // const targetPage = settingsMap[title]; + // if (targetPage) { + // // For now, just show an alert (can be replaced with actual navigation) + // console.log(`Navigating to ${title} settings...`); + // // Uncomment the line below when actual pages are created + // // window.location.href = targetPage; + // } + }); + }); +}); diff --git a/php_code/public/assets/js/usermgt.js b/php_code/public/assets/js/usermgt.js index f4a2cb70..47593bf2 100644 --- a/php_code/public/assets/js/usermgt.js +++ b/php_code/public/assets/js/usermgt.js @@ -1,4 +1,71 @@ $(document).ready(function(){ + + var selectedValue = $("input[name='user_type']:checked").val(); + const $dropdown = $("#uaPostionAdd"); + + const optionsMap = { + district_user: [ + "PPD Head", "Works Head", "MIS", + "PPD Staff", "Works Staff", + "Devt Planning Officer", + "MCE", "DCE", + "Urban Roads Department Head", + "District Fire Officer", + "District Disaster Prevention Department", + "Head of District Health Department", + "Representative of the Lands Commission", + "Representative of the Environmental Protection Agency", + "Rep from Traditional Council", + "Chairman of the Works Sub Committee", + "Chairman of Development Sub Planning Committee", + "Nominated Elected Assembly Memebers" + ], + national_luspa: ["Director", "IT Head", "Staff"], + regional_luspa: ["Director", "Staff"] + + }; + $dropdown.empty(); + $dropdown.append(''); + + if (optionsMap['district_user']) { + $.each(optionsMap['district_user'], function(index, value) { + $dropdown.append($("").attr("value", value.toLowerCase()).text(value)); + }); + } + + $("input[name='user_type']").change(function() { + var userValue = $(this).val(); + if (userValue == 'district_user') { + $('#regionID').prop('disabled', false); + $('#districtID').prop('disabled', false); + + } + if (userValue == 'national_luspa') { + $('#regionID').prop('disabled', true); + $('#districtID').prop('disabled', true); + + } + if (userValue == 'regional_luspa') { + $('#districtID').prop('disabled', true); + $('#regionID').prop('disabled', false); + + } + + $dropdown.empty(); + $dropdown.append(''); + + if (optionsMap[userValue]) { + $.each(optionsMap[userValue], function(index, value) { + $dropdown.append($("") + .attr("value", value.toLowerCase()) + .text(value)); + }); + } + + }); + + + $('#editAllowedApps').select2({ dropdownParent: $('#editUserModal'), placeholder : "Select options, multiple allowed" @@ -67,6 +134,8 @@ $(document).ready(function(){ }); + + $('.viewUserBtn').click(function(evnt){ evnt.preventDefault(); var selectedUserId = $(this).siblings('.userIdinput').val(); @@ -141,8 +210,6 @@ $(document).ready(function(){ $('#successArea').text(""); $('#successArea').text("User successfully created!"); - // location.reload(); - // alert('success'); $.alert({ title: 'Alert!', content: 'User successfully created!', diff --git a/php_code/resources/views/admin/district_params.blade.php b/php_code/resources/views/admin/district_params.blade.php index e69de29b..e046c504 100644 --- a/php_code/resources/views/admin/district_params.blade.php +++ b/php_code/resources/views/admin/district_params.blade.php @@ -0,0 +1,208 @@ +@extends('layouts.master') +@section('page-title') + Admin | {{ $page_title }} +@endsection +@section('page-css') + + + +@endsection +@section('page-content') + +@include('layouts.partials.navbar') + + +
+
+
+

District Parameters

+

Update the parameters as needed

+
+
+
+

+ General Settings +

+

+ +

+
+ + +
+ +
+
+
+ +
+

District Settings

+

+ View and update district details +

+
+
+ + +
+
+
+ +
+

Fee Fixing

+

View current fees

+
+
+ + +
+
+
+ +
+

Permissions

+

View user groups and permissions

+
+
+ + +
+
+ + +
+
+

+ Stakeholders +

+

+ Data sharing organisations +

+
+ + +
+ +
+
+ +

Lands Commission

+

+ View Available Data +

+ +
+
+ + +
+
+ +

Environmental Protection Agency (EPA)

+

+ View Available Data +

+ +
+
+ + +
+
+ +

Ghana Geological Survey Authority

+

+ View Available Data +

+ +
+
+ + +
+
+ +

National Disaster Management Organisation

+

+ View Available Data +

+ +
+
+ + +
+
+ +

Local Government

+

+ View Available Data +

+ +
+
+ + +
+
+ +

GSS

+

+ View Available Data +

+ + +
+
+
+
+ +
+
+ +@endsection +@section('page-js') + + + + + +@endsection diff --git a/php_code/resources/views/admin/partials/create-user.blade.php b/php_code/resources/views/admin/partials/create-user.blade.php index e6e5473b..d41f8e1c 100644 --- a/php_code/resources/views/admin/partials/create-user.blade.php +++ b/php_code/resources/views/admin/partials/create-user.blade.php @@ -14,12 +14,24 @@
@csrf - - +
+
+ + +
+
+ + +
+
+ + +
+
- - @@ -54,8 +66,8 @@
- - diff --git a/php_code/resources/views/admin/partials/edit-user.blade.php b/php_code/resources/views/admin/partials/edit-user.blade.php index 23b20eb0..416f8743 100644 --- a/php_code/resources/views/admin/partials/edit-user.blade.php +++ b/php_code/resources/views/admin/partials/edit-user.blade.php @@ -70,7 +70,12 @@
- +
+
+ + +
+
+
@@ -41,7 +41,7 @@
- +