"use strict";
// the selector will match all input controls of type :checkbox
// and attach a click event handler
$("#c-m-choice-s-4").hide();
$("#checkbox-s-4").on("click", function () {
  // in the handler, 'this' refers to the box clicked on
  var $box = $(this);
  if ($box.is(":checked")) {
    // $("#c-m-choice-s-4").show();
    // $("#main-box-s-4").hide();
    Swal.fire({
      title: 'تأكيد',
      icon: 'info',
      html:
        'سيتم اعتماد (عدم اعتماد) الملف المحدد التي تم تحديدها سابقا',
      text: "أدخل ملاحظات :",
      showCloseButton: false,
      showCancelButton: true,
      focusConfirm: false,
      confirmButtonText:
        'نعم',
      confirmButtonAriaLabel: 'Thumbs up, great!',
      cancelButtonText:
        'لا',
      cancelButtonAriaLabel: 'Thumbs down'
    })
    // the name of the box is retrieved using the .attr() method
    // as it is assumed and expected to be immutable
    var group = "input:checkbox[name='" + $box.attr("name") + "']";
    // the checked state of the group/box on the other hand will change
    // and the current value is retrieved using .prop() method
    $(group).prop("checked", false);
    $box.prop("checked", true);
  } else {
    // $("#c-m-choice-s-4").show();
    // $("#main-box-s-4").hide();
    Swal.fire({
      title: 'تأكيد',
      icon: 'info',
      html:
        'سيتم اعتماد (عدم اعتماد) الملف المحدد التي تم تحديدها سابقا',
      text: "أدخل ملاحظات :",
      showCloseButton: false,
      showCancelButton: true,
      focusConfirm: false,
      confirmButtonText:
        'نعم',
      confirmButtonAriaLabel: 'Thumbs up, great!',
      cancelButtonText:
        'لا',
      cancelButtonAriaLabel: 'Thumbs down'
    })
    $box.prop("checked", false);
  }
});

$("#checkbox-1-s-4").on("click", function () {
  // in the handler, 'this' refers to the box clicked on
  var $box = $(this);
  if ($box.is(":checked")) {
    Swal.fire({
      title: 'تأكيد',
      icon: 'info',
      html:
        'سيتم اعتماد (عدم اعتماد) الملف المحدد التي تم تحديدها سابقا',
      text: "أدخل ملاحظات :",
      showCloseButton: false,
      showCancelButton: true,
      focusConfirm: false,
      confirmButtonText:
        'نعم',
      confirmButtonAriaLabel: 'Thumbs up, great!',
      cancelButtonText:
        'لا',
      cancelButtonAriaLabel: 'Thumbs down'
    })
    // $("#c-m-choice-s-4").show();
    // $("#main-box-s-4").hide();
    // the name of the box is retrieved using the .attr() method
    // as it is assumed and expected to be immutable
    var group = "input:checkbox[name='" + $box.attr("name") + "']";
    // the checked state of the group/box on the other hand will change
    // and the current value is retrieved using .prop() method
    $(group).prop("checked", false);
    $box.prop("checked", true);
  } else {
    $box.prop("checked", false);
  }
});

$("#yes-choice-s-4").click(function () {
  $("#c-m-choice-s-4").hide();
  $("#main-box-s-4").show();
});
$("#no-choice-s-4").click(function () {
  $("#c-m-choice-s-4").hide();
  $("#main-box-s-4").show();
});
