home *** CD-ROM | disk | FTP | other *** search
/ 61.19.244.139 / 61.19.244.139.zip / 61.19.244.139 / 2015-03-03 / views / entry-policy-add.jsp < prev    next >
Text File  |  2015-03-03  |  63KB  |  1,366 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.  
  7. <div class="widget-content">
  8.     <div class="widget-box">
  9.         <form:form class="form-horizontal well" method="post" action="savePolicy" modelAttribute="policyBean" id="frmPolicy">
  10.             <fieldset>
  11.  
  12.                 <div class="box-tab">
  13.                     <div class="tabbable">
  14.                         <ul class="nav nav-tabs">
  15.                             <li class="active"><a data-toggle="tab" href="#tab1"><i class="black-icons blocks_images"></i>α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</a></li>
  16.                             <li><a data-toggle="tab" href="#tab2"><i class="black-icons abacus"></i> α╕£α╕╣α╣ëα╣Çα╕¡α╕▓α╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕ó</a></li>
  17.                             <li><a data-toggle="tab" href="#tab3"><i class="black-icons abacus"></i> α╕úα╕▓α╕óα╕Ñα╕░α╣Çα╕¡α╕╡α╕óα╕öα╕úα╕û</a></li>
  18.                             <li><a data-toggle="tab" href="#tab4"><i class="black-icons abacus"></i> α╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç</a></li>
  19.                             <li><a data-toggle="tab" href="#tab5"><i class="black-icons abacus"></i>α╕£α╕╣α╣ëα╕éα╕▒α╕Üα╕éα╕╡α╣ê</a></li>
  20.                             <li><a data-toggle="tab" href="#tab6"><i class="black-icons abacus"></i> α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕ó</a></li>
  21.                             <!-- <li><a data-toggle="tab" href="#tab7"><i class="black-icons abacus"></i>α╣Çα╕¡α╕üα╕¬α╕▓α╕úα╣üα╕Öα╕Ü</a></li> -->
  22.                         </ul>
  23.  
  24.                         <div class="tab-content">
  25.  
  26.                             <div id="tab1" class="tab-pane active">
  27.                                 <div class=" row-fluid">
  28.                                     <div class="widget-box">
  29.                                         <div class="control-group">
  30.                                             <label class="control-label" for="packageCode">PACKAGE</label>
  31.                                             <div class="controls">
  32.                                                 <form:select path="packageCode" id="packageCode">
  33.                                                     <form:options items="${packageList}" itemValue="packageCode" itemLabel="packageCode" /> 
  34.                                                 </form:select>
  35.                                                  <form:input id="packageDesc" path="packageDesc" class="input-xxlarge"  readonly="true"/> 
  36.                                             </div>
  37.                                         </div>
  38.  
  39.                                         <div class="control-group">
  40.                                             <label class="control-label" for="packageCode">α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</label>
  41.                                             <div class="controls">
  42.                                                 <form:input path="policyNo" class="input-medium"  readonly="true"/> 
  43.                                             </div>
  44.                                         </div>
  45.  
  46.                                         <div class="control-group">
  47.                                             <label class="control-label" for="beginDate">α╕ºα╕▒α╕Öα╕ùα╕╡α╣êα╣Çα╕úα╕┤α╣êα╕íα╕òα╣ëα╕Ö</label>
  48.                                             <div class="controls">
  49.                                                 <form:input path="beginDate" class="input-small" />
  50.                                                 α╕ºα╕▒α╕Öα╕ùα╕╡α╣êα╕¬α╕┤α╣ëα╕Öα╕¬α╕╕α╕ö
  51.                                                 <form:input path="endDate" class="input-small" />
  52.                                             </div>
  53.                                         </div>
  54.  
  55.                                         <div class="control-group">
  56.                                             <label class="control-label" for="issueDate">α╕ºα╕▒α╕Öα╕ùα╕╡α╣ê α╕ùα╕│α╕¬α╕▒α╕ìα╕ìα╕▓</label>
  57.                                             <div class="controls">
  58.                                                 <form:input path="agreeDate" class="input-small" />
  59.                                                 α╕ºα╕▒α╕Öα╕ùα╕╡α╣êα╕¡α╕¡α╕üα╣Çα╕¡α╕üα╕¬α╕▓α╕ú :
  60.                                                 <form:input path="issueDate" class="input-small" />
  61.                                             </div>
  62.                                         </div>
  63.  
  64.                                         <div class="control-group">
  65.                                             <label class="control-label" for=" "></label>
  66.                                             <div class="controls">
  67.                                                 <form:radiobutton path="premCal" value="A" id="premCalA" />
  68.                                                 Annual (α╣Çα╕òα╣çα╕íα╕¢α╕╡)
  69.                                                 <form:radiobutton path="premCal" value="P" id="premCalP" />
  70.                                                 Pro-Rata (α╕Öα╕▒α╕Üα╕ºα╕▒α╕Ö)
  71.                                                 <form:radiobutton path="premCal" value="S" id="premCalS" />
  72.                                                 Short Rate (α╕úα╕░α╕óα╕░α╕¬α╕▒α╣ëα╕Ö)
  73.                                             </div>
  74.                                         </div>
  75.  
  76.                                     </div>
  77.                                 </div>
  78.                             </div>
  79.  
  80.  
  81.                             <div id="tab2" class="tab-pane ">
  82.                                 <div class=" row-fluid">
  83.  
  84.                                     <div class="control-group">
  85.                                         <label class="control-label" for="packageCode"> α╕¢α╕úα╕░α╣Çα╕áα╕ùα╕Üα╕▒α╕òα╕úα╕¬α╕│α╕äα╕▒α╕ì</label>
  86.                                         <div class="controls">
  87.  
  88.  
  89.                                             <form:radiobutton path="insureType" value="P" id="insureTypeP" />
  90.                                             α╕Üα╕╕α╕äα╕äα╕Ñα╕ÿα╕úα╕úα╕íα╕öα╕▓
  91.                                             <form:radiobutton path="insureType" value="C" id="insureTypeC" />
  92.                                             α╕Öα╕┤α╕òα╕┤α╕Üα╕╕α╕äα╕äα╕Ñ
  93.                                             <form:radiobutton path="insureType" value="O" id="insureTypeO" />
  94.                                             α╕¡α╕╖α╣êα╕Öα╣å
  95.  
  96.                                             <form:input path="regId" class="input-small" id="regId" />
  97.                                         </div>
  98.                                     </div>
  99.  
  100.                                     <div class="control-group">
  101.                                         <label class="control-label" for="packageCode"> </label>
  102.                                         <div class="controls">                                          
  103.                                             <form:radiobutton path="brnFlag" value="Y" id="branchMain" />
  104.                                             α╕¬α╕│α╕Öα╕▒α╕üα╕çα╕▓α╕Öα╣âα╕½α╕ìα╣ê
  105.                                             <form:radiobutton path="brnFlag" value="N" id="branch" />
  106.                                             α╕¬α╕▓α╕éα╕▓ : 
  107.                                             <form:input path="brnDesc" class="input-xlarge" id="branchDesc" />
  108.                                         </div>
  109.                                     </div>
  110.  
  111.                                     <div class="control-group">
  112.                                         <label class="control-label" for="insureTitle"> α╕èα╕╖α╣êα╕¡-α╕¬α╕üα╕╕α╕Ñ</label>
  113.                                         <div class="controls">
  114.  
  115.                                             <form:select path="insureTitle" id="insureTitle" cssClass="input-small"  >
  116.                                                 <form:options items="${titles}" itemLabel="refDesc1" itemValue="refCode" />
  117.                                             </form:select>
  118.                                             <form:input path="insureName" class="input-xxlarge" maxlength="200"  />
  119.                                         </div>
  120.                                     </div>
  121.  
  122.                                     <div class="control-group">
  123.                                         <label class="control-label" for=""> α╕ùα╕╡α╣êα╕¡α╕óα╕╣α╣ê</label>
  124.                                         <div class="controls">
  125.  
  126.  
  127.                                             <form:input path="address" class="input-xxlarge"  maxlength="200" />
  128.                                         </div>
  129.                                     </div>
  130.  
  131.                                     <div class="control-group">
  132.                                         <label class="control-label" for="insureTitle"> α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕ö</label>
  133.                                         <div class="controls">
  134.                                             <form:select path="province" id="province" class="input-medium">
  135.                                                 <form:options items="${provinceList}" itemLabel="provName" itemValue="provCode" />
  136.                                             </form:select>
  137.                                             α╕¡α╕│α╣Çα╕áα╕¡/α╣Çα╕éα╕ò
  138.                                             <form:select path="amphur" id="amphur" class="input-medium"></form:select>
  139.                                                 α╕òα╕│α╕Üα╕Ñ/α╣üα╕éα╕ºα╕ç
  140.                                             <form:select path="tambol" id="tambol" class="input-medium"></form:select>
  141.                                             </div>
  142.                                         </div>
  143.  
  144.                                         <div class="control-group">
  145.                                             <label class="control-label" for="insureTitle"> α╕úα╕½α╕▒α╕¬α╣äα╕¢α╕úα╕⌐α╕ôα╕╡α╕óα╣î</label>
  146.                                             <div class="controls">
  147.                                             <form:input path="zipcode" class="input-medium" id="zipcode" maxlength="5" />
  148.                                             α╕¡α╕▓α╕èα╕╡α╕₧
  149.                                             <form:select path="occuCode" id="occuCode">
  150.  
  151.                                                 <form:options items="${occuCodeList}" itemLabel="refDesc1" itemValue="refCode" />
  152.                                             </form:select>
  153.  
  154.                                         </div>
  155.                                     </div>
  156.  
  157.                                     α╕ùα╕╡α╣êα╕¡α╕óα╕╣α╣êα╕½α╕Öα╣ëα╕▓α╣âα╕Üα╣Çα╕¬α╕úα╣çα╕ê  <input type="checkbox" id="reciptionName"/>  α╣Çα╕½α╕íα╕╖α╕¡α╕Öα╕£α╕╣α╣ëα╣Çα╕¡α╕▓α╕¢α╕úα╕░α╕üα╕▒α╕Ö
  158.  
  159.  
  160.                                     <div class="control-group">
  161.                                         <label class="control-label" for=""> α╕èα╕╖α╣êα╕¡-α╕Öα╕▓α╕íα╕¬α╕üα╕╕α╕Ñ</label>
  162.                                         <div class="controls">
  163.                                             <form:input path="receiptName"  id="receiptName" class="input-xxlarge" maxlength="200" />
  164.                                         </div>
  165.                                     </div>
  166.  
  167.                                     <div class="control-group">
  168.                                         <label class="control-label" for=""> α╕ùα╕╡α╣êα╕¡α╕óα╕╣α╣ê</label>
  169.                                         <div class="controls">
  170.                                             <form:input path="receiptAddress1" id="receiptAddress1" class="input-xxlarge"  maxlength="200" />
  171.                                         </div>
  172.                                     </div>
  173.  
  174.                                     <div class="control-group">
  175.                                         <label class="control-label" for=""> </label>
  176.                                         <div class="controls">
  177.                                             <form:input path="receiptAddress2" id="receiptAddress2" class="input-xxlarge"  maxlength="200" />
  178.                                         </div>
  179.                                     </div>
  180.                                     <div class="control-group">
  181.                                         <label class="control-label" for=""> α╕£α╕╣α╣ëα╕úα╕▒α╕Üα╕£α╕Ñα╕¢α╕úα╕░α╣éα╕óα╕èα╕Öα╣î</label>
  182.                                         <div class="controls">
  183.                                             <form:input path="beneficiaryName" class="input-xxlarge" />
  184.                                         </div>
  185.                                     </div>
  186.  
  187.                                 </div>
  188.                             </div>
  189.                             <div id="tab3" class="tab-pane ">
  190.                                 <div class=" row-fluid">
  191.  
  192.                                     <div class="control-group">
  193.                                         <label class="control-label" for=""> α╕óα╕╡α╣êα╕½α╣ëα╕¡α╕úα╕ûα╕óα╕Öα╕òα╣î</label>
  194.                                         <div class="controls">
  195.                                             <form:select path="vehBrand" class="input-medium" id="vehBrand" />
  196.                                             α╕¢α╕úα╕░α╣Çα╕áα╕ù MV /α╕üα╕▓α╕úα╣âα╕èα╣ëα╕úα╕û
  197.                                             <form:select path="vehCode" class="input-medium"  id="vehSize" />
  198.                                         </div>
  199.                                     </div>
  200.  
  201.                                     <div class="control-group">
  202.                                         <label class="control-label" for=""> α╕úα╕╕α╣êα╕Öα╕úα╕ûα╕óα╕Öα╕òα╣î</label>
  203.                                         <div class="controls">
  204.                                             <form:select path="vehBrandmodel" class="input-medium" id="vehBrandmodel" />
  205.                                             α╕¬α╕╡α╕úα╕û
  206.                                             <form:input path="vehColor" class="input-medium" />
  207.                                         </div>
  208.                                     </div>
  209.  
  210.                                     <div class="control-group">
  211.                                         <label class="control-label" for="">α╕ùα╕░α╣Çα╕Üα╕╡α╕óα╕Öα╕úα╕û</label>
  212.                                         <div class="controls">
  213.                                             <form:input path="vehLicense" class="input-medium" />
  214.                                             α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕öα╕ùα╕░α╣Çα╕Üα╕╡α╕óα╕Öα╕úα╕û
  215.                                             <form:select path="vehLicenseProv" class="input-medium">
  216.                                                 <form:options items="${ provinceList}" itemLabel="provName" itemValue="provCode" />
  217.                                             </form:select>
  218.                                         </div>
  219.                                     </div>
  220.  
  221.                                     <div class="control-group">
  222.                                         <label class="control-label" for="packageCode">α╣Çα╕Ñα╕éα╕òα╕▒α╕ºα╕ûα╕▒α╕ç</label>
  223.                                         <div class="controls">
  224.                                             <form:input path="vehChassis" class="input-large" maxlength="35" onblur="this.value=this.value.toUpperCase()"/>
  225.                                             α╣Çα╕Ñα╕éα╣Çα╕äα╕úα╕╖α╣êα╕¡α╕çα╕óα╕Öα╕òα╣î
  226.                                             <form:input path="vehMachine" class="input-large" maxlength="35" onblur="this.value=this.value.toUpperCase()"/>
  227.                                         </div>
  228.                                     </div>
  229.  
  230.                                     <div class="control-group">
  231.                                         <label class="control-label" for="">α╣üα╕Üα╕Üα╕òα╕▒α╕ºα╕ûα╕▒α╕ç</label>
  232.                                         <div class="controls">
  233.  
  234.                                             <form:select path="vehChassisModel" id="vehChassisModel">
  235.                                                 <form:options items="${chassisModelList}" itemLabel="vehmDesc" itemValue="vehmType" />
  236.                                             </form:select>
  237.                                             CC:
  238.                                             <form:input path="vehCc" class="input-mini autoInt" maxlength="5"/>
  239.                                             / α╕ùα╕╡α╣êα╕Öα╕▒α╣êα╕ç:
  240.                                             <form:input path="vehSeat" class="input-mini autoInt" maxlength="3"/>
  241.                                             / α╕Öα╣ëα╕│α╕½α╕Öα╕▒α╕ü:
  242.                                             <form:input path="vehWeigth" class="input-mini autoInt" maxlength="5"/>
  243.                                             α╕òα╕▒α╕Ö
  244.                                         </div>
  245.                                     </div>
  246.  
  247.                                     <div class="control-group">
  248.                                         <label class="control-label" for="">α╕¢α╕╡α╕ùα╕╡α╣êα╕êα╕öα╕ùα╕░α╣Çα╕Üα╕╡α╕óα╕Ö</label>
  249.                                         <div class="controls">
  250.                                             <form:input path="vehYrreg" class="input-small  autoInt" maxlength="4" />
  251.                                             α╕¢α╕╡α╕ùα╕╡α╣êα╕£α╕Ñα╕┤α╕ò
  252.                                             <form:input path="vehYrprod" class="input-small autoInt"  maxlength="4" />
  253.                                         </div>
  254.                                     </div>
  255.  
  256.                                     <div class="control-group">
  257.                                         <label class="control-label" for="">α╕úα╕▓α╕óα╕üα╕▓α╕úα╕òα╕üα╣üα╕òα╣êα╕çα╣Çα╕₧α╕┤α╣êα╕íα╣Çα╕òα╕┤α╕í</label>
  258.                                         <div class="controls">
  259.                                             <form:input path="vehOption" class="input-xxlarge" />
  260.                                         </div>
  261.                                     </div>
  262.                                 </div>
  263.                             </div>
  264.  
  265.                             <div id="tab4" class="tab-pane ">
  266.  
  267.                                 <div class=" row-fluid">
  268.                                     α╕òα╕▓α╕úα╕▓α╕çα╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç
  269.  
  270.                                     <div role="grid" class="dataTables_wrapper">
  271.                                         <div class="table_top clearfix"></div>
  272.  
  273.                                         <div class="table_content">
  274.  
  275.                                             <table class="data-tbl-striped table table-striped table-bordered dataTable">
  276.                                                 <thead>
  277.                                                     <tr role="row">
  278.                                                         <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 100px;">α╕äα╕ºα╕▓α╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç</th>
  279.                                                         <th class=" " role="columnheader" rowspan="1" colspan="1" style="width: 87px;">α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕ùα╕▒α╣ëα╕çα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</th>
  280.                                                         <th class="   " role="columnheader" rowspan="1" colspan="1" style="width: 87px;">α╕ùα╕╕α╕Öα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╕òα╣êα╕¡α╕äα╕úα╕▒α╣ëα╕ç</th>
  281.                                                         <th class="   " role="columnheader" rowspan="1" colspan="1" style="width: 87px;">α╕ùα╕╕α╕Öα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╕òα╣êα╕¡α╕äα╕Ö</th>
  282.                                                         <th class="   " role="columnheader" rowspan="1" colspan="1" style="width: 53px;">α╕êα╕│α╕Öα╕ºα╕Öα╕äα╕Ö</th>
  283.                                                         <th class="   " role="columnheader" rowspan="1" colspan="1" style="width: 152px;">Deduct</th>
  284.  
  285.                                                     </tr>
  286.                                                 </thead>
  287.  
  288.  
  289.                                                 <tbody role="alert" aria-live="polite" aria-relevant="all" id="coverContent">
  290.  
  291.  
  292.                                                     <!--content-->
  293.  
  294.  
  295.  
  296.  
  297.                                                 </tbody>
  298.                                             </table>
  299.  
  300.                                         </div>
  301.                                     </div>
  302.  
  303.                                 </div>
  304.  
  305.  
  306.                             </div>
  307.  
  308.                             <div id="tab5" class="tab-pane ">
  309.                                 <div class=" row-fluid">
  310.                                     α╕äα╕Öα╕éα╕▒α╕Üα╕äα╕Öα╕ùα╕╡α╣ê 1
  311.                                     <div class="control-group">
  312.                                         <label class="control-label" for=""> α╕èα╕╖α╣êα╕¡-α╕Öα╕▓α╕íα╕¬α╕üα╕╕α╕Ñ</label>
  313.                                         <div class="controls">
  314.  
  315.  
  316.                                             <form:select path="driver1Title" cssClass="input-small driverT" id="driver1Title">
  317.                                                 <form:options items="${titles}" itemLabel="refDesc1" itemValue="refCode" />
  318.                                             </form:select>
  319.                                             <form:input path="driver1Name" class="input-xxlarge driverT" />
  320.  
  321.                                         </div>
  322.                                     </div>
  323.  
  324.                                     <div class="control-group">
  325.                                         <label class="control-label" for="">α╣Çα╕₧α╕¿</label>
  326.                                         <div class="controls">
  327.  
  328.                                             <form:radiobutton path="driver1Sex" value="M" class=" driverT" />
  329.                                             α╕èα╕▓α╕ó
  330.                                             <form:radiobutton path="driver1Sex" value="F" class=" driverT" />
  331.                                             α╕½α╕ìα╕┤α╕ç α╕¡α╕▓α╕èα╕╡α╕₧
  332.                                             <form:select path="driver1OccuCode" id="driver1OccuCode" class=" driverT">
  333.  
  334.                                                 <form:options items="${occuCodeList}" itemLabel="refDesc1" itemValue="refCode" />
  335.                                             </form:select>
  336.                                         </div>
  337.                                     </div>
  338.                                     <div class="control-group">
  339.                                         <label class="control-label" for="">α╕ºα╕▒α╕Öα╣Çα╕üα╕┤α╕ö</label>
  340.                                         <div class="controls">
  341.  
  342.                                             <form:input path="driver1DateofBirth" class="input-large driverT" />
  343.  
  344.                                         </div>
  345.                                     </div>
  346.  
  347.                                     <div class="control-group">
  348.                                         <label class="control-label" for="">α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╣âα╕Üα╕éα╕▒α╕Üα╕éα╕╡α╣ê:</label>
  349.                                         <div class="controls">
  350.  
  351.  
  352.                                             <form:input path="driver1LicenseNo" class="input-large driverT" />
  353.                                         </div>
  354.                                     </div>
  355.  
  356.                                     <div class="control-group">
  357.                                         <label class="control-label" for="">α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕Üα╕▒α╕òα╕úα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Ö:</label>
  358.                                         <div class="controls">
  359.  
  360.  
  361.                                             <form:input path="driver1RegId" class="input-large driverT" maxlength="20"/>
  362.                                         </div>
  363.                                     </div>
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.                                     α╕äα╕Öα╕éα╕▒α╕Üα╕äα╕Öα╕ùα╕╡α╣ê 2
  372.                                     <div class="control-group">
  373.                                         <label class="control-label" for=""> α╕èα╕╖α╣êα╕¡-α╕Öα╕▓α╕íα╕¬α╕üα╕╕α╕Ñ</label>
  374.                                         <div class="controls">
  375.  
  376.  
  377.                                             <form:select path="driver2Title" cssClass="input-small driverT" id="driver2Title">
  378.                                                 <form:options items="${titles}" itemLabel="refDesc1" itemValue="refCode" />
  379.                                             </form:select>
  380.                                             <form:input path="driver2Name" class="input-xxlarge driverT" maxlength="200"/>
  381.  
  382.                                         </div>
  383.                                     </div>
  384.  
  385.                                     <div class="control-group">
  386.                                         <label class="control-label" for="">α╣Çα╕₧α╕¿</label>
  387.                                         <div class="controls">
  388.  
  389.                                             <form:radiobutton path="driver2Sex" value="M" class="driverT" />
  390.                                             α╕èα╕▓α╕ó
  391.                                             <form:radiobutton path="driver2Sex" value="F" class="driverT" />
  392.                                             α╕½α╕ìα╕┤α╕ç α╕¡α╕▓α╕èα╕╡α╕₧
  393.                                             <form:select path="driver2OccuCode" id="driver2OccuCode" class="driverT">
  394.  
  395.                                                 <form:options items="${occuCodeList}" itemLabel="refDesc1" itemValue="refCode" />
  396.                                             </form:select>
  397.                                         </div>
  398.                                     </div>
  399.                                     <div class="control-group">
  400.                                         <label class="control-label" for="">α╕ºα╕▒α╕Öα╣Çα╕üα╕┤α╕ö</label>
  401.                                         <div class="controls">
  402.  
  403.                                             <form:input path="driver2DateofBirth" class="input-large driverT"  />
  404.  
  405.                                         </div>
  406.                                     </div>
  407.  
  408.                                     <div class="control-group">
  409.                                         <label class="control-label" for="">α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╣âα╕Üα╕éα╕▒α╕Üα╕éα╕╡α╣ê:</label>
  410.                                         <div class="controls">
  411.  
  412.  
  413.                                             <form:input path="driver2LicenseNo" class="input-large driverT" maxlength="20"/>
  414.                                         </div>
  415.                                     </div>
  416.  
  417.                                     <div class="control-group">
  418.                                         <label class="control-label" for="">α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕Üα╕▒α╕òα╕úα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Ö:</label>
  419.                                         <div class="controls">
  420.  
  421.  
  422.                                             <form:input path="driver2RegId" class="input-large driverT" maxlength="20"/>
  423.                                         </div>
  424.                                     </div>
  425.  
  426.                                 </div>
  427.                             </div>
  428.  
  429.                             <div id="tab6" class="tab-pane ">
  430.                                 <div class=" row-fluid">
  431.  
  432.                                     <div class="control-group">
  433.                                         <label class="control-label" for=""> α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╣Çα╕òα╣çα╕íα╕¢α╕╡</label>
  434.                                         <div class="controls">
  435.  
  436.                                             <form:input path="annualPrem" class=" autoNumber" id="annualPrem"  readonly="true"/>
  437.  
  438.                                         </div>
  439.                                     </div>
  440.  
  441.                                     <div class="control-group">
  442.                                         <label class="control-label" for=""> α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕¬α╕╕α╕ùα╕ÿα╕┤</label>
  443.                                         <div class="controls">
  444.  
  445.                                             <form:input path="netPremium" class="input-small autoNumber" id="netPremium"  readonly="true"/>
  446.                                             α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╕úα╕ºα╕í
  447.                                             <form:input path="totalPremium" class="input-small autoNumber" id="totalPremium"  readonly="true" />
  448.                                         </div>
  449.                                     </div>
  450.  
  451.                                     <div class="control-group">
  452.                                         <label class="control-label" for=""> α╕¡α╕▓α╕üα╕ú</label>
  453.                                         <div class="controls">
  454.                                             <form:input path="feeAmt" class="input-small autoNumber" id="feeAmt"  readonly="true"/>
  455.  
  456.                                         </div>
  457.                                     </div>
  458.                                     <div class="control-group">
  459.                                         <label class="control-label" for="">VAT</label>
  460.                                         <div class="controls">
  461.                                             <form:input path="vatAmt" class="input-small autoNumber" id="vatAmt"  readonly="true" />
  462.                                         </div>
  463.                                     </div>
  464.  
  465.                                 </div>
  466.                             </div>
  467.  
  468.                             <!-- <div id="tab7" class="tab-pane ">
  469.                                     <div class=" row-fluid">
  470.  
  471.                                             <div class="control-group">
  472.                                                     <label class="control-label">File input</label>
  473.                                                     <div class="controls">
  474.                                                             α╕¢α╕úα╕░α╣Çα╕áα╕ùα╣Çα╕¡α╕üα╕¬α╕▓α╕úα╣üα╕Öα╕Ü <select name="" id="">
  475.                                                                     <option>α╣Çα╕¡α╕üα╕¬α╕▓α╕úα╕òα╕úα╕ºα╕êα╕¬α╕áα╕▓α╕₧α╕úα╕ûα╕óα╕Öα╕òα╣î</option>
  476.                                                                     <option>α╕úα╕╣α╕¢α╕ûα╣êα╕▓α╕ó</option>
  477.                                                                     <option>α╕¡α╕╖α╣êα╕Öα╣å</option>
  478.                                                             </select> <input class="input-file" type="file">
  479.                                                     </div>
  480.                                             </div>
  481.  
  482.                                     </div>
  483.                             </div>
  484.                             -->
  485.                         </div>
  486.                     </div>
  487.                 </div>
  488.                 <!-- end tab -->
  489.             </fieldset>
  490.             <button class="btn btn-success" name="saveBtn" id="saveBtn">α╕Üα╕▒α╕Öα╕ùα╕╢α╕üα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î</button>
  491.             <a class="btn" id="cancelBtn" onClick="$('#tableFrm').dialog('close');">α╕óα╕üα╣Çα╕Ñα╕┤α╕ü/α╕¢α╕┤α╕ö</a>
  492.         </form:form>
  493.     </div>
  494. </div> 
  495.  
  496. <script>
  497.  
  498.     $(function () {
  499.         var vehBrandmodel;
  500.         var vehBrand;
  501.         var packageCode;
  502.  
  503.  
  504.         var vatRate = ${vatRate};
  505.         var feeRate = ${feeRate} / 100;
  506.  
  507.  
  508.  
  509.         function check_idcard(idcard) {
  510.             if (idcard.value == "") {
  511.                 return false;
  512.             }
  513.             if (idcard.length != 13) {
  514.                 return false;
  515.             }
  516.  
  517.             var num = str_split(idcard); // function α╣Çα╕₧α╕┤α╣êα╕íα╣Çα╕òα╕┤α╕í
  518.             var sum = 0;
  519.             var total = 0;
  520.             var digi = 13;
  521.  
  522.             for (i = 0; i < 12; i++) {
  523.                 sum = sum + (num[i] * digi);
  524.                 digi--;
  525.             }
  526.             total = ((11 - (sum % 11)) % 10);
  527.  
  528.             if (total == num[12]) { //alert('α╕úα╕½α╕▒α╕¬α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕¢α╕úα╕░α╕êα╕│α╕òα╕▒α╕ºα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Öα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕ç');
  529.                 return true;
  530.             } else { //alert('α╕úα╕½α╕▒α╕¬α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕¢α╕úα╕░α╕êα╕│α╕òα╕▒α╕ºα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Öα╣äα╕íα╣êα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕ç');
  531.                 return false;
  532.             }
  533.         }
  534.  
  535.  
  536.         function checkID(id) {
  537.             if (id.length != 13)
  538.                 return false;
  539.             for (i = 0, sum = 0; i < 12; i++)
  540.                 sum += parseFloat(id.charAt(i)) * (13 - i);
  541.             if ((11 - sum % 11) % 10 != parseFloat(id.charAt(12)))
  542.                 return false;
  543.             return true;
  544.  
  545.         }
  546.  
  547. //        $("#issueDate").datepicker({dateFormat: 'dd/mm/yy', minDate: new Date()});
  548. //        $("#agreeDate").datepicker({dateFormat: 'dd/mm/yy', minDate: new Date()});
  549.  
  550.         $('#issueDate').datepicker('setDate', new Date());
  551.         $('#agreeDate').datepicker('setDate', new Date());
  552.         $("#issueDate").prop('readonly', true);
  553.         $("#agreeDate").prop('readonly', true);
  554.  
  555. //        $('#issueDate').datepicker('disable');
  556. //        $('#agreeDate').datepicker('disable'); 
  557.  
  558.         function daysInYear() {
  559.             var dateNow = new Date();
  560.             var year = dateNow.getYear();
  561.             year = year + 1;
  562.             if (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)) {
  563.                 // Leap year
  564.                 return 366;
  565.             } else {
  566.                 // Not a leap year
  567.                 return 365;
  568.             }
  569.         }
  570.  
  571.  
  572.  
  573.  
  574.         $('#beginDate').datepicker({dateFormat: 'dd/mm/yy', minDate: new Date(), onSelect: function (selectedDate) {
  575.  
  576.  
  577.                 $("#endDate").datepicker("option", "minDate", selectedDate);
  578.  
  579.                 if ($('#premCalA').prop('checked')) {
  580.  
  581.                     $('#endDate').prop('readonly', true);
  582.  
  583.                     var enddate = $('#beginDate').datepicker('getDate', '+1y');
  584.                     enddate.setDate(enddate.getDate() + daysInYear());
  585.                     $('#endDate').datepicker('setDate', enddate);
  586.                     // $('#endDate').datepicker("destroy");;
  587.  
  588.                 } else {
  589.  
  590.                     $('#endDate').prop('readonly', false);
  591.                     /*     $('#endDate').datepicker({
  592.                      dateFormat : 'dd/mm/yy',
  593.                      onSelect : function(selectedDate) {
  594.                      $("#beginDate").datepicker("option", "maxDate", selectedDate);
  595.                      }
  596.                      }); */
  597.                 }
  598.  
  599.                 $("input[name=premCal]:radio").change();
  600.  
  601.             }
  602.         });
  603.  
  604.         $('#endDate').datepicker({
  605.             dateFormat: 'dd/mm/yy',
  606.             onSelect: function (selectedDate) {
  607.                 $("#beginDate").datepicker("option", "maxDate", selectedDate);
  608.                 $("input[name=premCal]:radio").change();
  609.             }
  610.         });
  611.  
  612.         //$('#beginDate').datepicker( {  dateFormat: 'dd/MM/yyyy' });
  613.         //$("#beginDate").datepicker("setDate", new Date());
  614.         //$('#endDate').datepicker({  dateFormat: 'dd/mm/yyyy' });
  615.         //$('#issueDate').datepicker( {  dateFormat: 'dd/mm/yyyy' });
  616.         //$('#agreeDate').datepicker({  dateFormat: 'dd/mm/yyyy' });
  617.  
  618.         $('#beginDate').change(function () {
  619.             var date1 = $('#beginDate').datepicker('getDate');
  620.             var date = new Date(Date.parse(date1));
  621.             date.setFullYear(date.getFullYear() + 1);
  622.  
  623.             var newDate = date.toDateString();
  624.             newDate = new Date(Date.parse(newDate));
  625.  
  626.             $('#date2').datepicker('setDate', newDate);
  627.         })
  628.  
  629.         $('#beginDate').on('change', function () {
  630.  
  631.         });
  632.  
  633.         $("#regId").blur(function () {
  634. //            alert($('input[name=insureType]:checked').val().)
  635.             if ($('input[name=insureType]:checked').val() == 'P' && !check_idcard(this.value)) {
  636. //            if (!check_idcard(this.value)) {
  637.                 alert('α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕Üα╕▒α╕òα╕úα╣äα╕íα╣êα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕çα╕üα╕úα╕╕α╕ôα╕▓α╕òα╕úα╕ºα╕êα╕¬α╕¡α╕Üα╕¡α╕╡α╕üα╕äα╕úα╕▒α╣ëα╕ç');
  638.                 $("#regId").focus();
  639.             }
  640.  
  641.         });
  642.  
  643.         $('#tambol').on('change', function () {
  644.             if (this.value != '99') {
  645.                 $.ajax({
  646.                     type: "GET",
  647.                     dataType: "json",
  648.                     url: 'tambol?amphurCode=' + $('#amphur option:selected').val() + '&provCode=' + $('#province option:selected').val() + '&tambolCode=' + this.value,
  649.                     success: function (data) {
  650.  
  651.                         $('#zipcode').val(data.tabolZipcode);
  652.  
  653.                     },
  654.                     error: function (xhr, ajaxOptions, thrownError) {
  655.                         alert(xhr.status);
  656.                         alert(thrownError);
  657.                     }
  658.                 });
  659.             }
  660.  
  661.         });
  662.  
  663.         $('#amphur').on('change', function () {
  664.             $.ajax({
  665.                 type: "GET",
  666.                 dataType: "json",
  667.                 url: 'tambol-list?amphurCode=' + this.value + '&provCode=' + $('#province option:selected').val(),
  668.                 success: function (data) {
  669.  
  670.                     $('#tambol').find('option').remove().end();
  671.                     $('#tambol').append(new Option('-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --', '99'));
  672.                     $.each(data, function () {
  673.                         $('#tambol').append(new Option(this.tambolName, this.tambolCode));
  674.                     });
  675.                     $('#tambol').change();
  676.  
  677.                 },
  678.                 error: function (xhr, ajaxOptions, thrownError) {
  679.                     alert(xhr.status);
  680.                     alert(thrownError);
  681.                 }
  682.             });
  683.  
  684.         });
  685.  
  686.         $('#province').on('change', function () {
  687.  
  688.             $.ajax({
  689.                 type: "GET",
  690.                 dataType: "json",
  691.                 url: 'amphur-list?provCode=' + this.value,
  692.                 success: function (data) {
  693.  
  694.                     $('#amphur').find('option').remove().end();
  695.                     $('#tambol').find('option').remove().end();
  696.  
  697.                     $('#amphur').append(new Option('-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --', '99'));
  698.                     $.each(data, function () {
  699.                         $('#amphur').append(new Option(this.amphurName, this.amphurCode));
  700.                     });
  701.                     $('#amphur').change();
  702.                 },
  703.                 error: function (xhr, ajaxOptions, thrownError) {
  704.                     alert(xhr.status);
  705.                     alert(thrownError);
  706.                 }
  707.             });
  708.  
  709.         });
  710.         // mv 
  711.  
  712.  
  713.         $('#vehChassisModel').on('change', function () {
  714. //            alert(this.value);
  715.         });
  716.  
  717.         $('#vehBrand').on('change', function () {
  718.  
  719.             $('#vehBrandmodel').find('option').remove().end();
  720.  
  721.             if (packageCode.allBrand != 'Y') {
  722.                 $.each(vehBrandmodel, function () {
  723.  
  724.                     if ($('#vehBrand option:selected').val() == this.brand) {
  725.  
  726.                         $('#vehBrandmodel').append(new Option(this.model, this.model));
  727.                     }
  728.  
  729.                 });
  730.             } else {
  731.  
  732.                 $.each(vehBrandmodel, function () {
  733.  
  734.                     if ($('#vehBrand option:selected').val() == this.brandId) {
  735.  
  736.                         $('#vehBrandmodel').append(new Option(this.modelName, this.modelName));
  737.                     }
  738.  
  739.                 });
  740.  
  741.             }
  742.  
  743.         });
  744.         $('#packageCode').on('change', function () {
  745.  
  746.             $.ajax({
  747.                 type: "GET",
  748.                 dataType: "json",
  749.                 url: 'get-packageH-detail?packageCode=' + encodeURIComponent(this.value),
  750.                 success: function (data) {
  751.  
  752.                     packageCode = data;
  753.                     $("#packageDesc").val(packageCode.packageDesc);
  754.  
  755.  
  756.                     //brand Model
  757.  
  758.                     //    data.totalPremium;
  759.  
  760.                     $('#vehBrand').find('option').remove().end();
  761.  
  762.                     vehBrandmodel = data.brandmodels;
  763.                     vehBrand = {};
  764.  
  765.                     if (data.allBrand != 'Y') {
  766.                         $.each(vehBrandmodel, function () {
  767.  
  768.                             if (!(this.brand in vehBrand)) {
  769.                                 $('#vehBrand').append(new Option(this.brand, this.brand));
  770.                                 vehBrand[this.brand] = this.brand;
  771.                             }
  772.  
  773.                         });
  774.                     } else {
  775.  
  776.                         $.ajax({
  777.                             type: "GET",
  778.                             dataType: "json",
  779.                             url: 'vehBrandmodel-list',
  780.                             success: function (data2) {
  781.                                 vehBrandmodel = data2;
  782.                                 $.each(data2, function () {
  783.  
  784.                                     if (!(this.brandId in vehBrand)) {
  785.                                         $('#vehBrand').append(new Option(this.brandId, this.brandId));
  786.                                         vehBrand[this.brandId] = this.brandId;
  787.                                     }
  788.  
  789.                                 });
  790.  
  791.                                 $('#vehBrand').change();
  792.                             }
  793.                         });
  794.  
  795.                     }
  796.  
  797.  
  798.  
  799.                     //vehSize
  800.                     $('#vehSize').find('option').remove().end();
  801.  
  802.                     var vv = '';
  803.  
  804.                     if (data.allVehCode != 'Y') {
  805.  
  806.                         $.each(data.vehSizeBeans, function () {
  807.                             $('#vehSize').append(new Option(this.vehSizeDesc, this.vehSize + "|" + this.vehCode));
  808.                             if (vv == '') {
  809.                                 vv = this.vehSize + "|" + this.vehCode;
  810.                             }
  811.                         });
  812.  
  813.  
  814.                     } else {
  815.  
  816.                         $.ajax({
  817.                             type: "GET",
  818.                             dataType: "json",
  819.                             url: 'veh-size-list',
  820.                             success: function (data2) {
  821.                                 vehBrandmodel = data2;
  822.                                 $.each(data2, function () {
  823.                                     $('#vehSize').append(new Option(this.vehSizeDesc, this.vehSize + "|" + this.vehCode));
  824.                                     if (vv == '') {
  825.                                         vv = this.vehSize + "|" + this.vehCode;
  826.                                     }
  827.                                 });
  828.  
  829.                             }
  830.                         });
  831.                     }
  832.  
  833.                     if (vv != '') {
  834.                         $.ajax({
  835.                             type: "GET",
  836.                             dataType: "json",
  837.                             url: 'veh-model-list?vehmCode=' + vv,
  838.                             success: function (data) {
  839.                                 $('#vehChassisModel').find('option').remove().end();
  840.                                 $.each(data, function () {
  841.                                     $('#vehChassisModel').append(new Option(this.vehmDesc, this.vehmType));
  842.                                 });
  843.  
  844.                             },
  845.                             error: function (xhr, ajaxOptions, thrownError) {
  846.                                 alert(xhr.status);
  847.                                 alert(thrownError);
  848.                             }
  849.                         });
  850.  
  851.                     }
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.                     //cover Table
  860.                     coverages = data.coverages;
  861.                     var coveragesTable = '';
  862.  
  863.                     $.each(coverages, function () {
  864.  
  865.                         coveragesTable += '<tr class="odd">';
  866.  
  867.                         coveragesTable += '<td class="span4">' + this.covCode + ':' + this.covName;
  868.  
  869.                         coveragesTable += '</td>';
  870.                         coveragesTable += '<td class=" "> ';
  871.  
  872.                         if (!this.enableSumOfPol) {
  873.                             coveragesTable += '-';
  874.  
  875.                         } else {
  876.                             coveragesTable += this.sumOfPol.toLocaleString();
  877.                         }
  878.  
  879.                         coveragesTable += '</td>';
  880.                         coveragesTable += '<td class="center ">';
  881.                         if (!this.enableSumOfTimes) {
  882.                             coveragesTable += '-';
  883.  
  884.                         } else {
  885.                             coveragesTable += this.sumOfTimes.toLocaleString();
  886.                         }
  887.                         coveragesTable += '</td>';
  888.                         coveragesTable += '<td class="center ">';
  889.                         if (!this.enableSumOfPerson) {
  890.                             coveragesTable += '-';
  891.  
  892.                         } else {
  893.                             coveragesTable += this.sumOfPerson.toLocaleString();
  894.                         }
  895.                         coveragesTable += '</td>';
  896.                         coveragesTable += '<td class="center ">';
  897.                         if (!this.enableNoPerson) {
  898.                             coveragesTable += '-';
  899.  
  900.                         } else {
  901.                             coveragesTable += this.noPerson.toLocaleString();
  902.                         }
  903.                         coveragesTable += '</td>';
  904.                         coveragesTable += '<td class="center ">';
  905.                         if (!this.enableDeduct) {
  906.                             coveragesTable += '-';
  907.  
  908.                         } else {
  909.                             coveragesTable += this.deduct.toLocaleString();
  910.                         }
  911.  
  912.                         coveragesTable += '</td>';
  913.  
  914.                         coveragesTable += '</tr>';
  915.  
  916.                     });
  917.                     $('#coverContent').html("");
  918.                     $(coveragesTable).appendTo('#coverContent');
  919.                     //end cover table;
  920.  
  921.                     //driver tab
  922.  
  923.                     $(".driverT").prop('disabled', !(data.drivrers == 'Y'));
  924.  
  925.                     if (data.annualFlag == 'Y') {
  926.  
  927.                         $('#premCalA').prop('checked', true);
  928.                         $('#premCalP').prop('disabled', true);
  929.                         $('#premCalS').prop('disabled', true);
  930.  
  931.                         var enddate = $('#beginDate').datepicker('getDate', '+1y');
  932.                         enddate.setDate(enddate.getDate() + daysInYear());
  933.                         $('#endDate').datepicker('setDate', enddate);
  934.  
  935.                         $("#endDate").prop('readonly', true);
  936.                         $('#endDate').datepicker('disable');
  937.  
  938.  
  939.  
  940.                     } else {
  941.                         //$("input[type=radio]").attr('disabled', false);
  942.                         $('#premCalP').prop('disabled', !(data.prorata == 'Y'));
  943.                         $('#premCalS').prop('disabled', !(data.shortrate == 'Y'));
  944.                         $("#endDate").prop('readonly', false);
  945.                         $('#endDate').datepicker('enable');
  946.  
  947.                     }
  948.                     if (data.insureType == 'Y') {
  949.                         $('#insureTypeP').prop('checked', true);
  950.                         $('#insureTypeO').prop('disabled', true);
  951.                         $('#insureTypeC').prop('disabled', true);
  952.  
  953.                         $('#branchMain').prop('disabled', true);
  954.                         $('#branch').prop('disabled', true);
  955.  
  956.                     } else {
  957.                         // $('#insureTypeP').prop('checked', true);
  958.                         $('#insureTypeO').prop('disabled', false);
  959.                         $('#insureTypeC').prop('disabled', false);
  960.  
  961.                         $('#branchMain').prop('disabled', false);
  962.                         $('#branch').prop('disabled', false);
  963.  
  964.                     }
  965.  
  966.                     //                        data.allVehCode;
  967.                     //                        data.allBrand;
  968.                     //                        data.allGroup;
  969.                     //                        data.prorata;
  970.                     //                        data.shortrate;
  971.                     //                        ; 
  972.  
  973.                     $('#vehBrand').change();
  974.  
  975.  
  976.                     //premium
  977.                     $("input[name=premCal]:radio").change();
  978.                     /* if ($('#premCalA').prop('checked')) {
  979.                      
  980.                      $('#annualPrem').val(data.totalPremium);
  981.                      $('#netPremium').val(data.netPremium);
  982.                      $('#totalPremium').val(data.totalPremium);
  983.                      $('#feeAmt').val(data.fee);
  984.                      $('#vatAmt').val(data.vatAmt);
  985.                      
  986.                      } else if ($('#premCalP').prop('checked')) {
  987.                      
  988.                      var netPremium = data.netPremium;
  989.                      var bDate = ('#beginDate').datepicker("getDate") ;
  990.                      var eDate = ('#endDate').datepicker("getDate");
  991.                      //alert((eDate- bDate) /( 86400 * 1000));
  992.                      
  993.                      $('#annualPrem').val(data.totalPremium);
  994.                      $('#netPremium').val(data.netPremium);
  995.                      $('#totalPremium').val(data.totalPremium);
  996.                      $('#feeAmt').val(data.fee);
  997.                      $('#vatAmt').val(data.vatAmt);
  998.                      
  999.                      } else if ($('#premCalS').prop('checked')) {
  1000.                      
  1001.                      
  1002.                      $('#annualPrem').val(data.totalPremium);
  1003.                      $('#netPremium').val(data.netPremium);
  1004.                      $('#totalPremium').val(data.totalPremium);
  1005.                      $('#feeAmt').val(data.fee);
  1006.                      $('#vatAmt').val(data.vatAmt);
  1007.                      }
  1008.                      */
  1009.                     $('.autoNumber').autoNumeric('init', {
  1010.                         aSep: ',',
  1011.                         aDec: '.',
  1012.                         vMin: '0.00',
  1013.                         vMax: '1000000000.00'
  1014.                     });
  1015.  
  1016.                     //documents
  1017.                     if (data.loadDoc != 'Y') {
  1018.  
  1019.                         //disable loaddocs
  1020.                     }
  1021.  
  1022.                 },
  1023.                 error: function (xhr, ajaxOptions, thrownError) {
  1024.                     alert(xhr.status);
  1025.                     alert(thrownError);
  1026.                 }
  1027.             });
  1028.  
  1029.         });
  1030.  
  1031.  
  1032.  
  1033.  
  1034.         $('#branchMain').on('change', function () {
  1035.             $('#branchDesc').val('');
  1036.         });
  1037.  
  1038.         $('#insureTypeP').on('change', function () {
  1039.             $.ajax({
  1040.                 type: "GET",
  1041.                 dataType: "json",
  1042.                 url: 'title-list?type=P',
  1043.                 success: function (data) {
  1044.  
  1045.                     $('#insureTitle').find('option').remove().end();
  1046.                     $.each(data, function () {
  1047.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1048.                     });
  1049.                     ;
  1050.                 },
  1051.                 error: function (xhr, ajaxOptions, thrownError) {
  1052.                     alert(xhr.status);
  1053.                     alert(thrownError);
  1054.                 }
  1055.             });
  1056.             $('#branchMain').prop('disabled', true);
  1057.             $('#branch').prop('disabled', true);
  1058.  
  1059.         });
  1060.  
  1061.         $('#insureTypeC').on('change', function () {
  1062.             $.ajax({
  1063.                 type: "GET",
  1064.                 dataType: "json",
  1065.                 url: 'title-list?type=C',
  1066.                 success: function (data) {
  1067.  
  1068.                     $('#insureTitle').find('option').remove().end();
  1069.                     $.each(data, function () {
  1070.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1071.                     });
  1072.                     ;
  1073.                 },
  1074.                 error: function (xhr, ajaxOptions, thrownError) {
  1075.                     alert(xhr.status);
  1076.                     alert(thrownError);
  1077.                 }
  1078.             });
  1079.             $('#branch').prop('disabled', false);
  1080.             $('#branchMain').prop('disabled', false);
  1081.             $('#branchMain').prop('checked', true);
  1082.  
  1083.  
  1084.         });
  1085.         $('#insureTypeO').on('change', function () {
  1086.             $.ajax({
  1087.                 type: "GET",
  1088.                 dataType: "json",
  1089.                 url: 'title-list?type=O',
  1090.                 success: function (data) {
  1091.  
  1092.                     $('#insureTitle').find('option').remove().end();
  1093.                     $.each(data, function () {
  1094.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1095.                     });
  1096.                     ;
  1097.                 },
  1098.                 error: function (xhr, ajaxOptions, thrownError) {
  1099.                     alert(xhr.status);
  1100.                     alert(thrownError);
  1101.                 }
  1102.             });
  1103.             $('#branchMain').prop('disabled', false);
  1104.             $('#branch').prop('disabled', false);
  1105.         });
  1106.  
  1107.  
  1108.         $('#reciptionName').on('change', function () {
  1109.  
  1110.             var addressCopy = '';
  1111.  
  1112.             if ($('#reciptionName').prop('checked')) {
  1113.  
  1114.                 $('#receiptName').val($('#insureTitle option:selected').text() + "  " + $('#insureName').val());
  1115.                 $('#receiptAddress1').val($('#address').val());
  1116.                 if ($('#province option:selected').text() == 'α╕üα╕úα╕╕α╕çα╣Çα╕ùα╕₧α╕íα╕½α╕▓α╕Öα╕äα╕ú') {
  1117.  
  1118.                     if ($('#tambol option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1119.                         addressCopy += 'α╣üα╕éα╕ºα╕ç' + $('#tambol option:selected').text();
  1120.                     }
  1121.                     if ($('#amphur option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1122.                         addressCopy += '  α╣Çα╕éα╕ò' + $('#amphur option:selected').text();
  1123.                     }
  1124.  
  1125.                     addressCopy += '  ' + $('#province option:selected').text();
  1126.                     addressCopy += '  ' + $('#zipcode').val();
  1127.  
  1128.                     $('#receiptAddress2').val(addressCopy);
  1129. //                    $('#receiptAddress2').val(" α╣üα╕éα╕ºα╕ç" + $('#tambol option:selected').text() + " α╣Çα╕éα╕ò" + $('#amphur option:selected').text() + " " + $('#province option:selected').text());
  1130.  
  1131.                 } else {
  1132.  
  1133.                     if ($('#tambol option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1134.                         addressCopy += 'α╕òα╕│α╕Üα╕Ñ' + $('#tambol option:selected').text();
  1135.                     }
  1136.                     if ($('#amphur option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1137.                         addressCopy += '  α╕¡α╕│α╣Çα╕áα╕¡' + $('#amphur option:selected').text();
  1138.                     }
  1139.  
  1140.                     addressCopy += '  α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕ö' + $('#province option:selected').text();
  1141.                     addressCopy += '  ' + $('#zipcode').val();
  1142.  
  1143.                     $('#receiptAddress2').val(addressCopy);
  1144.  
  1145. //                    $('#receiptAddress2').val(" α╕òα╕│α╕Üα╕Ñ" + $('#tambol option:selected').text() + " α╕¡α╕│α╣Çα╕áα╕¡" + $('#amphur option:selected').text() + " α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕ö" + $('#province option:selected').text());
  1146.  
  1147.                 }
  1148.                 $('#receiptName').prop('readonly', true);
  1149.                 $('#receiptAddress1').prop('readonly', true);
  1150.                 $('#receiptAddress2').prop('readonly', true);
  1151.             } else {
  1152.  
  1153.                 /* $('#receiptName').val('');
  1154.                  $('#receiptAddress1').val('');
  1155.                  $('#receiptAddress2').val(''); */
  1156.                 $('#receiptName').prop('readonly', false);
  1157.                 $('#receiptAddress1').prop('readonly', false);
  1158.                 $('#receiptAddress2').prop('readonly', false);
  1159.  
  1160.  
  1161.             }
  1162.  
  1163.         });
  1164.  
  1165.  
  1166.  
  1167.  
  1168.         $("input[name=premCal]:radio").change(function () {
  1169.  
  1170.             var netPremium = packageCode.netPremium;
  1171.             var freeAmt = packageCode.fee;
  1172.             var vatAmt = packageCode.vatAmt;
  1173.             var totalPremium = packageCode.totalPremium;
  1174.             var annualPrem = packageCode.totalPremium; // α╣Çα╕Üα╕╡α╣ëα╕óα╕ùα╕▒α╣ëα╕çα╣Çα╕Üα╕╡α╣ëα╕ó
  1175.  
  1176.             var bDate = $('#beginDate').datepicker("getDate");
  1177.             var eDate = $('#endDate').datepicker("getDate");
  1178.             var difDate;
  1179.  
  1180.             if ($("input[name=premCal]:checked").val() != 'A') {
  1181.  
  1182.                 if ($("input[name=premCal]:checked").val() == 'P') {
  1183.                     difDate = (eDate - bDate) / (86400 * 1000);
  1184.                     netPremium = difDate * netPremium / 365;
  1185.  
  1186.                 } else if ($("input[name=premCal]:checked").val() == 'S') {
  1187.  
  1188.                     difDate = 1 + (eDate - bDate) / (86400 * 1000);
  1189.                     $.ajax({
  1190.                         type: "GET",
  1191.                         dataType: "json",
  1192.                         url: 'get-short-rate?days=' + difDate,
  1193.                         success: function (moShtRntBean) {
  1194.                             netPremium = netPremium * moShtRntBean.srShtPercent / 100;
  1195.                         }
  1196.                     });
  1197.                 }
  1198.  
  1199.  
  1200.                 var f = (netPremium * feeRate);
  1201.                 freeAmt = Math.ceil(f);
  1202.                 vatAmt = inprecise_round(((parseFloat(netPremium) + parseInt(freeAmt)) * vatRate) / 100, 2);
  1203.                 totalPremium = parseFloat(netPremium) + parseFloat(freeAmt) + parseFloat(vatAmt);
  1204.             }
  1205.  
  1206.             $('#annualPrem').val(annualPrem);
  1207.             $('#netPremium').val(netPremium);
  1208.             $("#feeAmt").val(freeAmt);
  1209.             $("#vatAmt").val(vatAmt);
  1210.             $("#totalPremium").val(totalPremium);
  1211.         });
  1212.         function inprecise_round(value, decPlaces) {
  1213.             return Math.round(value * Math.pow(10, decPlaces)) / Math.pow(10, decPlaces);
  1214.         }
  1215.  
  1216.  
  1217.         $('#province').change();
  1218.  
  1219.         $('#packageCode').change();
  1220.  
  1221.  
  1222.  
  1223.         $('#vehSize').on('change', function () {
  1224.  
  1225.             $.ajax({
  1226.                 type: "GET",
  1227.                 dataType: "json",
  1228.                 url: 'veh-model-list?vehmCode=' + this.value,
  1229.                 success: function (data) {
  1230.                     $('#vehChassisModel').find('option').remove().end();
  1231.                     $.each(data, function () {
  1232.                         $('#vehChassisModel').append(new Option(this.vehmDesc, this.vehmType));
  1233.                     });
  1234.  
  1235.                 },
  1236.                 error: function (xhr, ajaxOptions, thrownError) {
  1237.                     alert(xhr.status);
  1238.                     alert(thrownError);
  1239.                 }
  1240.             });
  1241.         });
  1242.  
  1243.  
  1244.  
  1245.         $("#packageCode").select2({
  1246.             width: 'resolve'
  1247.         });
  1248.  
  1249.         $("#driver1OccuCode").select2({
  1250.             width: 'resolve'
  1251.         });
  1252.         $("#driver2OccuCode").select2({
  1253.             width: 'resolve'
  1254.         });
  1255.         $("#driver1Title").select2({
  1256.             width: 'resolve'
  1257.         });
  1258.         $("#driver2Title").select2({
  1259.             width: 'resolve'
  1260.         });
  1261.         $("#occuCode").select2({
  1262.             width: 'resolve'
  1263.         });
  1264.         $("#insureTitle").select2({
  1265.             width: 'resolve'
  1266.         });
  1267.         $("#province").select2({
  1268.             width: 'resolve'
  1269.         });
  1270.         $("#amphur").select2({
  1271.             width: 'resolve'
  1272.         });
  1273.         $("#tambol").select2({
  1274.             width: 'resolve'
  1275.         });
  1276.  
  1277.         $('#driver1DateofBirth').datepicker({
  1278.             dateFormat: 'dd/mm/yy',
  1279.             minDate: new Date()
  1280.         });
  1281.         $('driver2DateofBirth').datepicker({
  1282.             dateFormat: 'dd/mm/yy',
  1283.             minDate: new Date()
  1284.         });
  1285.         $('.autoInt').autoNumeric('init', {
  1286.             aSep: '',
  1287.             aPad: false,
  1288.             vMin: '0',
  1289.             vMax: '99999'
  1290.         });
  1291. //$("#frmPolicy").preventDoubleSubmission();
  1292.  
  1293.     <%if (request.getParameter("policyNo") == null) {%>
  1294.  
  1295.     <%} else {%>
  1296.         $('#amphur option:selected').val('${policyBean.tambol}');
  1297.         //$('#amphur').change();
  1298.         $('#tambol option:selected').val('${policyBean.amphur}');
  1299.         $('#vehBrand option:selected').val('${policyBean.vehBrand}');
  1300.         //$('#vehBrand').change();
  1301.         $('#vehBrandmodel option:selected').val('${policyBean.vehBrandmodel}');
  1302.  
  1303.  
  1304.         //$('#vehBrandmodel').change();
  1305.         //$('#vehSize option:selected').val('${policyBean.vehSize}|${policyBean.vehCode}'); 
  1306.     <%}%>
  1307.  
  1308.  
  1309.  
  1310.         $("#frmPolicy").submit(function () {
  1311.  
  1312.             $('#saveBtn').click(function () {
  1313.                 return false;
  1314.             });
  1315.  
  1316.             var form = $(this);
  1317.             $('input').each(function (i) {
  1318.                 var self = $(this);
  1319.                 try {
  1320.                     var v = self.autoNumeric('get');
  1321.                     self.autoNumeric('destroy');
  1322.                     self.val(v);
  1323.                 } catch (err) {
  1324.                     console.log("Not an autonumeric field: " + self.attr("name"));
  1325.                 }
  1326.             });
  1327.  
  1328.  
  1329.             //$("saveBtn").prop('disabled', true);
  1330.             var url = "savePolicy";
  1331.             $.ajax({
  1332.                 type: "POST",
  1333.                 url: url,
  1334.                 data: $("#frmPolicy").serialize(),
  1335.                 success: function (data) {
  1336.  
  1337.                     $('#grid').trigger("reloadGrid", [{
  1338.                             page: 1
  1339.                         }]);
  1340.                     //$('#tableFrm').dialog('close');
  1341.                     $("#saveBtn").unbind();
  1342.                     $('#saveBtn').click(function () {
  1343.                         return true;
  1344.                     });
  1345.  
  1346.                     updateCreditMenu();
  1347.                     $('#tableFrm').dialog('close');
  1348.  
  1349.                 },
  1350.                 error: function (xhr, ajaxOptions, thrownError) {
  1351.  
  1352.                     var obj = JSON.parse(xhr.responseText);
  1353.                     alert(obj.errorMessages);
  1354.                     $("#saveBtn").unbind();
  1355.                     $('#saveBtn').click(function () {
  1356.                         return true;
  1357.                     });
  1358.                 }
  1359.             });
  1360.  
  1361.             return false;
  1362.         });
  1363.  
  1364.  
  1365.     });
  1366. </script>