Merge branch 'payBranch'
This commit is contained in:
commit
2538edf38c
@ -29,107 +29,176 @@
|
|||||||
</script>
|
</script>
|
||||||
<title>수수료등록</title>
|
<title>수수료등록</title>
|
||||||
<script type="text/javaScript" language="javascript">
|
<script type="text/javaScript" language="javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#plus").on("click", function(){
|
|
||||||
var obj = $("#payTb > tbody");
|
|
||||||
var tr = obj.find("tr:eq(0)").clone(true);
|
|
||||||
tr.find("input:first").val('');
|
|
||||||
tr.find("select option:eq(0)").prop("selected", true);
|
|
||||||
tr.find("td:eq(2) > p").text(tr.find("select option:eq(0)").attr('cost'));
|
|
||||||
var len = obj.find("tr:not(:last)").length;
|
|
||||||
$.each(tr.find("input,select"), function(idx, obj){
|
|
||||||
obj.name = obj.name.replace(/\[.*\]/,'['+len+']');
|
|
||||||
});
|
|
||||||
|
|
||||||
tr.find("td:eq(2) > input[type=hidden]").val("<c:out value='${code[0].codeDc}' />".replace(/,/gi, ''));
|
|
||||||
obj.find("tr:last").before(tr);
|
|
||||||
// 합계 진행
|
|
||||||
setSumTotal();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("select[name*=apprTy]").on("change", function(){
|
|
||||||
$(this).closest("td").next("td").find("p").text($('option:selected',this).attr('cost'));
|
|
||||||
$(this).closest("td").next("td").find("input").val($('option:selected',this).attr('cost').replace(/,/gi, ''));
|
|
||||||
setSumTotal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function setSumTotal(){
|
|
||||||
var obj = $("#payTb > tbody");
|
|
||||||
var sum = 0;
|
|
||||||
$.each($("#payTb > tbody > tr:not(:last)"), function(idx, obj){
|
|
||||||
sum += parseInt($(this).find("td:eq(2)").text().replace(/,/gi, ''));
|
|
||||||
});
|
|
||||||
var regexp = /\B(?=(\d{3})+(?!\d))/g;
|
|
||||||
obj.find("tr:last > td:last").text(sum.toString().replace(regexp, ','));
|
|
||||||
}
|
|
||||||
|
|
||||||
function delBtnBind(thisObj){
|
|
||||||
var len = $("input[name*=apprRson]").length;
|
|
||||||
if(len <= 1 ){
|
|
||||||
alert("수수료근거가 최소 하나이상 되어야합니다.");
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
$(thisObj).closest("tr").remove();
|
|
||||||
setSumTotal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fncSave(){
|
|
||||||
|
|
||||||
var form = document.createForm;
|
|
||||||
var data = new FormData(form);
|
|
||||||
if(validatation(data)){
|
|
||||||
if(confirm("납부요청하시겠습니까?")){
|
|
||||||
$.ajax({
|
|
||||||
type:"POST",
|
|
||||||
url: '/kccadr/adjReqMgr/popup/adjReqMgrRegPaymentPopupSave.do',
|
|
||||||
data: data,
|
|
||||||
dataType:'json',
|
|
||||||
async: false,
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
cache: false,
|
|
||||||
success:function(returnData){
|
|
||||||
if(returnData.result == "success"){
|
|
||||||
alert("저장되었습니다.");
|
|
||||||
opener.location.reload();
|
|
||||||
self.close();
|
|
||||||
}else{
|
|
||||||
alert(returnData.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function(request , status, error){
|
|
||||||
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validatation(data) {
|
|
||||||
var len = $("#payTb > tbody").find("tr:not(:last)").length;
|
|
||||||
if(len > 0 ){
|
|
||||||
for(var i=0; i < len; i++){
|
|
||||||
var price = $("[name='payment["+i+"].apprRson']").val();
|
|
||||||
if(price == ""){
|
|
||||||
alert("수수료 근거 "+(i+1)+"번째 입력 해주세요.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if (len == 0) {
|
|
||||||
alert("수수료 근거를 입력해주세요.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fncClose(){
|
|
||||||
|
$("#plus").on("click", function(){
|
||||||
self.close();
|
var obj = $("#payTb > tbody");
|
||||||
|
var tr = obj.find("tr:eq(0)").clone(true);
|
||||||
}
|
tr.find("input:first").val('');
|
||||||
|
tr.find("select option:eq(0)").prop("selected", true);
|
||||||
|
|
||||||
|
// Remove user-input text field if it exists
|
||||||
|
tr.find("input.user-input").remove();
|
||||||
|
|
||||||
|
// Update the p element and remove the display:none style
|
||||||
|
var pElement = tr.find("td:eq(2) > p");
|
||||||
|
pElement.text(tr.find("select option:eq(0)").attr('cost'));
|
||||||
|
pElement.removeAttr('style');
|
||||||
|
|
||||||
|
var len = obj.find("tr:not(:last)").length;
|
||||||
|
$.each(tr.find("input,select"), function(idx, obj){
|
||||||
|
obj.name = obj.name.replace(/\[.*\]/,'['+len+']');
|
||||||
|
});
|
||||||
|
|
||||||
|
tr.find("td:eq(2) > input[type=hidden]").val("<c:out value='${code[0].codeDc}' />".replace(/,/gi, ''));
|
||||||
|
obj.find("tr:last").before(tr);
|
||||||
|
// 합계 진행
|
||||||
|
setSumTotal();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("select[name*=apprTy]").on("change", function(){
|
||||||
|
var cost = $('option:selected', this).attr('cost');
|
||||||
|
var nextTd = $(this).closest("td").next("td");
|
||||||
|
|
||||||
|
if (cost != "0") {
|
||||||
|
nextTd.find("p").text(formatNumber(cost)).show();
|
||||||
|
nextTd.find("input[type=hidden]").val(cost.replace(/,/g, ''));
|
||||||
|
nextTd.find("input.user-input").remove();
|
||||||
|
} else {
|
||||||
|
nextTd.find("p").hide();
|
||||||
|
if (nextTd.find("input.user-input").length === 0) {
|
||||||
|
nextTd.append('<input type="number" class="user-input" placeholder="금액" oninput="updateHiddenInput(this); setSumTotal();" />');
|
||||||
|
}
|
||||||
|
nextTd.find("input[type=hidden]").val('0');
|
||||||
|
}
|
||||||
|
setSumTotal();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateHiddenInput(input) {
|
||||||
|
// Get the value from the input field
|
||||||
|
var value = input.value;
|
||||||
|
|
||||||
|
// Find the corresponding hidden input field
|
||||||
|
var hiddenInput = $(input).siblings('input[type="hidden"]');
|
||||||
|
|
||||||
|
// Update the value of the hidden input field
|
||||||
|
hiddenInput.val(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatNumber(num) {
|
||||||
|
// Ensure the input is a string and remove any existing commas
|
||||||
|
var str = num.toString().replace(/,/g, '');
|
||||||
|
|
||||||
|
// Add commas as thousand separators
|
||||||
|
var formatted = str.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
|
|
||||||
|
return formatted;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSumTotal(){
|
||||||
|
var sum = 0;
|
||||||
|
$("#payTb > tbody > tr:not(:last)").each(function(idx, row){
|
||||||
|
var pText = $(row).find("td:eq(2) p").text();
|
||||||
|
var userInput = $(row).find("td:eq(2) input.user-input").val();
|
||||||
|
var hiddenInput = $(row).find("td:eq(2) input[type=hidden]").val();
|
||||||
|
|
||||||
|
console.log('pText :: ', pText)
|
||||||
|
console.log('userInput :: ', userInput)
|
||||||
|
console.log('hiddenInput :: ', hiddenInput)
|
||||||
|
|
||||||
|
var costText = pText || userInput || hiddenInput || "0";
|
||||||
|
if(userInput != undefined){
|
||||||
|
costText = userInput ;
|
||||||
|
}
|
||||||
|
console.log('costText : ', costText);
|
||||||
|
if (userInput) {
|
||||||
|
costText = userInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cost = parseInt(costText.replace(/,/g, '')) || 0;
|
||||||
|
sum += cost;
|
||||||
|
});
|
||||||
|
var formattedSum = sum.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
$("#payTb > tbody > tr:last > td:last").text(formattedSum);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function delBtnBind(thisObj){
|
||||||
|
var len = $("input[name*=apprRson]").length;
|
||||||
|
if(len <= 1 ){
|
||||||
|
alert("수수료근거가 최소 하나이상 되어야합니다.");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$(thisObj).closest("tr").remove();
|
||||||
|
setSumTotal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fncSave(){
|
||||||
|
var form = document.createForm;
|
||||||
|
var data = new FormData(form);
|
||||||
|
if(validatation(data)){
|
||||||
|
if(confirm("납부요청하시겠습니까?")){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: '/kccadr/adjReqMgr/popup/adjReqMgrRegPaymentPopupSave.do',
|
||||||
|
data: data,
|
||||||
|
dataType: 'json',
|
||||||
|
async: false,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
cache: false,
|
||||||
|
success: function(returnData){
|
||||||
|
if(returnData.result == "success"){
|
||||||
|
alert("저장되었습니다.");
|
||||||
|
opener.location.reload();
|
||||||
|
self.close();
|
||||||
|
} else {
|
||||||
|
alert(returnData.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(request, status, error){
|
||||||
|
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function validatation(data) {
|
||||||
|
var len = $("#payTb > tbody").find("tr:not(:last)").length;
|
||||||
|
if(len > 0 ){
|
||||||
|
for(var i = 0; i < len; i++){
|
||||||
|
var price = $("[name='payment["+i+"].apprRson']").val();
|
||||||
|
var adrCost = $("[name='payment["+i+"].adrCost']").val();
|
||||||
|
if(price == ""){
|
||||||
|
alert("수수료 근거 "+(i+1)+"번째 입력 해주세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log('adrCost : ', adrCost);
|
||||||
|
if(adrCost == '' || adrCost == 0){
|
||||||
|
alert("금액 "+(i+1)+"번째를 입력 해주세요.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (len == 0) {
|
||||||
|
alert("수수료 근거를 입력해주세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fncClose(){
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -464,14 +464,14 @@ function fn_countryCodeToggle(){
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<p class="req_text"><span>필수입력 항목</span>*</p>
|
<p class="req_text"><span>필수입력 항목</span>*</p>
|
||||||
<p>주소</p>
|
<p>주소 </p>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<label for="rpplPost${status.index}" class="label">우편번호 입력</label>
|
<label for="rpplPost${status.index}" class="label">우편번호 입력</label>
|
||||||
<form:input path="adjstRpplList[${status.index}].rpplPost" id="rpplPost${status.index}" size="20" cssClass="adr_input" value="${list.rpplPost}" readonly="${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? true : ''}" placeholder="우편번호입력"/>
|
<form:input path="adjstRpplList[${status.index}].rpplPost" id="rpplPost${status.index}" size="20" cssClass="adr_input" value="${list.rpplPost}" readonly="${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? true : ''}" placeholder="우편번호입력"/>
|
||||||
|
|
||||||
<kc:select codeId="ITN018" defaultText="${empty list.countryCode ? '국적선택' : list.countryCode }" name="countryCode" id="countryCode" css="style='display:${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? 'none' : ''}' " onChange="AdjstReq.selectCountryCode(this);"/>
|
<kc:select codeId="ITN018" defaultText="${empty list.countryCode ? '국적선택' : list.countryCode }" name="countryCode" id="countryCode" css="style='display:${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? 'none' : ''}' " onChange="AdjstReq.selectCountryCode(this);"/>
|
||||||
<button type="button" class="btnType01 btn_adr_search" onclick="fn_postCode(this);" title="새창팝업 열림" style="display: ${list.rpplUsrDiv ne '02' ? '' : 'none'}">우편번호 검색</button>
|
<button type="button" class="btnType01 btn_adr_search" onclick="fn_postCode(this);" title="새창팝업 열림">우편번호 검색</button>
|
||||||
<div class="detail_address">
|
<div class="detail_address">
|
||||||
<label for="rpplAddr${status.index}" class="label">주소 입력</label>
|
<label for="rpplAddr${status.index}" class="label">주소 입력</label>
|
||||||
<form:input path="adjstRpplList[${status.index}].rpplAddr" id="rpplAddr${status.index}" value="${list.rpplAddr}" size="45" cssClass="searchResultAddr" readonly="${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? true : ''}" placeholder="주소를 입력해주세요."/>
|
<form:input path="adjstRpplList[${status.index}].rpplAddr" id="rpplAddr${status.index}" value="${list.rpplAddr}" size="45" cssClass="searchResultAddr" readonly="${list.rpplUsrDiv eq '01' || empty list.rpplUsrDiv ? true : ''}" placeholder="주소를 입력해주세요."/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user