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-view.jsp < prev    next >
Text File  |  2015-03-03  |  62KB  |  1,322 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"/>
  230.                                             α╣Çα╕Ñα╕éα╣Çα╕äα╕úα╕╖α╣êα╕¡α╕çα╕óα╕Öα╕òα╣î
  231.                                             <form:input path="vehMachine" class="input-large" maxlength="35"/>
  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.  
  512.         function check_idcard(idcard) {
  513.             if (idcard.value == "") {
  514.                 return false;
  515.             }
  516.             if (idcard.length < 13) {
  517.                 return false;
  518.             }
  519.  
  520.             var num = str_split(idcard); // function α╣Çα╕₧α╕┤α╣êα╕íα╣Çα╕òα╕┤α╕í
  521.             var sum = 0;
  522.             var total = 0;
  523.             var digi = 13;
  524.  
  525.             for (i = 0; i < 12; i++) {
  526.                 sum = sum + (num[i] * digi);
  527.                 digi--;
  528.             }
  529.             total = ((11 - (sum % 11)) % 10);
  530.  
  531.             if (total == num[12]) { //alert('α╕úα╕½α╕▒α╕¬α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕¢α╕úα╕░α╕êα╕│α╕òα╕▒α╕ºα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Öα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕ç');
  532.                 return true;
  533.             } else { //alert('α╕úα╕½α╕▒α╕¬α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕¢α╕úα╕░α╕êα╕│α╕òα╕▒α╕ºα╕¢α╕úα╕░α╕èα╕▓α╕èα╕Öα╣äα╕íα╣êα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕ç');
  534.                 return false;
  535.             }
  536.         }
  537.  
  538.  
  539.         function checkID(id) {
  540.             if (id.length != 13)
  541.                 return false;
  542.             for (i = 0, sum = 0; i < 12; i++)
  543.                 sum += parseFloat(id.charAt(i)) * (13 - i);
  544.             if ((11 - sum % 11) % 10 != parseFloat(id.charAt(12)))
  545.                 return false;
  546.             return true;
  547.  
  548.         }
  549.  
  550. //        $("#issueDate").datepicker({dateFormat: 'dd/mm/yy', minDate: new Date()});
  551. //        $("#agreeDate").datepicker({dateFormat: 'dd/mm/yy', minDate: new Date()});
  552.  
  553.         $("#issueDate").prop('readonly', true);
  554.         $("#agreeDate").prop('readonly', true);
  555.  
  556.  
  557.         function daysInYear() {
  558.             var dateNow = new Date();
  559.             var year = dateNow.getYear();
  560.             year = year + 1;
  561.             if (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)) {
  562.                 // Leap year
  563.                 return 366;
  564.             } else {
  565.                 // Not a leap year
  566.                 return 365;
  567.             }
  568.         }
  569.  
  570.         $('#beginDate').datepicker({dateFormat: 'dd/mm/yy', minDate: new Date(), onSelect: function (selectedDate) {
  571.  
  572.  
  573.                 $("#endDate").datepicker("option", "minDate", selectedDate);
  574.  
  575.                 if ($('#premCalA').prop('checked')) {
  576.  
  577.                     $('#endDate').prop('readonly', true);
  578.  
  579.                     var enddate = $('#beginDate').datepicker('getDate', '+1y');
  580.                     enddate.setDate(enddate.getDate() + daysInYear());
  581.                     $('#endDate').datepicker('setDate', enddate);
  582.                     // $('#endDate').datepicker("destroy");;
  583.  
  584.                 } else {
  585.  
  586.                     $('#endDate').prop('readonly', false);
  587.                     /*     $('#endDate').datepicker({
  588.                      dateFormat : 'dd/mm/yy',
  589.                      onSelect : function(selectedDate) {
  590.                      $("#beginDate").datepicker("option", "maxDate", selectedDate);
  591.                      }
  592.                      }); */
  593.                 }
  594.  
  595.                 $("input[name=premCal]:radio").change();
  596.  
  597.             }
  598.         });
  599.  
  600.         $('#endDate').datepicker({
  601.             dateFormat: 'dd/mm/yy',
  602.             minDate: new Date(),
  603.             onSelect: function (selectedDate) {
  604.                 $("#beginDate").datepicker("option", "maxDate", selectedDate);
  605.                 $("input[name=premCal]:radio").change();
  606.             }
  607.         });
  608.  
  609.         //$('#beginDate').datepicker( {  dateFormat: 'dd/MM/yyyy' });
  610.         //$("#beginDate").datepicker("setDate", new Date());
  611.         //$('#endDate').datepicker({  dateFormat: 'dd/mm/yyyy' });
  612.         //$('#issueDate').datepicker( {  dateFormat: 'dd/mm/yyyy' });
  613.         //$('#agreeDate').datepicker({  dateFormat: 'dd/mm/yyyy' });
  614.  
  615.         $('#beginDate').change(function () {
  616.             var date1 = $('#beginDate').datepicker('getDate');
  617.             var date = new Date(Date.parse(date1));
  618.             date.setFullYear(date.getFullYear() + 1);
  619.  
  620.             var newDate = date.toDateString();
  621.             newDate = new Date(Date.parse(newDate));
  622.  
  623.             $('#date2').datepicker('setDate', newDate);
  624.         })
  625.  
  626.         $('#beginDate').on('change', function () {
  627.  
  628.         });
  629.  
  630.         $("#regId").blur(function () {
  631.  
  632.             if ($('input[name=insureType]:checked').val() == 'P' && !check_idcard(this.value)) {
  633.                 alert('α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕Üα╕▒α╕òα╕úα╣äα╕íα╣êα╕ûα╕╣α╕üα╕òα╣ëα╕¡α╕çα╕üα╕úα╕╕α╕ôα╕▓α╕òα╕úα╕ºα╕êα╕¬α╕¡α╕Üα╕¡α╕╡α╕üα╕äα╕úα╕▒α╣ëα╕ç');
  634.                 $("#regId").focus();
  635.             }
  636.  
  637.         });
  638.  
  639.         $('#tambol').on('change', function () {
  640.             if (this.value != '99') {
  641.                 $.ajax({
  642.                     type: "GET",
  643.                     dataType: "json",
  644.                     url: 'tambol?amphurCode=' + $('#amphur option:selected').val() + '&provCode=' + $('#province option:selected').val() + '&tambolCode=' + this.value,
  645.                     success: function (data) {
  646.  
  647.                         $('#zipcode').val(data.tabolZipcode);
  648.  
  649.                     },
  650.                     error: function (xhr, ajaxOptions, thrownError) {
  651.                         alert(xhr.status);
  652.                         alert(thrownError);
  653.                     }
  654.                 });
  655.             }
  656.         });
  657.  
  658.         $('#amphur').on('change', function () {
  659.             $.ajax({
  660.                 type: "GET",
  661.                 dataType: "json",
  662.                 url: 'tambol-list?amphurCode=' + this.value + '&provCode=' + $('#province option:selected').val(),
  663.                 success: function (data) {
  664.  
  665.                     $('#tambol').find('option').remove().end();
  666.                     $('#tambol').append(new Option('-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --', '99'));
  667.                     $.each(data, function () {
  668.                         $('#tambol').append(new Option(this.tambolName, this.tambolCode));
  669.                     });
  670.                     $('#tambol').change();
  671.  
  672.                 },
  673.                 error: function (xhr, ajaxOptions, thrownError) {
  674.                     alert(xhr.status);
  675.                     alert(thrownError);
  676.                 }
  677.             });
  678.  
  679.         });
  680.  
  681.         $('#province').on('change', function () {
  682.  
  683.             $.ajax({
  684.                 type: "GET",
  685.                 dataType: "json",
  686.                 url: 'amphur-list?provCode=' + this.value,
  687.                 success: function (data) {
  688.  
  689.                     $('#amphur').find('option').remove().end();
  690.                     $('#tambol').find('option').remove().end();
  691.  
  692.                     $('#amphur').append(new Option('-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --', '99'));
  693.  
  694.                     $.each(data, function () {
  695.                         $('#amphur').append(new Option(this.amphurName, this.amphurCode));
  696.                     });
  697.                     $('#amphur').change();
  698.                 },
  699.                 error: function (xhr, ajaxOptions, thrownError) {
  700.                     alert(xhr.status);
  701.                     alert(thrownError);
  702.                 }
  703.             });
  704.  
  705.         });
  706.         $('#vehSize').on('change', function () {
  707.  
  708.             $.ajax({
  709.                 type: "GET",
  710.                 dataType: "json",
  711.                 url: 'veh-model-list?vehmCode=' + this.value,
  712.                 success: function (data) {
  713.                     $('#vehChassisModel').find('option').remove().end();
  714.  
  715.                     $.each(data, function () {
  716.                         $('#vehChassisModel').append(new Option(this.vehmDesc, this.vehmType));
  717.                     });
  718.  
  719.                 },
  720.                 error: function (xhr, ajaxOptions, thrownError) {
  721.                     alert(xhr.status);
  722.                     alert(thrownError);
  723.                 }
  724.             });
  725.         });
  726.  
  727.         $('#vehBrand').on('change', function () {
  728.  
  729.             $('#vehBrandmodel').find('option').remove().end();
  730.  
  731.             if (packageCode.allBrand != 'Y') {
  732.                 $.each(vehBrandmodel, function () {
  733.  
  734.                     if ($('#vehBrand option:selected').val() == this.brand) {
  735.  
  736.                         $('#vehBrandmodel').append(new Option(this.model, this.model));
  737.                     }
  738.  
  739.                 });
  740.             } else {
  741.  
  742.                 $.each(vehBrandmodel, function () {
  743.  
  744.                     if ($('#vehBrand option:selected').val() == this.brandId) {
  745.  
  746.                         $('#vehBrandmodel').append(new Option(this.modelName, this.modelName));
  747.                     }
  748.  
  749.                 });
  750.  
  751.             }
  752.  
  753.         });
  754.         $('#packageCode').on('change', function () {
  755.  
  756.             $.ajax({
  757.                 type: "GET",
  758.                 dataType: "json",
  759.                 url: 'get-packageH-detail?packageCode=' + encodeURIComponent(this.value),
  760.                 success: function (data) {
  761.  
  762.                     packageCode = data;
  763.                     //brand Model
  764.  
  765.                     //    data.totalPremium;
  766.  
  767.                     $('#vehBrand').find('option').remove().end();
  768.  
  769.                     vehBrandmodel = data.brandmodels;
  770.                     vehBrand = {};
  771.  
  772.                     if (data.allBrand != 'Y') {
  773.                         $.each(vehBrandmodel, function () {
  774.  
  775.                             if (!(this.brand in vehBrand)) {
  776.                                 $('#vehBrand').append(new Option(this.brand, this.brand));
  777.                                 vehBrand[this.brand] = this.brand;
  778.                             }
  779.  
  780.                         });
  781.                     } else {
  782.  
  783.                         $.ajax({
  784.                             type: "GET",
  785.                             dataType: "json",
  786.                             url: 'vehBrandmodel-list',
  787.                             success: function (data2) {
  788.                                 vehBrandmodel = data2;
  789.                                 $.each(data2, function () {
  790.  
  791.                                     if (!(this.brandId in vehBrand)) {
  792.                                         $('#vehBrand').append(new Option(this.brandId, this.brandId));
  793.                                         vehBrand[this.brandId] = this.brandId;
  794.                                     }
  795.  
  796.                                 });
  797.  
  798.                                 $('#vehBrand').change();
  799.                             }
  800.                         });
  801.  
  802.                     }
  803.  
  804.  
  805.  
  806.                     //vehSize
  807.                     $('#vehSize').find('option').remove().end();
  808.                     var vv = '';
  809.  
  810.  
  811.                     if (data.allVehCode != 'Y') {
  812.  
  813.                         $.each(data.vehSizeBeans, function () {
  814.                             $('#vehSize').append(new Option(this.vehSizeDesc, this.vehSize + "|" + this.vehCode));
  815.                             if (vv == '') {
  816.                                 vv = this.vehSize + "|" + this.vehCode;
  817.                             }
  818.                         });
  819.  
  820.                     } else {
  821.  
  822.                         $.ajax({
  823.                             type: "GET",
  824.                             dataType: "json",
  825.                             url: 'veh-size-list',
  826.                             success: function (data2) {
  827.                                 vehBrandmodel = data2;
  828.  
  829.                                 $.each(data2, function () {
  830.                                     $('#vehSize').append(new Option(this.vehSizeDesc, this.vehSize + "|" + this.vehCode));
  831.                                     if (vv == '') {
  832.                                         vv = this.vehSize + "|" + this.vehCode;
  833.                                     }
  834.                                 });
  835.                             }
  836.                         });
  837.  
  838.                     }
  839.  
  840.                     if (vv != '') {
  841.                         $.ajax({
  842.                             type: "GET",
  843.                             dataType: "json",
  844.                             url: 'veh-model-list?vehmCode=' + vv,
  845.                             success: function (data) {
  846.                                 $('#vehChassisModel').find('option').remove().end();
  847.                                 $.each(data, function () {
  848.                                     $('#vehChassisModel').append(new Option(this.vehmDesc, this.vehmType));
  849.                                 });
  850.  
  851.                             },
  852.                             error: function (xhr, ajaxOptions, thrownError) {
  853.                                 alert(xhr.status);
  854.                                 alert(thrownError);
  855.                             }
  856.                         });
  857.  
  858.                     }
  859.  
  860.                     //cover Table
  861.                     coverages = data.coverages;
  862.                     var coveragesTable = '';
  863.  
  864.                     $.each(coverages, function () {
  865.  
  866.                         coveragesTable += '<tr class="odd">';
  867.  
  868.                         coveragesTable += '<td class="span4 text-left">' + this.covCode + ':' + this.covName;
  869.  
  870.                         coveragesTable += '</td>';
  871.                         coveragesTable += '<td class=" "> ';
  872.  
  873.                         if (!this.enableSumOfPol) {
  874.                             coveragesTable += '-';
  875.  
  876.                         } else {
  877.                             coveragesTable += this.sumOfPol.toLocaleString();
  878.                         }
  879.  
  880.                         coveragesTable += '</td>';
  881.                         coveragesTable += '<td class="center ">';
  882.                         if (!this.enableSumOfTimes) {
  883.                             coveragesTable += '-';
  884.  
  885.                         } else {
  886.                             coveragesTable += this.sumOfTimes.toLocaleString();
  887.                         }
  888.                         coveragesTable += '</td>';
  889.                         coveragesTable += '<td class="center ">';
  890.                         if (!this.enableSumOfPerson) {
  891.                             coveragesTable += '-';
  892.  
  893.                         } else {
  894.                             coveragesTable += this.sumOfPerson.toLocaleString();
  895.                         }
  896.                         coveragesTable += '</td>';
  897.                         coveragesTable += '<td class="center ">';
  898.                         if (!this.enableNoPerson) {
  899.                             coveragesTable += '-';
  900.  
  901.                         } else {
  902.                             coveragesTable += this.noPerson.toLocaleString();
  903.                         }
  904.                         coveragesTable += '</td>';
  905.                         coveragesTable += '<td class="center ">';
  906.                         if (!this.enableDeduct) {
  907.                             coveragesTable += '-';
  908.  
  909.                         } else {
  910.                             coveragesTable += this.deduct.toLocaleString();
  911.                         }
  912.  
  913.                         coveragesTable += '</td>';
  914.  
  915.                         coveragesTable += '</tr>';
  916.  
  917.                     });
  918.                     $('#coverContent').html("");
  919.                     $(coveragesTable).appendTo('#coverContent');
  920.                     //end cover table;
  921.  
  922.                     //driver tab
  923.  
  924.                     $(".driverT").prop('disabled', !(data.drivrers == 'Y'));
  925.  
  926.                     if (data.annualFlag == 'Y') {
  927.  
  928.                         $('#premCalA').prop('checked', true);
  929.                         $('#premCalP').prop('disabled', true);
  930.                         $('#premCalS').prop('disabled', true);
  931.  
  932.                         $("#endDate").prop('readonly', true);
  933.                         $('#endDate').datepicker('disable');
  934.  
  935.                     } else {
  936.                         //$("input[type=radio]").attr('disabled', false);
  937.                         $('#premCalP').prop('disabled', !(data.prorata == 'Y'));
  938.                         $('#premCalS').prop('disabled', !(data.shortrate == 'Y'));
  939.                         $('#endDate').datepicker('disable');
  940.  
  941.                     }
  942.                     if (data.insureType == 'Y') {
  943.                         $('#insureTypeP').prop('checked', true);
  944.                         $('#insureTypeO').prop('disabled', true);
  945.                         $('#insureTypeC').prop('disabled', true);
  946.  
  947.                         $('#branchMain').prop('disabled', true);
  948.                         $('#branch').prop('disabled', true);
  949.  
  950.                     } else {
  951.                         // $('#insureTypeP').prop('checked', true);
  952.                         $('#insureTypeO').prop('disabled', false);
  953.                         $('#insureTypeC').prop('disabled', false);
  954.  
  955.                         $('#branchMain').prop('disabled', false);
  956.                         $('#branch').prop('disabled', false);
  957.  
  958.                     }
  959.  
  960.                     //                        data.allVehCode;
  961.                     //                        data.allBrand;
  962.                     //                        data.allGroup;
  963.                     //                        data.prorata;
  964.                     //                        data.shortrate;
  965.                     //                        ; 
  966.  
  967.                     $('#vehBrand').change();
  968.  
  969.                     //premium
  970.                     $("input[name=premCal]:radio").change();
  971.                     /* if ($('#premCalA').prop('checked')) {
  972.                      
  973.                      $('#annualPrem').val(data.totalPremium);
  974.                      $('#netPremium').val(data.netPremium);
  975.                      $('#totalPremium').val(data.totalPremium);
  976.                      $('#feeAmt').val(data.fee);
  977.                      $('#vatAmt').val(data.vatAmt);
  978.                      
  979.                      } else if ($('#premCalP').prop('checked')) {
  980.                      
  981.                      var netPremium = data.netPremium;
  982.                      var bDate = ('#beginDate').datepicker("getDate") ;
  983.                      var eDate = ('#endDate').datepicker("getDate");
  984.                      //alert((eDate- bDate) /( 86400 * 1000));
  985.                      
  986.                      $('#annualPrem').val(data.totalPremium);
  987.                      $('#netPremium').val(data.netPremium);
  988.                      $('#totalPremium').val(data.totalPremium);
  989.                      $('#feeAmt').val(data.fee);
  990.                      $('#vatAmt').val(data.vatAmt);
  991.                      
  992.                      } else if ($('#premCalS').prop('checked')) {
  993.                      
  994.                      
  995.                      $('#annualPrem').val(data.totalPremium);
  996.                      $('#netPremium').val(data.netPremium);
  997.                      $('#totalPremium').val(data.totalPremium);
  998.                      $('#feeAmt').val(data.fee);
  999.                      $('#vatAmt').val(data.vatAmt);
  1000.                      }
  1001.                      */
  1002.                     $('.autoNumber').autoNumeric('init', {
  1003.                         aSep: ',',
  1004.                         aDec: '.',
  1005.                         vMin: '0.00',
  1006.                         vMax: '1000000000.00'
  1007.                     });
  1008.  
  1009.                     //documents
  1010.                     if (data.loadDoc != 'Y') {
  1011.  
  1012.                         //disable loaddocs
  1013.                     }
  1014.  
  1015.                 },
  1016.                 error: function (xhr, ajaxOptions, thrownError) {
  1017.                     alert(xhr.status);
  1018.                     alert(thrownError);
  1019.                 }
  1020.             });
  1021.  
  1022.         });
  1023.  
  1024.         $('#insureTypeP').on('change', function () {
  1025.             $.ajax({
  1026.                 type: "GET",
  1027.                 dataType: "json",
  1028.                 url: 'title-list?type=P',
  1029.                 success: function (data) {
  1030.  
  1031.                     $('#insureTitle').find('option').remove().end();
  1032.                     $.each(data, function () {
  1033.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1034.                     });
  1035.                     ;
  1036.                 },
  1037.                 error: function (xhr, ajaxOptions, thrownError) {
  1038.                     alert(xhr.status);
  1039.                     alert(thrownError);
  1040.                 }
  1041.             });
  1042.             $('#branchMain').prop('disabled', true);
  1043.             $('#branch').prop('disabled', true);
  1044.         });
  1045.  
  1046.         $('#insureTypeC').on('change', function () {
  1047.             $.ajax({
  1048.                 type: "GET",
  1049.                 dataType: "json",
  1050.                 url: 'title-list?type=C',
  1051.                 success: function (data) {
  1052.  
  1053.                     $('#insureTitle').find('option').remove().end();
  1054.                     $.each(data, function () {
  1055.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1056.                     });
  1057.                     ;
  1058.                 },
  1059.                 error: function (xhr, ajaxOptions, thrownError) {
  1060.                     alert(xhr.status);
  1061.                     alert(thrownError);
  1062.                 }
  1063.             });
  1064.             $('#branch').prop('disabled', false);
  1065.             $('#branchMain').prop('disabled', false);
  1066.             $('#branchMain').prop('checked', true);
  1067.         });
  1068.  
  1069.         $('#insureTypeO').on('change', function () {
  1070.             $.ajax({
  1071.                 type: "GET",
  1072.                 dataType: "json",
  1073.                 url: 'title-list?type=O',
  1074.                 success: function (data) {
  1075.  
  1076.                     $('#insureTitle').find('option').remove().end();
  1077.                     $.each(data, function () {
  1078.                         $('#insureTitle').append(new Option(this.refDesc1, this.refCode));
  1079.                     });
  1080.                     ;
  1081.                 },
  1082.                 error: function (xhr, ajaxOptions, thrownError) {
  1083.                     alert(xhr.status);
  1084.                     alert(thrownError);
  1085.                 }
  1086.             });
  1087.             $('#branchMain').prop('disabled', false);
  1088.             $('#branch').prop('disabled', false);
  1089.         });
  1090.  
  1091.         $('#reciptionName').on('change', function () {
  1092.  
  1093.             var addressCopy = '';
  1094.  
  1095.             if ($('#reciptionName').prop('checked')) {
  1096.  
  1097.                 $('#receiptName').val($('#insureTitle option:selected').text() + "  " + $('#insureName').val());
  1098.                 $('#receiptAddress1').val($('#address').val());
  1099.                 if ($('#province option:selected').text() == 'α╕üα╕úα╕╕α╕çα╣Çα╕ùα╕₧α╕íα╕½α╕▓α╕Öα╕äα╕ú') {
  1100.  
  1101.                     if ($('#tambol option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1102.                         addressCopy += 'α╣üα╕éα╕ºα╕ç' + $('#tambol option:selected').text();
  1103.                     }
  1104.                     if ($('#amphur option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1105.                         addressCopy += '  α╣Çα╕éα╕ò' + $('#amphur option:selected').text();
  1106.                     }
  1107.  
  1108.                     addressCopy += '  ' + $('#province option:selected').text();
  1109.                     addressCopy += '  ' + $('#zipcode').val();
  1110.  
  1111.                     $('#receiptAddress2').val(addressCopy);
  1112. //                    $('#receiptAddress2').val(" α╣üα╕éα╕ºα╕ç" + $('#tambol option:selected').text() + " α╣Çα╕éα╕ò" + $('#amphur option:selected').text() + " " + $('#province option:selected').text());
  1113.  
  1114.                 } else {
  1115.  
  1116.                     if ($('#tambol option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1117.                         addressCopy += 'α╕òα╕│α╕Üα╕Ñ' + $('#tambol option:selected').text();
  1118.                     }
  1119.                     if ($('#amphur option:selected').text() != '-- α╣äα╕íα╣êα╕úα╕░α╕Üα╕╕ --') {
  1120.                         addressCopy += '  α╕¡α╕│α╣Çα╕áα╕¡' + $('#amphur option:selected').text();
  1121.                     }
  1122.  
  1123.                     addressCopy += '  α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕ö' + $('#province option:selected').text();
  1124.                     addressCopy += '  ' + $('#zipcode').val();
  1125.  
  1126.                     $('#receiptAddress2').val(addressCopy);
  1127.  
  1128. //                    $('#receiptAddress2').val(" α╕òα╕│α╕Üα╕Ñ" + $('#tambol option:selected').text() + " α╕¡α╕│α╣Çα╕áα╕¡" + $('#amphur option:selected').text() + " α╕êα╕▒α╕çα╕½α╕ºα╕▒α╕ö" + $('#province option:selected').text());
  1129.  
  1130.                 }
  1131.                 $('#receiptName').prop('readonly', true);
  1132.                 $('#receiptAddress1').prop('readonly', true);
  1133.                 $('#receiptAddress2').prop('readonly', true);
  1134.             } else {
  1135.  
  1136.                 /* $('#receiptName').val('');
  1137.                  $('#receiptAddress1').val('');
  1138.                  $('#receiptAddress2').val(''); */
  1139.                 $('#receiptName').prop('readonly', false);
  1140.                 $('#receiptAddress1').prop('readonly', false);
  1141.                 $('#receiptAddress2').prop('readonly', false);
  1142.  
  1143.  
  1144.             }
  1145.  
  1146.         });
  1147.  
  1148.  
  1149.         $("input[name=premCal]:radio").change(function () {
  1150.  
  1151.             var netPremium = packageCode.netPremium;
  1152.             var freeAmt = packageCode.fee;
  1153.             var vatAmt = packageCode.vatAmt;
  1154.             var totalPremium = packageCode.totalPremium;
  1155.             var annualPrem = packageCode.totalPremium; // α╣Çα╕Üα╕╡α╣ëα╕óα╕ùα╕▒α╣ëα╕çα╣Çα╕Üα╕╡α╣ëα╕ó
  1156.  
  1157.             var bDate = $('#beginDate').datepicker("getDate");
  1158.             var eDate = $('#endDate').datepicker("getDate");
  1159.             var difDate;
  1160.  
  1161.             if ($("input[name=premCal]:checked").val() != 'A') {
  1162.  
  1163.                 if ($("input[name=premCal]:checked").val() == 'P') {
  1164.                     difDate = (eDate - bDate) / (86400 * 1000);
  1165.                     netPremium = difDate * netPremium / 365;
  1166.  
  1167.                 } else if ($("input[name=premCal]:checked").val() == 'S') {
  1168.  
  1169.                     difDate = 1 + (eDate - bDate) / (86400 * 1000);
  1170.                     $.ajax({
  1171.                         type: "GET",
  1172.                         dataType: "json",
  1173.                         url: 'get-short-rate?days=' + difDate,
  1174.                         success: function (moShtRntBean) {
  1175.                             netPremium = netPremium * moShtRntBean.srShtPercent / 100;
  1176.                         }
  1177.                     });
  1178.                 }
  1179.  
  1180.  
  1181.                 var f = (netPremium * feeRate);
  1182.                 freeAmt = Math.ceil(f);
  1183.                 vatAmt = inprecise_round(((parseFloat(netPremium) + parseInt(freeAmt)) * vatRate) / 100, 2);
  1184.                 totalPremium = parseFloat(netPremium) + parseFloat(freeAmt) + parseFloat(vatAmt);
  1185.             }
  1186.  
  1187.             $('#annualPrem').val(annualPrem);
  1188.             $('#netPremium').val(netPremium);
  1189.             $("#feeAmt").val(freeAmt);
  1190.             $("#vatAmt").val(vatAmt);
  1191.             $("#totalPremium").val(totalPremium);
  1192.         });
  1193.  
  1194.         function inprecise_round(value, decPlaces) {
  1195.             return Math.round(value * Math.pow(10, decPlaces)) / Math.pow(10, decPlaces);
  1196.         }
  1197.  
  1198. //        $('#province').change();
  1199.  
  1200.         $('#packageCode').change();
  1201.  
  1202.         $("#packageCode").select2({
  1203.             width: 'resolve'
  1204.         });
  1205.  
  1206.         $("#driver1OccuCode").select2({
  1207.             width: 'resolve'
  1208.         });
  1209.         $("#driver2OccuCode").select2({
  1210.             width: 'resolve'
  1211.         });
  1212.         $("#driver1Title").select2({
  1213.             width: 'resolve'
  1214.         });
  1215.         $("#driver2Title").select2({
  1216.             width: 'resolve'
  1217.         });
  1218.         $("#occuCode").select2({
  1219.             width: 'resolve'
  1220.         });
  1221.         $("#insureTitle").select2({
  1222.             width: 'resolve'
  1223.         });
  1224.         $("#province").select2({
  1225.             width: 'resolve'
  1226.         });
  1227.         $("#amphur").select2({
  1228.             width: 'resolve'
  1229.         });
  1230.         $("#tambol").select2({
  1231.             width: 'resolve'
  1232.         });
  1233.  
  1234.         $('#driver1DateofBirth').datepicker({
  1235.             dateFormat: 'dd/mm/yy',
  1236.             minDate: new Date()
  1237.         });
  1238.         $('driver2DateofBirth').datepicker({
  1239.             dateFormat: 'dd/mm/yy',
  1240.             minDate: new Date()
  1241.         });
  1242.         $('.autoInt').autoNumeric('init', {
  1243.             aSep: '',
  1244.             aPad: false,
  1245.             vMin: '0',
  1246.             vMax: '99999'
  1247.         });
  1248.         //$("#frmPolicy").preventDoubleSubmission();
  1249.  
  1250.     <%if (request.getParameter("policyNo") == null) {%>
  1251.  
  1252.     <%} else {%>
  1253.         alert('α╕öα╕╣α╕úα╕▓α╕óα╕Ñα╕░α╣Çα╕¡α╕╡α╕óα╕ö');
  1254.         $('#amphur').val('${policyBean.tambol}');
  1255.         //$('#amphur').change();
  1256.         $('#tambol').val('${policyBean.amphur}');
  1257.         $('#vehBrand').val('${policyBean.vehBrand}');
  1258.         $('#vehBrand').change();
  1259.         $('#vehBrandmodel').val('${policyBean.vehBrandmodel}');
  1260.  
  1261.         $('#vehSize').val(${policyBean.vehSize} + '|' +${policyBean.vehCode});
  1262.         $('#vehChassisModel').val(${policyBean.vehChassisModel});
  1263.  
  1264.     <%}%>
  1265.  
  1266.  
  1267.         $("#frmPolicy").submit(function () {
  1268.  
  1269.             $('#saveBtn').click(function () {
  1270.                 return false;
  1271.             });
  1272.  
  1273.             var form = $(this);
  1274.             $('input').each(function (i) {
  1275.                 var self = $(this);
  1276.                 try {
  1277.                     var v = self.autoNumeric('get');
  1278.                     self.autoNumeric('destroy');
  1279.                     self.val(v);
  1280.                 } catch (err) {
  1281.                     console.log("Not an autonumeric field: " + self.attr("name"));
  1282.                 }
  1283.             });
  1284.  
  1285.             //$("saveBtn").prop('disabled', true);
  1286.             var url = "updatePolicy";
  1287.             $.ajax({
  1288.                 type: "POST",
  1289.                 url: url,
  1290.                 data: $("#frmPolicy").serialize(),
  1291.                 success: function (data) {
  1292.  
  1293.                     $('#grid').trigger("reloadGrid", [{
  1294.                             page: 1
  1295.                         }]);
  1296.                     //$('#tableFrm').dialog('close');
  1297.                     $("#saveBtn").unbind();
  1298.                     $('#saveBtn').click(function () {
  1299.                         return true;
  1300.                     });
  1301.  
  1302.                     updateCreditMenu();
  1303.  
  1304.  
  1305.                     $('#tableFrm').dialog('close');
  1306.                 },
  1307.                 error: function (xhr, ajaxOptions, thrownError) {
  1308.  
  1309.                     var obj = JSON.parse(xhr.responseText);
  1310.                     alert(obj.errorMessages);
  1311.                     $("#saveBtn").unbind();
  1312.                     $('#saveBtn').click(function () {
  1313.                         return true;
  1314.                     });
  1315.                 }
  1316.             });
  1317.  
  1318.             return false;
  1319.         });
  1320.  
  1321.     });
  1322. </script>