EVOLUTION-NINJA
Edit File: adddealer.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.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script> <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> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.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">Add Dealer</h1> </div> </div> <!-- SUCCESS POPUP --> <div id="successPopup" class="success-popup"> <div class="popup-box"> <div class="tick">✔</div> <p id="popupMessage">Success</p> </div> </div> <style> .inpfieldname { font-family: Poppins; font-size: 18px; font-weight: 500; color: #1F1F21; } .fieldsbox { border-radius: 23px !important; padding: 5px 10px !important; height: 45px; width: 85% } .projdetail { margin-inline: auto; margin-top: 15px; } .textfields { border-radius: 14px; } .projectinputs { width: 93% !important; } @media (max-width:620px) { .fieldsbox { width: 100% } .projectinputs { width: 100% !important; } } /* POPUP STYLE */ .success-popup{ display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); justify-content:center; align-items:center; z-index:9999; } .popup-box{ background:#fff; padding:30px 40px; border-radius:12px; text-align:center; } .tick{ font-size:50px; color:green; margin-bottom:10px; } </style> <!-- FORM START --> <form action="<?= base_url('add-dealer'); ?>" method="post"> <div class="createproject"> <!-- ROW 1 --> <div class="row projdetail"> <div class="col-sm-4"> <label class="form-label inpfieldname"> Dealer Name <span style="color:red">*</span> </label> <input type="text" name="name" class="form-control fieldsbox" placeholder="Enter Dealer Name" oninput="this.value = this.value.replace(/[^A-Za-z ]/g, '')" required> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> Mobile <span style="color:red">*</span> </label> <input type="text" name="mobile" class="form-control fieldsbox" placeholder="Enter Mobile Number" pattern="[0-9]{10}" maxlength="10" required> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> Email <span style="color:red">*</span> </label> <input type="email" name="email" class="form-control fieldsbox" placeholder="Enter Email" required> </div> </div> <!-- ROW 2 --> <div class="row projdetail"> <div class="col-sm-4" style="position:relative;"> <label class="form-label inpfieldname"> District <span style="color:red">*</span> </label> <input type="text" name="district" id="district" class="form-control fieldsbox" placeholder="Enter District" autocomplete="off" required> <div id="districtSuggestions" style="display:none; position:absolute; background:#fff; border:1px solid #ccc; width:85%; max-height:150px; overflow-y:auto; z-index:9999;"> </div> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> PAN No <span style="color:red">*</span> </label> <input type="text" name="pan_no" class="form-control fieldsbox" placeholder="Enter PAN Number" style="text-transform:uppercase" pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" required> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> TAN No <span style="color:red">*</span> </label> <input type="text" name="tan_no" class="form-control fieldsbox" placeholder="Enter TAN Number" style="text-transform:uppercase" pattern="[A-Z]{4}[0-9]{5}[A-Z]{1}" title="Enter valid TAN Number" required> </div> </div> <!-- ROW 3 --> <div class="row projdetail"> <div class="col-sm-4"> <label class="form-label inpfieldname"> GST % <span style="color:red">*</span> </label> <input type="number" step="0.01" name="gst_percent" class="form-control fieldsbox" placeholder="Enter GST Percentage" required> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> Contact Person <span style="color:red">*</span> </label> <input type="text" name="contact_person" class="form-control fieldsbox" placeholder="Enter Contact Person" oninput="this.value = this.value.replace(/[^A-Za-z ]/g, '')" required> </div> <div class="col-sm-4"> <label class="form-label inpfieldname"> Contact Person Mobile <span style="color:red">*</span> </label> <input type="text" name="contact_person_mobile" class="form-control fieldsbox" placeholder="Enter Contact Person Mobile" pattern="[0-9]{10}" maxlength="10" required> </div> </div> <!-- ROW 3 --> <div class="row projdetail"> <div class="col-sm-4"> <label class="form-label inpfieldname"> Address <span style="color:red">*</span> </label> <textarea name="address" class="form-control textfields projectinputs" placeholder="Enter Address" required></textarea> </div> </div> <!-- BUTTON ROW --> <div class="row projdetail"> <div class="col-sm-6 buttns-cnl"> <button type="submit" class="submit"> Add </button> <button type="button" class="cancel" onclick="this.form.reset();"> Cancel </button> </div> </div> </div> </form> </section> <!-- POPUP SCRIPT --> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <?php if(session()->getFlashdata('msg')): ?> <script> document.addEventListener("DOMContentLoaded", function () { Swal.fire({ icon: 'success', title: "<?= session()->getFlashdata('msg'); ?>", showConfirmButton: false, timer: 2000 }); }); </script> <?php endif; ?> <script> $(document).ready(function () { // All 31 Karnataka Districts let districts = [ "Bagalkot", "Ballari", "Belagavi", "Bangalore Rural", "Bangalore Urban", "Bidar", "Chamarajanagar", "Chikballapur", "Chikkamagaluru", "Chitradurga", "Dakshina Kannada", "Davanagere", "Dharwad", "Gadag", "Kalaburagi", "Hassan", "Haveri", "Kodagu", "Kolar", "Koppal", "Mandya", "Mysuru", "Raichur", "Ramanagara", "Shivamogga", "Tumakuru", "Udupi", "Uttara Kannada", "Vijayapura", "Vijayanagara", "Yadgir" ]; $('#district').on('keyup', function () { let value = $(this).val().toLowerCase(); let filtered = districts.filter(function(item) { return item.toLowerCase().startsWith(value); }); let suggestionBox = $('#districtSuggestions'); suggestionBox.empty(); if (value == '' || filtered.length == 0) { suggestionBox.hide(); return; } filtered.forEach(function(item) { suggestionBox.append( '<div class="district-item" style="padding:8px; cursor:pointer;">' + item + '</div>' ); }); suggestionBox.show(); }); $(document).on('click', '.district-item', function () { $('#district').val($(this).text()); $('#districtSuggestions').hide(); }); $(document).click(function(e){ if(!$(e.target).closest('#district, #districtSuggestions').length){ $('#districtSuggestions').hide(); } }); }); </script> <?php echo view('includes/footer'); ?>