Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- VIEW --
- <?php $this->load->view('back/head'); ?>
- <?php $this->load->view('back/header'); ?>
- <?php $this->load->view('back/leftbar'); ?>
- <div class="content-wrapper">
- <section class="content-header">
- <h1><?php echo $title ?></h1>
- <ol class="breadcrumb">
- <li><a href="<?php echo base_url('dashboard') ?>"><i class="fa fa-dashboard"></i> Home</a></li>
- <li>Kartu Garansi</li>
- <li class="active"><a href="<?php echo current_url() ?>"><?php echo $title ?></a></li>
- </ol>
- </section>
- <section class="content">
- <div class="box box-primary">
- <div class="box-body table-responsive padding">
- <p><button class="btn btn-grey" onclick="reload_table()"><i class="glyphicon glyphicon-refresh"></i> Refresh </button></p>
- <?php echo validation_errors() ?>
- <?php if ($this->session->flashdata('message')) {
- echo $this->session->flashdata('message');
- } ?>
- <p>
- <select class="form-control" id="urutkan" style="margin-top:5px">
- <option value="1" <?php echo $this->uri->segment(3) == 1 ? ' selected' : ''; ?>>Nota SPK</option>
- <option value="2" <?php echo $this->uri->segment(3) == 2 ? ' selected' : ''; ?>>Nota Pelunasan</option>
- </select>
- </p>
- <table id="datatable" class="table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th style="text-align: center">Last Update</th>
- <th style="text-align: center">No. Nota Pelunasan</th>
- <th style="text-align: center">Nota SPK</th>
- <th style="text-align: center">Nama Customer</th>
- <th style="text-align: center">No. HP</th>
- <th style="text-align: center">Plat Nomor</th>
- <th style="text-align: center">Jenis Mobil</th>
- <th style="text-align: center">Nama Produk</th>
- <th style="text-align: center">Berlaku s/d</th>
- <th style="text-align: center">Catatan Maintenance</th>
- <th style="text-align: center">Aksi</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
- </div>
- </div>
- </section>
- </div>
- <!-- DATA TABLES SCRIPT -->
- <script src="<?php echo base_url('assets/plugins/datatables/jquery.dataTables.min.js') ?>" type="text/javascript"></script>
- <script src="<?php echo base_url('assets/plugins/datatables/dataTables.bootstrap.min.js') ?>" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $('#urutkan').on('change', function() {
- var url = "<?php echo base_url('warranty_card/index/') ?>";
- var status = $(this).val();
- window.location = url + status;
- });
- table = $('#datatable').DataTable({
- processing: true, //Feature control the processing indicator.
- serverSide: true, //Feature control DataTables' server-side processing mode.
- bPaginate: true,
- bLengthChange: true,
- bFilter: true,
- bSort: true,
- bInfo: true,
- order: [
- [0, 'desc']
- ],
- lengthMenu: [
- [10, 25, 50, 100, 500, 1000, -1],
- [10, 25, 50, 100, 500, 1000, "Semua"]
- ],
- ajax: {
- "url": "<?php echo site_url('warranty_card/ajax_list_by_pelunasan') ?>",
- "type": "POST"
- },
- });
- });
- function reload_table() {
- table.ajax.reload(null, false); //reload datatable ajax
- }
- function delete_data(id_warranty_card) {
- if (confirm('Apakah Anda yakin?')) {
- // ajax delete data to database
- $.ajax({
- url: "<?php echo site_url('warranty_card/ajax_delete') ?>/" + id_warranty_card,
- type: "POST",
- dataType: "JSON",
- success: function(data) {
- //if success reload ajax table
- alert('Hapus data berhasil');
- $('#modal_form').modal('hide');
- reload_table();
- },
- error: function(jqXHR, textStatus, errorThrown) {
- alert('Gagal menghapus data');
- }
- });
- }
- }
- </script>
- <?php $this->load->view('back/footer'); ?>
Advertisement
Add Comment
Please, Sign In to add comment