(function($) {
  'use strict';
  $(function() {
    $('#order-listing').DataTable({
      "aLengthMenu": [[5, 10, 15, -1], [5, 10, 15, "All"]],
      "iDisplayLength": 10,
      "language": {
        "sProcessing":   "درحال پردازش...",
      "sLengthMenu":   "نمایش محتویات _MENU_",
      "sZeroRecords":  "موردی یافت نشد",
      "sInfo":         "نمایش _START_ تا _END_ از مجموع _TOTAL_ مورد",
      "sInfoEmpty":    "تهی",
      "sInfoFiltered": "(فیلتر شده از مجموع _MAX_ مورد)",
      "sInfoPostFix":  "",
      "sSearch":       "جستجو:",
      "sUrl":          "",
      "oPaginate": {
      "sFirst":    "ابتدا",
      "sPrevious": "قبلی",
      "sNext":     "بعدی",
      "sLast":     "انتها"
      }
      }
    });
    $('#order-listing').each(function(){
      var datatable = $(this);
      // SEARCH - Add the placeholder for Search and Turn this into in-line form control
      var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
      search_input.attr('placeholder', 'جستجو');
      search_input.removeClass('form-control-sm');
      // LENGTH - Inline-Form control
      var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
      length_sel.removeClass('form-control-sm');
    });
  });
})(jQuery);
