aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/fixmybarangay/messages.js26
-rw-r--r--web/cobrands/fixmybarangay/test-texts.json17
2 files changed, 43 insertions, 0 deletions
diff --git a/web/cobrands/fixmybarangay/messages.js b/web/cobrands/fixmybarangay/messages.js
new file mode 100644
index 000000000..aebf35156
--- /dev/null
+++ b/web/cobrands/fixmybarangay/messages.js
@@ -0,0 +1,26 @@
+$(function(){
+
+ var mm = $('#message_manager');
+
+ $.getJSON('/cobrands/fixmybarangay/test-texts.json', function(data) {
+ var items = [];
+ $.each(data, function(k, v) {
+ var item = $('<input type="radio"/>').attr({
+ 'id': 'mm_text_' + v.id,
+ 'name': 'mm_text',
+ 'value': v.text
+ }).wrap('<p/>').parent().html();
+ var label = $('<label/>', {
+ 'class': 'inline',
+ 'for': 'mm_text_' + v.id
+ }).text(v.text).wrap('<p/>').parent().html();
+ item = '<li><p>' + item + ' ' + label + '</p></li>';
+ items.push(item);
+ });
+ mm.html(items.join(''));
+ mm.find('input').click(function(){
+ $('#form_detail').val( $('input[name=mm_text]:checked').val() );
+ });
+ });
+
+});
diff --git a/web/cobrands/fixmybarangay/test-texts.json b/web/cobrands/fixmybarangay/test-texts.json
new file mode 100644
index 000000000..7acde1e32
--- /dev/null
+++ b/web/cobrands/fixmybarangay/test-texts.json
@@ -0,0 +1,17 @@
+[
+ {
+ "id" : 1,
+ "number" : "032-9999999",
+ "text" : "Pothole on corner of G. De Vera and T. Padilla"
+ },
+ {
+ "id" : 2,
+ "number" : "032-1234567",
+ "text" : "Broken street light on Rahmann Street"
+ },
+ {
+ "id" : 3,
+ "number" : "+63 917 0000000",
+ "text" : "F. Manalo giant pothole"
+ }
+]