SwVitaliy

Untitled

Aug 8th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. (function(form) {
  2. var select = form.find('[name=mt_mt_to_pseudo]');
  3. console.log(form, select);
  4. var pseudoTable = $('#pseudo_rates tbody');
  5. var r=[];
  6. var phones = SMSKA.siteMaster.getBillingUrlOptions(); phones = phones[0];console.log('phones=',phones);
  7. pseudoTable.find('tr:gt(0)').each(function() {
  8. var row = $(this), dataTd = row.find('td:first');
  9. var schemaId = $.trim(dataTd.find('[name^=outpseudo_subscription_id]').val());
  10. if (schemaId === '') {
  11. schemaId = 'NEW';
  12. }
  13. var pi = parseInt($.trim(pseudoTable.find('[name^=outpseudo_initial_number]').val()));
  14. var str = '#' + schemaId + ' (' + phones[pi] + ' &rarr ';
  15. var authCount = parseInt($.trim(dataTd.find('[name^=outpseudo_authorized_count]').val()));
  16. if (authCount<1 || authCount>3) { throw 'parsing error - pseudo authority number for #' + schemaId; }
  17. if (authCount >= 1) { pi = parseInt($.trim(dataTd.find('[name^=outpseudo_success_number]').val())); str+= phones[pi]; }
  18. if (authCount >= 2) { pi = parseInt($.trim(dataTd.find('[name^=outpseudo_response_number_1]').val())); str+= ', ' + phones[pi]; }
  19. if (authCount == 3) { pi = parseInt($.trim(dataTd.find('[name^=outpseudo_response_number_2]').val())); str+= ', ' + phones[pi] }
  20. r.push(str + ')');
  21.  
  22. });
  23. return r;
  24.  
  25.  
  26. })($('#ctrl_mt_addEdit'))
Advertisement
Add Comment
Please, Sign In to add comment