From 6730e92341f7943d9302ad0226332b6b9d414e24 Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Wed, 28 Feb 2018 18:55:39 +0000 Subject: [PATCH] Fix dropdown for voucher options population --- footer.tpl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/footer.tpl b/footer.tpl index 73f1a90..b2b1f8f 100644 --- a/footer.tpl +++ b/footer.tpl @@ -61,6 +61,7 @@ jQuery(document).ready(function(){ case 'telkommobile': case 'telkom': case 'neotel': + case 'imogotel': $('#vouchers').show(); $.ajax({ cache:false, @@ -71,7 +72,7 @@ jQuery(document).ready(function(){ contentType: 'application/json; charset=utf-8', success: function(json) { $('#voucher').empty(); - $.each(json, function(i, data) { + $.each(json['details'], function(i, data) { console.log(data); $('#voucher').append(''); }); @@ -83,6 +84,30 @@ jQuery(document).ready(function(){ break; } + /** + * Need to change the text input to a dropdown for ImogoTel/BongoTel users as we link MSISDN shown to user to + * the email address on file on TOS. + */ + if ('imogotel' == selected) { + $('#inputMSISDN').replaceWith(''); + $.ajax({ + cache:false, + url:'/prepaid/airtime/ajax/diallerusers', + type:'POST', + data: JSON.stringify({ 'network': selected, '{/literal}{$csrf_key}{literal}': '{/literal}{$csrf_token}{literal}' }), + dataType: 'json', + contentType: 'application/json; charset=utf-8', + success: function(json) { + $('#inputMSISDN').empty(); + $.each(json['details'], function(i, data) { + console.log(data); + $('#inputMSISDN').append(''); + }); + } + }); + } else { + $('#inputMSISDN').replaceWith(''); + } }).change(); $('#vouchers').hide(); });