Files
korea-research/admin/src/main/resources/templates/home.html

469 lines
20 KiB
HTML

<!DOCTYPE html>
<html layout:decorate="~{layout/layout-home}"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<section layout:fragment="content">
<div class="d-flex-tit">
<hgroup class="page-tit-group">
<h2 class="page-tit" id="recordMonthText">
2025년 6월 현황
</h2>
</hgroup>
<form autocomplete="off" method="get" name="reqForm" th:object="${reqVO}">
<div class="filter-group">
<div class="component-select">
<select class="select-list" required id="usageType" name="usageType" >
<option value="" selected>전체</option>
<option value="MOBILE">모바일</option>
<option value="PAPER">지류</option>
</select>
</div>
</div>
</form>
</div>
<section class="dounut-chart-area">
<div class="chart-group type-green">
<dl>
<dt>
<strong>일계부 진행률</strong>
<span>(전체 임가 기준)</span>
</dt>
<dd>
<strong class="percent" id="totalPercent-dailyPercent">0</strong>
</dd>
</dl>
<div class="donut-chart" id="donut-totalPercent-dailyPercent" style="--percent: 0;">
</div>
</div>
<div class="chart-group type-blue">
<dl>
<dt>
<strong>현장 방문률</strong>
<span>(전체 임가 기준)</span>
</dt>
<dd>
<strong class="percent" id="totalPercent-visitPercent">0</strong>
<span class="d-flex">
<span id="totalPercent-totalVisitCount">0</span>
/
<span class="totalPercent-totalHouseholdCount">0</span>
</span>
</dd>
</dl>
<div class="donut-chart" id="donut-totalPercent-visitPercent" style="--percent: 0;">
</div>
</div>
<div class="chart-group type-orange">
<dl>
<dt>
<strong>일계부 진행률</strong>
<span>(전체 임가 기준)</span>
</dt>
<dd>
<strong class="percent" id="totalPercent-giftSentPercent">0</strong>
<span class="d-flex">
<span id="totalPercent-totalGiftSentCount">0</span>
/
<span class="totalPercent-totalHouseholdCount">0</span>
</span>
</dd>
</dl>
<div class="donut-chart" id="donut-totalPercent-giftSentPercent" style="--percent: 0;">
</div>
</div>
</section>
<section>
<div class="table-group" style="display: none" id="tableLocalRegion">
<div class="table-tit-group large">
<h3>
지방실사별 진행현황
</h3>
</div>
<table>
<thead>
<tr>
<th>실사</th>
<th>임계부 진행률</th>
<th>현장 방문률(1차)</th>
<th>답례품 전달률</th>
</tr>
</thead>
<tbody id="tableLocalRegionBody">
</tbody>
</table>
</div>
<div class="table-group" style="display: none" id="tableResearcher">
<div class="table-tit-group large">
<h3>
조사원별 진행 현황
</h3>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode" >
<option value="" disabled hidden>선택해주세요.</option>
<option value="value1" selected>전체</option>
<option value="value2">Option 2</option>
</select>
</div>
</div>
<!-- 테이블 스크롤 클래스 추가 "table-scroll-wrap" -->
<div class="table-scroll-wrap">
<table>
<colgroup>
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="25%" />
<col width="25%" />
<col width="25%" />
</colgroup>
<thead>
<tr>
<th>조사원명</th>
<th>실사</th>
<th>할당 임가 수</th>
<th>임계부 진행률</th>
<th>현장 방문률(1차)</th>
<th>답례품 전달률</th>
</tr>
</thead>
<tbody id="tableResearcherBody">
</tbody>
</table>
</div>
</div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<div class="btns-col-2">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
</div>
</div>
</div>
</section>
<div class="component-input sms-check" th:if="${loginUserRoles.id == 'ROLE_ADMIN'}">
<label class="switch-inner">
<span class="switch-label">문자 자동 발송 여부</span>
<input type="checkbox" id="smsAutoSend" name="temp_switch_0100" th:checked="${smsActive}"
onclick="smsAutoSendConfirm(this);">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
</section>
<section layout:fragment="script">
<script>
const getTotalPercentage = () => {
const f = document.reqForm;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/dashboard/chart/total',
dataOj,
function (response) {
$('#recordMonthText').text(response.recordMonthText);
// 첫번째 영역
$('.totalPercent-totalHouseholdCount').text(response.totalPercentDto.totalHouseholdCount);
$('#totalPercent-dailyPercent').text(response.totalPercentDto.dailyPercent);
$('#donut-totalPercent-dailyPercent').css('--percent', response.totalPercentDto.dailyPercent);
$('#totalPercent-visitPercent').text(response.totalPercentDto.visitPercent);
$('#donut-totalPercent-visitPercent').css('--percent', response.totalPercentDto.visitPercent);
$('#totalPercent-giftSentPercent').text(response.totalPercentDto.giftSentPercent);
$('#donut-totalPercent-giftSentPercent').css('--percent', response.totalPercentDto.giftSentPercent);
$('#totalPercent-totalVisitCount').text(response.totalPercentDto.totalVisitCount);
$('#totalPercent-totalGiftSentCount').text(response.totalPercentDto.totalGiftSentCount);
if ( response.localRegionPercentDtoList.length > 0 ) {
$('#tableLocalRegion').show();
const regionBody = $('#regionMainCode');
regionBody.empty();
regionBody.append(`
<option value="" selected>전체</option>
`);
$(response.regionMainCodeList).each((idx,ct)=> {
regionBody.append(`
<option value="${ct.id}">${ct.codeText}</option>
`);
});
const tbody = $('#tableLocalRegionBody');
tbody.empty();
$(response.localRegionPercentDtoList).each((idx, ct) => {
if(ct.regionName !== '전체') {
tbody.append(
`
<tr>
<td>${ct.regionName}</td>
<td>
<div class="progress-group type-green">
<progress class="progress" value="${ct.dailyPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.dailyPercent}</p>
</div>
</div>
</td>
<td>
<div class="progress-group type-blue">
<progress class="progress" value="${ct.visitPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.visitPercent}</p>
<span class="d-flex">
(
<span>${ct.totalVisitCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
<td>
<div class="progress-group type-orange">
<progress class="progress" value="${ct.giftSentPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.giftSentPercent}</p>
<span class="d-flex">
(
<span>${ct.totalGiftSentCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
</tr>
`
);
}else{
tbody.append(
`
<tr class="total">
<td>전체</td>
<td>
<span>${ct.dailyPercent}</span>%
</td>
<td>
<span>${ct.visitPercent}</span>%
</td>
<td>
<span>${ct.giftSentPercent}</span>%
</td>
</tr>
`);
}
});
}
if(response.localRegionResearcherPercentDtoList.length > 0) {
$('#tableResearcher').show();
const tbody = $('#tableResearcherBody');
tbody.empty();
$(response.localRegionResearcherPercentDtoList).each((idx, ct) => {
tbody.append(
`
<tr>
<td>
<a href="">${ct.researcherName}</a>
</td>
<td>${ct.regionMainCodeName}</td>
<td>${ct.totalHouseholdCount}</td>
<td>
<div class="progress-group type-green">
<progress class="progress" value="${ct.dailyPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.dailyPercent}</p>
</div>
</div>
</td>
<td>
<div class="progress-group type-blue">
<progress class="progress" value="${ct.visitPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.visitPercent}</p>
<span class="d-flex">
(
<span>${ct.totalVisitCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
<td>
<div class="progress-group type-orange">
<progress class="progress" value="${ct.giftSentPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.giftSentPercent}</p>
<span class="d-flex">
(
<span>${ct.totalGiftSentCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
</tr>
`
);
});
}
},
function (code, rstData) {
},
'get',
'json',
null
);
}
const getResearcherArea = () => {
const f = document.reqForm;
let dataOj = $(f).serializeObject();
dataOj.regionMainCode = $("#regionMainCode").val();
ajaxUtil._ajaxMethod(
'/api/dashboard/chart/researcher',
dataOj,
function (response) {
if(response.length > 0) {
const tbody = $('#tableResearcherBody');
tbody.empty();
$(response).each((idx, ct) => {
tbody.append(
`
<tr>
<td>
<a href="">${ct.researcherName}</a>
</td>
<td>${ct.regionMainCodeName}</td>
<td>${ct.totalHouseholdCount}</td>
<td>
<div class="progress-group type-green">
<progress class="progress" value="${ct.dailyPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.dailyPercent}</p>
</div>
</div>
</td>
<td>
<div class="progress-group type-blue">
<progress class="progress" value="${ct.visitPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.visitPercent}</p>
<span class="d-flex">
(
<span>${ct.totalVisitCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
<td>
<div class="progress-group type-orange">
<progress class="progress" value="${ct.giftSentPercent}" min="0" max="100"></progress>
<div class="detail">
<p class="percent">${ct.giftSentPercent}</p>
<span class="d-flex">
(
<span>${ct.totalGiftSentCount}</span>
/
<span>${ct.totalHouseholdCount}</span>
)
</span>
</div>
</div>
</td>
</tr>
`
);
});
}
},
function (code, rstData) {
},
'get',
'json',
null
);
}
const activeProfile = '[[${activeProfile}]]';
// 페이지 로드 시 호출
$(document).ready(function() {
getTotalPercentage();
$('#usageType').change(function() {
getTotalPercentage();
});
$('#regionMainCode').change(function() {
getResearcherArea();
});
});
</script>
<script>
/**
* 문자 발송 체크 스크립트
* */
// 문자 자동 발송 컨펌창
const smsAutoSendConfirm = (el) => {
let message = el.checked ? '문자 자동 발송 기능을 사용하시겠습니까?' : '문자 자동 발송 기능을 중지하시겠습니까?';
etUI.dialog.confirm({
title: '문자 자동 발송 안내',
message: message,
negativeCallback: function () {
$(el).prop('checked', !el.checked);
},
positiveCallback: function () {
updateSmsAutoStatusActive(el.checked);
},
});
}
// 문자 자동 발송 기능 활성화
const updateSmsAutoStatusActive = (active) => {
ajaxUtil._ajaxMethod(
'/api/smsAutoStatus/update',
JSON.stringify({
active: active,
}),
() => {
$('#smsAutoSend').prop('checked', active);
},
(code, rstData) => {
if(code == 422) alert(rstData.responseText);
$('#smsAutoSend').prop('checked', !active);
},
'patch',
'json',
{ handle422Type: 'alert' }
);
}
// 엑셀 다운로드
const goExcel = () => {
excelDownload('/api/dashboard/chart/excel', null);
}
</script>
</section>
</html>