diff --git a/cloud/endagaweb/static/js/dashboard/sms-broadcast.js b/cloud/endagaweb/static/js/dashboard/sms-broadcast.js new file mode 100644 index 00000000..b58e21dd --- /dev/null +++ b/cloud/endagaweb/static/js/dashboard/sms-broadcast.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + function broadcastSms() { + var data = { + sendto: $('input[type=radio][name="send_to"]:checked').val(), + network_id: $('#network_id').val(), + tower_id: $('#bts_id').val(), + imsi: $('#imsi').val(), + message: $('#message').val(), + csrfmiddlewaretoken: $('#token').val(), + }; + $.post('/dashboard/broadcast', data, function(response) { + if (response['status'] == 'ok') { + // Show that it was successful and then reload the page. + // Clear out any old messages and show the div again. + $('#messages-container').html(); + $('#messages-container').css('opacity', 1); + var html = ''; + response['messages'].map(function(message) { + html += '
' + message + '
'; + }); + $('#messages-container').html(html).show(); + setTimeout(function() { + location.reload(); + }, 800); + } else { + // Show the messages that were sent back. + // Clear out any old messages and show the div again. + $('#messages-container').html(); + $('#messages-container').css('opacity', 1); + var html = ''; + response['messages'].map(function(message) { + html += '
' + message + '
'; + }); + $('#messages-container').html(html).show(); + setTimeout(function() { + $('#messages-container').fadeTo(500, 0); + $('#messages-container').hide(); + }, 4000); + } + }); + return false; + } + +$(document).ready(function() { + + $('input[type=radio][name="send_to"]').change(function() { + if (this.value == 'network') { + $('#network_row').show(); + $('#tower_row').hide(); + $('#imsi_row').hide(); + } else if (this.value == 'tower') { + $('#network_row').hide(); + $('#tower_row').show(); + $('#imsi_row').hide(); + } else if (this.value == 'imsi') { + $('#network_row').hide(); + $('#tower_row').hide(); + $('#imsi_row').show(); + } else { + $('#network_row').hide(); + $('#tower_row').hide(); + $('#imsi_row').show(); + } + }); + $('#broadcast-modal').on('shown.bs.modal', function() { + $('#broadcast-form')[0].reset(); + $('#network_row').hide(); + $('#tower_row').hide(); + $('#imsi_row').show(); + if($('input[type=radio][name="send_to"]:checked').val()) { + var selected = $('input[type=radio][name="send_to"]:checked').val(); + if (selected == 'network') { + $('#network_row').show(); + $('#tower_row').hide(); + $('#imsi_row').hide(); + } else if (selected == 'tower') { + $('#network_row').hide(); + $('#tower_row').show(); + $('#imsi_row').hide(); + } else if (selected == 'imsi') { + $('#network_row').hide(); + $('#tower_row').hide(); + $('#imsi_row').show(); + } else { + $('#network_row').hide(); + $('#tower_row').hide(); + $('#imsi_row').show(); + } + } + }); +}); diff --git a/cloud/endagaweb/templates/dashboard/activity.html b/cloud/endagaweb/templates/dashboard/activity.html index ca00ff07..1f67b506 100644 --- a/cloud/endagaweb/templates/dashboard/activity.html +++ b/cloud/endagaweb/templates/dashboard/activity.html @@ -145,6 +145,37 @@

No events match these filters!

+
@@ -152,7 +183,7 @@

No events match these filters!

{% if event_count > 100000 %} Too many results to export, try a shorter date range. {% elif event_count > 0 %} - Export results as CSV + Export results as CSV {% endif %}

@@ -175,4 +206,58 @@

No events match these filters!

+ + {% endblock %} diff --git a/cloud/endagaweb/templates/dashboard/network_detail/denomination.html b/cloud/endagaweb/templates/dashboard/network_detail/denomination.html index 3e7582f0..6fa07ac3 100644 --- a/cloud/endagaweb/templates/dashboard/network_detail/denomination.html +++ b/cloud/endagaweb/templates/dashboard/network_detail/denomination.html @@ -149,6 +149,7 @@

+ $(function() { // Show or hide parts of the form when autoupgrade is enabled or disabled. $('input:radio').change(function() { diff --git a/cloud/endagaweb/templates/dashboard/network_detail/inactive-subscribers.html b/cloud/endagaweb/templates/dashboard/network_detail/inactive-subscribers.html index eb786070..c299f916 100644 --- a/cloud/endagaweb/templates/dashboard/network_detail/inactive-subscribers.html +++ b/cloud/endagaweb/templates/dashboard/network_detail/inactive-subscribers.html @@ -150,5 +150,6 @@ }); }); + {% endblock %} diff --git a/cloud/endagaweb/templates/dashboard/network_detail/info.html b/cloud/endagaweb/templates/dashboard/network_detail/info.html index 6ae1b2c5..f877da3e 100644 --- a/cloud/endagaweb/templates/dashboard/network_detail/info.html +++ b/cloud/endagaweb/templates/dashboard/network_detail/info.html @@ -81,3 +81,7 @@

{% endblock %} + +{% block js %} + +{% endblock %} diff --git a/cloud/endagaweb/templates/dashboard/network_detail/nav.html b/cloud/endagaweb/templates/dashboard/network_detail/nav.html index d2c2d396..837351f6 100644 --- a/cloud/endagaweb/templates/dashboard/network_detail/nav.html +++ b/cloud/endagaweb/templates/dashboard/network_detail/nav.html @@ -43,5 +43,10 @@ {% else %}{% url 'network-edit' %} {% endif %}">Edit + +
  • + SMS Broadcast +
  • +{% include "dashboard/subscriber_detail/broadcast.html" with target='network' %} diff --git a/cloud/endagaweb/templates/dashboard/subscriber_detail/activity.html b/cloud/endagaweb/templates/dashboard/subscriber_detail/activity.html index 7c0c47db..1b28d204 100644 --- a/cloud/endagaweb/templates/dashboard/subscriber_detail/activity.html +++ b/cloud/endagaweb/templates/dashboard/subscriber_detail/activity.html @@ -121,4 +121,5 @@

    No events matched your search.

    + {% endblock %} diff --git a/cloud/endagaweb/templates/dashboard/subscriber_detail/adjust_credit.html b/cloud/endagaweb/templates/dashboard/subscriber_detail/adjust_credit.html index b2078ef7..0ca0f8d8 100644 --- a/cloud/endagaweb/templates/dashboard/subscriber_detail/adjust_credit.html +++ b/cloud/endagaweb/templates/dashboard/subscriber_detail/adjust_credit.html @@ -69,4 +69,5 @@ var adjust_credit_url = "{% url 'subscriber-adjust-credit' imsi=subscriber.imsi %}"; -{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/cloud/endagaweb/templates/dashboard/subscriber_detail/broadcast.html b/cloud/endagaweb/templates/dashboard/subscriber_detail/broadcast.html new file mode 100644 index 00000000..fcee372c --- /dev/null +++ b/cloud/endagaweb/templates/dashboard/subscriber_detail/broadcast.html @@ -0,0 +1,71 @@ +{% load apptags %} + diff --git a/cloud/endagaweb/templates/dashboard/subscriber_detail/edit.html b/cloud/endagaweb/templates/dashboard/subscriber_detail/edit.html index 11946e86..2d2be911 100644 --- a/cloud/endagaweb/templates/dashboard/subscriber_detail/edit.html +++ b/cloud/endagaweb/templates/dashboard/subscriber_detail/edit.html @@ -131,6 +131,7 @@