X7ROOT File Manager
Current Path:
/home/hamdjcne/app.hamdalillahitravel.com/app/Views/accounts
home
/
hamdjcne
/
app.hamdalillahitravel.com
/
app
/
Views
/
accounts
/
ðŸ“
..
📄
admin.php
(5.11 KB)
📄
admin_form.php
(4.56 KB)
📄
announcement.php
(12.35 KB)
📄
announcement_form.php
(6.28 KB)
📄
customer.php
(13.06 KB)
📄
customer_form.php
(9.6 KB)
📄
profile.php
(75.96 KB)
Editing: profile.php
<?php use App\Models\Crud; $this->Crud = new Crud(); ?> <?= $this->extend('designs/backend'); ?> <?= $this->section('title'); ?> <?= $title; ?> <?= $this->endSection(); ?> <?= $this->section('content'); ?> <!--begin::Wrapper--> <div class="app-wrapper d-flex " style="margin-left: 1px; "> <!--begin::Wrapper container--> <div class="app-container container-fluid "> <!--begin::Main--> <div class="app-main flex-column flex-row-fluid " id="kt_app_main"> <!--begin::Content wrapper--> <div class="d-flex flex-column flex-column-fluid"> <!--begin::Toolbar--> <div id="kt_app_toolbar" class="app-toolbar "> <!--begin::Toolbar container--> <div class="d-flex flex-stack flex-row-fluid"> <!--begin::Toolbar wrapper--> <div class="d-flex flex-column flex-row-fluid"> <!--begin::Breadcrumb--> <ul class="breadcrumb breadcrumb-separatorless fw-semibold mb-3"> <!--begin::Item--> <li class="breadcrumb-item text-gray-600 fw-bold lh-1"> <a href="<?=site_url(); ?>" class="text-white text-hover-success"> <i class="ki-duotone ki-home text-gray-500 fs-2"></i> </a> </li> <!--end::Item--> <!--begin::Item--> <li class="breadcrumb-item"> <i class="ki-duotone ki-right fs-3 text-gray-500 mx-n1"></i> </li> <!--end::Item--> <!--begin::Item--> <li class="breadcrumb-item text-gray-600 fw-bold lh-1"> Account </li> <!--end::Item--> <input type="hidden" name="user_id" id="user_id" value="<?=$user_id; ?>"> </ul> <!--end::Breadcrumb--> <!--begin::Page title--> <div class="page-title d-flex align-items-center me-3"> <!--begin::Title--> <h1 class="page-heading d-flex text-gray-900 fw-bolder fs-1 flex-column justify-content-center my-0"> Account Overview </h1> <!--end::Title--> </div> <!--end::Page title--> </div> <div class="d-flex align-items-center gap-3 gap-lg-5"> <!--begin::Primary button--> <a href="javascript:void(0);" class="btn btn-flex btn-center bg-gray-600 btn-color-white h-35px h-md-40px btn-active-dark btn-sm px-6" onclick="window.history.back();"> <i class="ki-duotone ki-left-square fs-2 p-0 m-0"> <span class="path1"></span><span class="path2"></span> </i> <span class="ms-2">Go Back</span> </a> <!--end::Primary button--> </div> </div> </div> <!--begin::Content--> <div id="kt_app_content" class="app-content "> <div class="card mb-5 mb-xl-10"> <div class="card-body pt-9 pb-0"> <!--begin::Details--> <div class="d-flex flex-wrap flex-sm-nowrap"> <!--begin: Pic--> <div class="me-7 mb-4"> <div class="symbol symbol-100px symbol-lg-160px symbol-fixed position-relative"> <img src="<?=site_url($img); ?>" alt="image" /> <div class="position-absolute translate-middle bottom-0 start-100 mb-6 bg-success rounded-circle border border-4 border-body h-20px w-20px"> </div> </div> </div> <!--end::Pic--> <!--begin::Info--> <div class="flex-grow-1"> <!--begin::Title--> <div class="d-flex justify-content-between align-items-start flex-wrap mb-2"> <!--begin::User--> <div class="d-flex flex-column"> <!--begin::Name--> <div class="d-flex align-items-center mb-2"> <a href="javascript:;" class="text-gray-900 text-hover-success fs-2 fw-bold me-1"><?=ucwords($company_name); ?></a> <a href="javascript:;"><i class="ki-duotone ki-verify fs-1 text-primary"><span class="path1"></span><span class="path2"></span></i></a> </div> <!--end::Name--> <!--begin::Info--> <div class="d-flex flex-wrap fw-semibold fs-6 mb-4 pe-2"> <a href="javascript:;" class="d-flex align-items-center text-gray-500 text-hover-success me-5 mb-2"> <i class="ki-duotone ki-profile-circle fs-4 me-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i> <?=ucwords($user_role); ?> </a> <a href="javascript:;" class="d-flex align-items-center text-gray-500 text-hover-success mb-2"> <i class="ki-duotone ki-sms fs-4"><span class="path1"></span><span class="path2"></span></i> <?=$email; ?> </a> </div> <!--end::Info--> </div> </div> </div> <!--end::Info--> </div> <!--end::Details--> <!--begin::Navs--> <ul class="nav nav-stretch nav-line-tabs nav-line-tabs-2x border-transparent fs-5 fw-bold"> <!--begin::Nav item--> <li class="nav-item mt-2"> <a class="nav-link text-active-success ms-0 me-10 py-5 active" data-bs-toggle="tab" href="#overview"> Overview </a> </li> <!--end::Nav item--> <!--begin::Nav item--> <li class="nav-item mt-2"> <a class="nav-link text-active-success ms-0 me-10 py-5 " data-bs-toggle="tab" href="#edit-profile"> Edit Profile </a> </li> <li class="nav-item mt-2"> <a class="nav-link text-active-success ms-0 me-10 py-5 " data-bs-toggle="tab" href="#activity"> Activity </a> </li> <!--end::Nav item--> </ul> <!--begin::Navs--> </div> </div> <!--end::Navbar--> <div class="tab-content" id="myTabContent"> <div class="tab-pane fade show active" id="overview" role="tabpanel"> <div class="card mb-5 mb-xl-10" id="kt_profile_details_view"> <!--begin::Card header--> <div class="card-header cursor-pointer"> <!--begin::Card title--> <div class="card-title m-0"> <h3 class="fw-bold m-0">Profile Details</h3> </div> </div> <!--begin::Card header--> <!--begin::Card body--> <div class="card-body p-9"> <!--begin::Row--> <div class="row mb-7"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">Contact Name</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8"> <span class="fw-bold fs-6 text-gray-800"><?=ucwords($fullname);?></span> </div> <!--end::Col--> </div> <!--end::Row--> <?php if(!empty($company_name)){?> <!--begin::Input group--> <div class="row mb-7"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">Company</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <span class="fw-semibold text-gray-800 fs-6"><?=ucwords($company_name); ?></span> <?php if($this->Crud->check2('approval', 1, 'id', $user_id, 'user') > 0){ echo '<span class="badge badge-success">Approved</span>'; } else { echo '<span class="badge badge-danger">Not Approved</span>'; } ?> </div> <!--end::Col--> </div> <!--end::Input group--> <?php } ?> <!--begin::Input group--> <div class="row mb-7"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted"> Contact Phone </label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 d-flex align-items-center"> <span class="fw-bold fs-6 text-gray-800 me-2"><?=$phone; ?></span> </div> <!--end::Col--> </div> <!--end::Input group--> <!--begin::Input group--> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">Address</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?=$address; ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">Zone</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?=$zone; ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">RC Number</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?=$rc_no; ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">IATA MEMBER</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?php if(empty($iata_number)){echo 'Not a Member';}else{echo $iata_number;} ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">NAHCON License</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?php if(empty($nahcon_license)){echo 'Not Registered';}else{echo $nahcon_license;} ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <!--begin::Label--> <label class="col-lg-4 fw-semibold text-muted">Website</label> <!--begin::Label--> <!--begin::Label--> <div class="col-lg-8"> <span class="fw-semibold fs-6 text-gray-800"><?php if(empty($website)){echo 'No Website';}else{echo $website;} ?></span> </div> <!--begin::Label--> </div> <div class="row mb-10"> <label class="col-lg-4 fw-semibold text-muted">CAC Certificate</label> <div class="col-lg-8"> <div class="row"> <?php function previewFile($file) { if (!empty($file)) { $extension = pathinfo($file, PATHINFO_EXTENSION); $imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp']; $pdfExtensions = ['pdf']; if (in_array(strtolower($extension), $imageExtensions)) { // Display Image Preview return "<img src='$file' alt='Preview' class='img-fluid' style='max-width: 200px; max-height: 200px;'>"; } elseif (in_array(strtolower($extension), $pdfExtensions)) { // Display PDF Preview return "<embed src='$file' type='application/pdf' width='450px' height='400px' />"; } else { // If not an image or PDF, just show the file name return "<span class='fw-semibold fs-6 text-gray-800'>$file</span>"; } } else { return "<span class='text-danger'>No file uploaded</span>"; } } ?> <div class="col-md-12 mb-5"> <div class="fw-semibold fs-6 text-gray-800"> <?php $path = FCPATH . $cac_certificate; // Convert URL to server path if (file_exists($path) && is_file($path)) { echo previewFile(site_url($cac_certificate)); } else { echo '<div class="text-danger">CAC Certificate not available or missing.</div>'; } ?> </div> </div> </div> </div> </div> <div class="row mb-10"> <label class="col-lg-4 fw-semibold text-muted">CAC 2 & 7</label> <div class="col-lg-8"> <div class="fw-semibold fs-6 text-gray-800"> <?php $path = FCPATH . $cac_2_7; // Convert URL to server path if (file_exists($path) && is_file($path)) { echo previewFile(site_url($cac_2_7)); } else { echo '<div class="text-danger">CAC 2 & 7 not available or missing.</div>'; } ?> </div> </div> </div> <div class="row mb-10"> <label class="col-lg-4 fw-semibold text-muted">Proof of Payment</label> <div class="col-lg-8"> <div class="fw-semibold fs-6 text-gray-800"> <?php $path = FCPATH . $proof_of_payment; // Convert URL to server path if (file_exists($path) && is_file($path)) { echo previewFile(site_url($proof_of_payment)); } else { echo '<div class="text-danger">Proof of Payment not available or missing.</div>'; } ?> </div> </div> </div> </div> <!--end::Card body--> </div> </div> <div class="tab-pane fade" id="edit-profile" role="tabpanel"> <!--begin::Basic info--> <div class="card mb-5 mb-xl-10"> <!--begin::Card header--> <div class="card-header border-0 cursor-pointer" role="button" data-bs-toggle="collapse" data-bs-target="#kt_account_profile_details" aria-expanded="true" aria-controls="kt_account_profile_details"> <!--begin::Card title--> <div class="card-title m-0"> <h3 class="fw-bold m-0">Edit Profile</h3> </div> <!--end::Card title--> </div> <!--begin::Card header--> <!--begin::Content--> <div id="kt_account_settings_profile_details" class="collapse show"> <!--begin::Form--> <?php echo form_open_multipart('accounts/profile_view/update', array('id'=>'bb_ajax_form', 'class'=>'form')); ?> <input type="hidden" name="user_id" id="user_id" value="<?=$user_id; ?>"> <!--begin::Card body--> <div class="card-body border-top p-9"> <!--begin::Input group--> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6">Avatar</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8"> <!--begin::Image input--> <div class="image-input image-input-outline" data-kt-image-input="true" style="background-image: url('<?=site_url($img); ?>')"> <!--begin::Preview existing avatar--> <div class="image-input-wrapper w-125px h-125px" style="background-image: url(<?=site_url($img); ?>)"></div> <!--end::Preview existing avatar--> <!--begin::Label--> <label class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" data-kt-image-input-action="change" data-bs-toggle="tooltip" title="Change avatar"> <i class="ki-duotone ki-pencil fs-7"><span class="path1"></span><span class="path2"></span></i> <input type="hidden" name="img_id" value="<?=$img; ?>"> <!--begin::Inputs--> <input type="file" name="avatar" accept=".png, .jpg, .jpeg"/> <input type="hidden" name="avatar_remove"/> <!--end::Inputs--> </label> <!--end::Label--> <!--begin::Cancel--> <span class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" data-kt-image-input-action="cancel" data-bs-toggle="tooltip" title="Cancel avatar"> <i class="ki-duotone ki-cross fs-2"><span class="path1"></span><span class="path2"></span></i> </span> <!--end::Cancel--> <!--begin::Remove--> <span class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" data-kt-image-input-action="remove" data-bs-toggle="tooltip" title="Remove avatar"> <i class="ki-duotone ki-cross fs-2"><span class="path1"></span><span class="path2"></span></i> </span> <!--end::Remove--> </div> <!--end::Image input--> <!--begin::Hint--> <div class="form-text">Allowed file types: png, jpg, jpeg.</div> <!--end::Hint--> </div> <!--end::Col--> </div> <!--end::Input group--> <?php $parts = explode(' ', $fullname, 2); // Split into two parts based on the first space $firstname = isset($parts[0]) ? $parts[0] : ''; $surname = isset($parts[1]) ? $parts[1] : ''; ?> <!--begin::Input group--> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label required fw-semibold fs-6">Full Name</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8"> <!--begin::Row--> <div class="row"> <!--begin::Col--> <div class="col-lg-6 fv-row"> <input type="text" name="firstname" class="form-control form-control-lg form-control-solid mb-3 mb-lg-0" placeholder="First name" value="<?=ucwords($firstname); ?>" /> </div> <!--end::Col--> <!--begin::Col--> <div class="col-lg-6 fv-row"> <input type="text" name="surname" class="form-control form-control-lg form-control-solid" placeholder="Last name" value="<?=ucwords($surname); ?>" /> </div> <!--end::Col--> </div> <!--end::Row--> </div> <!--end::Col--> </div> <!--end::Input group--> <?php if(!empty($company_name)){?> <!--begin::Input group--> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label required fw-semibold fs-6">Company</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input type="text" name="company_name" class="form-control form-control-lg form-control-solid" placeholder="Company name" value="<?=ucwords($company_name); ?>" /> </div> <!--end::Col--> </div> <?php } ?> <!--end::Input group--> <!--begin::Input group--> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6"> <span class="required"> Phone</span> </label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input type="tel" name="phone" class="form-control form-control-lg form-control-solid" required placeholder="Phone number" value="<?=$phone; ?>" /> </div> <!--end::Col--> </div> <!--end::Input group--> <!--begin::Input group--> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6"> Email</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input type="email" name="email" class="form-control form-control-lg form-control-solid" placeholder="Contact Email" value="<?=$email; ?>" /> </div> <!--end::Col--> </div> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6">Pick Address on the Map</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input id="autocomplete" class="form-control form-control-lg mb-3" type="text" placeholder="Search for a location" /> <div id="mapz" style="width: 100%; height: 500px;"></div> </div> <!--end::Col--> </div> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6">State</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input name="state_id" id="state_id" class="form-control form-control-solid form-control-lg " value="<?=$state; ?>" placeholder="Ogun" readonly/> </div> <!--end::Col--> </div> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6">City</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input name="lga_id" id="lga_id" class="form-control form-control-solid form-control-lg " value="<?=$city; ?>" placeholder="Abeokuta" readonly/> </div> <!--end::Col--> </div> <div class="row mb-6"> <!--begin::Label--> <label class="col-lg-4 col-form-label fw-semibold fs-6">Address</label> <!--end::Label--> <!--begin::Col--> <div class="col-lg-8 fv-row"> <input name="address" id="address" class="form-control form-control-solid form-control-lg " value="<?=$address; ?>" placeholder="" readonly/> </div> <!--end::Col--> </div> <input type="hidden" value="<?=$lat; ?>" name="latitude" id="latitude"/> <input type="hidden" value="<?=$lng; ?>" name="longitude" id="longitude"/> </div> <!--begin::Actions--> <div class="card-footer d-flex justify-content-end py-6 px-9"> <button type="submit" class="btn btn-primary" id="">Save Changes</button> </div> <div class="row mb-3"><div id="bb_ajax_msg"></div></div> <!--end::Actions--> </form> </div> <!--end::Content--> </div> <div class="card"> <!--begin::Card header--> <div class="card-header border-0 cursor-pointer" role="button" data-bs-toggle="collapse" data-bs-target="#kt_account_deactivate" aria-expanded="true" aria-controls="kt_account_deactivate"> <div class="card-title m-0"> <h3 class="fw-bold m-0">Account Priviledge Manager</h3> </div> </div> <!--end::Card header--> <!--begin::Content--> <div id="kt_account_settings_deactivate" class="collapse show"> <div class="card-body border-top p-9"> <!--begin::Notice--> <div class="notice d-flex bg-light-warning rounded border-warning border border-dashed mb-9 p-6"> <!--begin::Icon--> <i class="ki-duotone ki-information fs-2tx text-warning me-4"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i> <div class="d-flex flex-stack flex-grow-1 "> <div class=" fw-semibold"> <?php $accountStatus = $this->Crud->read_field('id', $user_id, 'user', 'activate'); // Could be 'active' or 'inactive' // Determine the action and message using a ternary operator $message = $accountStatus == 1 ? 'You Are Deactivating this Account' : 'You Are Activating this Account'; $status = $accountStatus == 1 ? 'danger' : 'primary'; $title = $accountStatus == 1 ? 'Deactivate' : 'Activate'; ?> <h4 class="text-gray-900 fw-bold"><?=$message; ?></h4> </div> <!--end::Content--> </div> <!--end::Wrapper--> </div> <!--end::Notice--> </div> <!--end::Card body--> <!--begin::Card footer--> <div class="card-footer d-flex justify-content-end py-6 px-9"> <button id="deactivate_submit" type="submit" class="btn btn-<?=$status; ?> fw-semibold "><?=$title; ?> Account</button> </div> <input type="hidden" id="user_id" value="<?=$user_id; ?>"> <div class="d-flex flex-wrap align-items-center my-6"> <div id="deactivate_resp"></div> </div> </div> <!--end::Content--> </div> </div> <div class="tab-pane fade" id="transaction" role="tabpanel"> <div class="card mb-5 mb-xxl-10"> <!--begin::Header--> <div class="card-header"> <!--begin::Title--> <div class="card-title"> <h3 class="m-0 text-gray-800">Transaction</h3> </div> <!--end::Title--> <div class="card-toolbar"> <div class="my-1 me-4"> <!--begin::Label--> <label class="form-label fs-5 fw-semibold mb-3">Date Range:</label> <input class="form-control form-control-solid element1" placeholder="Pick date rage" id="transaction_datez" onchange="load_transaction('', '')" /> </div> </div> <!--end::Toolbar--> </div> <!--end::Header--> <!--begin::Tab Content--> <div id="kt_referred_users_tab_content" class="tab-content"> <div id="kt_referrals_1" class="card-body p-0 tab-pane fade show active" role="tabpanel"> <div class="table-responsive"> <!--begin::Table--> <table class="table align-middle table-row-bordered table-row-solid gy-4 gs-9"> <!--begin::Thead--> <thead> <tr class="text-start text-gray-500 fw-bold fs-7 text-uppercase gs-0"> <th class="min-w-125px">Date</th> <th class="min-w-125px">Customer</th> <th class="min-w-125px">Merchant</th> <th class="min-w-125px">Voucher</th> <th class="min-w-125px">Liter Bought</th> </tr> </thead> <tbody class="fw-semibold text-gray-600" id="transaction_data" > </tbody> <tfoot id="transaction_more" ></tfoot> </table> <!--end::Table--> </div> </div> </div> <!--end::Tab Content--> </div> </div> <div class="tab-pane fade" id="wallet" role="tabpanel"> <div class="card mb-5 mb-xxl-10"> <!--begin::Header--> <div class="card-header"> <!--begin::Title--> <div class="card-title"> <h3 class="m-0 text-gray-800">Wallet</h3> </div> <!--end::Title--> <div class="card-toolbar"> <div class="my-1 me-4"> <!--begin::Label--> <label class="form-label fs-5 fw-semibold mb-3">Date Range:</label> <input class="form-control form-control-solid element1" placeholder="Pick date rage" id="wallet_datez" onchange="load_wallet('', '')" /> </div> </div> <!--end::Toolbar--> </div> <!--end::Header--> <!--begin::Tab Content--> <div id="kt_referred_users_tab_content" class="tab-content"> <div id="kt_referrals_1" class="card-body p-0 tab-pane fade show active" role="tabpanel"> <div class="row"> <!--begin::Col--> <div class="col"> <div class="card card-dashed flex-center min-w-175px my-3 p-6"> <span class="fs-4 fw-semibold text-success pb-1 px-2">Credit</span> <span class="fs-lg-2tx fw-bold d-flex justify-content-center" id="credit" >0 </span> </div> </div> <!--end::Col--> <!--begin::Col--> <div class="col"> <div class="card card-dashed flex-center min-w-175px my-3 p-6"> <span class="fs-4 fw-semibold text-danger pb-1 px-2">Debit </span> <span class="fs-lg-2tx fw-bold d-flex justify-content-center" id="debit" >0 </span> </div> </div> <!--end::Col--> <!--begin::Col--> <div class="col"> <div class="card card-dashed flex-center min-w-175px my-3 p-6"> <span class="fs-4 fw-semibold text-primary pb-1 px-2">Balance</span> <span class="fs-lg-2tx fw-bold d-flex justify-content-center" id="balance" >0 </span> </div> </div> <!--end::Col--> </div> <div class="table-responsive"> <!--begin::Table--> <table class="table align-middle table-row-bordered table-row-solid gy-4 gs-9"> <!--begin::Thead--> <thead> <tr class="text-start text-gray-500 fw-bold fs-7 text-uppercase gs-0"> <th class="min-w-125px">Date</th> <th class="min-w-125px">Type</th> <th class="min-w-125px">Amount</th> <th class="min-w-125px">Remark</th> </tr> </thead> <tbody class="fw-semibold text-gray-600" id="wallet_data" > </tbody> <tfoot id="wallet_more" ></tfoot> </table> <!--end::Table--> </div> </div> </div> <!--end::Tab Content--> </div> </div> <div class="tab-pane fade" id="activity" role="tabpanel"> <!--begin::Statements--> <div class="card mb-5 mb-xxl-10"> <!--begin::Header--> <div class="card-header"> <!--begin::Title--> <div class="card-title"> <h3 class="m-0 text-gray-800">Activity</h3> </div> <!--end::Title--> <div class="card-toolbar"> <div class="my-1 me-4"> <!--begin::Label--> <label class="form-label fs-5 fw-semibold mb-3">Date Range:</label> <input class="form-control form-control-solid element1" placeholder="Pick date rage" id="activity_datez" onchange="load_activity('', '')" /> </div> </div> <!--end::Toolbar--> </div> <!--end::Header--> <!--begin::Tab Content--> <div id="kt_referred_users_tab_content" class="tab-content"> <div id="kt_referrals_1" class="card-body p-0 tab-pane fade show active" role="tabpanel"> <div class="table-responsive"> <!--begin::Table--> <table class="table align-middle table-row-bordered table-row-solid gy-4 gs-9"> <!--begin::Thead--> <thead class="border-gray-200 fs-5 fw-semibold bg-lighten"> <tr> <th class="min-w-125px">Date</th> <th class="min-w-125px">Item</th> <th class="min-w-125px">User</th> <th class="min-w-125px">Description</th> <th class="min-w-125px">Timespan</th> </tr> </thead> <tbody class="fw-semibold text-gray-600" id="activity_data" > </tbody> <tfoot id="activity_more" ></tfoot> </table> <!--end::Table--> </div> </div> </div> <!--end::Tab Content--> </div> <!--end::Statements--> </div> </div> <!--end::details View--> </div> <!--end::Content--> </div> <!--end::Content wrapper--> <!--begin::Footer--> <div id="kt_app_footer" class="app-footer d-flex flex-column flex-md-row align-items-center flex-center flex-md-stack "> <div class="text-gray-900 order-2 order-md-1"> <span class="text-gray-500 fw-semibold me-1"><?=date('Y'); ?>©</span> <a href="javascript:;" target="_blank" class="text-gray-500 text-hover-success"><?=app_name; ?></a> </div> </div> <!--end::Footer--> </div> <!--end:::Main--> </div> <!--end::Wrapper container--> </div> <!--end::Wrapper--> <?= $this->endSection(); ?> <?= $this->section('scripts'); ?> <script src="<?= site_url(); ?>assets/js/jsform.js"></script> <script> var site_url = '<?= site_url(); ?>'; $('.select2').select2(); $(function () { }); function formatToYYYYMMDD(dateString) { const date = new Date(dateString); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); // Add 1 to the month (0-indexed) const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } $(document).ready(function () { $('#deactivate_submit').click(function () { // Get form values $('#deactivate_resp').html('<div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div>'); var id = $('#user_id').val(); $.ajax({ url: site_url + 'accounts/profile_view/activate', type: 'post', data: {user_id:id}, success: function(data) { $('#deactivate_resp').html(data); } }); }); }); function readURL(input, id) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { if (id != 'vid') { $('#' + id).attr('src', e.target.result); } else { $('#' + id).show(500); } } reader.readAsDataURL(input.files[0]); } } $("#img-upload").change(function () { readURL(this, 'img0'); }); function get_city() { $('#lga_id').html('<option>Loading..</option>'); var state_id = $('#state_id').val(); var lga_id = '<?=$lga_id; ?>'; $.ajax({ url: site_url + 'auth/get_city/' + state_id, success: function(data) { $('#lga_id').empty(); $('#lga_id').html(data); if (lga_id) { $('#lga_id').val(lga_id); } } }); } function load_voucher(x, y) { var more = 'no'; var methods = ''; if (parseInt(x) > 0 && parseInt(y) > 0) { more = 'yes'; methods = '/' + x + '/' + y; } if (more == 'no') { $('#voucher_data').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } else { $('#voucher_more').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } var search = $('#search').val(); var status = $('#status').val(); var dateRange = $('#voucher_datez').val(); var id = $('#user_id').val(); let start_date = ''; let end_date = ''; if (dateRange) { const dates = dateRange.split(' - '); // Split by " - " if (dates.length === 2) { start_date = formatToYYYYMMDD(dates[0].trim()); end_date = formatToYYYYMMDD(dates[1].trim()); } } $.ajax({ url: site_url + 'accounts/profile_view/records/voucher_load' + methods, type: 'post', data: { search: search, status: status, start_date: start_date, end_date: end_date,id:id }, success: function (data) { var dt = JSON.parse(data); if (more == 'no') { $('#voucher_data').html(dt.item); } else { $('#voucher_data').append(dt.item); } if (dt.offset > 0) { $('#voucher_more').html('<tr><td colspan="8"><a href="javascript:;" class="btn btn-dim btn-light btn-block p-30" onclick="load(' + dt.limit + ', ' + dt.offset + ');"><i class="ki-duotone ki- arrows-loop"><span class="path1"></span><span class="path2"></span></i> Load More</a></td></tr>'); } else { $('#voucher_more').html(''); } } }); } function load_transaction(x, y) { var more = 'no'; var methods = ''; if (parseInt(x) > 0 && parseInt(y) > 0) { more = 'yes'; methods = '/' + x + '/' + y; } if (more == 'no') { $('#transaction_data').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } else { $('#transaction_more').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } var search = $('#search').val(); var status = $('#status').val(); var dateRange = $('#transaction_datez').val(); var id = $('#user_id').val(); let start_date = ''; let end_date = ''; if (dateRange) { const dates = dateRange.split(' - '); // Split by " - " if (dates.length === 2) { start_date = formatToYYYYMMDD(dates[0].trim()); end_date = formatToYYYYMMDD(dates[1].trim()); } } //alert(status); $.ajax({ url: site_url + 'accounts/profile_view/records/transaction_load' + methods, type: 'post', data: { search: search, status: status, start_date: start_date, end_date: end_date,id:id }, success: function (data) { var dt = JSON.parse(data); if (more == 'no') { $('#transaction_data').html(dt.item); } else { $('#transaction_data').append(dt.item); } if (dt.offset > 0) { $('#transaction_more').html('<tr><td colspan="8"><a href="javascript:;" class="btn btn-dim btn-light btn-block p-30" onclick="load(' + dt.limit + ', ' + dt.offset + ');"><i class="ki-duotone ki- arrows-loop"><span class="path1"></span><span class="path2"></span></i> Load More</a></td></tr>'); } else { $('#transaction_more').html(''); } } }); } function load_wallet(x, y) { var more = 'no'; var methods = ''; if (parseInt(x) > 0 && parseInt(y) > 0) { more = 'yes'; methods = '/' + x + '/' + y; } $('#credit').html('<div class="col-sm-12 fs-3x text-center" data-kt-indicator="on"> <span class="indicator-progress"><span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div>'); $('#debit').html('<div class="col-sm-12 fs-3x text-center" data-kt-indicator="on"> <span class="indicator-progress"><span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div>'); $('#balance').html('<div class="col-sm-12 fs-3x text-center" data-kt-indicator="on"> <span class="indicator-progress"><span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div>'); if (more == 'no') { $('#wallet_data').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } else { $('#wallet_more').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } var search = $('#search').val(); var status = $('#status').val(); var dateRange = $('#wallet_datez').val(); var id = $('#user_id').val(); let start_date = ''; let end_date = ''; if (dateRange) { const dates = dateRange.split(' - '); // Split by " - " if (dates.length === 2) { start_date = formatToYYYYMMDD(dates[0].trim()); end_date = formatToYYYYMMDD(dates[1].trim()); } } $.ajax({ url: site_url + 'accounts/profile_view/records/wallet_load' + methods, type: 'post', data: { search: search, status: status, start_date: start_date, end_date: end_date,id:id }, success: function (data) { var dt = JSON.parse(data); if (more == 'no') { $('#wallet_data').html(dt.item); } else { $('#wallet_data').append(dt.item); } $('#credit').html(dt.credit); $('#debit').html(dt.debit); $('#balance').html(dt.balance); if (dt.offset > 0) { $('#wallet_more').html('<tr><td colspan="8"><a href="javascript:;" class="btn btn-dim btn-light btn-block p-30" onclick="load(' + dt.limit + ', ' + dt.offset + ');"><i class="ki-duotone ki- arrows-loop"><span class="path1"></span><span class="path2"></span></i> Load More</a></td></tr>'); } else { $('#wallet_more').html(''); } } }); } function load_activity(x, y) { var more = 'no'; var methods = ''; if (parseInt(x) > 0 && parseInt(y) > 0) { more = 'yes'; methods = '/' + x + '/' + y; } if (more == 'no') { $('#activity_data').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); $('#total_id').html('<div class="col-sm-12 text-center"><span class="ni ni-loader fa-spin" ></span></div>'); } else { $('#activity_more').html('<tr><td colspan="8"><div class="col-sm-12 fs-2 text-center" data-kt-indicator="on"> <span class="indicator-progress">Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span></span></div></td></tr>'); } var dateRange = $('#activity_datez').val(); console.log(dateRange); var id = $('#user_id').val(); let start_date = ''; let end_date = ''; if (dateRange) { const dates = dateRange.split(' - '); // Split by " - " if (dates.length === 2) { start_date = formatToYYYYMMDD(dates[0].trim()); end_date = formatToYYYYMMDD(dates[1].trim()); } } $.ajax({ url: site_url + 'accounts/profile_view/records/activity_load' + methods, type: 'post', data: {start_date: start_date, end_date: end_date,id:id }, success: function (data) { var dt = JSON.parse(data); if (more == 'no') { $('#activity_data').html(dt.item); } else { $('#activity_data').append(dt.item); } if (dt.offset > 0) { $('#activity_more').html('<tr><td colspan="8"><a href="javascript:;" class="btn btn-dim btn-light btn-block p-30" onclick="load(' + dt.limit + ', ' + dt.offset + ');"><i class="ki-duotone ki- arrows-loop"><span class="path1"></span><span class="path2"></span></i> Load More</a></td></tr>'); } else { $('#activity_more').html(''); } }, complete: function () { $.getScript(site_url + '/assets/js/jsmodal.js'); } }); } </script> <script> let map, marker, autocomplete, geocoder; // Initialize map and autocomplete function initializeMapAndAutocomplete(userLocation) { const nigeriaBounds = { north: 13.885645, south: 4.272504, west: 2.676932, east: 14.678014, }; // Input fields for state, LGA, address, latitude, and longitude const stateInput = document.getElementById("state_id"); const lgaInput = document.getElementById("lga_id"); const addressInput = document.getElementById("address"); const latitudeInput = document.getElementById("latitude"); const longitudeInput = document.getElementById("longitude"); // Initialize map map = new google.maps.Map(document.getElementById("mapz"), { center: userLocation, zoom: 10, restriction: { latLngBounds: nigeriaBounds, strictBounds: false, }, }); // Initialize marker marker = new google.maps.Marker({ position: userLocation, map: map, draggable: true, }); // Initialize geocoder geocoder = new google.maps.Geocoder(); // Update location and address when marker is dragged marker.addListener("dragend", function () { const position = marker.getPosition(); latitudeInput.value = position.lat(); longitudeInput.value = position.lng(); updateAddressFields(position); }); // Update marker position and address on map click map.addListener("click", function (event) { marker.setPosition(event.latLng); latitudeInput.value = event.latLng.lat(); longitudeInput.value = event.latLng.lng(); updateAddressFields(event.latLng); }); // Initialize autocomplete const input = document.getElementById("autocomplete"); autocomplete = new google.maps.places.Autocomplete(input, { componentRestrictions: { country: "ng" }, fields: ["geometry", "formatted_address", "address_components"], }); // Listen for place selection autocomplete.addListener("place_changed", function () { const place = autocomplete.getPlace(); if (place.geometry) { const position = place.geometry.location; // Zoom into the selected place map.setCenter(position); map.setZoom(15); // Adjust zoom level as needed marker.setPosition(position); latitudeInput.value = position.lat(); longitudeInput.value = position.lng(); updateAddressFields(position, place); } }); // Function to update address fields function updateAddressFields(location, place = null) { if (!place) { geocoder.geocode({ location }, function (results, status) { if (status === "OK" && results[0]) { const formattedAddress = formatAddress(results[0].address_components); addressInput.value = formattedAddress; // Update address input with formatted address extractAddressComponents(results[0]); // Extract state and LGA } }); } else { const formattedAddress = formatAddress(place.address_components || []); addressInput.value = place.formatted_address || formattedAddress; extractAddressComponents(place); } } // Function to format address into a readable string function formatAddress(components) { const addressParts = []; components.forEach((component) => { if ( component.types.includes("street_number") || // Street number component.types.includes("route") || // Street name component.types.includes("sublocality_level_1") || // Area/Suburb component.types.includes("locality") || // City/Town component.types.includes("administrative_area_level_2") || // LGA component.types.includes("administrative_area_level_1") || // State component.types.includes("postal_code") // Postal code ) { addressParts.push(component.long_name); } }); return addressParts.join(", "); // Combine parts into a readable address } // Function to extract state, LGA, and other components function extractAddressComponents(result) { const components = result.address_components || []; let state = ""; let lga = ""; components.forEach((component) => { if (component.types.includes("administrative_area_level_1")) { state = component.long_name; } if (component.types.includes("administrative_area_level_2")) { lga = component.long_name; } }); stateInput.value = state; lgaInput.value = lga; } // Initialize fields with user location updateAddressFields(userLocation); } // Get user's current location or use existing lat/lng if provided function getCurrentLocation() { // Access latitude and longitude fields const latitudeField = document.getElementById("latitude"); const longitudeField = document.getElementById("longitude"); // Check if lat/lng fields are not empty if (latitudeField.value && longitudeField.value) { const existingLocation = { lat: parseFloat(latitudeField.value), lng: parseFloat(longitudeField.value), }; console.log("Using existing location:", existingLocation); initializeMapAndAutocomplete(existingLocation); // Initialize map with existing location } else if (navigator.geolocation) { // Use geolocation to get user's current location navigator.geolocation.getCurrentPosition( (position) => { const userLocation = { lat: position.coords.latitude, lng: position.coords.longitude, }; console.log("Using user's current location:", userLocation); initializeMapAndAutocomplete(userLocation); // Initialize map with user's location }, (error) => { console.error("Error getting location: ", error); // Fallback to default location const defaultLocation = { lat: 6.5244, lng: 3.3792 }; console.log("Using default location:", defaultLocation); initializeMapAndAutocomplete(defaultLocation); } ); } else { console.error("Geolocation is not supported by this browser."); // Fallback to default location const defaultLocation = { lat: 6.5244, lng: 3.3792 }; console.log("Using default location:", defaultLocation); initializeMapAndAutocomplete(defaultLocation); } } // Initialize map and autocomplete on page load window.onload = getCurrentLocation; </script> <?= $this->endSection(); ?>
Upload File
Create Folder