$(".status-filter-select-two").select2({
  dir: "rtl",
  language: {
    inputTooShort: function() {
      return "جستجو در اشتراکها";
    },
    noResults: function () {
      return "جستجو نتیجه‌ای نداشت";
    }
  },
  minimumInputLength: 0,
  templateResult: formatStatus,
  templateSelection: formatStatusSelection
});

function formatStatus (item) {
  if (item.loading) {
    return item.text;
  }

  let $container = $(
    "<div class='select2-result clearfix'>" +
      "<div class='select2-result-meta'>" +
        "<div class='select2-result-text'></div>" +
        "<div class='select2-result-summary'></div>" +
      "</div>" +
    "</div>"
  );

  $container.find(".select2-result-text").text(item.text);
  $container.find(".select2-result-summary").text(item.summary);

  return $container;
}

function formatStatusSelection (item) {
  return item.text ;
}

$(".type-filter-select-two").select2({
  dir: "rtl",
  language: {
    inputTooShort: function() {
      return "جستجو در اشتراکها";
    },
    noResults: function () {
      return "جستجو نتیجه‌ای نداشت";
    }
  },
  minimumInputLength: 0,
  templateResult: formatType,
  templateSelection: formatTypeSelection
});

function formatType (item) {
  if (item.loading) {
    return item.text;
  }

  let $container = $(
    "<div class='select2-result clearfix'>" +
      "<div class='select2-result-meta'>" +
        "<div class='select2-result-text'></div>" +
        "<div class='select2-result-summary'></div>" +
      "</div>" +
    "</div>"
  );

  $container.find(".select2-result-text").text(item.text);
  $container.find(".select2-result-summary").text(item.summary);

  return $container;
}

function formatTypeSelection (item) {
  return item.text ;
}

$(".confirm-filter-select-two").select2({
  dir: "rtl",
  language: {
    inputTooShort: function() {
      return "وضعیت تایید";
    },
    noResults: function () {
      return "جستجو نتیجه‌ای نداشت";
    }
  },
  minimumInputLength: 0,
  templateResult: formatConfirm,
  templateSelection: formatConfirmSelection
});

function formatConfirm (item) {
  if (item.loading) {
    return item.text;
  }

  let $container = $(
    "<div class='select2-result clearfix'>" +
      "<div class='select2-result-meta'>" +
        "<div class='select2-result-text'></div>" +
        "<div class='select2-result-summary'></div>" +
      "</div>" +
    "</div>"
  );

  $container.find(".select2-result-text").text(item.text);
  $container.find(".select2-result-summary").text(item.summary);

  return $container;
}

function formatConfirmSelection (item) {
  return item.text ;
}
