1
0

devTellerMap_create.jsp 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <%@ include file="../common/header.jsp" %>
  2. <script type="text/javascript" src="./js/autocomplete/jquery.js"></script>
  3. <script type='text/javascript' src='./js/autocomplete/jquery.bgiframe.min.js'></script>
  4. <script type='text/javascript' src='./js/autocomplete/jquery.ajaxQueue.js'></script>
  5. <script type='text/javascript' src='./js/autocomplete/thickbox-compressed.js'></script>
  6. <script type='text/javascript' src='./js/autocomplete/jquery.autocomplete.js'></script>
  7. <script type='text/javascript' src='./js/autocomplete/localdata.js'></script>
  8. <script type="text/javascript" language="javascript">
  9. function doCreateOk() {
  10. var form = document.forms.devTellerMap;
  11. var message = "";
  12. var focus = false;
  13. if (trim(form.group.value).length == 0) {
  14. message = message + ("<bean:message key="error.devTellerMap.group" />\n");
  15. if (!focus) form.group.focus(); focus = true;
  16. }
  17. if (trim(form.deviceId.value).length == 0) {
  18. message = message + ("<bean:message key="error.devTellerMap.deviceId" />\n");
  19. if (!focus) form.deviceId.focus(); focus = true;
  20. }
  21. if (trim(form.deviceName.value).length == 0) {
  22. message = message + ("<bean:message key="error.devTellerMap.deviceName" />\n");
  23. if (!focus) form.deviceName.focus(); focus = true;
  24. }
  25. if (trim(form.terminalId.value).length == 0) {
  26. message = message + ("<bean:message key="error.devTellerMap.terminalId" />\n");
  27. if (!focus) form.terminalId.focus(); focus = true;
  28. }
  29. if (trim(form.terminalIp.value).length == 0) {
  30. message = message + ("<bean:message key="error.devTellerMap.terminalIp" />\n");
  31. if (!focus) form.terminalIp.focus(); focus = true;
  32. }
  33. if (trim(form.tellerId.value).length == 0) {
  34. message = message + ("<bean:message key="error.devTellerMap.tellerId" />\n");
  35. if (!focus) form.tellerId_id.focus(); focus = true;
  36. } else if (trim(form.tellerId_id.value).length == 0) {
  37. message = message + ("<bean:message key="error.devTellerMap.tellerId" />\n");
  38. if (!focus) form.tellerId_id.focus(); focus = true;
  39. }
  40. if (message == "") {
  41. var x = window.confirm("<bean:message key="confirm.create" />")
  42. if (x) {
  43. form.action.value="create_ok";
  44. form.submit();
  45. doDisable(form, "button");
  46. }
  47. } else {
  48. alert(message);
  49. }
  50. }
  51. function doChangeGroup() {
  52. var form = document.forms.devTellerMap;
  53. form.tellerId_id.value = "";
  54. }
  55. $(function() {
  56. function format(jsonmap) {
  57. return jsonmap.tellerId+ " - " +jsonmap.tellerName+ " - " +jsonmap.ctrlUnitId;
  58. }
  59. $("#tellerId_id").autocomplete('devTellerMap.do?action=loadTeller', {
  60. dataType: "json",
  61. parse: function(data) {
  62. return $.map(data, function(row) {
  63. return {
  64. data: row,
  65. value: row.tellerName,
  66. result: row.tellerName
  67. }
  68. });
  69. },
  70. formatItem: function(jsonmap) {
  71. return format(jsonmap);
  72. },
  73. extraParams:{ group:function(){ return $("#group_id").val();} }
  74. }).result(function(e, jsonmap) {
  75. //after select
  76. $("#tellerId_id").val(format(jsonmap));
  77. $("#tellerId").val(jsonmap.tellerId);
  78. $("#tellerName").val(jsonmap.tellerName);
  79. $("#ctrlUnitId").val(jsonmap.ctrlUnitId);
  80. });
  81. });
  82. function doReloadTeller() {
  83. var form = document.forms.devTellerMap;
  84. var message = "";
  85. var group = form.group.value;
  86. if (trim(group).length == 0) {
  87. message = message + ("<bean:message key="error.devTellerMap.group" />\n");
  88. if (!focus) form.group.focus(); focus = true;
  89. }
  90. if (message == "") {
  91. var req = createXMLHttpRequest();
  92. try {
  93. var url = "devTellerMap.do?action=reloadTeller&group=" +group+ "&ts=" +new Date().getTime();
  94. req.open("GET", url);
  95. req.onreadystatechange = function(){
  96. if (req.readyState < 4){
  97. document.getElementById('tellerId_div').innerHTML = "<img src='./images/wait.gif' border=0 >&nbsp;<b>Please Wait...<\/b>";
  98. }
  99. if (req.readyState == 4){
  100. document.getElementById('tellerId_div').innerHTML = "";
  101. }
  102. }
  103. req.send(null);
  104. } catch(e) {
  105. alert(e);
  106. }
  107. } else {
  108. alert(message);
  109. }
  110. }
  111. </script>
  112. <!-- CONTENT -->
  113. <form name="devTellerMap" method="post" action="devTellerMap.do">
  114. <input type="hidden" name="action">
  115. <input type="hidden" name="clear">
  116. <input type="hidden" name="ctrlUnitId" id="ctrlUnitId" value="<logic:notEmpty name="devTellerMap"><bean:write name="devTellerMap" property="ctrlUnitId" /></logic:notEmpty>">
  117. <input type="hidden" name="itemFocus" value="group">
  118. <input type="hidden" name="redirect" value="create">
  119. <input type="hidden" name="sequence">
  120. <input type="hidden" name="tellerName" id="tellerName" value="<logic:notEmpty name="tellerName"><bean:write name="tellerName" /></logic:notEmpty>">
  121. <input type="hidden" name="tellerId" id="tellerId" value="<logic:notEmpty name="devTellerMap"><bean:write name="devTellerMap" property="tellerId" /></logic:notEmpty>">
  122. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="4">
  123. <tr>
  124. <td class="titleHeader" align="left"><bean:message key="project.devTellerMap.key" /> CREATE</td>
  125. </tr>
  126. </table>
  127. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="4">
  128. <tr>
  129. <td align="center">
  130. <table width="100%" border="0" cellspacing="1" cellpadding="2">
  131. <tr><td colspan="6"><html:errors/></td></tr>
  132. <tr>
  133. <td width="15%"><b><bean:message key="devTellerMap.group.key"/> <font color="#FF0000">*</font></b></td>
  134. <td width="10">:</td>
  135. <td width="30%">
  136. <select name="group" style="width:200" id="group_id" onchange="doChangeGroup();">
  137. <option value="">-- Select Group --</option>
  138. <logic:notEmpty name="groupList">
  139. <logic:iterate id="element_group" name="groupList" >
  140. <option value="<bean:write name="element_group" property="name" />"
  141. <logic:notEmpty name="devTellerMap" property="group">
  142. <logic:equal name="devTellerMap" property="group" value="${element_group.name}">
  143. selected
  144. </logic:equal>
  145. </logic:notEmpty>
  146. ><bean:write name="element_group" property="name" /></option>
  147. </logic:iterate>
  148. </logic:notEmpty>
  149. </select>
  150. </td>
  151. <td width="5%">&nbsp;</td>
  152. <td width="15%">&nbsp;</td>
  153. <td width="10">&nbsp;</td>
  154. <td width="30%">&nbsp;</td>
  155. </tr>
  156. <tr>
  157. <td width="15%"><b><bean:message key="devTellerMap.deviceId.key"/> <font color="#FF0000">*</font></b></td>
  158. <td width="10">:</td>
  159. <td width="30%">
  160. <html:text name="devTellerMap" property="deviceId" size="30"/>
  161. </td>
  162. <td width="5%">&nbsp;</td>
  163. <td width="15%">&nbsp;</td>
  164. <td width="10">&nbsp;</td>
  165. <td width="30%">&nbsp;</td>
  166. </tr>
  167. <tr>
  168. <td width="15%"><b><bean:message key="devTellerMap.deviceName.key"/> <font color="#FF0000">*</font></b></td>
  169. <td width="10">:</td>
  170. <td width="30%">
  171. <html:text name="devTellerMap" property="deviceName" size="30"/>
  172. </td>
  173. <td width="5%">&nbsp;</td>
  174. <td width="15%">&nbsp;</td>
  175. <td width="10">&nbsp;</td>
  176. <td width="30%">&nbsp;</td>
  177. </tr>
  178. <tr>
  179. <td width="15%"><b><bean:message key="devTellerMap.terminalId.key"/> <font color="#FF0000">*</font></b></td>
  180. <td width="10">:</td>
  181. <td width="30%">
  182. <html:text name="devTellerMap" property="terminalId" size="30"/>
  183. </td>
  184. <td width="5%">&nbsp;</td>
  185. <td width="15%">&nbsp;</td>
  186. <td width="10">&nbsp;</td>
  187. <td width="30%">&nbsp;</td>
  188. </tr>
  189. <tr>
  190. <td width="15%"><b><bean:message key="devTellerMap.terminalIp.key"/> <font color="#FF0000">*</font></b></td>
  191. <td width="10">:</td>
  192. <td width="30%">
  193. <html:text name="devTellerMap" property="terminalIp" size="30"/>
  194. </td>
  195. <td width="5%">&nbsp;</td>
  196. <td width="15%">&nbsp;</td>
  197. <td width="10">&nbsp;</td>
  198. <td width="30%">&nbsp;</td>
  199. </tr>
  200. <tr>
  201. <td width="15%"><b><bean:message key="devTellerMap.tellerId.key"/> <font color="#FF0000">*</font></b></td>
  202. <td width="10">:</td>
  203. <td width="30%">
  204. <input type="text" name="tellerId_id" size="50" id="tellerId_id" value="<logic:notEmpty name="combine"><bean:write name="combine" /></logic:notEmpty>">
  205. <input type="button" value="<bean:message key="button.reload"/>" onclick="javascript:doReloadTeller();">
  206. <div id="tellerId_div" align="left">&nbsp;</div>
  207. </td>
  208. <td width="5%">&nbsp;</td>
  209. <td width="15%">&nbsp;</td>
  210. <td width="10">&nbsp;</td>
  211. <td width="30%">&nbsp;</td>
  212. </tr>
  213. <tr>
  214. <td width="15%"></td>
  215. <td width="10"></td>
  216. <td width="30%">
  217. <input type="button" value="<bean:message key="button.submit"/>" onclick="javascript:doCreateOk();">
  218. </td>
  219. <td colspan="4">&nbsp;</td>
  220. </tr>
  221. </table>
  222. </td>
  223. </tr>
  224. <tr>
  225. <td>&nbsp;</td>
  226. </tr>
  227. </table>
  228. </form>
  229. <!-- END CONTENT -->
  230. <logic:notEmpty name="focus"><bean:write name="focus" filter="false" /></logic:notEmpty>
  231. <%@ include file="../common/footer.jsp"%>