147 lines
4.1 KiB
JavaScript
147 lines
4.1 KiB
JavaScript
|
|
// 업무리스트 분류 선택
|
|
$(document).ready(function () {
|
|
|
|
|
|
/*회원 필터링*/
|
|
$(".btn-chk,.member-chk").on("click", function () {
|
|
|
|
let id = this.id;
|
|
let target;
|
|
|
|
if(!id) {
|
|
let className = this.className;
|
|
var classNames = className.split(' ');
|
|
$.each(classNames, function (index, className) {
|
|
if (!className.startsWith('btn-') && className !== 'active') {
|
|
target = "."+className;
|
|
}
|
|
});
|
|
}else{
|
|
target = "#"+id;
|
|
}
|
|
|
|
let targetGroups = target.split('-');
|
|
let targetGroup = targetGroups[0].replace(/[.#]/g, "")
|
|
|
|
|
|
if(id) {
|
|
if (!$(target).hasClass('active')) {
|
|
$('.'+targetGroup+'-chk').removeClass('active');
|
|
$(target).addClass('active');
|
|
} else {
|
|
$(target).removeClass('active');
|
|
}
|
|
listChk();
|
|
}
|
|
else{
|
|
$('#'+targetGroup+'-all').removeClass('active');
|
|
$(this).toggleClass('active');
|
|
|
|
let statusM = false;
|
|
$("."+targetGroup+"-chk").each(function (idx, item) {
|
|
if ($(this).hasClass("active")) statusM = true;
|
|
})
|
|
if (!statusM) {
|
|
$('#'+targetGroup+'-all').trigger("click");
|
|
} else {
|
|
listChk(); // 리스트 재설정
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
|
|
function listChk(){
|
|
$("[class^='filterChk']").addClass('hidden'); // 초기화
|
|
$("[class^='filterChk']").removeClass('FC'); // 초기화
|
|
|
|
// 활성리스트 설정
|
|
$("[class^='filterChk']").each(function(idx,item){
|
|
|
|
let $this = item;
|
|
|
|
// 진행구분
|
|
let filterChk = false;
|
|
let statusF;
|
|
if($("#filter-all").hasClass('active')) {
|
|
filterChk = true;
|
|
}else{
|
|
$(".filter-chk").each(function (idx, item) {
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusF = $(this).data('status');
|
|
if($($this).hasClass('filterChk'+statusF)) {
|
|
filterChk = true;
|
|
$($this).addClass('FC');
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 회원구분
|
|
let memberChk = false;
|
|
let statusM;
|
|
if($("#member-all").hasClass('active')) {
|
|
memberChk = true;
|
|
}else{
|
|
$(".member-chk").each(function(idx,item){
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusM = $(this).data('status');
|
|
if($($this).hasClass('MC'+statusM)) {
|
|
memberChk = true;
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
//필터링
|
|
if( filterChk && memberChk ) {
|
|
$(this).removeClass("hidden");
|
|
}
|
|
})
|
|
|
|
// 수량확인
|
|
if($("#filter-all").hasClass('active')) {
|
|
listCnt("[class^='filterChk']");
|
|
}else {
|
|
listCnt(".FC");
|
|
}
|
|
|
|
}
|
|
|
|
// 개별 수량
|
|
function listCnt(elem){
|
|
|
|
// 회원별 수량
|
|
let MC = [];
|
|
$(elem).each(function(idx,item){
|
|
|
|
let $this = item;
|
|
$(".member-chk").each(function(idx,item){
|
|
|
|
statusM = $(this).data('status');
|
|
if($($this).hasClass('MC'+statusM)) {
|
|
|
|
//console.log(statusM);
|
|
if (MC[statusM] !== undefined) {
|
|
MC[statusM]++;
|
|
} else {
|
|
MC[statusM] = 1;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
$(".member-chk > span").text('');
|
|
for (let key in MC) {
|
|
if (MC.hasOwnProperty(key)) {
|
|
$("[data-status='"+key+"']>span").text('('+MC[key]+')');
|
|
}
|
|
}
|
|
|
|
}
|
|
}); |