form_modals.tpl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <div class="modal fade" id="send-invitation-modal" tabindex="-1" role="dialog" aria-labelledby="send-invitation-modal-title" aria-hidden="true">
  2. <div class="modal-dialog">
  3. <div class="modal-content">
  4. <div class="modal-header">
  5. <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close' | get_lang }}">
  6. <span aria-hidden="true">&times;</span>
  7. </button>
  8. <h4 class="modal-title" id="send-invitation-modal-title">{{ 'SendInvitation' | get_lang }}</h4>
  9. </div>
  10. <div class="modal-body">
  11. <div id="send-invitation-alert"></div>
  12. {{ invitation_form }}
  13. </div>
  14. <div class="modal-footer">
  15. <button type="button" id="btn-send-invitation" class="btn btn-primary">
  16. <em class="fa fa-send"></em> {{ 'Send' | get_lang }}
  17. </button>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <script>
  23. $(document).on('ready', function() {
  24. var $sendInvitationModal = $('#send-invitation-modal');
  25. var sendToUser = 0;
  26. $('.btn-to-send-invitation').on('click', function(e) {
  27. e.preventDefault();
  28. sendToUser = $(this).data('send-to');
  29. $sendInvitationModal.modal('show');
  30. });
  31. $('#btn-send-invitation').on('click', function(e) {
  32. e.preventDefault();
  33. var $frmSendInvitation = $sendInvitationModal.find('.modal-body form'),
  34. url = '{{ _p.web_ajax }}message.ajax.php?a=send_invitation&user_id=' + sendToUser;
  35. $.get(url, $frmSendInvitation.serialize(), function() {
  36. $frmSendInvitation[0].reset();
  37. window.location.reload();
  38. });
  39. });
  40. });
  41. </script>