aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/businessadmin.js50
1 files changed, 47 insertions, 3 deletions
diff --git a/js/businessadmin.js b/js/businessadmin.js
index e5da52e..1d00fa9 100644
--- a/js/businessadmin.js
+++ b/js/businessadmin.js
@@ -108,9 +108,6 @@ $(document).ready(function(){
method: 'GET',
crossDomain: true,
cache: false,
- xhrFields: {
- withCredentials: true
- },
data: {
setting: collapsed
}
@@ -119,3 +116,50 @@ $(document).ready(function(){
return true;
});
});
+
+// Email modal
+function sendMail() {
+ var modal = $('#modal-email');
+ var modalBody = modal.find('.modal-body');
+ var sendIcon = modal.find('.modal-footer .btn-send .fa');
+ var values = modalBody.find('form').serialize();
+ modalBody.find(':input').prop('disabled', true);
+ sendIcon.removeClass('fa-envelope').addClass('fa-spin fa-refresh');
+ $.ajax({
+ url: const_url_external + 'ajax/email/offer',
+ method: 'POST',
+ data: values,
+ success: function(data) {
+ modal.modal('hide');
+ modalBody.html('');
+ },
+ error: function(jqxhr, stat, err) {
+ modalBody.find('.alert').remove();
+ modalBody.html('<div class="alert alert-danger" role="alert">' + stat + ': ' + err + '</div>' + modalBody.html());
+ },
+ complete: function() {
+ modalBody.find(':input').prop('disabled', false);
+ sendIcon.addClass('fa-envelope').removeClass('fa-spin fa-refresh');
+ }
+ });
+}
+
+function offerEmail(offerId) {
+ var modal = $('#modal-email');
+ var modalBody = modal.find('.modal-body');
+ modal.modal('show');
+ modalBody.html('<i class="fa fa-fw fa-refresh fa-spin"></i>');
+ $.ajax({
+ url: const_url_external + 'ajax/email/offer',
+ method: 'GET',
+ data: {
+ id: offerId
+ },
+ success: function(data) {
+ modalBody.html(data);
+ },
+ error: function(jqxhr, stat, err) {
+ modalBody.html('<div class="alert alert-danger" role="alert">' + stat + ': ' + err + '</div>');
+ }
+ });
+}