단속수기등록 validation 수정

main
이범준 1 year ago
parent 25b353c520
commit f322003303

@ -17,7 +17,7 @@
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
</div>
<div class="col-md-4">
<label for="crdnHm--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end required">
<label for="crdnTm--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end required">
(숫자6자리)위반시간
</label>
<input type="text" id="crdnTm--${pageName}" name="crdnTm" data-map="CRDN_TM"
@ -27,7 +27,8 @@
<label for="vhrno--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end required">
차량번호
</label>
<input type="text" id="vhrno--${pageName}" name="vhrno" data-map="VHRNO" class="form-control" required />
<input type="text" id="vhrno--${pageName}" name="vhrno" data-map="VHRNO" class="form-control"
data-maxlengthb="30" required />
</div>
<div class="col-md-6">
<label for="vltnCd--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">
@ -46,18 +47,21 @@
</div>
<div class="col-md-4">
<label for="crdnPlc--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">위반장소</label>
<input type="text" id="crdnPlc--${pageName}" name="crdnPlc" data-map="CRDN_PLC" class="form-control" />
<input type="text" id="crdnPlc--${pageName}" name="crdnPlc" data-map="CRDN_PLC" class="form-control"
data-maxlengthb="200" />
</div>
<div class="col-md-8 slot-edit" data-slot-index="1">
</div>
<div class="col-md-12">
<label for="etcCn--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">특기사항</label>
<input type="text" id="etcCn--${pageName}" name="etcCn" data-map="ETC_CN" class="form-control" />
<input type="text" id="etcCn--${pageName}" name="etcCn" data-map="ETC_CN" class="form-control"
data-maxlengthb="1000" />
</div>
<div class="col-md-4">
<label for="rtpyrNm--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">소유자</label>
<input type="text" id="rtpyrNm--${pageName}" name="rtpyrNm" data-map="RTPYR_NM" class="form-control" />
<input type="text" id="rtpyrNm--${pageName}" name="rtpyrNm" data-map="RTPYR_NM" class="form-control"
/>
</div>
<div class="col-md-4">
<label for="rtpyrSeCd--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">주민번호구분</label>
@ -74,15 +78,18 @@
</div>
<div class="col-md-12">
<label for="addr--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">주소</label>
<input type="text" id="addr--${pageName}" name="addr" data-map="ADDR" class="form-control w-px-700" />
<input type="text" id="addr--${pageName}" name="addr" data-map="ADDR" class="form-control w-px-700"
data-maxlengthb="320" />
</div>
<div class="col-md-12">
<label for="dtlAddr--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">상세주소</label>
<input type="text" id="dtlAddr--${pageName}" name="dtlAddr" data-map="DTL_ADDR" class="form-control w-px-700" />
<input type="text" id="dtlAddr--${pageName}" name="dtlAddr" data-map="DTL_ADDR" class="form-control w-px-700"
data-maxlengthb="200" />
</div>
<div class="col-md-6">
<label for="zip--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">우편번호</label>
<input type="text" id="zip--${pageName}" name="zip" data-map="ZIP" class="form-control w-px-100" />
<input type="text" id="zip--${pageName}" name="zip" data-map="ZIP" class="form-control w-px-100"
maxlength="7" pattern="(\d{3}-\d{3}|\d{6}|\d{5})" />
<button type="button" class="btn btn-sm btn-outline-dark" onclick="">검색</button>
</div>
<div class="col-md-6">
@ -164,7 +171,8 @@
</div>
<div class="col-md-8 bpv slot-edit" data-slot-index="1">
<label for="dtlCrdnPlc--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">상세위반장소</label>
<input type="text" id="dtlCrdnPlc--${pageName}" name="dtlCrdnPlc" data-map="DTL_CRDN_PLC" class="form-control" />
<input type="text" id="dtlCrdnPlc--${pageName}" name="dtlCrdnPlc" data-map="DTL_CRDN_PLC" class="form-control"
data-maxlenghb="200" />
</div>
<div class="col-md-8 pvs slot-edit" data-slot-index="1">
<label for="crdnSpareaCd--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">특별구역</label>
@ -190,7 +198,8 @@
</div>
<div class="col-md-4 dpv eca pvs slot-edit" data-slot-index="5">
<label for="crdnSn--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">스티커번호</label>
<input type="text" id="crdnSn--${pageName}" name="crdnSn" data-map="CRDN_SN" class="form-control" />
<input type="text" id="crdnSn--${pageName}" name="crdnSn" data-map="CRDN_SN" class="form-control"
maxlength="20" data-maxlengthb="20" />
</div>
<div class="col-md-4 dpv slot-edit" data-slot-index="6">
<label for="parkngPsbltyRsltCd--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-end">장애차량확인</label>
@ -313,7 +322,28 @@ $(document).ready(function(){
};
$P.fnSave = () => {
if (!$("#frmEdit--${pageName} input").validInputs()) return;
//if (!$("#frmEdit--${pageName} input").validInputs()) return;
if(!customValidate($("#frmEdit--${pageName} input"))) return;
//if(){
//dialog.alert({
//content:"계도 처리를 하기 위해선 차량번호가 입력되어야 합니다",
//onClose:function(){input.focus();}
//});
//}
//if(){
//dialog.alert({
//content:"계도 처리를 하기 위해선 소유주정보가 입력되어야 합니다.",
//onClose:function(){input.focus();}
//});
//}
dialog.alert({
content:"현재 단속 정보를 저장하시겠습니까?",
@ -321,6 +351,8 @@ $(document).ready(function(){
$P.crdnControl.save($P.formFields.get());
}
});
};
$P.videoCallback = (snapshots) => {
@ -406,4 +438,5 @@ $(document).ready(function(){
});
</script>

@ -1,6 +1,47 @@
/**************************************************************************
* validation
**************************************************************************/
function customValidate(targetArr) {
var handler = validationFailureHandler();
for(var i=0;i<targetArr.length;i++){
var input = targetArr[i];
if(!validInput(input)){
return false;
}
if(!input.required && input.value == ""){
continue;
}
//입력값의 최대 바이트 수 체크
if(input.dataset.maxlengthb){
if(!isMaxByte(input.value, input.dataset.maxlengthb)){
handler.tooLong(input);
return false;
}
}
//입력값의 포맷형식 체크
if(input.dataset.fmtType){
if(input.dataset.fmtType == "day"){
if(!isDate(input.value)){
handler.typeMismatch(input);
return false;
}
}
if(input.dataset.fmtType == "time"){
if(!isTime(input.value)){
handler.typeMismatch(input);
return false;
}
}
}
}
return true;
}
/**
* 문자열이 숫자형인지의 여부를 반환한다.
@ -11,9 +52,39 @@ function isNumber(str, exceptChar) {
return (/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/).test(str.replaceAll(exceptChar,"")) ? true : false;
};
// 시간체크
function isTime(str) {
str = str.replaceAll(":","");
if(str.length != 6){
return false;
}
if (!isNumber(str, "")) {
return false;
}
var hour = str.substring(0,2);
var minute = str.substring(2,4);
var second = str.substring(4,6);
if(hour>="00" && hour<="23"){
if(minute>="00" && minute<="59"){
if(second>="00" && second<="59"){
return true;
}
}
}
return false;
}
// 날짜체크
function isDate(str) {
str = str.replaceAll("-","");
if(str.length != 8){
return false;
}
@ -53,7 +124,7 @@ function isDate(str) {
}
return true;
return false;
}

Loading…
Cancel
Save