Advertisement
Dreamvenstion

Untitled

Feb 20th, 2020
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.31 KB | None | 0 0
  1. <style>
  2. .d_social_login .pre_loader.hide{
  3. display: none;
  4. }
  5.  
  6. .d_social_login #dsl_form{
  7. z-index: 16000011;
  8. position: relative;
  9. }
  10.  
  11. .d_social_login .modal-backdrop.in{
  12. opacity: 0;
  13. }
  14.  
  15. .d_social_login #dsl_form .form-group input{
  16. width: 278px;
  17. max-width: 100%;
  18. }
  19.  
  20. .d_social_login #dsl_form label.error{
  21. width: 100%;
  22. }
  23.  
  24. .d_social_login #dsl_form label.help{
  25. width: 100%;
  26. }
  27.  
  28. .d_social_login .wrapper-spinner-refresh{
  29. display: flex;
  30. align-items: center;
  31. justify-content: center;
  32. margin-top: 10px;
  33. }
  34.  
  35. .d_social_login span.wait{
  36. position: unset;
  37. padding: 0;
  38. margin: 0;
  39. }
  40. </style>
  41.  
  42.  
  43.  
  44. <script>
  45. function log(text) {
  46. {% if(debug) %}
  47. console.log(text);
  48. {% endif %}
  49. }
  50. function sendForm(e) {
  51. e.preventDefault();
  52. log($('#dsl_form').serialize());
  53. $.ajax({
  54. url: 'index.php?route=extension/module/d_social_login/register',
  55. type: 'post',
  56. data: $('#dsl_form').serialize(),
  57. dataType: 'json',
  58. beforeSend: function () {
  59. $('#dsl_submit').prop('disabled', true);
  60. $('#dsl_submit').after('<span class="wait fa fa-refresh fa-spin"></span>');
  61. $('.pre_loader').toggleClass('hide');
  62. $('#d_social_login .modal-content').css('transform', 'scale(0)')
  63. },
  64. complete: function () {
  65. $('#dsl_submit').prop('disabled', false);
  66. $('.wait').remove();
  67. $('.pre_loader').toggleClass('hide');
  68. $('#d_social_login .modal-content').css('transform', 'scale(1)')
  69. },
  70. success: function (json) {
  71. log(json);
  72. $('#dsl_error').remove();
  73. $('.error').removeClass('error');
  74. if (!json['error']) {
  75. if (json['success']) {
  76. $(".d_social_login .popup").html(json['success']);
  77. setTimeout(function () {
  78. location.reload();
  79. }, 1000)
  80. }
  81. } else {
  82. $.each(json['error'], function (id, error) {
  83. $("#" + id).addClass('has-error');
  84. $("#" + id).after('<div class="dsl_error">' + error + '</div>');
  85. });
  86. }
  87. },
  88. error: function (xhr, ajaxOptions, thrownError) {
  89. // $("#d_social_login .popup").html(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
  90. console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
  91. location.reload();
  92. }
  93. });
  94. }
  95.  
  96. </script>
  97. {% if not islogged %}
  98. <div id="d_social_login">
  99. <div class="modal fade d_social_login d_social_login-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  100. <div class="modal-dialog " role="document">
  101. <div class="pre_loader hide">{{ pre_loader }}</div>
  102. <div class="modal-content">
  103. <div class="modal-backdrop fade in hide"></div>
  104. <div id="dsl_popup">
  105. <div class="holder">
  106. <div class="popup">
  107. <form id="dsl_form" class="form-horizontal" method="post"
  108. action="index.php?route=extension/module/d_social_login/register">
  109. {% if (authentication_data['photo_url']) %}
  110. <div class="col-xs-12">
  111. <div class="img-wrap">
  112. <img src="{{ authentication_data['photo_url'] }}"
  113. id="dsl_profile_image"/>
  114. <div class="log-small-icon"
  115. style="{{ log_style }}"></div>
  116. </div>
  117. </div>
  118. {% endif %}
  119. <div id="dsl_intro" class="col-xs-12">{{ text_email_intro }}</div>
  120. <div class="col-xs-12">
  121. {% for field in fields %}
  122. {% if (field['enabled']) %}
  123. <div class="form-group">
  124. <label for="{{ field['id'] }}_control"
  125. class="control-label "> {{ labels_field[field['id']] }}{{ field['required'] ? '*' }} </label>
  126. {% if (field['type'] == "select") %}
  127. <select id="{{ field['id'] }}" name="{{ field['id'] }}"
  128. class="form-control">
  129. {% if (field['id'] == 'country_id') %}
  130. {% for country in countries %}
  131. <option value="{{ country['country_id'] }}" {{ country['country_id'] == customer_data[field['id']] ? 'selected="selected"' : '' }}>{{ country['name'] }}</option>
  132. {% endfor %}
  133. {% endif %}
  134. </select>
  135. {% elseif (field['id'] == "confirm") %}
  136. <input class="form-control"
  137. type="{{ field['type'] }}" id="{{ field['id'] }}"
  138. name="{{ field['id'] }}"
  139. value="{{ customer_data[field['id']]!='false' ? customer_data[field['id']] }}"
  140. {{ field['required'] ? 'required' }}
  141. placeholder=" {{ not mobile ? attribute(_context, 'text_' ~ field['id']) }}"
  142. autocomplete="off"/>
  143. <script type="text/javascript">
  144. $( "#dsl_form" ).validate({
  145. rules: {
  146. password: "required",
  147. confirm: {
  148. equalTo: "#password"
  149. }
  150. },
  151. submitHandler: function (form, e) {
  152. sendForm(e);
  153. }, //errror highlight
  154. highlight: function (element, errorClass, validClass) {
  155. $(element).addClass(errorClass).removeClass(validClass);
  156. $(element).parent().parent().addClass(errorClass);
  157. },
  158. unhighlight: function (element, errorClass, validClass) {
  159. $(element).removeClass(errorClass).addClass(validClass);
  160. $(element).parent().parent().removeClass(errorClass);
  161. }
  162. });
  163. </script>
  164. {% else %}
  165. <input class="form-control"
  166. type="{{ field['type'] }}" id="{{ field['id'] }}"
  167. name="{{ field['id'] }}"
  168.  
  169. {% if field['type'] == 'email' and customer_data[field['id']] !='false' %}
  170. readonly="readonly"
  171. {% endif %}
  172.  
  173. value="{{ customer_data[field['id']]!='false' ? customer_data[field['id']] }}"
  174.  
  175. {{ field['required'] and field['type'] != 'email' and not customer_data[field['id']] ? 'required' }}
  176.  
  177. placeholder=" {{ not mobile ? attribute(_context, 'text_' ~ field['id']) }}"
  178. autocomplete="off"/>
  179. {% endif %}
  180.  
  181. </div>
  182. {% if (field['mask'] is defined and field['mask'] and not mobile) %}
  183. <script>
  184. $(document).ready(function () {
  185. $("#{{ field['id'] }}").mask("{{ field['mask'] }}");
  186. })
  187. </script>
  188. {% endif %}
  189. {% endif %}
  190. {% endfor %}
  191. <div class="form-group"><label class="help control-label ">{{ text_help_required }}</label>
  192. </div>
  193. </div>
  194. <input type="hidden" name="provider" value="{{ authentication_data['provider'] }}"/>
  195. <input type="submit" id="dsl_submit" class="btn btn-primary"
  196. value=" {{ button_sign_in_mail }}"/>
  197. </form>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. <script>
  206. $(document).ready(function () {
  207. setTimeout(function(){
  208. var s = $('#d_social_login .d_social_login-modal').detach();
  209. console.log(s)
  210. s.appendTo('body');
  211. $('.d_social_login-modal').modal('show');
  212. $('.d_social_login-modal').on('hidden.bs.modal', function (e) {
  213. $.ajax({
  214. url: 'index.php?route=extension/module/d_social_login/reset'
  215. }).done(function (res) {
  216. $('.d_social_login-modal').detach();
  217. $('#d_social_login').html(res);
  218. })
  219. })
  220. })
  221.  
  222. })
  223. </script>
  224. <script>
  225. $(document).ready(function () {
  226.  
  227.  
  228. $("#dsl_form").validate({
  229. submitHandler: function (form, e) {
  230. sendForm(e);
  231. },
  232. //errror highlight
  233. highlight: function (element, errorClass, validClass) {
  234. $(element).addClass(errorClass).removeClass(validClass);
  235. $(element).parent().parent().addClass(errorClass);
  236. },
  237. unhighlight: function (element, errorClass, validClass) {
  238. $(element).removeClass(errorClass).addClass(validClass);
  239. $(element).parent().parent().removeClass(errorClass);
  240. }
  241. });
  242.  
  243. });
  244. $('input').on('blur keyup', function() {
  245. if ($("#dsl_form").valid()) {
  246. $('#dsl_submit').prop('disabled', false);
  247. } else {
  248. $('#dsl_submit').prop('disabled', 'disabled');
  249. }
  250. });
  251. $('#dsl_form select[name=\'country_id\']').bind('change', function () {
  252. if (this.value == '') return;
  253. $.ajax({
  254. url: 'index.php?route=checkout/checkout/country&country_id=' + this.value,
  255. dataType: 'json',
  256. beforeSend: function () {
  257. $('#dsl_form').after('<span class="wait fa fa-refresh fa-spin"></span>');
  258. },
  259. complete: function () {
  260. $('.wait').remove();
  261. },
  262. success: function (json) {
  263.  
  264. html = '<option value="">{{ text_select }}</option>';
  265.  
  266. if (json['zone'] != '') {
  267. for (i = 0; i < json['zone'].length; i++) {
  268. html += '<option value="' + json['zone'][i]['zone_id'] + '"';
  269. html += '>' + json['zone'][i]['name'] + '</option>';
  270. }
  271. } else {
  272. html += '<option value="0" selected="selected">{{ text_none }}</option>';
  273. }
  274.  
  275. $('#dsl_form select[name=\'zone_id\']').html(html);
  276. },
  277. error: function (xhr, ajaxOptions, thrownError) {
  278. console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
  279. }
  280. });
  281. });
  282. $('#dsl_form select[name=\'country_id\']').trigger('change');
  283. </script>
  284. {% if (background) %}
  285. <script>
  286. $(document).ready(function () {
  287. $('.modal-backdrop.fade.in').css('background-image', "url('{{ background_img_thumb }}')");
  288. $('.modal-backdrop.fade.in').css('opacity', "1");
  289. });
  290. </script>
  291. {% endif %}
  292. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement