Prechádzať zdrojové kódy

환자 등록 진행중

huiwon.seo 4 rokov pred
rodič
commit
07bf002669
1 zmenil súbory, kde vykonal 20 pridanie a 33 odobranie
  1. 20 33
      src/main/webapp/WEB-INF/jsp/patient/new.jsp

+ 20 - 33
src/main/webapp/WEB-INF/jsp/patient/new.jsp

@@ -11,12 +11,6 @@ function patientNewInit() {
     $( "label.label-readonly-check input[type='text']" ).prop( "readonly", true );
 };
 function setEventHandler(){
-    
-}
-$( function(){
-    patientNewInit();
-    
-    
     //체크yes시 content입력 처리
     $( "label.label-readonly-check input[type='checkbox']" ).on( "click", function(){
         var $this = $( this );
@@ -59,38 +53,34 @@ $( function(){
     
     
     //생년월일
-    $( "select.jumin-date" ).on( "change", function(){
-        var juminYear  = $( "#juminYear" ).val();
-        var juminMonth = $( "#juminMonth" ).val();
-        var juminDay   = $( "#juminDay" ).val();
+    $( ".select-date" ).on( "change", function(){
+        var $this = $( this );
+        var wrap  = $this.closest( "div.date" );
         
-        console.log( juminYear  + "-" + juminMonth  + "-" + juminDay );
-        if( juminYear != "" && juminMonth != "" && juminDay != ""  ) {
-            juminMonth = Number(juminMonth) < 10 ? "0" + juminMonth : juminMonth;
-            juminDay   = Number(juminDay) < 10   ? "0" + juminDay   : juminDay;
-
-            console.log( juminYear);
-            console.log( juminMonth  );
-            console.log( juminDay );
-            
-            $( "#jumin" ).val( juminYear  + "-" + juminMonth  + "-" + juminDay );
-        }
+        var dateYear  = wrap.find( ".date-year" ).val();
+        var dateMonth = wrap.find( ".date-month" ).val();
+        var dateDay   = wrap.find( ".date-day" ).val();
         
-        $( "#jumin" ).valid();
+        dateMonth = Number(dateMonth) < 10 ? "0" + dateMonth : dateMonth;
+        dateDay   = Number(dateDay) < 10   ? "0" + dateDay   : dateDay;
+        
+        wrap.find( "input.error-box" ).val( dateYear  + "-" + dateMonth  + "-" + dateDay );
     });
+}
+$( function(){
+    patientNewInit();
+    setEventHandler();
     
     
     $( "input.date" ).daterangepicker({
         singleDatePicker : true,
         showDropdowns : true,
-//         startDate : "<c:out value='${endDate}'/>",
         locale : {
             //format : "M/DD hh:mm A"
             format : "YYYY-MM-DD"
         }
     });
     
-    
     $( "#patientForm" ).validate({
         rules: {
             hospitalizationDate : {
@@ -104,7 +94,7 @@ $( function(){
             }
         },
         messages : {
-            jumin : "생년월일을 모두 선택해주세요",
+//             jumin : "생년월일을 모두 선택해주세요",
             gender: "성별을 선택해주세요",
             wardNumber : "동을 입력해주세요",
             roomNumber : "호실을 입력해주세요",
@@ -119,9 +109,6 @@ $( function(){
             $( element ).val( $.trim( $( element ).val() ) );
             $( element ).valid();
         },
-        onchange: function(element) {
-            $( element ).valid();
-        },
         errorPlacement: function(error, element) {
             if (element.attr("type") == "radio") {
                 error.insertBefore(element);
@@ -252,11 +239,11 @@ $( function(){
                                                     <th><span class="fix">*</span>생년월일</th>
                                                     <td>
                                                         <!-- 생년월일 -->
-                                                        <div class="form-row">
+                                                        <div class="form-row date">
                                                             <div class="col-4">
                                                                 <c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
                                                                  
-                                                                <select class="custom-select jumin-date" id="juminYear">
+                                                                <select class="custom-select select-date date-year">
                                                                       <option value="" selected="">년</option>
                                                                       <c:forEach var="y" begin="1940" end="${sysYear}" step="1">
                                                                           <option value="${y}">${y} 년</option>
@@ -264,7 +251,7 @@ $( function(){
                                                                 </select>
                                                             </div>
                                                             <div class="col-4">
-                                                                <select class="custom-select jumin-date" id="juminMonth" >
+                                                                <select class="custom-select select-date date-month">
                                                                       <option value="" selected="">월</option>
                                                                       <c:forEach var="m" begin="1" end="12" step="1">
                                                                           <option value="${m}">${m} 월</option>
@@ -272,7 +259,7 @@ $( function(){
                                                                 </select>
                                                             </div>
                                                             <div class="col-4">
-                                                                <select class="custom-select jumin-date" id="juminDay">
+                                                                <select class="custom-select select-date date-day">
                                                                       <option value="" selected="">일</option>
                                                                       <c:forEach var="d" begin="1" end="31" step="1">
                                                                           <option value="${d}">${d} 일</option>
@@ -280,7 +267,7 @@ $( function(){
                                                                 </select>
                                                             </div>
                                                             
-                                                            <input type="date" class="error-box" id="jumin" name="jumin" required>
+                                                            <input type="text" class="error-box" id="jumin" name="jumin" required>
                                                         </div>
                                                     </td>
                                                 </tr>