PageRenderTime 32ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/grails-app/views/servicioTransaccion/edita.gsp

http://github.com/jdmr/mateo
text | 236 lines | 224 code | 12 blank | 0 comment | 0 complexity | 54b826cf4e1f79a5f1f9e142d0fdad12 MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta name="layout" content="main">
  5. <g:set var="entityName" value="${message(code: 'transaccion.label', default: 'Transacción')}" />
  6. <g:set var="servicioName" value="${message(code: 'servicio.label', default: 'Servicio')}" />
  7. <title><g:message code="default.edit.label" args="[entityName]" /></title>
  8. <r:require module="tagit" />
  9. </head>
  10. <body>
  11. <a href="#edit-cuenta" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
  12. <div class="nav" role="navigation">
  13. <ul>
  14. <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
  15. <li><g:link class="edit" controller="servicio" action="edita" id="${transaccion.servicio.id}"><g:message code="default.edit.label" args="[servicioName]" /></g:link></li>
  16. <li><g:link class="create" action="nueva"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
  17. </ul>
  18. </div>
  19. <div id="edit-transaccion" class="content scaffold-edit" role="main">
  20. <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
  21. <g:if test="${flash.message}">
  22. <div class="message" role="status">${flash.message}</div>
  23. </g:if>
  24. <g:hasErrors bean="${transaccion}">
  25. <ul class="errors" role="alert">
  26. <g:eachError bean="${transaccion}" var="error">
  27. <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
  28. </g:eachError>
  29. </ul>
  30. </g:hasErrors>
  31. <g:form action="actualiza" method="post" >
  32. <g:hiddenField name="id" value="${transaccion?.id}" />
  33. <g:hiddenField name="version" value="${transaccion?.version}" />
  34. <g:hiddenField name="cuentaId" value="" />
  35. <g:hiddenField name="auxiliarId" value="" />
  36. <g:if test="${origenes}">
  37. <fieldset class="form" style="margin:0;padding:0;">
  38. <div id="movimientosDiv">
  39. <table style="margin:0;">
  40. <thead>
  41. <tr>
  42. <th style="width:100px;">${message(code:'transaccion.cuenta.label')}</th>
  43. <th style="width:100px;">${message(code:'transaccion.auxiliar.label')}</th>
  44. <th>${message(code:'transaccion.nombre.label')}</th>
  45. <th style='text-align:right;width:130px;'>${message(code:'transaccion.parcial.label')}</th>
  46. <th style='text-align:right;width:130px;'>${message(code:'transaccion.debe.label')}</th>
  47. <th style='text-align:right;width:130px;'>${message(code:'transaccion.debe.label')}</th>
  48. <th style='text-align:right;width:100px;'>${message(code:'servicioTransaccion.preguntar.label',default:'¿Preguntar?')}</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. <g:set var="counter" value="${1}" />
  53. <g:set var="counter2" value="${1}" />
  54. <g:each var="movimiento" in="${origenes}" status="i">
  55. <tr>
  56. <td <g:if test="${movimiento.padre}">style="text-decoration:underline;"</g:if>><g:if test="${!movimiento.auxiliar}">${movimiento.cuenta.numero}</g:if></td>
  57. <td>${movimiento.auxiliar?.numero}</td>
  58. <td <g:if test="${movimiento.padre}">style="text-decoration:underline;"</g:if>><g:if test="${!movimiento.auxiliar}">${movimiento.cuenta.descripcion}</g:if><g:else>${movimiento.auxiliar.descripcion}</g:else></td>
  59. <td style='text-align:right;<g:if test="${movimiento.ultimo}">text-decoration:underline;</g:if>'>
  60. <g:if test="${movimiento.auxiliar}">
  61. <g:if test="${(counter2++) == 1}">
  62. <g:formatNumber type="currency" number="${movimiento.importe}" />
  63. </g:if>
  64. <g:else>
  65. <g:formatNumber type="currency" number="${movimiento.importe}" currencySymbol="" />
  66. </g:else>
  67. </g:if>
  68. </td>
  69. <td style='text-align:right;'>
  70. <g:if test="${!movimiento.auxiliar}">
  71. <g:if test="${(counter++) == 1}">
  72. <g:formatNumber type="currency" number="${movimiento.importe}" />
  73. </g:if>
  74. <g:else>
  75. <g:formatNumber type="currency" number="${movimiento.importe}" currencySymbol="" />
  76. </g:else>
  77. </g:if>
  78. </td>
  79. <td>&nbsp;</td>
  80. <td style="text-align:center;"><g:checkBox name="preguntar$i" value="${movimiento.preguntar}" /></td>
  81. </tr>
  82. </g:each>
  83. <g:set var="counter" value="${1}" />
  84. <g:set var="counter2" value="${1}" />
  85. <g:each var="movimiento" in="${destinos}" status="i">
  86. <tr>
  87. <td <g:if test="${movimiento.padre}">style="text-decoration:underline;"</g:if>><g:if test="${!movimiento.auxiliar}">${movimiento.cuenta.numero}</g:if></td>
  88. <td>${movimiento.auxiliar?.numero}</td>
  89. <td style='padding-left:30px;<g:if test="${movimiento.padre}">text-decoration:underline;</g:if>'><g:if test="${!movimiento.auxiliar}">${movimiento.cuenta.descripcion}</g:if><g:else>${movimiento.auxiliar.descripcion}</g:else></td>
  90. <td style='text-align:right;<g:if test="${movimiento.ultimo}">text-decoration:underline;</g:if>'>
  91. <g:if test="${movimiento.auxiliar}">
  92. <g:if test="${(counter2++) == 1}">
  93. <g:formatNumber type="currency" number="${movimiento.importe}" />
  94. </g:if>
  95. <g:else>
  96. <g:formatNumber type="currency" number="${movimiento.importe}" currencySymbol="" />
  97. </g:else>
  98. </g:if>
  99. </td>
  100. <td>&nbsp;</td>
  101. <td style='text-align:right;'>
  102. <g:if test="${!movimiento.auxiliar}">
  103. <g:if test="${(counter++) == 1}">
  104. <g:formatNumber type="currency" number="${movimiento.importe}" />
  105. </g:if>
  106. <g:else>
  107. <g:formatNumber type="currency" number="${movimiento.importe}" currencySymbol="" />
  108. </g:else>
  109. </g:if>
  110. </td>
  111. <td style="text-align:center;"><g:checkBox name="preguntar$i" value="${movimiento.preguntar}" /></td>
  112. </tr>
  113. </g:each>
  114. </tbody>
  115. <tfoot>
  116. <tr>
  117. <th colspan="4" style="text-align:right;">TOTAL</th>
  118. <th style="text-align:right;"><g:formatNumber type="currency" number="${transaccion.importe}" /></th>
  119. <th style="text-align:right;"><g:formatNumber type="currency" number="${transaccion.importe}" /></th>
  120. <th>&nbsp;</th>
  121. </tr>
  122. </tfoot>
  123. </table>
  124. </div>
  125. </fieldset>
  126. </g:if>
  127. <fieldset class="form">
  128. <div class="fieldcontain">
  129. <h3>
  130. <g:message code="transaccion.tags.label" default="tags" />
  131. </h3>
  132. <ul name="tags">
  133. <g:each in="${transaccion?.tags?.tokenize(',')}">
  134. <li>${it}</li>
  135. </g:each>
  136. </ul>
  137. </div>
  138. <div class="fieldcontain ${hasErrors(bean: transaccion, field: 'descripcion', 'error')} required">
  139. <label for="descripcion">
  140. <g:message code="transaccion.descripcion.label" default="descripcion" />
  141. <span class="required-indicator">*</span>
  142. </label>
  143. <g:textArea name="descripcion" maxlength="200" required="" value="${transaccion?.descripcion}"/>
  144. </div>
  145. <div class="fieldcontain ${hasErrors(bean: transaccion, field: 'importe', 'error')} required">
  146. <label for="importe">
  147. <g:message code="transaccion.importe.label" default="importe" />
  148. </label>
  149. <g:textField name="importe" maxlength="200" value="" style="width:400px;"/>
  150. </div>
  151. <div class="fieldcontain ${hasErrors(bean: transaccion, field: 'cuenta', 'error')} required">
  152. <label for="cuenta">
  153. <g:message code="transaccion.cuenta.label" default="cuenta" />
  154. </label>
  155. <g:textField name="cuenta" maxlength="200" value="" style="width:400px;"/>
  156. </div>
  157. <div id="auxiliarDiv" class="fieldcontain ${hasErrors(bean: transaccion, field: 'auxiliar', 'error')} required" style="display:none;">
  158. <label for="auxiliar">
  159. <g:message code="transaccion.auxiliar.label" default="auxiliar" />
  160. </label>
  161. <g:textField name="auxiliar" maxlength="200" value="" style="width:400px;"/>
  162. </div>
  163. <div class="fieldcontain">
  164. <label for="esDebe">
  165. <g:message code="transaccion.esDebe.label" default="esDebe" />
  166. </label>
  167. <input type="checkbox" name="esDebe" value="" id="esDebe" />
  168. </div>
  169. <div class="fieldcontain">
  170. <label for="preguntar">
  171. <g:message code="servicioTransaccion.preguntar.label" default="¿Preguntar?" />
  172. </label>
  173. <input type="checkbox" name="preguntar" value="" id="preguntar" />
  174. </div>
  175. <div class="fieldcontain">
  176. <label for="agrega"><g:message code="transaccion.agrega.label" /></label>
  177. <g:submitButton name="agrega" class="save" value="${message(code: 'transaccion.nuevoMovimiento.button')}"/>
  178. </div>
  179. </fieldset>
  180. <fieldset class="buttons">
  181. <g:actionSubmit class="save" action="actualizaIngreso" value="${message(code: 'default.button.update.label', default: 'Update')}" />
  182. <g:actionSubmit class="delete" action="elimina" value="${message(code: 'default.button.delete.label', default: 'Delete')}" formnovalidate="" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
  183. <g:link class="edit" controller="servicio" action="edita" id="${transaccion.servicio.id}"><g:message code="default.edit.label" args="[servicioName]" /></g:link>
  184. </fieldset>
  185. </g:form>
  186. </div>
  187. <r:script>
  188. $(document).ready(function() {
  189. $('#cuenta').autocomplete({
  190. source:"${createLink(action:'cuentas')}"
  191. , select: function(event, ui) {
  192. $('#cuentaId').val(ui.item.id);
  193. if (ui.item.auxiliar) {
  194. $("#auxiliarId").val(ui.item.auxiliarId);
  195. $("#auxiliarDiv").toggle('blind',{},500, function() {
  196. $("#auxiliar").val($("#cuenta").val());
  197. $("#cuenta").val(ui.item.cuenta);
  198. $("#esDebe").focus();
  199. });
  200. } else if (ui.item.tieneAuxiliares) {
  201. $("#auxiliarDiv").toggle('blind',{},500, function() {
  202. $("#auxiliar").focus();
  203. });
  204. } else {
  205. $("#esDebe").focus();
  206. }
  207. }
  208. });
  209. $('#auxiliar').autocomplete({
  210. source:"${createLink(action:'auxiliares')}/"+$('#cuentaId').val()
  211. ,select: function(event,ui) {
  212. $('#auxiliarId').val(ui.item.id);
  213. $('#cuentaId').val(ui.item.cuentaId);
  214. $('#cuenta').val(ui.item.cuenta);
  215. $("#esDebe").focus();
  216. }
  217. });
  218. $("ul[name='tags']").tagit({select:true, tagSource: "${g.createLink(action: 'tags')}"});
  219. $('#descripcion').select();
  220. $('#descripcion').focus();
  221. });
  222. </r:script>
  223. </body>
  224. </html>