EVOLUTION-NINJA
Edit File: project_payment_edit.php
<?php echo view('includes/sidebar'); ?> <script type="text/javascript" src="<?php echo base_url('public/assets/js/jquery-3.6.0.min.js'); ?>"></script> <script src="<?php echo base_url('public/assets/toastr/toastr.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('public/assets/toastr/toastr.min.css');?>"> <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css"> <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/createproject.css');?>"> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/font-awesome.min.css');?>"> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/bootstrap.min.css');?>"> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/sidebar.css');?>"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="<?php echo base_url('public/assets/images/constituency.png');?>"> <link rel="stylesheet" href="<?php echo base_url('public/assets/images/Logo.png');?>"> <link rel="stylesheet" href="<?php echo base_url('public/assets/images/employee.png');?>"> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <section class="home-section"> <div class="home-content"> <i class='bx bx-menu'></i> </div> <div class="row m-0"> <div class="col-sm-12"> <h1 class="crt-pjt">Project Payment</h1> </div> </div> <style> .inpfieldname { font-family: Poppins; font-size: 18px; font-weight: 500; text-align: left; color: #1F1F21; } .excelFile{ padding:5px !important; } .excel{ display:flex; justify-content:space-evenly; } .plus { background-color: transparent !important; padding: 2px; margin: 15px 15px; } .fieldsbox { border-radius: 23px !important; padding: 5px 10px !important; height: 45px; width: 85% } .projdetail { margin-inline: auto; margin-top: 15px; } .constuency_page { width: 100%; padding: 20px 16px; } .textfields { border-radius: 14px; } .buttns-cnl { margin-inline: 15px !important; } @media (min-width: 768px) and (max-width: 1024px) { .inpfieldname { font-size: 15px; } .fieldsbox { width: 100%; } } @media only screen and (max-width:620px) { .fieldsbox { width: 100% } .home-section { height: 100% } } body { margin: 0px; padding: 0px; overflow-x: hidden; } .search-bar { border-radius: 18px !important; border: none; box-shadow: 1px 1px 6px 0px #00000040; height: 35px; } .rem { width: 70% !important; } @media only screen and (max-width: 600px) { .rem { width: 100% !important; } } </style> <!--<form id="project-edit-form" method="post" action="<?= base_url('save-payment') ?>">--> <form id="project-edit-form" method="post" action="<?= base_url('save-payment') ?>" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?= $customer['id'] ?>"> <div class="createproject"> <div class="row projdetail"> <!-- Total Paid Amount Field --> <div class="col-sm-5"> <label class="form-label inpfieldname" for="TotalPaidAmount">Total Paid Amount</label> <input type="number" name="paid_amount" class="form-control fieldsbox" id="TotalPaidAmount" value="<?= isset($customer['paid_amount']) ? $customer['paid_amount'] : '' ?>"> </div> <div class="col-sm-1"></div> <!-- Payment Type Field --> <div class="col-sm-5"> <label for="PaymentType" class="form-label inpfieldname">Payment Type</label> <select name="payment_type" id="payment_type" class="form-control fieldsbox"> <option value="">Select Payment Type</option> <option value="Cash" <?= (isset($customer['payment_type']) && $customer['payment_type'] == 'Cash') ? 'selected' : '' ?>>Cash</option> <option value="Cheque" <?= (isset($customer['payment_type']) && $customer['payment_type'] == 'Cheque') ? 'selected' : '' ?>>Cheque</option> <option value="Online Transfer" <?= (isset($customer['payment_type']) && $customer['payment_type'] == 'Online Transfer') ? 'selected' : '' ?>>Online Transfer</option> </select> </div> <div class="col-sm-1"></div> </div> <div class="projdetail row"> <div class="col-sm-6"> <label for="Remarks" class="form-label inpfieldname">Farmer Share UTR NO</label><br> <input type="text" name="upi" id="upi" class="form-control textfields rem" value="<?= isset($customer['upi']) ? $customer['upi'] : '' ?>"> </div> <div class="col-sm-5"> <label class="form-label inpfieldname" for="payment_date"> Payment Date </label> <input type="date" name="payment_date" id="payment_date" class="form-control fieldsbox" value="<?= isset($customer['payment_date']) ? $customer['payment_date'] : date('d-m-y') ?>"> </div> </div> <div class="col-sm-3"> <label for="upload" class="form-label inpfieldname">Upload</label><br> <!-- Upload New File --> <input type="file" name="upload" id="upload" class="form-control fieldsbox"> <!-- Show Existing Uploaded File --> <?php if (!empty($customer['payment_file'])): ?> <?php $file = esc($customer['payment_file']); $path = base_url('public/payment_files/' . $file); $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); ?> <a href="<?= $path ?>" class="btn btn-primary btn-sm mt-2 mx-2" target="_blank"> View File </a> <?php endif; ?> </div> <div class="row"> <div class="col-sm-6 buttns-cnl"> <button type="submit" class="submit">Submit</button> <button type="button" id="btn-cancel" class="cancel">Cancel</button> </div> </div> </div> </form> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.8/dist/sweetalert2.all.min.js"></script> <link href="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.8/dist/sweetalert2.min.css" rel="stylesheet"> </section> <script> $(document).ready(function () { $('#project-edit-form').on('submit', function (e) { e.preventDefault(); let formData = new FormData(this); $.ajax({ url: "<?= base_url('save-payment') ?>", type: "POST", data: formData, processData: false, contentType: false, success: function (response) { Swal.fire({ icon: 'success', title: 'Success', text: 'Payment Updated Successfully', confirmButtonColor: '#3085d6' }).then(() => { window.location.href = "<?= base_url('customer-list') ?>"; }); }, error: function () { Swal.fire({ icon: 'error', title: 'Error', text: 'Failed to update payment' }); } }); }); }); </script> <script> $(document).ready(function () { $('#btn-cancel').click(function () { window.location.href = "<?= base_url('customer-list'); ?>"; }); }); </script> <?php echo view('includes/footer'); ?>