485 lines
21 KiB
Plaintext
485 lines
21 KiB
Plaintext
<!-- #include Virtual="/include/Header.asp"-->
|
||
<%
|
||
|
||
Dim PKEY : PKEY = Request("PKEY")
|
||
Dim PRJCODE : PRJCODE = Request("PKEY")
|
||
Dim SIDKEY : SIDKEY = Request("SIDKEY")
|
||
Dim STATUS : STATUS = Request("STATUS")
|
||
|
||
%>
|
||
|
||
<link rel="stylesheet" href="./quota_gang_css/style_quota.css">
|
||
|
||
<body style="padding-top: 120px;">
|
||
<!-- 상단 고정 헤더 전체 -->
|
||
<div class="fixed-top bg-white shadow-lg">
|
||
|
||
<!-- 1️⃣ 제목 영역 -->
|
||
<div class="p-3 text-center border-bottom">
|
||
<span class="h5 mb-0">
|
||
<i class="fa fa-television" aria-hidden="true"></i>
|
||
설문 진행 현황 페이지
|
||
</span>
|
||
</div>
|
||
|
||
<!-- 2️⃣ 검색 영역 -->
|
||
<div class="p-2 d-flex flex-wrap align-items-center justify-content-start" style="padding-left: 1rem;">
|
||
<!-- PKEY -->
|
||
<div class="input-group align-items-stretch"
|
||
style="max-width:300px; height:34px; margin-left:40px; margin-right:16px;">
|
||
<span class="input-group-text bg-navy-3 text-white d-flex align-items-center px-2"
|
||
style="font-size:0.85rem;">
|
||
<i class="fa fa-key"></i> 프로젝트 코드
|
||
</span>
|
||
<input type="text" name="pkey" id="pkey" value="<%=pkey %>"
|
||
class="form-control border-start-0"
|
||
placeholder="프로젝트 코드 입력"
|
||
style="font-size:0.85rem;">
|
||
</div>
|
||
<!-- ID -->
|
||
<div class="input-group align-items-stretch"
|
||
style="max-width:220px; height:34px; margin-right:16px;">
|
||
<span class="input-group-text bg-navy-3 text-white d-flex align-items-center px-2"
|
||
style="font-size:0.85rem;">
|
||
<i class="fa fa-user"></i> ID
|
||
</span>
|
||
<input type="text" name="sidkey" id="sidkey" value="<%=sidkey%>"
|
||
class="form-control border-start-0"
|
||
placeholder="응답자 ID 입력"
|
||
style="font-size:0.85rem;">
|
||
</div>
|
||
<!-- 상태 -->
|
||
<div class="input-group align-items-stretch"
|
||
style="max-width:160px; height:34px; margin-right:16px;">
|
||
<span class="input-group-text bg-navy-3 text-white d-flex align-items-center px-2"
|
||
style="font-size:0.85rem;">
|
||
<i class="fa fa-tasks"></i> 상태
|
||
</span>
|
||
<select id="status" name="status"
|
||
class="form-control border-start-0 custom-select-style"
|
||
style="font-size:0.85rem;">
|
||
<option value="">전체</option>
|
||
<option value="1">진행</option>
|
||
<option value="10">완료</option>
|
||
<option value="0">미진행</option>
|
||
</select>
|
||
</div>
|
||
<!-- 검색 버튼 -->
|
||
<button type="button" id="gogogo"
|
||
class="btn btn-info btn-sm d-flex align-items-center px-3"
|
||
style="height:34px;">
|
||
<i class="fa fa-search me-1"></i> 검색
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="container-fluid h-100" >
|
||
<div class="row h-100">
|
||
<div class="col-lg-12 pt-1 h-100 d-flex flex-column bg-navy-2 pb-2">
|
||
<div class="p-2 text-white d-flex flex-row" id="search-box" >
|
||
<div ><i class="fa fa-globe" aria-hidden="true"></i> 조회 건수 : <span id="end-cnt"></span></div>
|
||
<div class="flex-fill"></div>
|
||
<div onclick="window.location.reload()" style="cursor: pointer;" class=" text-right"><i class="fa fa-refresh" aria-hidden="true"></i> 새로고침</div>
|
||
</div>
|
||
|
||
<div class="p-2 main-box rounded bg-light h-100 d-flex flex-row shadow-sm" style="overflow-x: auto;">
|
||
<div class="p-2 d-flex flex-column flex-fill border bg-white rounded shadow-sm">
|
||
|
||
<div id="list-box" class="d-flex flex-row p-2 flex-fill" style="height:1px">
|
||
<div class="p-2 m-1 border shadow-sm rounded" style="min-width:800px;overflow-y: auto;">
|
||
<div class="d-flex flex-row align-items-center">
|
||
<div><i class="fa fa-table" aria-hidden="true"></i> 응답자 테이블</div>
|
||
</div>
|
||
<table id="list-table" class="table table-sm table-bordered" style="font-size: .7rem;">
|
||
<thead >
|
||
<tr class="text-white text-center bg-navy-3">
|
||
<!--<td class='filter-td' data-type="1"><i class="fa fa-filter" aria-hidden="true"></i> 그룹</td>-->
|
||
<td>ID</td>
|
||
<td>시작</td>
|
||
<td>종료</td>
|
||
<td>상태</td>
|
||
</thead>
|
||
<tbody>
|
||
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<!-- 중간 FLEX -->
|
||
<div class="p-1 flex-fill d-flex flex-row align-items-center justify-content-center">
|
||
<div class="p-1 border d-flex flex-column shadow-sm rounded bg-white h-100 w-100 overflow-auto" style="font-size: .8rem;">
|
||
<div class="p-1 border-bottom d-flex flex-row align-items-center">
|
||
<div>
|
||
<i class="fa fa-info" aria-hidden="true"></i> [<span id='id-label' class="text-primary">--</span>] 세부 사항
|
||
</div>
|
||
</div>
|
||
<div id="DAT_ARR_VAL" >
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
<script>
|
||
var list = ""
|
||
|
||
var lgModule = (function(){
|
||
var list = "";
|
||
var img_list = "";
|
||
var selected_list = "";
|
||
var list_question = "";
|
||
var prjcode = $("#pkey").val();
|
||
var sidkey = $("#sidkey").val();
|
||
var status = $("#status").val();
|
||
|
||
var hlist = "";
|
||
|
||
var filter_list = {
|
||
"group":"",
|
||
"model":"",
|
||
"prev":""
|
||
}
|
||
|
||
function set_filter(type, value){
|
||
this.filter_list[type] = value;
|
||
$("span.filter_"+type).remove();
|
||
if(value !== ""){
|
||
$(".filter-list").append("<span class='filter_"+type+"' >"+value+"</span>")
|
||
}
|
||
this.filtering_list()
|
||
}
|
||
|
||
function get_list() {
|
||
var urlParams = new URLSearchParams(window.location.search);
|
||
var status = urlParams.get("status"); // ← URL에서 status 값 읽기
|
||
|
||
this.list = ajax_returnData("./datalist-ajax.asp", setparam("s", "LIST", { "PRJCODE" : prjcode , "SIDKEY" : sidkey, "STATUS" : status}));
|
||
|
||
//var listcount = ajax_returnData("./datalist-ajax.asp", setparam("s", "LISTCOUNT", { "PRJCODE" : prjcode , "SIDKEY" : sidkey, "STATUS" : status}));
|
||
|
||
$("#end-cnt").text(this.list.length.toLocaleString());
|
||
if (status) {
|
||
$("#status").val(status);
|
||
}
|
||
}
|
||
|
||
function get_list_question() {
|
||
this.list_question = ajax_returnData("./datalist-ajax.asp",{"COMMAND":"LIST_QUESTION", "PRJCODE":prjcode});
|
||
}
|
||
|
||
function filtering_list(){
|
||
|
||
$(".tr-none").removeClass("tr-none");
|
||
|
||
if(filter_list["group"]){
|
||
$(".data-filter-1").each(function(i,elem){
|
||
if(elem.innerText !== filter_list["group"]){
|
||
$(elem).closest("TR").addClass("tr-none");
|
||
}
|
||
})
|
||
}
|
||
|
||
if(filter_list["model"]){
|
||
$(".data-filter-2").each(function(i,elem){
|
||
var $tr = $(elem).closest("TR")
|
||
if($tr.hasClass("tr-none")){
|
||
return true;
|
||
}
|
||
|
||
if(elem.innerText.substring(0,2) !== filter_list["model"]){
|
||
$tr.addClass("tr-none");
|
||
}
|
||
})
|
||
}
|
||
|
||
}
|
||
|
||
function draw_list(){
|
||
var img_list = this.img_list;
|
||
var list = this.list; // list 참조 변수로 두면 보기 편해요
|
||
|
||
// tbody 요소 미리 잡기
|
||
var tbody = document.querySelector('#list-table > tbody');
|
||
|
||
// 먼저 tbody 비우기 (이전 데이터 지우기)
|
||
$(tbody).empty();
|
||
|
||
// ✅ 데이터 없을 때 처리
|
||
if (!list || list.length === 0) {
|
||
// "조회된 데이터가 없습니다" 한 줄 추가
|
||
var emptyTr = $("<tr>")
|
||
.append(
|
||
$("<td>")
|
||
.attr("colspan", 5) // 테이블 컬럼 수에 맞게 변경
|
||
.attr("class", "text-center text-muted")
|
||
.text("조회된 데이터가 없습니다.")
|
||
);
|
||
$(tbody).append(emptyTr);
|
||
return; // 이후 코드 실행 안 함
|
||
}
|
||
|
||
// ✅ 데이터 있을 때 기존 로직 실행
|
||
var tr_list = list.map(function(item){
|
||
var img_target = img_list[item["IDKEY"]];
|
||
var td = [
|
||
//item["grp"], // 이름
|
||
item["IDKEY"], // 아이디
|
||
//item["attendee_pw"], //휴대폰
|
||
item["start_date"], // start_date
|
||
item["end_date"], // end_date
|
||
!item["Status"] || item["Status"].trim() === ""
|
||
? "미진행"
|
||
: item["Status"] === "1"
|
||
? "진행" + "(" + (item["IB"]?.[0]?.["value"] ?? "") + ")"
|
||
: item["Status"] === "10"
|
||
? "완료"
|
||
: "미진행"
|
||
];
|
||
|
||
td = td.map(function(txt){return createnode("TD", txt, {"style":"vertical-align:middle"})});
|
||
|
||
$(td[0]).attr("class", "data-filter-1");
|
||
$(td[4]).attr("class", "data-filter-2");
|
||
|
||
if (item["Status"] != null && item["Status"].toString().trim() !== "") {
|
||
$(td[3]).append(" <button type='button' data-id='" + item["IDKEY"] + "' class='view-btn'>보기</button>");
|
||
}
|
||
|
||
return createnode("TR", td, {
|
||
"class": "text-center " + (item["target_cd"] === "1" ? "target-tr" : ""),
|
||
"data-idkey": item["IDKEY"]
|
||
});
|
||
});
|
||
|
||
$(tbody).append(tr_list);
|
||
}
|
||
|
||
function chk_target(){
|
||
if( this.selected_list === "" ){
|
||
alert("대상을 먼저 선택해주세요.");
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function choice_target(id) {
|
||
// console.log(id);
|
||
this.selected_list = this.list.filter(function(item){ return item["IDKEY"] === id ? true : false})[0];
|
||
}
|
||
|
||
//-- replace function
|
||
function replaceAll(str, searchStr, replaceStr) {
|
||
|
||
return str.split(searchStr).join(replaceStr);
|
||
}
|
||
function view_detail(id){
|
||
if(chk_target.call(this)){
|
||
$("#DAT_ARR_VAL div").remove();
|
||
var selected_list = this.selected_list
|
||
$("#id-label").text(selected_list["IDKEY"]);
|
||
|
||
var data = selected_list["DAT"].split(','); //-- 응답값
|
||
|
||
var list_question = this.list_question; //-- 질문정보
|
||
|
||
for (var i = 0; i < list_question.length; i++) {
|
||
|
||
var td_tt = "";
|
||
arr_num01 = list_question[i].variable;
|
||
arr_num02 = list_question[i].qid;
|
||
arr_num03 = list_question[i].value;
|
||
arr_num11 = "";
|
||
|
||
var arr_num03_split = arr_num03.split(",");
|
||
//-- console.log(" arr_num01 = "+ arr_num01 + " arr_num02 = "+ arr_num02 + " arr_num03 = "+ arr_num03);
|
||
//-- console.log(" arr_num03_split.length = "+ arr_num03_split.length);
|
||
|
||
if( arr_num03_split.length == 1 ){
|
||
for (var j = 0; j < data.length; j++) {
|
||
data[j] = replaceAll(data[j],"{","")
|
||
data[j] = replaceAll(data[j],"}","")
|
||
data[j] = replaceAll(data[j],'"','')
|
||
data_arr = data[j].split(":");
|
||
arr_val01 = data_arr[0].trim();
|
||
arr_val02 = data_arr[1].trim();
|
||
|
||
//console.log("data_arr = "+ data_arr[0].trim() );
|
||
//console.log("arr_val01 = "+ arr_val01 +" arr_num03 = "+ arr_num03 );
|
||
if( arr_val01 == arr_num03){
|
||
arr_num11 = arr_val02;
|
||
//-- console.log( arr_val01 +" - "+ arr_val02 +" - "+ arr_num03 );
|
||
break; // for 문 종료
|
||
}
|
||
}
|
||
td_tt += "<div class='DAT_ARR_VAL p-1 border rounded d-flex flex-column m-1'>"
|
||
td_tt += "<div >"+ arr_num01 +" (<font style='font-size: x-small;' >"+ arr_num03 +"</font>) : "+ arr_num11 +"</div>"
|
||
td_tt +="</div>"
|
||
}else{
|
||
for(var k = 0; k < arr_num03_split.length; k++){
|
||
arr_num03 = arr_num03_split[k]
|
||
for (var j = 0; j < data.length; j++) {
|
||
data[j] = replaceAll(data[j],"{","")
|
||
data[j] = replaceAll(data[j],"}","")
|
||
data[j] = replaceAll(data[j],'"','')
|
||
data_arr = data[j].split(":");
|
||
arr_val01 = data_arr[0].trim();
|
||
arr_val02 = data_arr[1].trim();
|
||
|
||
arr_num11 = "";
|
||
if( arr_val01 == arr_num03){
|
||
arr_num11 = arr_val02;
|
||
//-- console.log( "k >>> "+ arr_val01 +" - "+ arr_val02 +" - "+ arr_num03 );
|
||
break; // for 문 종료
|
||
}
|
||
}
|
||
td_tt += "<div class='DAT_ARR_VAL p-1 border rounded d-flex flex-column m-1'>"
|
||
td_tt += "<div >"+ arr_num01 +" (<font style='font-size: x-small;' >"+ arr_num03 +"</font>) : "+ arr_num11 +"</div>"
|
||
td_tt +="</div>"
|
||
}
|
||
}
|
||
$("#DAT_ARR_VAL").append( td_tt );
|
||
}
|
||
|
||
|
||
|
||
|
||
/*
|
||
var data = selected_list["DAT"].split(',');
|
||
for (var i = 0; i < data.length; i++) {
|
||
data[i] = replaceAll(data[i],"{","")
|
||
data[i] = replaceAll(data[i],"}","")
|
||
data[i] = replaceAll(data[i],'"','')
|
||
console.log(data[i]);
|
||
data_arr = data[i].split(":");
|
||
|
||
arr_num01 = data_arr[0].trim();
|
||
arr_num02 = data_arr[1].trim();
|
||
td_tt = "<div class='DAT_ARR_VAL p-1 border rounded d-flex flex-column m-1'>"
|
||
td_tt += "<div >"+ arr_num01 +" : "+ arr_num02 +"</div>"
|
||
//td_tt +="<div class='border-bottom' >"+ data_arr[0] +"</div>"
|
||
//td_tt +="<div class='detail-label text-primary' >"+ data_arr[1] +"</div>"
|
||
td_tt +="</div>"
|
||
|
||
chk_show_val = 1 //보여줄 것인가?
|
||
if( data_arr[0] == "GROUP") chk_show_val = 0
|
||
if( data_arr[0] == "CROTA") chk_show_val = 0
|
||
|
||
if( chk_show_val == 1 ){
|
||
$("#DAT_ARR_VAL").append( td_tt );
|
||
}
|
||
} */
|
||
//DAT_ARR_VAL
|
||
}
|
||
}
|
||
|
||
return {
|
||
list:list, /* 전체 리스트 2002021_A 데이터 */
|
||
selected_list:selected_list, /* 선택된 리스트 */
|
||
get_list:get_list, /* 리스트 받아오기 */
|
||
get_list_question:get_list_question, /* 리스트 받아오기 */
|
||
img_list:img_list, /* 이미지 리스트 2002021_B */
|
||
filter_list,filter_list, /* 필터 옵션 */
|
||
draw_list:draw_list, /* 리스트 그리기 */
|
||
set_filter:set_filter, /* 필터 설정 */
|
||
filtering_list:filtering_list, /* 필터링된 리스트 */
|
||
view_detail:view_detail, /* 세부사항 항목 그리기 */
|
||
choice_target:choice_target, /* 리스트 선택 */
|
||
}
|
||
})()
|
||
|
||
$("document").ready(function(){
|
||
|
||
$("body").on("click","#gogogo",function(e){
|
||
|
||
if($("#pkey").val() == "") {
|
||
alert("프로젝트 코드를 입력해 주세요");
|
||
$("#pkey").focus()
|
||
return false;
|
||
}
|
||
location.href="?pkey="+ $("#pkey").val()+"&sidkey="+ $("#sidkey").val()+"&status="+ $("#status option:selected").val();
|
||
})
|
||
|
||
<% if( pkey <> "" )then %>
|
||
lgModule.get_list();
|
||
lgModule.draw_list();
|
||
lgModule.get_list_question();
|
||
<% end if %>
|
||
|
||
$("body").on("click",".view-btn",function(e){
|
||
prjcode = pkey;
|
||
var $target = $(e.target);
|
||
var id = $target.attr("data-id");
|
||
lgModule.choice_target(id)
|
||
lgModule.view_detail();
|
||
})
|
||
|
||
$("#h-list").click(function(e){
|
||
var visible_flag = $("#h-list-item").attr("data-visible")
|
||
$("#h-list-item").attr("data-visible",visible_flag === "true" ? "false" : "true");
|
||
});
|
||
|
||
$("body").on("click",".hlist-item",function(e){
|
||
var $target = $(e.target);
|
||
var id = $target.attr("data-id");
|
||
var filterd_list = lgModule.hlist.filter(function(item){ return item["IDKEY"] === id ? true : false });
|
||
|
||
if(filterd_list.length === 1) {
|
||
lgModule.selected_list = filterd_list[0];
|
||
}
|
||
});
|
||
|
||
$("body").on("click",".filter-option p",function(e){
|
||
var option = $(e.target).parent().attr("data-option");
|
||
lgModule.set_filter(option, e.target.innerText)
|
||
$(".filter-option").remove();
|
||
});
|
||
|
||
$("body").on("click",".filter_group",function(e){
|
||
lgModule.set_filter("group", "")
|
||
$(e.target).remove();
|
||
});
|
||
|
||
$("body").on("click",".filter_model",function(e){
|
||
lgModule.set_filter("model", "")
|
||
$(e.target).remove();
|
||
});
|
||
|
||
|
||
$(".filter-td").click(function(e){
|
||
var type = $(this).attr("data-type");
|
||
var grpArr = [];
|
||
$("tr:gt(0)").each(function(i,e){grpArr.push(parseInt($(e).find("td:eq(0)").text()))})
|
||
$.unique(grpArr).sort(function(a, b){return a - b});
|
||
|
||
|
||
if($(e.target).hasClass("filter-td")){
|
||
$(".filter-option").remove();
|
||
if(type==="1") {
|
||
$div= $("<div class='filter-option position-absolute p-1' data-option='group'></div>")
|
||
$.each(grpArr, function(i, e){$div.append("<p>"+e+"</p>");})
|
||
$(this).append($div);
|
||
} else if(type==="2") {
|
||
$(this).append("<div class='filter-option position-absolute p-1' data-option='model' ><p>진행</p><p>완료</p></div>")
|
||
}
|
||
}
|
||
});
|
||
|
||
$("#pkey, #sidkey, #status").on("keydown", function(e){
|
||
if (e.key === "Enter" || e.keyCode === 13) {
|
||
e.preventDefault(); // 엔터 시 폼 제출 방지
|
||
location.href="?pkey="+ $("#pkey").val()+"&sidkey="+ $("#sidkey").val();
|
||
}
|
||
});
|
||
})
|
||
|
||
</script>
|
||
|
||
<!-- #include Virtual="/include/Footer.asp"-->
|
||
<script>
|
||
var loc = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
|
||
var pkey = $("#pkey").val();
|
||
clklog("wi11u215oh",pkey,"","설문 진행 현황 페이지","","");
|
||
</script> |