home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
61.19.244.139
/
61.19.244.139.zip
/
61.19.244.139
/
2015-02-19
/
views
/
agent-broker-setup-add.jsp
< prev
next >
Wrap
Text File
|
2015-02-19
|
20KB
|
616 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="" id="frmAgentDetailSetup" name="frmAgentDetailSetup" method="POST" modelAttribute="agentDetailBean">
<div class="widget-content">
<div class="widget-box">
<fieldset>
<div class="box-tab">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab1"><i class="black-icons blocks_images"></i> รายละเอียดตัวแทน</a></li>
<li><a data-toggle="tab" href="#tab2"><i class="black-icons blocks_images"></i> กลุ่ม</a></li>
<li class=""><a data-toggle="tab" href="#tab3"><i class="black-icons abacus"></i> รายละเอียด</a></li>
<li><a data-toggle="tab" href="#tab4"><i class="black-icons abacus"></i> กำหนดวงเงิน</a></li>
</ul>
<div class="tab-content">
<!-- Tab1 -->
<div id="tab1" class="tab-pane active">
<div class=" row-fluid">
<div class="control-group">
<label class="control-label" for="input01">ตัวแทน</label>
<div class="controls">
<form:input class="input-small" type="text" placeholder="รหัสตัวแทน" name="agentId" id="agentId" path="agentId"/>
<form:input class="input-xlarge" type="text" placeholder="ชื่อตัวแทน" name="agentName" id="agentName" path="agentName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">ที่อยู่</label>
<div class="controls">
<form:input class="input-xxlarge" type="text" id="address1" name="address1" path="address1" placeholder="บ้านเลขที่ ตรอก ซอย ถนน"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">จังหวัด</label>
<div class="controls multiline-input">
<form:select class="input-medium" id="province" name="provinceId" path="provinceId">
<c:if test="${not empty refProvinceBeanList}">
<c:forEach var="listValue" items="${refProvinceBeanList}">
<form:option value="${listValue.provCode}">${listValue.provName}</form:option>
</c:forEach>
</c:if>
</form:select>
<form:select path="amphurId" id="amphur" class="input-medium"></form:select>
<form:select path="tambonId" id="tambol" class="input-medium"></form:select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">รหัสไปรษณีย์</label>
<div class="controls">
<form:input class="autoZipCode input-small" type="text" name="prbZipcode" path="prbZipcode" id="prbZipcode" placeholder="รหัสไปรษณีย์"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">ที่อยู่จดทะเบียนขาย พรบ.</label>
<div class="controls">
<form:input class="input-xxlarge" type="text" id="prbAddress1" name="prbAddress1" path="prbAddress1" placeholder="บ้านเลขที่ ตรอก ซอย ถนน"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">จังหวัด</label>
<div class="controls multiline-input">
<form:select class="input-medium" id="prbProvinceId" name="prbProvinceId" path="prbProvinceId">
<c:if test="${not empty refProvinceBeanList}">
<c:forEach var="listValue" items="${refProvinceBeanList}">
<form:option value="${listValue.provCode}">${listValue.provName}</form:option>
</c:forEach>
</c:if>
</form:select>
<form:select path="prbAmphurId" id="prbAmphurId" class="input-medium"></form:select>
<form:select path="prbTambonId" id="prbTambonId" class="input-medium"></form:select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input02">เลขที่ใบอนุญาติ</label>
<div class="controls">
<form:input path="licenseCode" class="input-small" type="text" placeholder="เลขที่ใบอนุญาติ" id="licenseCode" name="licenseCode"/>
<form:checkbox value="Y" name="licenseOwn" id="licenseOwn" path="licenseOwn"/>
เจ้าของใบอนุญาติ
</div>
</div>
<div class="control-group">
<label class="control-label">ประเภทตัวแทน</label>
<div class="controls">
<form:radiobutton name="agentType" path="agentType" id="agentType" value="AC" class="radio-b" />
ตัวแทนนิติบุคคล
<form:radiobutton name="agentType" path="agentType" id="agentType" value="AP" class="radio-b" />
ตัวแทนบุคคลธรรมดา <br />
<form:radiobutton name="agentType" path="agentType" id="agentType" value="BC" class="radio-b" />
นายหน้านิติบุคล
<form:radiobutton name="agentType" path="agentType" id="agentType" value="BP" class="radio-b" />
นายหน้าบุคคลธรรมดา
</div>
</div>
</div>
</div>
<!-- end tab1 -->
<div id="tab2" class="tab-pane">
<div class=" row-fluid">
<div class="control-group">
<label class="control-label" for="input01">หัวหน้ากลุ่ม</label>
<div class="controls">
<form:select class="input-xlarge" name="headGrpId" id="headGrpId" path="headGrpId">
<form:option value="">====ไม่กำหนด====</form:option>
<c:forEach var="ag" items="${agentDetailList}">
<form:option value="${ag.agentId}">
<c:out value="${ag.agentId}-${ag.agentName}" />
</form:option>
</c:forEach>
</form:select>
</div>
</div>
</div>
</div>
<!-- end Tab 2 -->
<div id="tab3" class="tab-pane">
<div class=" row-fluid">
<div class="control-group">
<div class="control-group">
<div class="controls">
<label class="checkbox"> <form:checkbox value="Y" name="allPackage" id="allPackage" path="allPackage"/> All Packages
</label>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<form:select multiple="true" path="agentPacks" name="agentPackages" id="agentPackages">
<form:options items="${activePackages}" itemLabel="packageCode" itemValue="packageCode"/>
</form:select>
</div>
</div>
<div class="control-group">
<label class="control-label">การพิมพ์เอกสารสำคัญ</label>
<div class="controls">
<c:if test="${not empty agentDocBeans}">
<c:forEach var="listValue" items="${agentDocBeans}" varStatus="status">
<label class="checkbox">
<form:checkbox value="Y" path="agentDocBeans[${status.index }].selected"/>
<form:hidden path="agentDocBeans[${status.index }].refCode"/>
<form:hidden path="agentDocBeans[${status.index }].refName"/>
${listValue.refName}
</label>
</c:forEach>
</c:if>
</div>
</div>
</div>
</div>
<!-- end Tab 3 -->
<div id="tab4" class="tab-pane">
<div class=" row-fluid">
<div class="control-group">
<div class="controls">
<label class="checkbox"> <form:checkbox value="Y" name="crLinePool" id="crLinePool" path="crLinePool"/> ใช้วงเงินเดียวกับหัวหน้าทีม
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">วงเงินที่ได้รับ</label>
<div class="controls">
<form:input path="crLimited" class="autoNumber input-medium" type="text" id="crLimited" name="crLimited" placeholder="วงเงินที่ได้รับ"/>
</div>
</div>
<div class="control-group">
<label class="control-label">วงเงินที่ใช้ไป</label>
<div class="controls">
<form:input path="crBalnace" class="autoNumber input-medium" type="text" id="crBalnace" name="crBalnace" placeholder="วงเงินที่ใช้ได้"/>
</div>
</div>
<div class="control-group">
<label class="control-label">วงเงินชั่วคราว</label>
<div class="controls">
<form:input path="crTempLimit" class="autoNumber input-medium" type="text" id="crTempLimit" name="crTempLimit" placeholder="วงเงินชั่วคราว"/>
</div>
</div>
<div class="control-group">
<label class="control-label">วันสิ้นสุดใช้วงเงินชั่วคราว</label>
<div class="controls" id="maxIndex">
<form:input path="crExpireDate" class="input-medium" type="text" id="crExpireDate" name="crExpireDate" placeholder="dd/mm/yyyy"/>
</div>
</div>
<div class="control-group">
<label class="control-label">Credit Term</label>
<div class="controls">
<form:input path="crTerm" class="autoNumber input-medium" type="text" name="crTerm" placeholder="Credit Term"/>
</div>
</div>
</div>
</div>
<!-- end Tab4 - -->
</div>
</div>
</div>
<!-- Eng Tab box -->
<%
if (request.getParameter("agentId") == 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'); return false;">ยกเลิก/ปิด</a>
</fieldset>
</div>
</div>
</form:form>
<script>
$(function() {
if($("#agentId").val() ){
$('#agentId').attr('readonly', true);
};
$('.autoNumber').autoNumeric('init', {aSep: ',', aDec: '.',vMin:'0.00',vMax:'1000000000.00'});
$('.autoZipCode').autoNumeric('init', { aSep: '',aPad:false,vMin:'0',vMax:'99999'});
$("#headGrpId").select2();
$('#crExpireDate').datepicker({ dateFormat: 'dd/mm/yy' });
$('#agentPackages').multiSelect({
afterSelect : function(values) {
},
afterDeselect : function(values) {
},
selectableHeader : "<div class='custom-header'>ทั้งหมด</div>",
selectionHeader : "<div class='custom-header'> ที่สามารถขายได้</div>"
});
if($('#crLinePool').prop('checked' )){
$('#crLimited').prop('readonly',true);
$('#crTempLimit').prop('readonly',true);
$('#crBalnace').prop('readonly',true);
$('#crExpireDate').prop('readonly',true);
$('#crLimited').val('0');
$('#crTempLimit').val('0');
$('#crBalnace').val('0');
$('#crExpireDate').val('');
}else{
$('#crLimited').prop('readonly',false);
$('#crTempLimit').prop('readonly',false);
$('#crBalnace').prop('readonly',false);
$('#crExpireDate').prop('readonly',false);
}
$('#crLinePool').click(function() {
if(this.checked){
$('#crLimited').prop('readonly',true);
$('#crTempLimit').prop('readonly',true);
$('#crBalnace').prop('readonly',true);
$('#crExpireDate').prop('readonly',true);
$('#crLimited').val('0');
$('#crTempLimit').val('0');
$('#crBalnace').val('0');
$('#crExpireDate').val('');
}else{
$('#crLimited').prop('readonly',false);
$('#crTempLimit').prop('readonly',false);
$('#crBalnace').prop('readonly',false);
$('#crExpireDate').prop('readonly',false);
}
//crLimited;
});
$('#tambol').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'tambol?amphurCode=' + $('#amphur option:selected').val() + '&provCode=' + $('#province option:selected').val() + '&tambolCode=' + this.value,
success : function(data) {
$('#prbZipcode').val(data.tabolZipcode);
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
var amphurChange =true;
var tambonChange =true;
$('#amphur').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'tambol-list?amphurCode=' + this.value + '&provCode=' + $('#province option:selected').val(),
success : function(data) {
$('#tambol').find('option').remove().end();
$.each(data, function() {
$('#tambol').append(new Option(this.tambolName, this.tambolCode));
<%
if (request.getParameter("agentId") != null) {
%>
if(this.tambolCode=='${agentDetailBean.tambonId}'&&tambonChange){
$('#tambol').val('${agentDetailBean.tambonId}');
tambonChange=false;
}
<%
}
%>
});
$('#tambol').change();
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
$('#province').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'amphur-list?provCode=' + this.value,
success : function(data) {
$('#amphur').find('option').remove().end();
$('#tambol').find('option').remove().end();
$.each(data, function() {
$('#amphur').append(new Option(this.amphurName, this.amphurCode));
<%
if (request.getParameter("agentId") != null) {
%>
if(this.amphurCode=='${agentDetailBean.amphurId}'&&hurChange){
$('#amphur').val('${agentDetailBean.amphurId}');
amphurChange=false;
}
<%
}
%>
});
$('#amphur').change();
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
$('#prbTambonId').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'tambol?amphurCode=' + $('#prbAmphurId option:selected').val() + '&provCode=' + $('#prbProvinceId option:selected').val() + '&tambolCode=' + this.value,
success : function(data) {
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
var prbAmphurIdChange = true;
var prbTambonIdChange = true;
$('#prbAmphurId').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'tambol-list?amphurCode=' + this.value + '&provCode=' + $('#prbProvinceId option:selected').val(),
success : function(data) {
$('#prbTambonId').find('option').remove().end();
$.each(data, function() {
$('#prbTambonId').append(new Option(this.tambolName, this.tambolCode));
<%
if (request.getParameter("agentId") != null) {
%>
if(this.tambolCode=='${agentDetailBean.prbTambonId}'&&prbTambonIdChange){
$('#prbTambonId').val('${agentDetailBean.prbTambonId}');
prbTambonIdChange=false;
}
<%
}
%>
});
$('#prbTambonId').change();
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
$('#prbProvinceId').on('change', function() {
$.ajax({
type : "GET",
dataType : "json",
url : 'amphur-list?provCode=' + this.value,
success : function(data) {
$('#prbAmphurId').find('option').remove().end();
$('#prbTambonId').find('option').remove().end();
$.each(data, function() {
$('#prbAmphurId').append(new Option(this.amphurName, this.amphurCode));
<%
if (request.getParameter("agentId") != null) {
%>
if(this.amphurCode=='${agentDetailBean.prbAmphurId}'&&prbAmphurIdChange){
$('#prbAmphurId').val('${agentDetailBean.prbAmphurId}');
prbAmphurIdChange=false;
}
<%
}
%>
});
$('#prbAmphurId').change();
},
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
$('#province').change();
$('#prbProvinceId').change();
$("#frmAgentDetailSetup").submit(function() {
var form = $(this);
$('input').each(function(i){
var self = $(this);
try{
var v = self.autoNumeric('get');
self.autoNumeric('destroy');
self.val(v);
}catch(err){
console.log("Not an autonumeric field: " + self.attr("name"));
}
});
var url = "saveAgentDetail";
$.ajax({
type: "POST",
url: url,
data: $("#frmAgentDetailSetup").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;
});
$("#prbProvinceId").select2({
width : 'resolve'
});
$("#prbAmphurId").select2({
width : 'resolve'
});
$("#prbTambonId").select2({
width : 'resolve'
});
$("#province").select2({
width : 'resolve'
});
$("#amphur").select2({
width : 'resolve'
});
$("#tambol").select2({
width : 'resolve'
});
});
</script>