$(function () {
    "use strict";
    $(document).ready(function () {
        $('#basic-datatables2a').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 5 }
            ],
            order: [[5, 'desc']]
        });
        
        $('#basic-datatables').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
            order: [0, 'desc']
		});

        $('#basic-datatables1').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 4 }
            ],
            order: [[4, 'desc']]
        });
        $('#basic-datatables2').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 5 }
            ],
            order: [[5, 'desc']]
        });
        $('#basic-datatables3').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 4 }
            ],
            order: [[4, 'desc']]
        });
        $('#basic-datatables4').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [5, 6]  }
            ],
            order: [[5, 'desc']]
        });
        $('#basic-datatables5').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 6 }
            ],
            order: [[6, 'desc']]
        });
        $('#basic-datatables6').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [5, 6] }
            ],
            order: [[5, 'desc']]
        });
        $('#basic-datatables7').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 3 }
            ],
            order: [[3, 'desc']]
        });
        $('#basic-datatables8').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                {
                    targets: 2,
                    type: 'date' // Set the column type to 'date'
                }
            ],
            order: [[2, 'desc']] //for making desc with date
        });
        $('#basic-datatables9').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                {
                    targets: 3,
                    type: 'date'
                }
            ],
            order: [[0, 'desc']] 
        });
        $('#basic-datatables10').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                {
                    targets: 4,
                    type: 'date'
                }
            ],
            order: [[0, 'desc']] 
        });
        $('#basic-datatabless').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 2 }
            ],
            order: [[2, 'desc']]
        });
        $('#basic-datatables11').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 7 }
            ],
            order: [[7, 'desc']]
        });
        $('#basic-datatables12').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 7 }
            ],
            order: [[7, 'desc']]
        });
        $('#basic-datatables13').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 7 }
            ],
            order: [[7, 'desc']]
        });
        $('#basic-datatables14').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 8 }
            ],
            order: [[7, 'desc']]
        });
        $('#basic-datatablesShort').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 6 }
            ],
            order: [[6, 'desc']]
        });
        $('#basic-datatablesreseller').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
			columnDefs: [
				{ type: 'date', targets: [4, 5] } 
			],
			order: [[0, 'desc']] 
		});
        $('#basic-datatablespanding').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
			columnDefs: [
				{
					targets: 5,
					type: 'date'
				}
			],
			order: [[5, 'desc']] 
		});
        $('#basic-datatablesaccount').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                {
                    targets: 5,
                    type: 'date'
                }
            ],
            order: [[5, 'desc']]
        });
        $('#basic-datatablespanding').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
			columnDefs: [
				{
					targets: 0,
					type: 'date'
				}
			],
			order: [[0, 'desc']] 
		});
         $('#basic-dataSIPdetails').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
			columnDefs: [
				{
					targets: 5,
					type: 'date'
				}
			],
			order: [[0, 'desc']] 
		});
        $('#basic-datatableuser').DataTable({
			retrieve: true,
			paging: true,
			stateSave: false,
			columnDefs: [
                { targets: 7, type: 'date', visible: false }, // Hidden column (Full Date-Time)
                { targets: 6, orderData: 7 } // Sort "Closing Invoice Date" (Column 6) by hidden column (Column 7)
            ],
            order: [[7, 'desc']] // Sort by hidden date-time column
		});
        $('#basic-datatablessc1').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [4, 5] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablessc3').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [4, 5] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablessc4').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [6, 7] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablessc5').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [7, 8] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablessc6').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [8, 9] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablesAssign').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [3] }
            ],
            order: [[3, 'desc']]
        });
        $('#basic-datatablesShortsc').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [7, 8] }
            ],
            order: [[0, 'desc'], [0, 'desc']]
        });
        $('#basic-datatablesmultiuser').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: 6 }
            ],
            order: [[6, 'desc']]
        });
        $('#basic-datatablesscN').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
				{
					targets: 0,
					type: 'date'
				}
			],
			order: [[0, 'desc']] 
        });
        $('#basic-datatablessub').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [4, 5] }
            ],
            order: [[4 , 'desc'], [0, 'desc']]
            // columnDefs: [
            //     { type: 'num', targets: 3 },
            //     { type: 'date', targets: [4, 5] }
            //   ],
            //   order: [[4, 'desc']]
        });
        $('#basic-datatablesstrip').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { orderData: [0], targets: 6 }
            ],
            order: [[6, 'desc']]
        });
        $('#basic-datatablespendingtodelete').DataTable({
            retrieve: true,
            paging: true,
            stateSave: false,
            columnDefs: [
                { type: 'date', targets: [7] }
            ],
            order: [ [7, 'desc']]
        });
       
    });
});

