validateSuccess.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <div class="content-add01">
  2. <div class="heading01"><h1>Validation des factures pour la période "<?php echo $katao_period->getName() ?>"</h1></div>
  3. </div>
  4. <?php echo form_tag('@katao_invoice_validate') ?>
  5. <p><i>Sélectioner ci-dessous le noeud pour lequel vous souhaitez valider les factures adhérents.</i></p>
  6. <table>
  7. <tr valign="top">
  8. <td><?php echo label_for('node_id', 'Noeud') ?></td>
  9. <td><?php echo select_tag('node_id', options_for_select(KataoNodePeer::getAllArray(), false, array('include_custom' => '&mdash;&nbsp;choisir&nbsp;&mdash;')), array('onchange' => 'updateProductsDetails(); return true;')) ?></td>
  10. </tr>
  11. </table>
  12. <div id="products-details"></div>
  13. <br /><?php echo submit_tag('Valider', array('id' => 'commit', 'disabled' => true)) ?> ou <a href="<?php echo url_for('kataoInvoice/index') ?>">annuler</a>
  14. </form>
  15. <script type="text/javascript">
  16. function updateProductsDetails(){
  17. if ($F('node_id')) {
  18. new Ajax.Request('<?php echo url_for('kataoInvoice/updateProductDetails') ?>', {
  19. method: 'get',
  20. parameters: {
  21. node_id: $F('node_id')
  22. },
  23. onSuccess: updateProductsDetailsResponse
  24. });
  25. }
  26. }
  27. function updateProductsDetailsResponse(xhr){
  28. var response = xhr.responseText;
  29. $('products-details').innerHTML = response;
  30. if ("<i>Aucune facture à valider.</i>" == response || "<i>Toutes les factures de ce noeud ne sont pas délivrées.</i>" == response) {
  31. $('commit').disabled = true;
  32. return false;
  33. }
  34. $('commit').disabled = false;
  35. }
  36. </script>