X7ROOT File Manager
Current Path:
/home/hamdjcne/app.hamdalillahitravel.com/app/Views/wallets
home
/
hamdjcne
/
app.hamdalillahitravel.com
/
app
/
Views
/
wallets
/
ðŸ“
..
📄
fuel_price.php
(11.91 KB)
📄
fuel_price_form.php
(2.21 KB)
📄
list.php
(20.64 KB)
📄
list_form.php
(15.54 KB)
📄
price_structure.php
(10.88 KB)
📄
price_structure_form.php
(21.21 KB)
📄
trade.php
(10.9 KB)
📄
trade_form.php
(11.38 KB)
📄
transaction.php
(13.8 KB)
📄
transaction_form.php
(3.36 KB)
Editing: list_form.php
<?php use App\Models\Crud; $this->Crud = new Crud(); ?> <?php echo form_open_multipart($form_link, array('id'=>'bb_ajax_form2', 'class'=>'')); ?> <!-- delete view --> <?php if($param2 == 'delete') { ?> <div class="row"> <div class="col-sm-12"><div id="bb_ajax_msg2"></div></div> </div> <div class="row"> <div class="col-sm-12 text-center"> <h3><b>Are you sure?</b></h3> <input type="hidden" name="d_branch_id" value="<?php if(!empty($d_id)){echo $d_id;} ?>" /> </div> <div class="col-sm-12 text-center"> <button class="btn btn-danger text-uppercase" type="submit"> <i class="ri-delete-bin-4-line"></i> Yes - Delete </button> </div> </div> <?php } ?> <!-- insert/edit view --> <?php if($param2 == 'withdraw') { ?> <div class="row"> <div class="col-sm-12"><div id="bb_ajax_msg2"></div></div> </div> <div class="row"> <?php if($role == 'developer' || $role == 'administrator') {?> <div class="col-sm-12 mb-5"> <div class="form-group"> <label for="activate" class="required mb-2">Account</label> <select class="form-select js-select2" data-search="on" id="user_id" name="user_id"> <?php $cat = $this->Crud->read_single_order('role_id >', 2, 'user', 'fullname', 'asc'); foreach ($cat as $ca) { $name = $ca->fullname; if(!empty($ca->company_name)){ $name .= '('.$ca->company_name.')'; } ?> <option value="<?=$ca->id;?>"><?=ucwords($name.' - '.$this->Crud->read_field('id', $ca->role_id, 'access_role', 'name')); ?></option> <?php }?> </select> </div> </div> <?php } else {?> <input type="hidden" class="form-control" name="user_id" id="user_id" value="<?=$log_id; ?>"> <?php } ?> <div class="col-sm-12 mb-5"> <div class="form-group"> <label for="activate" class="required mb-2">Wallet Balance</label> <input type="text" class="form-control form-control-solid" name="balance" id="balancez" required placeholder="0.0" readonly> </div> </div> <div class="col-sm-12 mb-5"> <div class="form-group"> <label for="withdraw_type" class="mb-2">Withdraw Type</label> <select class="form-select js-select2" data-search="on" id="withdraw_type" name="withdraw_type" required> <option value="all">All Funds</option> <option value="partial">Partial Amount</option> </select> </div> </div> <div class="col-sm-12 mb-5" style="display: none;" id="amount_container"> <div class="form-group"> <label for="withdraw_amount" class="required mb-2">Withdraw Amount</label> <input type="text" class="form-control form-control-solid" name="withdraw_amount" id="withdraw_amount" placeholder="0.00"> <div class="text-danger mt-2" id="amount_error" style="display: none;">Amount exceeds available balance.</div> </div> </div> <div class="col-sm-12 text-center"> <button class="btn btn-primary bb_fo_btn" id="submit_btn" type="submit"> <i class="bi bi-floppy"></i> WiithdraW </button> </div> </div> <?php } ?> <?php if($param2 == 'fund'){?> <div class="login-opup"> <div class="row g-0"> <div class="col-md-12 col-lg-12 py-lg-1"> <div class="login"> <div class="row"> <div class="col-sm-12"><div id="bb_ajax_msg2"></div></div> </div> <div class="row g-6"> <input type="hidden" name="user_id" value="<?php if(!empty($log_id)){echo $log_id;} ?>"> <!-- Payment Method Selection --> <div class="form-group"> <label for="activate" class="required mb-2">Select Payment Method</label> <select class="form-select js-select2" data-search="on" name="payment_method" id="payment_method" onchange="togglePaymentMethodFields();"> <option value="paystack">Paystack</option> <option value="virtual">Virtual Account</option> </select> </div> <div style="display:none;" id="amount_field"> <!-- Amount Input (will be hidden for Virtual Account) --> <div class="form-group mb-3"> <input type="text" class="form-control" onkeyup="amo_cal();" oninput="this.value=this.value.replace(/[^\d]/,'')" name="amount" id="amount" required placeholder="5000"> </div> <!-- Total Amount Display --> <div class="bg-white border rounded mb-3 col-md-12 col-12"> <h1 id="t_amount" class="text-center text-success mb-1 fw-bold">₦0.00</h1> <input type="hidden" class="form-control bg-white border-0 ps-0" name="tot_amount" id="tot_amount" readonly placeholder="0.00"> </div> <!-- Payment Method Display --> <div class="row g-4 mt-4"> <div class="col-sm-3 text-light">.</div> <div class="col-sm-6"> <img src="<?=site_url('assets/media/svg/card-logos/mastercard.svg'); ?>" style="width:80%"> </div> <div class="col-sm-3 text-light">.</div> </div> <!-- Submit Button --> <button class="btn btn-lg text-white py-3 bb_form_bt px-4 text-uppercase w-100 mt-4" style="background-color:#1b2a53 !important;" type="submit" id="btns">Make Payment <i class="bi bi-arrow-right ms-2"></i></button> </div> <!-- Virtual Account Details (Initially hidden, just "Coming soon") <div id="virtual_account_fields" class="d-none"> <div class="bg-white border rounded mb-3 col-md-12 col-12 mx-1"> <p class="text-center">Please send the specified amount to the following account:</p> </div> <div class="bg-white border rounded mb-3 col-md-12 col-12 mx-1"> <label for="account_number">Account Number:</label> <input type="text" class="form-control" name="account_number" id="account_number" value="1234567890" disabled> </div> <div class="bg-white border rounded mb-3 col-md-12 col-12 mx-1"> <label for="bank_name">Bank Name:</label> <input type="text" class="form-control" name="bank_name" id="bank_name" value="Example Bank" disabled> </div> </div> Coming Soon Message for Virtual Account --> <div id="virtual_account_fields" style="display:none;" > <div class="bg-white border rounded mb-3 col-md-12 col-12 mx-1"> <h3 class="text-danger text-center">Coming soon!<br> Virtual Account option is not available yet.</h3> </div> </div> </div> </div> </div> </div> </div> <?php } ?> <?php echo form_close(); ?> <script> $('.js-select2').select2(); // Function to toggle between Virtual Account and Paystack payment fields // Function to toggle between Virtual Account and Paystack payment fields function togglePaymentMethodFields() { var paymentMethod = $("#payment_method").val(); // Hide all additional fields first $("#amount_field").show(); // Show amount input $("#virtual_account_fields").hide(); // Hide Virtual Account fields $("#virtual_account_coming_soon").hide(); // Hide the "Coming soon" message // Show the respective fields based on the selected payment method if (paymentMethod === 'virtual') { $("#amount_field").hide(); // Hide amount input for Virtual Account $("#virtual_account_fields").show(); // Show Virtual Account fields } else if (paymentMethod === 'paystack') { $("#amount_field").show(); // Show amount input for Paystack $("#virtual_account_fields").hide(); // Hide Virtual Account fields } } // Call this function on page load to hide/show fields based on initial selection $(document).ready(function() { togglePaymentMethodFields(); // Ensure correct fields are displayed on page load // Change event listener for payment method dropdown $("#payment_method").change(function() { togglePaymentMethodFields(); }); }); function isEmpty(str) { return (!str || str.length === 0); } $(document).ready(function () { // Trigger balance update on user change $('#user_id').on('change', updateBalance); // Initial balance load updateBalance(); // Function to get and update balance function updateBalance() { var userId = $('#user_id').val(); // Show loading message in balance input $('#balancez').val('Loading...'); // If no user ID is selected, reset the balance and exit if (!userId) { $('#balancez').val(''); return; } // Make AJAX call to fetch balance $.ajax({ url: site_url + 'wallets/list/get_balance', type: 'POST', data: { user_id: userId }, success: function (data) { // Update balance with the returned data $('#balancez').val(data); }, error: function (xhr, status, error) { console.error('Error fetching balance:', error); $('#balancez').val('Error loading balance'); } }); } var availableBalance = $('#balancez').val(); $('#withdraw_type').on('change', function () { var selectedType = $(this).val(); if (selectedType === 'partial') { $('#amount_container').show(); $('#withdraw_amount').val('').prop('readonly', false); // Make input editable and clear value $('#amount_error').hide(); $('#submit_btn').prop('disabled', false); // Ensure submit is enabled initially } else { $('#amount_container').hide(); $('#withdraw_amount').val('').prop('readonly', true); // Make input readonly $('#amount_error').hide(); $('#submit_btn').prop('disabled', false); } }); // Monitor input in the Withdraw Amount field $('#withdraw_amount').on('input', function () { var inputValue = $(this).val(); // Format as currency var formattedValue = formatCurrency(inputValue); $(this).val(formattedValue); // Remove formatting to compare values var numericValue = parseFloat(inputValue.replace(/,/g, '')); if (numericValue > availableBalance) { $('#amount_error').show(); $('#submit_btn').prop('disabled', true); // Disable submit button } else { $('#amount_error').hide(); $('#submit_btn').prop('disabled', false); // Enable submit button } }); // Function to format numbers as currency function formatCurrency(value) { if (!value) return ''; value = value.replace(/,/g, ''); // Remove existing commas // Check if the input is a valid number if (isNaN(value)) return ''; // Format only the integer and decimal parts as entered const parts = value.split('.'); // Split into integer and decimal parts parts[0] = parseInt(parts[0], 10).toLocaleString('en-US'); // Format the integer part with commas // Return formatted integer part with the original decimal part (if any) return parts.join('.'); } }); function amo_cal() { var amount = $('#amount').val(); var tot = 0.00; if(isEmpty(amount)){ tot = 0.00; } else { var amo = parseFloat(amount); // Waive the ₦100 fee if the transaction is under ₦2500 if (amo < 2500) { var fee = (0.015 * amo); // No fee for transactions below ₦2500 } else { // Calculate 1.5% + ₦100 for amounts greater than ₦2500 fee = (0.015 * amo) + 100; // Apply the cap of ₦2000 on the fee if (fee > 2000) { fee = 2000; } } // Calculate the total amount the user has to pay var tota = amo + fee; // Format the total amount for display (with comma as thousand separator) var totFormatted = tota.toLocaleString('en-US', { style: 'currency', currency: 'NGN' }); // Update the input field and the displayed total amount $('#tot_amount').val(tota.toFixed(2)); $('#t_amount').html(totFormatted); } } function banks() { var bank_id = $('#bank_id').val(); var account = $('#account').val(); if(isEmpty(bank_id) || account.length < 10){ $('#check_resp').html('<span class="text-danger">All Fields Required</span>'); } else { $('#check_resp').html(''); $('#check_resp').html('<div class="row"><div class="text-center col-lg-12"><i class="fas fa-circle-notch fa-spin fa-2x fa-fw"></i> Content loading please wait...</div></div>'); $.ajax({ url: '<?=site_url('auth/validate_account/');?>' + account +'/'+bank_id, success: function(data) { $('#check_resp').html(data); } }); } } </script> <script src="<?php echo site_url(); ?>assets/js/jsform.js"></script>
Upload File
Create Folder