Blame view

resources/views/js/modals.blade.php 6.42 KB
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
1
2
3
  <script>
      console.log('Test system');
      $(document).on('click', '#button_send', function() {
1c6078a15   Андрей Ларионов   Обновление от вос...
4
          var field_login = $('#email_input');
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
5
6
7
8
9
10
11
12
13
14
15
16
          var field_pwd = $('#password');
          var login_val = field_login.val();
          var pwd_val = field_pwd.val();
  
          console.log('login: '+login_val+' password: '+pwd_val);
  
          $.ajax({
              type: "GET",
              url: "{{ route('login') }}",
              data: "email="+login_val+"&password="+pwd_val,
              success: function (data) {
                  console.log('Вход в систему');
1c6078a15   Андрей Ларионов   Обновление от вос...
17
                  console.log(data);
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
18
19
20
21
22
23
24
25
26
                  let d = JSON.parse(data);
                  if(typeof d['REDIRECT'] !== "undefined") {
                      location.href = d['REDIRECT'];
                      console.log(d['REDIRECT']);
                  }
                  if (typeof d['ERROR'] !== "undefined") {
                      console.log(d['ERROR']);
                      $('#message_error').html(d['ERROR']);
                  }
1c6078a15   Андрей Ларионов   Обновление от вос...
27
                  //console.log(d['REDIRECT']);
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
                  //$('#block_1').html(data);
              },
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              },
              error: function (data) {
                  data = JSON.stringify(data);
                  console.log('Error: ' + data);
              }
          });
      });
  
      $(document).on('click', '#button_reg_worker', function() {
          var field_login = $('#email_worker');
          var field_pwd = $('#password_worker');
          var field_confirm_pwd = $('#password_confirmation_worker');
231a1f4aa   Андрей Ларионов   Проект финализация
44
          var field_politik_worker = $('#politik');
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
          var field_telephone_worker = $('#telephone_worker');
          var field_job_titles_worker = $('#job_titles_worker');
          var field_surname_worker = $('#surname_worker');
          var field_name_man = $('#name_man_worker');
          var field_surname2_worker = $('#surname2_worker');
  
          var login = field_login.val();
          var pwd = field_pwd.val();
          var confirm_pwd = field_confirm_pwd.val();
          var politik = field_politik_worker.val();
          var telephone = field_telephone_worker.val();
          var job_titles = field_job_titles_worker.val();
          var surname = field_surname_worker.val();
          var name_man = field_name_man.val();
          var surname2 = field_surname2_worker.val();
231a1f4aa   Андрей Ларионов   Проект финализация
60
61
62
63
64
65
66
          if (field_politik_worker.attr('checked')) {
              console.log('politik=1');
              politik = 1;
          } else {
              politik = 0;
              console.log('politik=0');
          }
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
          console.log('login: '+login+' password: '+pwd);
  
          $.ajax({
              type: "GET",
              url: "{{ route('register_worker') }}",
              data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+
                  "&telephone="+telephone+"&job_titles="+job_titles+"&surname="+surname+"&name_man="+name_man+
                  "&surname2="+surname2+"&subscribe_email="+login,
              success: function (data) {
                  console.log('Вход в систему');
                  let d = JSON.parse(data);
                  if(typeof d['REDIRECT'] !== "undefined") {
                      console.log(d['REDIRECT']);
                      location.href = d['REDIRECT'];
                  }
                  if (typeof d['ERROR'] !== "undefined") {
                      console.log(d['ERROR']);
                      $('#block-info').css({'display': 'block'});
                      $('#messages_error_reg').html(d['ERROR']);
                  }
                  console.log(d['REDIRECT']);
  
              },
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              },
              error: function (data) {
                  data = JSON.stringify(data);
                  console.log('Error: ' + data);
              }
          });
  
          return false;
      });
  
      $(document).on('click', '#button_reg_employer', function() {
          var field_login = $('#email_employer');
          var field_pwd = $('#password_employer');
          var field_confirm_pwd = $('#password_confirmation_employer');
          var field_politik_employer = $('#politik_employer');
          var field_telephone_employer = $('#telephone_employer');
          var field_company_employer = $('#company_employer');
          var field_surname_employer = $('#surname_employer');
          var field_name_man_employer = $('#name_man_employer');
          var field_surname2_employer = $('#surname2_employer');
  
          var login = field_login.val();
          var pwd = field_pwd.val();
          var confirm_pwd = field_confirm_pwd.val();
          var politik = field_politik_employer.val();
          var telephone = field_telephone_employer.val();
          var company_employer = field_company_employer.val();
          var surname = field_surname_employer.val();
          var name_man = field_name_man_employer.val();
          var surname2 = field_surname2_employer.val();
  
  
          console.log('login: '+login+' password: '+pwd);
231a1f4aa   Андрей Ларионов   Проект финализация
125
126
127
128
129
130
131
          if (field_politik_employer.attr('checked')) {
              console.log('politik=1');
              politik = 1;
          } else {
              politik = 0;
              console.log('politik=0');
          }
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
          $.ajax({
              type: "GET",
              url: "{{ route('register_employer') }}",
              data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+
                  "&telephone="+telephone+"&name_company="+company_employer+"&surname="+surname+"&name_man="+name_man+
                  "&surname2="+surname2+"&subscribe_email="+login,
              success: function (data) {
                  console.log('Вход в систему');
                  let d = JSON.parse(data);
                  if(typeof d['REDIRECT'] !== "undefined") {
                      console.log(d['REDIRECT']);
                      location.href = d['REDIRECT'];
                  }
                  if (typeof d['ERROR'] !== "undefined") {
                      console.log(d['ERROR']);
                      $('#block-info').css({'display': 'block'});
                      $('#messages_error_reg').html(d['ERROR']);
                  }
                  console.log(d['REDIRECT']);
a9dfa8c95   Андрей Ларионов   Обновление на 7 м...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
              },
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              },
              error: function (data) {
                  data = JSON.stringify(data);
                  console.log('Error: ' + data);
              }
          });
  
          return false;
      });
  
  </script>