Pārlūkot izejas kodu

체크박스 관련 클릭 이벤트 안 먹는 거 수정 - 박성희차장

gagamel 5 gadi atpakaļ
vecāks
revīzija
e9bdce1174
1 mainītis faili ar 31 papildinājumiem un 55 dzēšanām
  1. 31 55
      src/main/webapp/ux/js/admin.ui.js

+ 31 - 55
src/main/webapp/ux/js/admin.ui.js

@@ -147,71 +147,47 @@ function lnbToggle(){
 	};
 };
 
+
+//체크박스 전체선택 : 210401
+function uifnAllCheck(el, grpId) {
+	let $thisId = $("#"+grpId);
+	$thisId.find('input').prop("checked", $(el).find("input").is(":checked"));
+	uiChkCount(grpId);
+};
+
+//체크박스 선택된 갯수 출력 : 210401
+function uiChkCount(grpId){
+	let chkLen = $(".chkBox[data-group='"+grpId+"']").find("input:checked").length;//체크된 갯수
+	if( $(".tagNum[data-count='"+grpId+"']") != undefined ){
+		$(".tagNum[data-count='"+grpId+"']").text(chkLen);
+	}
+};
+
 $(document).ready(function(){
 
 	//MODELESS POPUP : draggable
 	$(document).find(".draggable").draggable({containment:"#wrapper", scroll:false});
 
-	//chart resizing
-/* 	$(window).resize(function(){
-	}); */
-
-	//체크박스(단일), 라디오버튼 : readOnly 처리
-	$(document).on("click", "[type=checkbox][readonly],[type=radio][readonly]", function(){
+	//input readOnly 처리
+	$(document).on("click", "[readonly='readonly']", function(){
 		return false;
 	});
 
-	$(document).on("click", ".chkBox", function(e){
-		if (  !$(this).children("input").is("[disabled]")  && !$(this).children("input").is("[readonly]") ) {
-
-			let cntId = $(this).parent().parent("ul").attr("data-count-id");
-			let cntLen;
-
-			if ( $(this).children("input").is('[id]') ){ // ---------------전체선택ID
-				let $id = $(this).children("input").attr("id");
-				if ( $(this).children("input").is(":checked") ) { //체크된 경우
-					$("input[id="+$id+"]").prop("checked", false);
-					$("input[name="+$id+"]").prop("checked", false);
-				} else {
-					$("input[id="+$id+"]").prop("checked", true);
-					$("input[name="+$id+"]").prop("checked", true);
-				};
-				//선택된 개수 출력 (checkBoxList)
-				if (cntId != undefined ) {
-					cntLen =  $("input[name="+$id+"]:checked").length; //체크된 개수
-					$("#"+cntId).text(cntLen);
-				};
-				return false;
-
-			} else {	// ---------------개별선택
-				let $name = $(this).find("input").attr("name");
-				let totLen = $("input[name="+$name+"]").length; //전체 개수
-				if ( $(this).children("input").is(":checked") ) {
-					$(this).find("input").prop("checked", false);
-					$("input[id="+$name+"]").prop("checked", false); //전체선택 체크 해제
-				} else {
-					//$(this).addClass("checked");
-					$(this).find("input").prop("checked", true);
-					cntLen =  $("input[name="+$name+"]:checked").length; //체크된 개수
-					if (totLen == cntLen ){
-						$("input[id="+$name+"]").prop("checked", true); //전체선택 체크
-					}
-				};
-				//선택된 개수 출력 (checkBoxList)
-				if (cntId != undefined ) {
-					cntLen =  $("input[name="+$name+"]:checked").length; //체크된 개수
-					if (totLen > cntLen ) {
-						$("#"+cntId).text(cntLen);
-					} else if  (totLen == cntLen ) {
-						$("#"+cntId).text(totLen);
-					};
-				};
-				return false;
-			};
+	//그룹내 개별 체크박스 선택 : 210401
+	$(document).on("click", ".chkBox", function(){
+		if( $(this).attr("data-group") ) {
+			let grpId = $(this).attr("data-group");
+			let is_checked = true;
+			let chkLen;
+			$(".chkBox[data-group='"+grpId+"']").each(function(){
+				is_checked = is_checked && $(this).find("input").is(":checked");
+			});
+			$("#"+grpId).find("input[name='전체선택']").prop("checked", is_checked); //전체선택 체크 또는 해제
+			uiChkCount(grpId);
 		}
 	});
 
-	/* CheckBox List : More(+) 버튼 */
+	//checkBoxList : More(+,-) 버튼
 	$(document).on("click", ".checkBoxList .more", function(){
 		var thisI = $(this).find("i");
 		if( $(thisI).hasClass("fa-plus") ){
@@ -223,7 +199,7 @@ $(document).ready(function(){
 		}
 	});
 
-	/* Multi CheckBox - 다중선택 체크박스 */
+	//multiCheckBox : Header open
 	$(document).on("click", ".multiCheckBox .sltBtn", function(){
 		if($(this).hasClass("on")){
 			$(this).removeClass("on");