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