123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <button class="btn btn-primary" onclick="document.getElementById('addForm').style.display = 'block';document.getElementById('editForm').style.display = 'none';"> Add Vehicle </button>
- <table id="vehicle" class="table display table-striped table-bordered table-hover table-sm" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th></th>
- <th></th>
- <th>Id</th>
- <th>Number</th>
- <!-- <th>Vehicle Id</th> -->
- <!-- <th>Vehicle Number</th> -->
- </tr>
- </thead>
- <tfoot>
- <tr>
- <th></th>
- <th></th>
- <th>Id</th>
- <th>Number</th>
- <!-- <th>Vehicle Id</th> -->
- <!-- <th>Vehicle Number</th> -->
- </tr>
- </tfoot>
- </table>
- <script type="text/javascript">
- /* Formatting function for row details - modify as you need */
- // function format ( d ) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(document).ready(function() {
- var table = $('#vehicle').DataTable( {
- "buttons": true,
- "ajax": "api/v1/Customers/vehicles.txt",
- "columns": [
-
-
-
-
-
-
- {
- "className": 'delete',
- "orderable": false,
- "data": null,
- "defaultContent": 'Delete'
- },
- {
- "className": 'edit',
- "orderable": false,
- "data": null,
- "defaultContent": 'Edit'
- },
- { "data": "Id" },
- { "data": "Number" },
-
-
-
- ],
- "order": [[1, 'asc']]
- } );
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $('#vehicle tbody').on('click', 'td.delete', function () {
- var tr = $(this).closest('tr');
- var row = table.row( tr );
- var username = table.row( this ).data()['Name'];
- var id = table.row( this ).data()['Customer_Id'];
-
-
-
- } );
-
- $('#vehicle tbody').on('click', 'tr td.edit', function () {
- var tr = $(this).closest('tr');
- var row = table.row( tr );
-
-
- var username = table.row( this ).data()['Name'];
- var creditSale = table.row( this ).data()['Credit_Sale'];
- var id = table.row( this ).data()['Customer_Id'];
- var vehicle_id = table.row( this ).data()['Id'];
- var number = table.row( this ).data()['Number'];
- document.getElementById('username').value = username;
- document.getElementById('id').value = id;
- document.getElementById('vehicle_id').value = vehicle_id;
- document.getElementById('number').value = number;
- if (creditSale=='Yes') {
- document.getElementById('creditSale').checked = true;
- }else if(creditSale=='No'){
- document.getElementById('creditSale').checked = false;
- }
- document.getElementById('editForm').style.display = 'block';
- document.getElementById('addForm').style.display = 'none';
- } );
- } );
- </script>
|