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 >
Wrap
Text File
|
2015-02-19
|
13KB
|
417 lines
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<spring:url value="/bui/get-package-list" var="get_package_listUrl" htmlEscape="true" />
<tiles:insertDefinition name="defaultTemplate">
<tiles:putAttribute name="body">
<ul class="breadcrumb">
<li><a href="#">α╕½α╕Öα╣ëα╕▓α╕½α╕Ñα╕▒α╕ü</a><span class="divider">»</span></li>
<li class="active">กำหนดรายละเอียด Package</li>
</ul>
<div class="dashboard-widget">
<div class="row-fluid">
<div class="span12 ">
<div class=" widget-block">
<div class="widget-head">
<h5>
<i class="black-icons documents"></i> รายละเอียด Package
</h5>
</div>
<div class="widget-content">
<div class="widget-searchbox">
<ul>
<li class="row-counts"><a class="btn btn-success" id="addBtn" href="#frm-box"> <i class="icon-plus icon-white"></i> เพิ่ม
</a> <a class="btn btn-primary" id="editBtn"> <i class="icon-pencil icon-white"></i> แก้ไข
</a> <a class="btn btn-danger" id="delBtn"> <i class="icon-trash icon-white"></i> ลบ
</a></li>
<li class="right">
<form>
<fieldset>
<div class="control-group">
<div class="controls">
<input class="input-small" type="text" id="packageStart" name="packageStart" placeholder="รหัส PACKAGE"> - <input id="packageEnd" name="packageEnd" class="input-small"
type="text" placeholder="รหัส PACKAGE"> <a class="btn btn-info" id="btSearch" > <i class="icon-search icon-white"></i> ค้นหา
</a>
</div>
</div>
</fieldset>
</form>
</li>
</ul>
</div>
<div class="widget-box">
<div align="center" id='jqgrid'>
<table id='grid'></table>
<div id='pager'></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tableFrm"></div>
</tiles:putAttribute>
<tiles:putAttribute name="customScript">
<script>
$(function() {
$('#btSearch').click(function() {
//alert( $('#packageStart').val() +'-'+$('#packageEnd').val());
var f = { groupOp: "AND", rules: [] };
f.rules.push({ field: "packageStart", op: "cn", data: $('#packageStart').val() });
f.rules.push({ field: "packageEnd", op: "cn", data: $('#packageEnd').val() });
var grid = $('#grid');
grid[0].p.search = f.rules.length > 0;
$.extend(grid[0].p.postData, { filters: JSON.stringify(f) });
grid.trigger("reloadGrid", [{ page: 1 }]);
});
$('#vehcodes').multiSelect({
afterSelect: function(values){
},
afterDeselect: function(values){
},
selectableHeader: "<div class='custom-header'>รหัสรถยนต์ทั้งหมด</div>",
selectionHeader: "<div class='custom-header'>รหัสรถยนต์สำหรับ Package</div>",
});
/* $.getJSON("veh-size-list",{vehsize: $(this).val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
var indexValue = j[i].mainClass + '|'+j[i].vehSize+'|'+j[i].vehCode;
$('#vehcodes').multiSelect('addOption', { value: indexValue, text: j[i].vehCode+' '+ j[i].vehSizeDesc, index: i });
//$('#vehcodes').multiSelect('select', indexValue);
}
}); */
/* $.getJSON("vehBrandmodel-list",{vehBrandmodel: $(this).val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
var indexValue = j[i].brandId + '|'+j[i].modelName ;
var textValue = j[i].brandId + '->'+j[i].modelName ;
$('#brandmodels').multiSelect('addOption', { value: indexValue, text: textValue, index: i });
}
});
$('#brandmodels').multiSelect({
afterSelect: function(values){
},
afterDeselect: function(values){
},
selectableHeader: "<div class='custom-header'>รถยนต์ทั้งหมด</div>",
selectionHeader: "<div class='custom-header'>รถยนต์สำหรับ Package</div>"
});*/
$("#grid").jqGrid(
{
url : '${get_package_listUrl}',
datatype : 'json',
mtype : 'GET',
colNames : [ 'รหัส PACKAGE', 'วันเริ่ม',
'วันสิ้นสุด', 'ประเภทกรมธรรม์',
'เบี้ยประกันภัยรวม', 'Action' ],
colModel : [ {
name : 'packageCode',
index : 'packageCode',
width : 55,
hidden : false,
formatter : packageCodeFormat
}, {
name : 'startDate',
index : 'packageCode',
width : 50,
hidden : false,
formatter : dateFormat,
align : 'center'
}, {
name : 'endDate',
index : 'packageCode',
width : 50,
hidden : false,
formatter : dateFormat,
align : 'center'
}, {
name : 'polType',
index : 'polType',
width : 100,
hidden : false
}, {
name : 'totalPremium',
index : 'totalPremium',
width : 60,
formatter : 'number',
hidden : false,
align : 'right'
}, {
name : 'action',
index : 'packageCode',
width : 100,
formatter : actionFormat,
align : 'center',
hidden : true
} ],
postData : {},
rowNum : 10,
rowList : [ 10, 20, 40, 60 ],
height : 240,
autowidth : true,
rownumbers : true,
pager : '#pager',
sortname : 'packageCode',
viewrecords : true,
sortorder : "asc",
//caption:"รายละเอียด Package ",
emptyrecords : "Empty records",
loadonce : false,
loadComplete : function() {
},
jsonReader : {
root : "rows",
page : "page",
total : "total",
records : "records",
repeatitems : false,
cell : "cell",
id : "packageCode"
}
});
});
function dateFormat(cellvalue, options, rowObject) {
var d = new Date(cellvalue);
return d.customFormat("#DD#/#MM#/#YYYY#");
}
function digitFormat(cellvalue, options, rowObject) {
return cellvalue;
}
function packageCodeFormat(cellvalue, options, rowObject) {
return '<span class="label label-success">' + cellvalue
+ '</span>';
}
function actionFormat(cellvalue, options, rowObject) {
return '<div class="btn-group" align="center"> <button class="btn btn-warning">แก้ไข</button> <button class="btn btn-dange" onClick="javaScript:confirm(\'ยืนยันการลบข้อมูล\');">ลบ</button></div>';
}
Date.prototype.customFormat = function(formatString) {
var YYYY, YY, MMMM, MMM, MM, M, DDDD, DDD, DD, D, hhh, hh, h, mm, m, ss, s, ampm, AMPM, dMod, th;
var dateObject = this;
YY = ((YYYY = dateObject.getFullYear()) + "").slice(-2);
MM = (M = dateObject.getMonth() + 1) < 10 ? ('0' + M) : M;
MMM = (MMMM = [ "January", "February", "March", "April", "May",
"June", "July", "August", "September", "October",
"November", "December" ][M - 1]).substring(0, 3);
DD = (D = dateObject.getDate()) < 10 ? ('0' + D) : D;
DDD = (DDDD = [ "Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday" ][dateObject.getDay()])
.substring(0, 3);
th = (D >= 10 && D <= 20) ? 'th'
: ((dMod = D % 10) == 1) ? 'st' : (dMod == 2) ? 'nd'
: (dMod == 3) ? 'rd' : 'th';
formatString = formatString.replace("#YYYY#", YYYY).replace(
"#YY#", YY).replace("#MMMM#", MMMM).replace("#MMM#",
MMM).replace("#MM#", MM).replace("#M#", M).replace(
"#DDDD#", DDDD).replace("#DDD#", DDD).replace("#DD#",
DD).replace("#D#", D).replace("#th#", th);
h = (hhh = dateObject.getHours());
if (h == 0)
h = 24;
if (h > 12)
h -= 12;
hh = h < 10 ? ('0' + h) : h;
AMPM = (ampm = hhh < 12 ? 'am' : 'pm').toUpperCase();
mm = (m = dateObject.getMinutes()) < 10 ? ('0' + m) : m;
ss = (s = dateObject.getSeconds()) < 10 ? ('0' + s) : s;
return formatString.replace("#hhh#", hhh).replace("#hh#", hh)
.replace("#h#", h).replace("#mm#", mm)
.replace("#m#", m).replace("#ss#", ss)
.replace("#s#", s).replace("#ampm#", ampm).replace(
"#AMPM#", AMPM);
}
function showModal(){
}
//alert(enforceModalFocusFn);
$(document).ready(
function() {
$.getJSON("pol-type-list",{polType: $(this).val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].polType + '">' + j[i].polTypeName + '</option>';
}
$("select#polType").html(options);
});
/* $.getJSON("veh-code-list",{vehcodes: $(this).val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].vehCode + '">' + j[i].vehType + '-'+j[i].vehSizeFlag+'</option>';
}
$("select#vehcodes").html(options);
}); */
$('#startDate').datepicker({
dateFormat: 'dd-mm-yy',
minDate: '+5d',
changeMonth: true,
changeYear: true,
altField: "#startDate",
altFormat: "yy-mm-dd"
});
var enforceModalFocusFn = $.fn.modal.Constructor.prototype.enforceFocus;
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
$('#editBtn').click(function() {
//return false;
var selr = $("#grid").jqGrid('getGridParam', 'selrow');
if (selr) {
$.get("package-setup-add?packageCode="+encodeURIComponent(selr), function(data1) {
$('#tableFrm').html(data1);
var dialog = $("#tableFrm").dialog({
maxWidth : 890,
maxHeight : 680,
width : 890,
height : 680,
modal : true,
close : function() {
$('#sidebar').removeClass('side-hide');
$('.top-nav').removeClass('full-fluid');
$('#main-content').removeClass('full-fluid');
}
});
$('#sidebar').addClass('side-hide');
$('.top-nav').addClass('full-fluid');
$('#main-content').addClass('full-fluid');
});
} else {
alert('กรุณาเลือกข้อมูลในตาราง');
}
});
$('#delBtn').click(function() {
var selr = $("#grid").jqGrid('getGridParam', 'selrow');
if (selr && confirm("ยืนยันการลบข้อมูล Package รหัส " + selr)) {
var url = "delete-packageH?packageCode=" + encodeURIComponent(selr);
$.ajax({
type : "GET",
url : url,
success : function(data) {
$('#grid').trigger("reloadGrid", [ {
page : 1
} ]);
$('#tableDetail').html('');
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
});
$('#addBtn').click(function() {
$.get("package-setup-add", function(data1) {
$('#tableFrm').html(data1);
var dialog = $("#tableFrm").dialog({
maxWidth : 890,
maxHeight : 680,
width : 890,
height : 680,
modal : true,
close : function() {
$('#sidebar').removeClass('side-hide');
$('.top-nav').removeClass('full-fluid');
$('#main-content').removeClass('full-fluid');
}
});
$('#sidebar').addClass('side-hide');
$('.top-nav').addClass('full-fluid');
$('#main-content').addClass('full-fluid');
});
});
});
</script>
</tiles:putAttribute>
</tiles:insertDefinition>