home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
61.19.244.139
/
61.19.244.139.zip
/
61.19.244.139
/
2015-02-19
/
views
/
policy-type-add.jsp
< prev
next >
Wrap
Text File
|
2015-02-19
|
6KB
|
159 lines
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ 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"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<form:form class="form-horizontal well" action="savePolicyType" method="POST" id="frmPolicyType" modelAttribute="polTypeBean">
<div class="row-fluid">
<div class="dashboard-widget">
<div class="row-fluid">
<div class="span12">
<div class="nonboxy-widget">
<div class="widget-head">
<h5>กำหนดประเภทกรมธรรม์</h5>
</div>
<div class="widget-content">
<div class="widget-box">
<fieldset>
<div class="control-group">
<label class="control-label" for="input01">ประเภทกรมธรรม์</label>
<div class="controls">
<form:input class="input-small" type="text" placeholder="รหัส" name="polType" id="polType" path="polType"/>
<form:input class="input-xlarge" type="text" name="polTypeName" id="polTypeName" path="polTypeName" placeholder="ประเภทกรมธรรม์" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="input01">ความคุ้มครอง</label>
<div class="controls">
<form:select path="coverList" name="poltypeCovBeans" id="poltypeCovBeans" multiple="multiple">
<form:options items="${covBeanList}" itemValue="covCode" itemLabel="covName"/>
</form:select>
</div>
</div>
<%
if (request.getParameter("polType") == null) {
%>
<button class="btn btn-success" name="saveBtn" id="saveBtn">บันทึก</button>
<%
} else {
%>
<button class="btn btn-primary" name="editBtn" id="editBtn">แก้ไข</button>
<%
}
%>
<a class="btn" id="cancelBtn" onClick="$('#tableFrm').dialog('close');">ยกเลิก/ปิด</a>
</fieldset>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form:form>
<script>
$(function () {
var list = '';
if ($("#polType").val()) {
$('#polType').attr('readonly', true);
list = "${selectedvalues}";
}
;
/* if( ${not empty selectedvalues} ) {
var selectedvalues = "${selectedvalues}-" ;
var dataarray=selectedvalues.split(",");
$("#poltypeCovBeans").val(dataarray);
$("#poltypeCovBeans").multiselect("refresh");
} */
$('#poltypeCovBeans').multiSelect({
afterSelect: function (values) {
//
list += values + ",";
// alert(list)
},
afterDeselect: function (values) {
var r = values + ",";
list = list.replace(r, "");
// alert(list)
},
keepOrder: true,
selectableHeader: "<div class='custom-header'>ความคุ้มครองทั้งหมด</div>",
selectionHeader: "<div class='custom-header'>ความคุ้มครองที่คุ้มครอง</div>"
});
$("#frmPolicyType").submit(function () {
var url = "savePolicyType";
//
var l = list.split(",");
var pol_type = 'polType=' + $('#polType').val();
var poltype_name = '&polTypeName=' + $('#polTypeName').val();
var clist = '';
for (i = 0; i < l.length - 1; i++) {
var pp = l[i];
if (pp.indexOf('&') !== -1) {
pp = pp.replace('&','%26');
}
clist += "&coverList=" + pp;
}
var _c = '&_coverList=1';
var _data = pol_type + poltype_name + clist + _c;
// alert( $("#frmPolicyType").serialize())
console.log($("#frmPolicyType").serialize());
console.log(_data);
$.ajax({
type: "POST",
url: url,
data: _data, //$("#frmPolicyType").serialize(),
success: function (data) {
$('#grid').trigger("reloadGrid", [{page: 1}]);
$('#tableFrm').dialog('close');
},
error: function (xhr, ajaxOptions, thrownError) {
var obj = JSON.parse(xhr.responseText);
alert(obj.errorMessages);
}
});
return false;
});
});
</script>