home *** CD-ROM | disk | FTP | other *** search
/ 61.19.244.139 / 61.19.244.139.zip / 61.19.244.139 / 2015-02-19 / views / policy-type-add.jsp < prev    next >
Text File  |  2015-02-19  |  6KB  |  159 lines

  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
  3. <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
  4. <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  5. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  6. <form:form class="form-horizontal well" action="savePolicyType" method="POST" id="frmPolicyType" modelAttribute="polTypeBean">        
  7.     <div class="row-fluid">
  8.         <div class="dashboard-widget">
  9.             <div class="row-fluid">
  10.                 <div class="span12">
  11.                     <div class="nonboxy-widget">
  12.  
  13.                         <div class="widget-head">
  14.                             <h5>α╕üα╕│α╕½α╕Öα╕öα╕¢α╕úα╕░α╣Çα╕áα╕ùα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</h5>
  15.                         </div>
  16.  
  17.                         <div class="widget-content">
  18.                             <div class="widget-box">
  19.  
  20.                                 <fieldset>
  21.  
  22.                                     <div class="control-group">
  23.                                         <label class="control-label" for="input01">α╕¢α╕úα╕░α╣Çα╕áα╕ùα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</label>
  24.                                         <div class="controls">
  25.                                             <form:input class="input-small" type="text" placeholder="α╕úα╕½α╕▒α╕¬" name="polType" id="polType" path="polType"/>
  26.                                             <form:input class="input-xlarge" type="text" name="polTypeName" id="polTypeName" path="polTypeName" placeholder="α╕¢α╕úα╕░α╣Çα╕áα╕ùα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î" />
  27.                                         </div>
  28.                                     </div>
  29.  
  30.                                     <div class="control-group">
  31.                                         <label class="control-label" for="input01">α╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç</label>
  32.                                         <div class="controls">
  33.                                             <form:select path="coverList" name="poltypeCovBeans" id="poltypeCovBeans"  multiple="multiple">
  34.                                                 <form:options items="${covBeanList}" itemValue="covCode" itemLabel="covName"/>
  35.                                             </form:select> 
  36.  
  37.                                         </div>
  38.  
  39.                                     </div>
  40.                                     <%
  41.                                         if (request.getParameter("polType") == null) {
  42.                                     %>
  43.                                     <button class="btn btn-success" name="saveBtn" id="saveBtn">α╕Üα╕▒α╕Öα╕ùα╕╢α╕ü</button>
  44.                                     <%
  45.                                     } else {
  46.                                     %>
  47.                                     <button class="btn btn-primary" name="editBtn" id="editBtn">α╣üα╕üα╣ëα╣äα╕é</button>
  48.                                     <%
  49.                                         }
  50.                                     %>
  51.                                     <a class="btn" id="cancelBtn" onClick="$('#tableFrm').dialog('close');">α╕óα╕üα╣Çα╕Ñα╕┤α╕ü/α╕¢α╕┤α╕ö</a>
  52.                                 </fieldset>
  53.                             </div>
  54.                         </div>
  55.                     </div>
  56.                 </div>
  57.             </div>
  58.         </div>     
  59.     </div>
  60. </form:form>
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. <script>
  69.     $(function () {
  70.         var list = '';
  71.  
  72.         if ($("#polType").val()) {
  73.  
  74.             $('#polType').attr('readonly', true);
  75.             list = "${selectedvalues}";
  76.  
  77.         }
  78.         ;
  79.  
  80.  
  81.         /*  if( ${not empty selectedvalues} ) { 
  82.          
  83.          var selectedvalues =  "${selectedvalues}-" ;
  84.          var dataarray=selectedvalues.split(",");
  85.          $("#poltypeCovBeans").val(dataarray);
  86.          $("#poltypeCovBeans").multiselect("refresh");
  87.          
  88.          }   */
  89.  
  90.  
  91.  
  92.  
  93.         $('#poltypeCovBeans').multiSelect({
  94.             afterSelect: function (values) {
  95. //             
  96.                 list += values + ",";
  97. //                alert(list)
  98.  
  99.             },
  100.             afterDeselect: function (values) {
  101.                 var r = values + ",";
  102.                 list = list.replace(r, "");
  103.  
  104. //               alert(list)
  105.             },
  106.             keepOrder: true,
  107.             selectableHeader: "<div class='custom-header'>α╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕çα╕ùα╕▒α╣ëα╕çα╕½α╕íα╕ö</div>",
  108.             selectionHeader: "<div class='custom-header'>α╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕çα╕ùα╕╡α╣êα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç</div>"
  109.         });
  110.  
  111.  
  112.         $("#frmPolicyType").submit(function () {
  113.  
  114.             var url = "savePolicyType";
  115. //       
  116.             var l = list.split(",");
  117.             var pol_type = 'polType=' + $('#polType').val();
  118.             var poltype_name = '&polTypeName=' + $('#polTypeName').val();
  119.  
  120.             var clist = '';
  121.  
  122.             for (i = 0; i < l.length - 1; i++) {
  123.  
  124.                 var pp = l[i];
  125.                 if (pp.indexOf('&') !== -1) {
  126.                     pp = pp.replace('&','%26');
  127.                 }
  128.                 clist += "&coverList=" + pp;
  129.             }
  130.             var _c = '&_coverList=1';
  131.  
  132.             var _data = pol_type + poltype_name + clist + _c;
  133.  
  134. //            alert( $("#frmPolicyType").serialize())
  135.  
  136.             console.log($("#frmPolicyType").serialize());
  137.             console.log(_data);
  138.             $.ajax({
  139.                 type: "POST",
  140.                 url: url,
  141.                 data: _data, //$("#frmPolicyType").serialize(),
  142.                 success: function (data) {
  143.  
  144.                     $('#grid').trigger("reloadGrid", [{page: 1}]);
  145.                     $('#tableFrm').dialog('close');
  146.                 },
  147.                 error: function (xhr, ajaxOptions, thrownError) {
  148.                     var obj = JSON.parse(xhr.responseText);
  149.                     alert(obj.errorMessages);
  150.                 }
  151.             });
  152.  
  153.             return false;
  154.         });
  155.  
  156.  
  157.  
  158.     });
  159. </script>