home *** CD-ROM | disk | FTP | other *** search
/ 61.19.244.139 / 61.19.244.139.zip / 61.19.244.139 / 2015-02-19 / views / package-setup.jsp < prev    next >
Text File  |  2015-02-19  |  13KB  |  417 lines

  1.  
  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.  
  6. <spring:url value="/bui/get-package-list" var="get_package_listUrl"    htmlEscape="true" />
  7. <tiles:insertDefinition name="defaultTemplate">
  8.     <tiles:putAttribute name="body">
  9.  
  10.  
  11.         <ul class="breadcrumb">
  12.             <li><a href="#">α╕½α╕Öα╣ëα╕▓α╕½α╕Ñα╕▒α╕ü</a><span class="divider">»</span></li>
  13.             <li class="active">α╕üα╕│α╕½α╕Öα╕öα╕úα╕▓α╕óα╕Ñα╕░α╣Çα╕¡α╕╡α╕óα╕ö Package</li>
  14.         </ul>
  15.         <div class="dashboard-widget">
  16.             <div class="row-fluid">
  17.  
  18.                 <div class="span12 ">
  19.                     <div class=" widget-block">
  20.                         <div class="widget-head">
  21.                             <h5>
  22.                                 <i class="black-icons  documents"></i> α╕úα╕▓α╕óα╕Ñα╕░α╣Çα╕¡α╕╡α╕óα╕ö Package
  23.                             </h5>
  24.                         </div>
  25.                         <div class="widget-content">
  26.  
  27.                             <div class="widget-searchbox">
  28.  
  29.                                 <ul>
  30.                                     <li class="row-counts"><a class="btn btn-success" id="addBtn" href="#frm-box"> <i class="icon-plus icon-white"></i> α╣Çα╕₧α╕┤α╣êα╕í
  31.                                     </a> <a class="btn btn-primary" id="editBtn"> <i class="icon-pencil icon-white"></i> α╣üα╕üα╣ëα╣äα╕é
  32.                                     </a> <a class="btn  btn-danger" id="delBtn"> <i class="icon-trash icon-white"></i> α╕Ñα╕Ü
  33.                                     </a></li>
  34.                                     <li class="right">
  35.                                         <form>
  36.                                             <fieldset>
  37.  
  38.                                                 <div class="control-group">
  39.                                                     <div class="controls">
  40.                                                         <input class="input-small" type="text" id="packageStart" name="packageStart" placeholder="α╕úα╕½α╕▒α╕¬ PACKAGE"> - <input id="packageEnd" name="packageEnd" class="input-small"
  41.                                                             type="text" placeholder="α╕úα╕½α╕▒α╕¬ PACKAGE"> <a class="btn btn-info" id="btSearch"  > <i class="icon-search icon-white"></i> α╕äα╣ëα╕Öα╕½α╕▓
  42.                                                         </a>
  43.                                                     </div>
  44.                                                 </div>
  45.                                             </fieldset>
  46.                                         </form>
  47.                                     </li>
  48.                                 </ul>
  49.                             </div>
  50.                             <div class="widget-box">
  51.                                 <div align="center" id='jqgrid'>
  52.                                     <table id='grid'></table>
  53.                                     <div id='pager'></div>
  54.                                 </div>
  55.  
  56.  
  57.                             </div>
  58.  
  59.                         </div>
  60.                     </div>
  61.                 </div>
  62.  
  63.             </div>
  64.         </div>
  65.  
  66.          
  67.         
  68.         <div id="tableFrm"></div>
  69.     </tiles:putAttribute>
  70.     <tiles:putAttribute name="customScript">
  71.  
  72.         <script>
  73.             $(function() {
  74.  
  75.  
  76.                   $('#btSearch').click(function() {
  77.                      //alert( $('#packageStart').val() +'-'+$('#packageEnd').val());
  78.  
  79.                       var f = { groupOp: "AND", rules: [] };
  80.                       f.rules.push({ field: "packageStart", op: "cn", data: $('#packageStart').val() });
  81.                       f.rules.push({ field: "packageEnd", op: "cn", data: $('#packageEnd').val() });
  82.                       var grid = $('#grid');
  83.                          grid[0].p.search = f.rules.length > 0;
  84.                         $.extend(grid[0].p.postData, { filters: JSON.stringify(f) });
  85.                         grid.trigger("reloadGrid", [{ page: 1 }]);
  86.                   });    
  87.                     
  88.                   $('#vehcodes').multiSelect({
  89.                       afterSelect: function(values){
  90.                        
  91.                       },
  92.                       afterDeselect: function(values){
  93.                       
  94.                       },
  95.                       selectableHeader: "<div class='custom-header'>α╕úα╕½α╕▒α╕¬α╕úα╕ûα╕óα╕Öα╕òα╣îα╕ùα╕▒α╣ëα╕çα╕½α╕íα╕ö</div>",
  96.                       selectionHeader: "<div class='custom-header'>α╕úα╕½α╕▒α╕¬α╕úα╕ûα╕óα╕Öα╕òα╣îα╕¬α╕│α╕½α╕úα╕▒α╕Ü Package</div>",
  97.                       
  98.                     }); 
  99.  
  100.  
  101.  
  102.                 /*   $.getJSON("veh-size-list",{vehsize: $(this).val()}, function(j){
  103.                       var options = '';
  104.                        
  105.                       for (var i = 0; i < j.length; i++) {
  106.                           var indexValue = j[i].mainClass + '|'+j[i].vehSize+'|'+j[i].vehCode;
  107.                           $('#vehcodes').multiSelect('addOption', { value: indexValue, text: j[i].vehCode+' '+ j[i].vehSizeDesc, index: i  }); 
  108.                           
  109.                            //$('#vehcodes').multiSelect('select', indexValue);
  110.                        
  111.                       }
  112.                       
  113.                     }); */
  114.  
  115.                     
  116.                   /* $.getJSON("vehBrandmodel-list",{vehBrandmodel: $(this).val()}, function(j){
  117.                       var options = '';
  118.                        
  119.                       for (var i = 0; i < j.length; i++) {
  120.                           var indexValue = j[i].brandId + '|'+j[i].modelName ;
  121.                           var textValue = j[i].brandId + '->'+j[i].modelName ;
  122.                           $('#brandmodels').multiSelect('addOption', { value: indexValue, text: textValue, index: i  }); 
  123.                           
  124.                        
  125.                       }
  126.                       
  127.                     }); 
  128.                      
  129.                 $('#brandmodels').multiSelect({
  130.                       afterSelect: function(values){
  131.                      
  132.                       },
  133.                       afterDeselect: function(values){
  134.                        
  135.                       },
  136.                       selectableHeader: "<div class='custom-header'>α╕úα╕ûα╕óα╕Öα╕òα╣îα╕ùα╕▒α╣ëα╕çα╕½α╕íα╕ö</div>",
  137.                       selectionHeader: "<div class='custom-header'>α╕úα╕ûα╕óα╕Öα╕òα╣îα╕¬α╕│α╕½α╕úα╕▒α╕Ü  Package</div>"
  138.                     });*/
  139.                 
  140.                 
  141.                 $("#grid").jqGrid(
  142.                         {
  143.                             url : '${get_package_listUrl}',
  144.                             datatype : 'json',
  145.                             mtype : 'GET',
  146.                             colNames : [ 'α╕úα╕½α╕▒α╕¬ PACKAGE', 'α╕ºα╕▒α╕Öα╣Çα╕úα╕┤α╣êα╕í',
  147.                                     'α╕ºα╕▒α╕Öα╕¬α╕┤α╣ëα╕Öα╕¬α╕╕α╕ö', 'α╕¢α╕úα╕░α╣Çα╕áα╕ùα╕üα╕úα╕íα╕ÿα╕úα╕úα╕íα╣î',
  148.                                     'α╣Çα╕Üα╕╡α╣ëα╕óα╕¢α╕úα╕░α╕üα╕▒α╕Öα╕áα╕▒α╕óα╕úα╕ºα╕í', 'Action' ],
  149.                             colModel : [ {
  150.                                 name : 'packageCode',
  151.                                 index : 'packageCode',
  152.                                 width : 55, 
  153.                                  
  154.                                 hidden : false,
  155.                                 formatter : packageCodeFormat
  156.                             }, {
  157.                                 name : 'startDate',
  158.                                 index : 'packageCode',
  159.                                 width : 50, 
  160.                                 hidden : false,
  161.                                 formatter : dateFormat,
  162.                                 align : 'center'
  163.                             }, {
  164.                                 name : 'endDate',
  165.                                 index : 'packageCode',
  166.                                 width : 50,
  167.                                  
  168.                                 hidden : false,
  169.                                 formatter : dateFormat,
  170.                                 align : 'center'
  171.                             }, {
  172.                                 name : 'polType',
  173.                                 index : 'polType',
  174.                                 width : 100,
  175.                                  
  176.                                 hidden : false
  177.                             }, {
  178.                                 name : 'totalPremium',
  179.                                 index : 'totalPremium',
  180.                                 width : 60,
  181.                                 formatter : 'number',
  182.                                 hidden : false,
  183.                                 align : 'right'
  184.                             }, {
  185.                                 name : 'action',
  186.                                 index : 'packageCode',
  187.                                 width : 100,
  188.                                  
  189.                                 formatter : actionFormat,
  190.                                 align : 'center',
  191.                                 hidden : true
  192.                             } ],
  193.                             postData : {},
  194.                             rowNum : 10,
  195.                             rowList : [ 10, 20, 40, 60 ],
  196.                             height : 240,
  197.                             autowidth : true,
  198.                             rownumbers : true,
  199.                             pager : '#pager',
  200.                             sortname : 'packageCode',
  201.                             viewrecords : true,
  202.                             sortorder : "asc",
  203.                             //caption:"α╕úα╕▓α╕óα╕Ñα╕░α╣Çα╕¡α╕╡α╕óα╕ö Package ",
  204.                             emptyrecords : "Empty records",
  205.                             loadonce : false,
  206.                             loadComplete : function() {
  207.                             },
  208.                             jsonReader : {
  209.                                 root : "rows",
  210.                                 page : "page",
  211.                                 total : "total",
  212.                                 records : "records",
  213.                                 repeatitems : false,
  214.                                 cell : "cell",
  215.                                 id : "packageCode"
  216.                             }
  217.                         });
  218.  
  219.             });
  220.  
  221.             function dateFormat(cellvalue, options, rowObject) {
  222.                 var d = new Date(cellvalue);
  223.                 return d.customFormat("#DD#/#MM#/#YYYY#");
  224.             }
  225.             function digitFormat(cellvalue, options, rowObject) {
  226.                   return cellvalue;
  227.                 }
  228.             function packageCodeFormat(cellvalue, options, rowObject) {
  229.                 return '<span class="label label-success">' + cellvalue
  230.                         + '</span>';
  231.             }
  232.  
  233.             function actionFormat(cellvalue, options, rowObject) {
  234.                 return '<div class="btn-group" align="center">  <button class="btn btn-warning">α╣üα╕üα╣ëα╣äα╕é</button> <button class="btn btn-dange" onClick="javaScript:confirm(\'α╕óα╕╖α╕Öα╕óα╕▒α╕Öα╕üα╕▓α╕úα╕Ñα╕Üα╕éα╣ëα╕¡α╕íα╕╣α╕Ñ\');">α╕Ñα╕Ü</button></div>';
  235.             }
  236.  
  237.             Date.prototype.customFormat = function(formatString) {
  238.                 var YYYY, YY, MMMM, MMM, MM, M, DDDD, DDD, DD, D, hhh, hh, h, mm, m, ss, s, ampm, AMPM, dMod, th;
  239.                 var dateObject = this;
  240.                 YY = ((YYYY = dateObject.getFullYear()) + "").slice(-2);
  241.                 MM = (M = dateObject.getMonth() + 1) < 10 ? ('0' + M) : M;
  242.                 MMM = (MMMM = [ "January", "February", "March", "April", "May",
  243.                         "June", "July", "August", "September", "October",
  244.                         "November", "December" ][M - 1]).substring(0, 3);
  245.                 DD = (D = dateObject.getDate()) < 10 ? ('0' + D) : D;
  246.                 DDD = (DDDD = [ "Sunday", "Monday", "Tuesday", "Wednesday",
  247.                         "Thursday", "Friday", "Saturday" ][dateObject.getDay()])
  248.                         .substring(0, 3);
  249.                 th = (D >= 10 && D <= 20) ? 'th'
  250.                         : ((dMod = D % 10) == 1) ? 'st' : (dMod == 2) ? 'nd'
  251.                                 : (dMod == 3) ? 'rd' : 'th';
  252.                 formatString = formatString.replace("#YYYY#", YYYY).replace(
  253.                         "#YY#", YY).replace("#MMMM#", MMMM).replace("#MMM#",
  254.                         MMM).replace("#MM#", MM).replace("#M#", M).replace(
  255.                         "#DDDD#", DDDD).replace("#DDD#", DDD).replace("#DD#",
  256.                         DD).replace("#D#", D).replace("#th#", th);
  257.  
  258.                 h = (hhh = dateObject.getHours());
  259.                 if (h == 0)
  260.                     h = 24;
  261.                 if (h > 12)
  262.                     h -= 12;
  263.                 hh = h < 10 ? ('0' + h) : h;
  264.                 AMPM = (ampm = hhh < 12 ? 'am' : 'pm').toUpperCase();
  265.                 mm = (m = dateObject.getMinutes()) < 10 ? ('0' + m) : m;
  266.                 ss = (s = dateObject.getSeconds()) < 10 ? ('0' + s) : s;
  267.                 return formatString.replace("#hhh#", hhh).replace("#hh#", hh)
  268.                         .replace("#h#", h).replace("#mm#", mm)
  269.                         .replace("#m#", m).replace("#ss#", ss)
  270.                         .replace("#s#", s).replace("#ampm#", ampm).replace(
  271.                                 "#AMPM#", AMPM);
  272.             }
  273.  
  274.          
  275.      function showModal(){ 
  276.  
  277.  
  278.      
  279.          }
  280.  
  281.             //alert(enforceModalFocusFn);
  282.             $(document).ready(
  283.                     function() {
  284.  
  285.                    $.getJSON("pol-type-list",{polType: $(this).val()}, function(j){
  286.                                   var options = '';
  287.                                   for (var i = 0; i < j.length; i++) {
  288.                                     options += '<option value="' + j[i].polType + '">' + j[i].polTypeName + '</option>';
  289.                                   }
  290.                                   $("select#polType").html(options);
  291.                                 });
  292.  
  293.                  /*   $.getJSON("veh-code-list",{vehcodes: $(this).val()}, function(j){
  294.                           var options = '';
  295.                           for (var i = 0; i < j.length; i++) {
  296.                             options += '<option value="' + j[i].vehCode + '">' + j[i].vehType + '-'+j[i].vehSizeFlag+'</option>';
  297.                           }
  298.                           $("select#vehcodes").html(options);
  299.                         }); */
  300.  
  301.                  
  302.                     
  303.  
  304.                                       
  305.  
  306.                  $('#startDate').datepicker({
  307.                      dateFormat: 'dd-mm-yy',
  308.                      minDate: '+5d',
  309.                      changeMonth: true,
  310.                      changeYear: true,
  311.                       altField: "#startDate",
  312.                       altFormat: "yy-mm-dd"
  313.                  });
  314.                   
  315.                  var enforceModalFocusFn = $.fn.modal.Constructor.prototype.enforceFocus;
  316.                  $.fn.modal.Constructor.prototype.enforceFocus = function() {};
  317.  
  318.  
  319.  
  320.             $('#editBtn').click(function() {
  321.                     //return false;
  322.                     var selr = $("#grid").jqGrid('getGridParam', 'selrow');
  323.                     if (selr) {
  324.                         $.get("package-setup-add?packageCode="+encodeURIComponent(selr), function(data1) {
  325.                             $('#tableFrm').html(data1);
  326.  
  327.                             var dialog = $("#tableFrm").dialog({
  328.                                 maxWidth : 890,
  329.                                 maxHeight : 680,
  330.                                 width : 890,
  331.                                 height : 680,
  332.                                 modal : true,
  333.  
  334.                                 close : function() {
  335.  
  336.                                     $('#sidebar').removeClass('side-hide');
  337.                                     $('.top-nav').removeClass('full-fluid');
  338.                                     $('#main-content').removeClass('full-fluid');
  339.                                 }
  340.  
  341.                             });
  342.  
  343.  
  344.                             $('#sidebar').addClass('side-hide');
  345.                             $('.top-nav').addClass('full-fluid');
  346.                             $('#main-content').addClass('full-fluid');
  347.  
  348.                         });
  349.  
  350.  
  351.                          
  352.                     } else {
  353.                         alert('α╕üα╕úα╕╕α╕ôα╕▓α╣Çα╕Ñα╕╖α╕¡α╕üα╕éα╣ëα╕¡α╕íα╕╣α╕Ñα╣âα╕Öα╕òα╕▓α╕úα╕▓α╕ç');
  354.                     }
  355.  
  356.                 });
  357.  
  358.                 $('#delBtn').click(function() {
  359.                     var selr = $("#grid").jqGrid('getGridParam', 'selrow');
  360.                     if (selr && confirm("α╕óα╕╖α╕Öα╕óα╕▒α╕Öα╕üα╕▓α╕úα╕Ñα╕Üα╕éα╣ëα╕¡α╕íα╕╣α╕Ñ Package α╕úα╕½α╕▒α╕¬ " + selr)) {
  361.  
  362.                         var url = "delete-packageH?packageCode=" + encodeURIComponent(selr);
  363.  
  364.                         $.ajax({
  365.                             type : "GET",
  366.                             url : url,
  367.                             success : function(data) {
  368.                                 $('#grid').trigger("reloadGrid", [ {
  369.                                     page : 1
  370.                                 } ]);
  371.                                 $('#tableDetail').html('');
  372.                             },
  373.                             error : function(xhr, ajaxOptions, thrownError) {
  374.                                 alert(xhr.status);
  375.                                 alert(thrownError);
  376.                             }
  377.                         });
  378.  
  379.                     }
  380.  
  381.                 });
  382.  
  383.                 $('#addBtn').click(function() {
  384.  
  385.                     $.get("package-setup-add", function(data1) {
  386.                         $('#tableFrm').html(data1);
  387.  
  388.                         var dialog = $("#tableFrm").dialog({
  389.                             maxWidth : 890,
  390.                             maxHeight : 680,
  391.                             width : 890,
  392.                             height : 680,
  393.                             modal : true,
  394.  
  395.                             close : function() {
  396.  
  397.                                 $('#sidebar').removeClass('side-hide');
  398.                                 $('.top-nav').removeClass('full-fluid');
  399.                                 $('#main-content').removeClass('full-fluid');
  400.                             }
  401.  
  402.                         });
  403.  
  404.                      
  405.                         $('#sidebar').addClass('side-hide');
  406.                         $('.top-nav').addClass('full-fluid');
  407.                         $('#main-content').addClass('full-fluid');
  408.  
  409.                     });
  410.  
  411.                 });
  412.             });
  413.         </script>
  414.  
  415.     </tiles:putAttribute>
  416.  
  417. </tiles:insertDefinition>