summaryrefslogtreecommitdiff
path: root/public/app/views/js/submit
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-25 09:30:37 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-25 09:30:37 +0300
commita3dc1f0f55003ca2fb325ed2e3f974094f6cad2e (patch)
tree09aa5f8208460c5c2883209d7139d59ba2d623e3 /public/app/views/js/submit
parent2b1f4aed56c5bfbf014f3f871e9dcc336b5a31b7 (diff)
downloadgyraf1gov-a3dc1f0f55003ca2fb325ed2e3f974094f6cad2e.tar.gz
gyraf1gov-a3dc1f0f55003ca2fb325ed2e3f974094f6cad2e.tar.bz2
gyraf1gov-a3dc1f0f55003ca2fb325ed2e3f974094f6cad2e.zip
break form scripts in parts; first pdf example
Diffstat (limited to 'public/app/views/js/submit')
-rw-r--r--public/app/views/js/submit/application-form.php54
-rw-r--r--public/app/views/js/submit/invitation-form.php52
2 files changed, 106 insertions, 0 deletions
diff --git a/public/app/views/js/submit/application-form.php b/public/app/views/js/submit/application-form.php
new file mode 100644
index 0000000..badff03
--- /dev/null
+++ b/public/app/views/js/submit/application-form.php
@@ -0,0 +1,54 @@
+<script>
+ $(document).ready(function() {
+
+ // When form is submited
+ ////////////////////////////////////////////////////////////////////////
+
+ $('.content-form form').submit( event => {
+ event.preventDefault();
+
+ if (false) {
+ alert('Τα δυο passrods δεν ταιριάζουν!');
+
+ } else {
+
+ var data = { // select content data
+ of_article: selected_text($('select[name=of_article]')),
+ student_names: $('textarea[name=student_names]').val(),
+ of_department: $('input[name=of_department]').val(),
+ date: $('input[name=date]').val(),
+ time: $('input[name=time]').val(),
+ place: selected_text($('select[name=place]')),
+ rapporteur: selected_text($('select[name=rapporteur]')),
+ charge: $('textarea[name=charge]').val(),
+ apology: $('textarea[name=apology]').val(),
+ decision_reasoning: $('textarea[name=decision_reasoning]').val(),
+ decision: selected_text($('select[name=decision]')),
+ decision_more: $('input[name=decision_more]').val(),
+ president: selected_text($('select[name=president]')),
+ members: selected_multitexts($('select[name="members[]"]'))
+ };
+
+ var form_data = { // prepare data to post
+ subject: $('input[name=of_department]').val(),
+ content: JSON.stringify(data),
+ on_date: $('input[name=date]').val(),
+ user_id: $('input[name=id]').val()
+ }
+
+ // select action url (add or update)
+ // var request = '/account/register';
+ console.log(data);
+
+ // send POST request
+ // $.post(request, form_data)
+ // .done(function( data ) {
+ // $('.classroom .content-form').html(data.message)
+ // });
+ }
+
+ });
+
+
+ });
+</script>
diff --git a/public/app/views/js/submit/invitation-form.php b/public/app/views/js/submit/invitation-form.php
new file mode 100644
index 0000000..efeba27
--- /dev/null
+++ b/public/app/views/js/submit/invitation-form.php
@@ -0,0 +1,52 @@
+<script>
+ $(document).ready(function() {
+
+ // When form is submited
+ ////////////////////////////////////////////////////////////////////////////
+
+ $('form').submit( event => {
+ event.preventDefault();
+
+ if ($('input[name=password]').val() != $('input[name=confirm_password]').val()) {
+ alert('Τα δυο κωδικοί πρόσβασης δεν ταιριάζουν!');
+
+ } else if ($('input[name=password]').val() == "") {
+ alert('Ο κωδικός πρόσβασης δεν μπορεί να είναι κενός')
+
+ } else if ( ($('input[name=password]').val() == '0')
+ || ($('input[name=password]').val() =='') ) {
+ alert('Παρκαλώ συμπληρώστε ένα τηλέφωνο επικοινωνίας')
+
+ } else {
+ // prepare data to POST
+ var data = {
+ // identification fields
+ id: $('input[name=id]').val(),
+ invitation: $('input[name=invitation]').val(),
+ // data fields
+ first_name: $('input[name=first_name]').val(),
+ last_name: $('input[name=last_name]').val(),
+ father_name: $('input[name=father_name]').val(),
+ email: $('input[name=email]').val(),
+ registration_number: $('input[name=registration_number]').val(),
+ sector: $('select[name=sector]').select2('data')[0].text,
+ belonging_school: $('input[name=belonging_school]').val(),
+ position: $('select[name=position]').select2('data')[0].text,
+ phone: $('input[name=phone]').val(),
+ // access verification
+ password: $('input[name=password]').val()
+ };
+ console.log(data);
+
+ var request = '/account/activate'; // set action url
+
+ // send POST request
+ $.post(request, data)
+ .done(function( data ) {
+ $('.office .content-form').html(`<h4>${data.title}<h4><br>${data.message}`)
+ });
+ }
+ });
+
+ });
+</script> \ No newline at end of file