EVOLUTION-NINJA
Edit File: asset_list.php
<?php echo view('includes/home_sidebar');?> <main id="rightDiv"> <style> #leftDiv { height: 1260px !important; } .v-e-d { font-size: 13px; font-weight: 600; border: none; outline: none; padding: 3px 8px; border-radius: 5px; min-width: 75px; color: white; margin-left: 3px; } #view--details { background-color: #0065A3; } #Edit--button { background-color: chocolate; } #delete--button { background-color: #034c5f; } /* -----------STUDENT OVERALL DETAILS-student-------------- */ .overall-details-student { padding: 6px; display: grid; grid-template-columns: 1fr; grid-auto-rows: auto; height: auto; gap: 15px; } .overall-details-student>div { padding: 4px 7px; } .overall-details-student>div h5 { color: #123053; font-size: 17px; font-weight: 600; } /* ------------STUDENT INFORMATION---------- */ .student-information1 { height: auto; background-color: #219F94; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 4px; position: relative; padding: 7px; border-radius: 4px; } .student-information1 .stud-detail-model { padding: 3px 8px; color: white; font-size: 15px; font-weight: 400; } .student-information1 .stud-detail-model:last-child { position: relative; left: 30px; } /* new function */ .new-function { background-color: #219F94; color: white; padding: 12px 10px; border-radius: 6px; font-size: 16px; margin-left: 0px; } .modal-dialog .modal-content { width: 113% !important; padding-right: 10px; } #excelform { background: #A5DD9B; padding: 7px; } @media only screen and (max-width: 728px) { .Add-student { width: 100vw; display: block; } } #datatable thead tr { background-color: rgba(0, 72, 76, 1) !important; color: white; } </style> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <!-- -------ADDSTUDENT AND BACK BUTTON---------- --> <section class="Add-student"> <button class="btn back-butt" onclick="goBack()"><i class="fa fa-arrow-left" aria-hidden="true"></i> Back</button> </section> <table id="datatable" class="display" style="width:100%"> <thead> <tr> <th>SL no</th> <th>ID</th> <th>Product Name</th> <th>Product Description</th> <th>Document Name</th> <th>Document Description</th> <th>Agrement Name</th> <th>Agrement Description</th> <th>Action</th> </tr> </thead> <tbody> </tbody> </table> <br /> <div id="resultID"></div> </div> </div> </div> </section> </main> </section> <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"> <script> $(document).ready(function () { var table = $('#datatable').DataTable({ ajax: { url: '<?php echo base_url("asset-list-data"); ?>', dataSrc: '' }, columns: [ { data: null }, { data: 'id', visible: false }, { data: 'product_name' }, { data: 'product_description' }, { data: 'document_name' }, { data: 'document_description' }, { data: 'agreement_name' }, { data: 'agreement_description' }, { data: null, render: function (data, type, row) { return `<div class="crud--buttons" > <button class="btn edit--butt v-e-d" id="Edit--button" onclick='Editasset(${row.id})' >Edit </button> <button class="btn delete--butt v-e-d" id="delete--button" onclick='Deleteasset(${row.id})'>Delete </button> </div>`; } } ], rowCallback: function (row, data, index) { $('td:eq(0)', row).html(index + 1); }, language: { emptyTable: "No data available" } }); }); function Editasset(id) { window.location.href = '<?php echo base_url("asset-edit");?>?id=' + id; } function Deleteasset(id) { // console.log(id) Swal.fire({ title: "Are you sure?", text: "You won't be able to revert this!", icon: "warning", showCancelButton: true, confirmButtonColor: "#3085d6", cancelButtonColor: "#d33", confirmButtonText: "Yes, delete it!" }).then((result) => { if (result.isConfirmed) { $.ajax({ type: 'post', url: '<?php echo base_url("asset-delete");?>?id=' + id, contentType: false, processData: false, success: function (response) { if (response.result == 1) { Swal.fire({ title: "Deleted!", text: "Data has been deleted.", icon: "success", }).then(function () { $('#datatable').DataTable().ajax.reload(); }) } } }) } }); } </script> <!-- BACK BUTTON SCRIPT --> <script> function goBack() { window.location.href = 'dashboard'; } function add() { window.location.href = 'form'; } </script> <?php echo view('includes/footer'); ?>