home *** CD-ROM | disk | FTP | other *** search
/ 61.19.244.139 / 61.19.244.139.zip / 61.19.244.139 / 2015-03-03 / views / export-policy.jsp < prev    next >
Text File  |  2015-03-03  |  8KB  |  262 lines

  1.  <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
  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. <spring:url value="/bui/get-policy-list-export" var="get_policy_list_exportUrl" htmlEscape="true" />
  8. <tiles:insertDefinition name="defaultTemplate">
  9.     <tiles:putAttribute name="body">
  10.         <ul class="breadcrumb">
  11.             <li><a href="#">α╕½α╕Öα╣ëα╕▓α╕½α╕Ñα╕▒α╕ü</a><span class="divider">»</span></li>
  12.             <li class="active">α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î </li>
  13.         </ul>
  14.         <div class="row-fluid">
  15.             <div class="span12 ">
  16.                 <div class=" widget-block">
  17.                     <div class="widget-head">
  18.                         <h5>
  19.                             <i class="black-icons  documents"></i> α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î
  20.                         </h5>
  21.                     </div>
  22.                     <div class="widget-content">
  23.  
  24.                         <div class="widget-searchbox">
  25.  
  26.                             <ul>
  27.                                 <li class="row-counts"><a class="btn btn-primary" id="exportBtn" href="#frm-box"> <i class="icon-share icon-white"></i> Export α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î
  28.                                 </a> </li>
  29.                                 <li class="right">
  30.  
  31.                                     <fieldset>
  32.  
  33.                                         <div class="control-group">
  34.                                             <div class="controls">
  35.                                                 <input class="input-small" type="text" id="policyIssueStartSearch" name="policyIssueStartSearch" placeholder="α╕ºα╕▒α╕Öα╕ùα╕╡α╣êα╕ùα╕│α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î "> - <input id="policyIssueEndSearch" name="policyIssueEndSearch"
  36.                                                     class="input-small" type="text" placeholder="α╕ºα╕▒α╕Öα╕ùα╕╡α╣êα╕ùα╕│α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î "> <a class="btn btn-info" id="btSearch"> <i class="icon-search icon-white"></i> α╕äα╣ëα╕Öα╕½α╕▓
  37.                                                 </a>
  38.                                             </div>
  39.                                         </div>
  40.  
  41.                                     </fieldset>
  42.  
  43.                                 </li>
  44.                             </ul>
  45.                         </div>
  46.                         <div class="widget-box">
  47.                             <div align="center" id='jqgrid'>
  48.                                 <table id='grid'></table>
  49.                                 <div id='pager'></div>
  50.                             </div>
  51.                         </div>
  52.  
  53.                     </div>
  54.                 </div>
  55.             </div>
  56.         </div>
  57.  
  58.          
  59.         <br/>
  60.         
  61.         <br/>
  62.         
  63.         <br/>
  64.         <div id="tableFrm"></div>
  65.         
  66.              
  67.         
  68.     </tiles:putAttribute>
  69.     <tiles:putAttribute name="customScript">
  70.  
  71.     </tiles:putAttribute>
  72.  
  73.     <tiles:putAttribute name="customScript">
  74.         <script type="text/javascript">
  75.    
  76.             function successFormat(cellvalue, options, rowObject) {
  77.                 return '<span class="label label-success">' + cellvalue + '</span>';
  78.  
  79.             }
  80.  
  81.             $(function() {
  82.  
  83.  
  84.                 $("#grid").jqGrid({
  85.                     url : '${get_policy_list_exportUrl}',
  86.                     datatype : 'json',
  87.                     mtype : 'GET',
  88.                     colNames : [ 'α╕½α╕íα╕▓α╕óα╣Çα╕Ñα╕éα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î', 'α╕òα╕▒α╕ºα╣üα╕ùα╕Ö', 'α╕ºα╕▒α╕Öα╣Çα╕úα╕┤α╣êα╕íα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç', 'α╕ºα╕▒α╕Öα╕¬α╕┤α╣ëα╕Öα╕¬α╕╕α╕öα╕äα╕╕α╣ëα╕íα╕äα╕úα╕¡α╕ç', 'α╕¢α╕úα╕░α╣Çα╕áα╕ùα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î', 'α╕ùα╕░α╣Çα╕Üα╕╡α╕óα╕Öα╕úα╕û','α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╕úα╕ºα╕í', 'α╕£α╕╣α╣ëα╣Çα╕¡α╕▓α╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕ó' ],
  89.                     colModel : [ {
  90.                         name : 'policyNo',
  91.                         index : 'policyNo',
  92.                         formatter : successFormat,
  93.                         width : 20,
  94.                         hidden : false
  95.                     }, {
  96.                         name : 'agentId',
  97.                         index : 'agentId',
  98.                         width : 10,
  99.  
  100.                         hidden : false,
  101.                         align : 'left'
  102.                     }, {
  103.                         name : 'beginDate',
  104.                         index : 'beginDate',
  105.                         width : 10,
  106.                         datefmt: "d-M-Y",
  107.                         formatoptions: {newformat:'d/m/Y'},
  108.                         formatter: function (cellval, opts, rowObject, action) {
  109.                             return $.fn.fmatter.call(
  110.                                       this,
  111.                                       "date",
  112.                                       new Date(cellval),
  113.                                       $.extend({}, $.jgrid.formatter.date, opts),
  114.                                       rowObject,
  115.                                       action);
  116.                         },
  117.                         align : 'center'
  118.                     }, {
  119.                         name : 'endDate',
  120.                         index : 'endDate',
  121.                         width : 10,
  122.                         hidden : false,
  123.                         datefmt: "d-M-Y",
  124.                         formatoptions: {newformat:'d/m/Y'},
  125.                         formatter: function (cellval, opts, rowObject, action) {
  126.                             return $.fn.fmatter.call(
  127.                                       this,
  128.                                       "date",
  129.                                       new Date(cellval),
  130.                                       $.extend({}, $.jgrid.formatter.date, opts),
  131.                                       rowObject,
  132.                                       action);
  133.                         },
  134.                         align : 'center'
  135.                     }, {
  136.                         name : 'polType',
  137.                         index : 'polType',
  138.                         width : 10,
  139.                         hidden : false,
  140.                         align : 'left'
  141.                     }, {
  142.                         name : 'vehLicense',
  143.                         index : 'vehLicense',
  144.                         width : 10,
  145.                         hidden : false,
  146.                         align : 'left'
  147.                     }, {
  148.                         name : 'totalPremium',
  149.                         index : 'totalPremium',
  150.                         width : 10,
  151.                         formatter: "number", sorttype: "number", align: "right"
  152.                          
  153.                     }, {
  154.                         name : 'insureName',
  155.                         index : 'insureName',
  156.                         width : 30,
  157.  
  158.                         align : 'left'
  159.                     } ],
  160.                     postData : {},
  161.                     rowNum : 20,
  162.                     rowList : [10, 20, 40, 60,100,200,300,500,1000],
  163.                     height : 380,
  164.                     autowidth : true,
  165.                     rownumbers : true,
  166.                     pager : '#pager',
  167.                     sortname : 'policyNo',
  168.                     viewrecords : true,
  169.                     sortorder : "asc",
  170.                     multiselect: true,
  171.                     emptyrecords : "Empty records",
  172.                     loadonce : false,
  173.                     loadComplete : function() {
  174.                     },
  175.                     jsonReader : {
  176.                         root : "rows",
  177.                         page : "page",
  178.                         total : "total",
  179.                         records : "records",
  180.                         repeatitems : false,
  181.                         cell : "cell",
  182.                         id : "policyNo"
  183.                     }
  184.                 });
  185.             });
  186.  
  187.             $('#btSearch').click(function() {
  188.  
  189.                 var f = {
  190.                     groupOp : "AND",
  191.                     rules : []
  192.                 };
  193.                 f.rules.push({
  194.                     field : "policyIssueStartSearch",
  195.                     op : "cn",
  196.                     data : $('#policyIssueStartSearch').val()
  197.                 });
  198.                 f.rules.push({
  199.                     field : "policyIssueEndSearch",
  200.                     op : "cn",
  201.                     data : $('#policyIssueEndSearch').val()
  202.                 });
  203.                 var grid = $('#grid');
  204.                 grid[0].p.search = f.rules.length > 0;
  205.                 $.extend(grid[0].p.postData, {
  206.                     filters : JSON.stringify(f)
  207.                 });
  208.                 grid.trigger("reloadGrid", [ {
  209.                     page : 1
  210.                 } ]);
  211.             });
  212.  
  213.              
  214.                 
  215.             $('#exportBtn').click(function() {
  216.                 var s;
  217.                 s = jQuery("#grid").jqGrid('getGridParam', 'selarrrow');
  218.  
  219.                 if (s!=null&&s.length>0) {
  220.                     $.ajax({
  221.                         type : "POST",
  222.                         url : "export-policy",
  223.                         data : JSON.stringify(s),
  224.                         contentType : "application/json",
  225.  
  226.                         success : function(data) {
  227.                             var url = "download-export-policy?filename=" + data;
  228.                             $('#grid').trigger("reloadGrid", [ {
  229.                                 page : 1
  230.                             } ]);
  231.                             $("body").append("<iframe src='" + url+ "' style='display: none;' ></iframe>");
  232.  
  233.                         },
  234.                         error : function(xhr, ajaxOptions, thrownError) {
  235.                             var obj = JSON.parse(xhr.responseText);
  236.                             alert(obj.errorMessages);
  237.                         }
  238.                     });
  239.  
  240.                 } else {
  241.                     alert("α╕üα╕úα╕╕α╕ôα╕▓α╣Çα╕Ñα╕╖α╕¡α╕ü α╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î");
  242.                 }
  243.                 return false;
  244.  
  245.             });
  246.             
  247.             $('#policyIssueEndSearch').datepicker({
  248.                 dateFormat : 'dd/mm/yy',
  249.                 maxDate : new Date()
  250.             });
  251.             $('#policyIssueStartSearch').datepicker({
  252.                 dateFormat : 'dd/mm/yy',
  253.                 maxDate : new Date()
  254.             });
  255.                  </script>
  256.          
  257.         
  258.     </tiles:putAttribute>
  259. </tiles:insertDefinition>
  260.  
  261.  
  262.