tab3.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. function validateOption()
  2. {
  3. document.getElementById("fsync_option_proformaserie_error").style.display = "none";
  4. document.getElementById("fsync_option_avizeserie_error").style.display = "none";
  5. document.getElementById("fsync_option_expfacturaserie_error").style.display = "none";
  6. document.getElementById("fsync_option_daysago_error").style.display = "none";
  7. var days = document.getElementById("fsync_option_daysago").value;
  8. $error = false;
  9. if(days == '' || !days.match(/^\d+$/))
  10. {
  11. document.getElementById("fsync_option_daysago_error").style.display = "block";
  12. $error = true;
  13. }
  14. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  15. for (var i = 0, length = radios.length; i < length; i++) {
  16. if (radios[i].checked) {
  17. if(radios[i].value == 'proforma' && document.getElementById("fsync_option_proformaserie").value == '')
  18. {
  19. document.getElementById("fsync_option_proformaserie_error").style.display = "block";
  20. $error = true;
  21. }
  22. if(radios[i].value == 'avize' && document.getElementById("fsync_option_avizeserie").value == '')
  23. {
  24. document.getElementById("fsync_option_avizeserie_error").style.display = "block";
  25. $error = true;
  26. }
  27. if(radios[i].value == 'expfactura' && document.getElementById("fsync_option_expfacturaserie").value == '')
  28. {
  29. document.getElementById("fsync_option_expfacturaserie_error").style.display = "block";
  30. $error = true;
  31. }
  32. }
  33. }
  34. if($error)
  35. {
  36. return false;
  37. }
  38. else
  39. {
  40. return true;
  41. }
  42. }
  43. function submitOrderOptionForm()
  44. {
  45. if(validateOption()) {
  46. document.getElementById('save-oo-btn').classList.remove('btn-green');
  47. document.getElementById('save-oo-btn').innerHTML = '<img src="View/img/loader.gif" />';
  48. document.getElementById('order_option_form').submit();
  49. }
  50. }
  51. function showOrHideProformaSerie()
  52. {
  53. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  54. for (var i = 0, length = radios.length; i < length; i++) {
  55. if (radios[i].checked) {
  56. if(radios[i].value == 'proforma')
  57. {
  58. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'block';
  59. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'none';
  60. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'none';
  61. }
  62. else if(radios[i].value == 'avize')
  63. {
  64. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'block';
  65. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'none';
  66. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'none';
  67. }
  68. else if(radios[i].value == 'expfactura')
  69. {
  70. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'block';
  71. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'none';
  72. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'none';
  73. }
  74. else
  75. {
  76. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'none';
  77. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'none';
  78. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'none';
  79. }
  80. break;
  81. }
  82. }
  83. }
  84. function showOrHideProformaSerie2()
  85. {
  86. var radios = document.getElementsByClassName("fsync_option_addproforma");
  87. for (var i = 0, length = radios.length; i < length; i++) {
  88. if (radios[i].checked) {
  89. var element = document.getElementById("fsync_option_proformaserie2");
  90. if(radios[i].value == 'activ')
  91. {
  92. element.parentElement.parentElement.parentElement.style.display = 'block';
  93. }
  94. else
  95. {
  96. element.parentElement.parentElement.parentElement.style.display = 'none';
  97. }
  98. break;
  99. }
  100. }
  101. }
  102. function showOrHideAvizeSerie()
  103. {
  104. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  105. for (var i = 0, length = radios.length; i < length; i++) {
  106. if (radios[i].checked) {
  107. if(radios[i].value == 'avize')
  108. {
  109. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'block';
  110. }
  111. else
  112. {
  113. document.getElementById("fsync_option_avizeserie").parentElement.parentElement.style.display = 'none';
  114. }
  115. break;
  116. }
  117. }
  118. }
  119. function showOrHideExpfacturaSerie()
  120. {
  121. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  122. for (var i = 0, length = radios.length; i < length; i++) {
  123. if (radios[i].checked) {
  124. if(radios[i].value == 'expfactura')
  125. {
  126. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'block';
  127. }
  128. else
  129. {
  130. document.getElementById("fsync_option_expfacturaserie").parentElement.parentElement.style.display = 'none';
  131. }
  132. break;
  133. }
  134. }
  135. }
  136. function showOrHideAvizeSerie2()
  137. {
  138. var radios = document.getElementsByClassName("fsync_option_addavize");
  139. for (var i = 0, length = radios.length; i < length; i++) {
  140. if (radios[i].checked) {
  141. var element = document.getElementById("fsync_option_avizeserie2");
  142. if(radios[i].value == 'activ')
  143. {
  144. element.parentElement.parentElement.parentElement.style.display = 'block';
  145. }
  146. else
  147. {
  148. element.parentElement.parentElement.parentElement.style.display = 'none';
  149. }
  150. break;
  151. }
  152. }
  153. }
  154. function showOrHideExpfacturaSerie2()
  155. {
  156. var radios = document.getElementsByClassName("fsync_option_addexpfactura");
  157. for (var i = 0, length = radios.length; i < length; i++) {
  158. if (radios[i].checked) {
  159. var element = document.getElementById("fsync_option_expfacturaserie2");
  160. if(radios[i].value == 'activ')
  161. {
  162. element.parentElement.parentElement.parentElement.style.display = 'block';
  163. }
  164. else
  165. {
  166. element.parentElement.parentElement.parentElement.style.display = 'none';
  167. }
  168. break;
  169. }
  170. }
  171. }
  172. function showOrHideInvoiceSerie()
  173. {
  174. var radios = document.getElementsByClassName("fsync_option_addinvoice");
  175. for (var i = 0, length = radios.length; i < length; i++) {
  176. if (radios[i].checked) {
  177. var element = document.getElementById("fsync_option_invoiceserie");
  178. if(radios[i].value == 'activ')
  179. {
  180. element.parentElement.parentElement.parentElement.style.display = 'block';
  181. }
  182. else
  183. {
  184. element.parentElement.parentElement.parentElement.style.display = 'none';
  185. }
  186. break;
  187. }
  188. }
  189. }
  190. function getPdls()
  191. {
  192. var params = '';
  193. params += '&fsync_option_pdls=' + document.getElementById("fsync_option_pdls_hidden").value;
  194. params += '&shop=' + document.getElementById("fsync_shop_hidden").value;
  195. params = encodeURI(params);
  196. var xhttp;
  197. xhttp = new XMLHttpRequest();
  198. xhttp.onreadystatechange = function() {
  199. if (this.readyState == 4 && this.status == 200) {
  200. if( this.responseText != '')
  201. {
  202. document.getElementById("fsync_option_pdls").innerHTML = this.responseText;
  203. }
  204. }
  205. };
  206. xhttp.open("GET","ajax.php?random=" + Math.random() + "&action=getPdls" + params,true);
  207. xhttp.send();
  208. }