diff options
Diffstat (limited to 'public/app/views')
| -rw-r--r-- | public/app/views/error/404.php | 12 | ||||
| -rw-r--r-- | public/app/views/templates/penalty.php | 12 | ||||
| -rw-r--r-- | public/app/views/user/invitation.php (renamed from public/app/views/user/registration.php) | 96 | ||||
| -rw-r--r-- | public/app/views/welcome.php | 15 |
4 files changed, 93 insertions, 42 deletions
diff --git a/public/app/views/error/404.php b/public/app/views/error/404.php index a085830..41f17da 100644 --- a/public/app/views/error/404.php +++ b/public/app/views/error/404.php @@ -7,7 +7,6 @@ * * optional @var $error_code (int) : error code * optional @var $moto (string) : super-mini description text - * optional @var $message (string) * */ @@ -15,14 +14,14 @@ $error_code = 404; // set default (404) } - http_response_code(403); + http_response_code($error_code); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> - <title>404: Not Found</title> + <title><?=$error_code?> : <?= $moto ?? 'Not found' ?></title> <style> html,body{ @@ -52,13 +51,10 @@ <body> <div class='container'> <div class='content'> + <h3><?=$error_code?></h3> <?= $moto ?? 'Not found' ?><br /> - <!-- - — - <br /> - <span><?= $message ?? "and I still haven't found what I'm looking for." ?></span> - --> + </div> </div> </body> diff --git a/public/app/views/templates/penalty.php b/public/app/views/templates/penalty.php index 6a8f563..bbd7b4a 100644 --- a/public/app/views/templates/penalty.php +++ b/public/app/views/templates/penalty.php @@ -2,7 +2,7 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title><?=SITE_TITLE?> - Εγγραφή</title> + <title><?=SITE_TITLE?> - Πρακτικό Πειθαρχικής Υπόθεσης</title> <?php // header includes //////////////////////////////////////////////////////////////////////// @@ -56,14 +56,8 @@ <div class='content-form'> <form method="post"> <div> - <p>1o Γυμνάσιο Ραφήνας /<br /> - Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας διαδικαστικών εγγράφων</p> - <h2>Πρόσκληση #</h2> - - <?php - $form = JsonToForm::make_a_form(PENALTY_FORM); - ?> + <h2>Πρακτικό Πειθαρχικής Υπόθεσης</h2> <?=$form['html']?> @@ -122,6 +116,8 @@ <?=$form['init_js']?> + + <?=$form['values_js']?> </script> </html> diff --git a/public/app/views/user/registration.php b/public/app/views/user/invitation.php index 9eb0ea3..eb34bc4 100644 --- a/public/app/views/user/registration.php +++ b/public/app/views/user/invitation.php @@ -43,7 +43,7 @@ label { font-size: 14px; } </style> </head> -<body class="classroom"> +<body class="office"> <div class='container'> <div class="content"> <div class="info"> @@ -58,10 +58,6 @@ <h2>Πρόσκληση #</h2> - <?php - $form = JsonToForm::make_a_form(REGISTRATION_FORM); - ?> - <?=$form['html']?> <br /> @@ -80,42 +76,104 @@ </body> <script> +var values = {}; +var empty = ''; + +$(document).ready(function() { + + /** select2_set_text + * select an (select2-)option by text + * + * @param control = jquery selector, + * @param t (string) = text of option + */ + function select2_set_text(control, t) { /* define function */ + opts = control.select2()[0].options; + var id; + for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } + control.val(id).trigger('change'); + } + + /** get_id_of_text + * get id (=value) of an option with `t` text + * + * @param control = jquery selector, + * @param t (string) = text of option + */ + function get_id_of_text( control , t) { /* define id from text */ + opts = control.select2()[0].options; + var id = false; + for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } + return id; + } + + /** select2_set_multi_text + * select several (select2-)options by text + * + * @param control = jquery selector, + * #param t_list (string) = list of selected texts + */ + function select2_set_multi_text(control, t_list) { /* define function */ + var ids = []; + t_list.forEach (t => { let id = get_id_of_text(control, t); + if (id !== false) ids.push(id); + }) + control.val(ids).change(); + } + + + <?=$form['init_js']?> + + <?=$form['values_js']?> + // When form is submited // ------------------------------------------------------------------------- - $('.content-form form').submit( event => { + $('form').submit( event => { event.preventDefault(); - if ($('input[name=password]').val() != $('input[name=password2]').val()) { - alert('Τα δυο passrods δεν ταιριάζουν!'); + if ($('input[name=password]').val() != $('input[name=confirm_password]').val()) { + alert('Τα δυο κωδικοί πρόσβασης δεν ταιριάζουν!'); + + } else if ($('input[name=password]').val() == "") { + alert('Ο κωδικός πρόσβασης δεν μπορεί να είναι κενός') - } else { + } 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: $('input[name=sector]').val(), + sector: $('select[name=sector]').select2('data')[0].text, belonging_school: $('input[name=belonging_school]').val(), - working_shcool: $('input[name=working_shcool]').val(), - position_type_id: $('input[name=position_type_id]').val(), + position: $('select[name=position]').select2('data')[0].text, phone: $('input[name=phone]').val(), + // access verification password: $('input[name=password]').val() }; - - // select action url (add or update) - var request = '/account/register'; + // console.log('post:', data); + + var request = '/account/activate'; // set action url // send POST request $.post(request, data) .done(function( data ) { - $('.classroom .content-form').html(data.message) + $('.office .content-form').html(data.message) }); - } - + } }); -</script> + +}); +</script> </html> diff --git a/public/app/views/welcome.php b/public/app/views/welcome.php index e97f748..fd3f703 100644 --- a/public/app/views/welcome.php +++ b/public/app/views/welcome.php @@ -26,15 +26,14 @@ select option { font-size: .87rem; } </head> <body class='classroom'> <div class="container" style="max-width: 640px;"> - <div class="row"> + <div class="row"> - <?php - $form = JsonToForm::make_a_form(REGISTRATION_FORM); - ?> +<?php + $form = JsonToForm::make_a_form(REGISTRATION_FORM); +?> +<?=$form['html']?> - <?=$form['html']?> - - </div> + </div> </div> @@ -196,6 +195,8 @@ $('.select-field').select2({ width: '100%' }); // --------------------------------------------------------------------------- <?=$form['init_js']?> +<?=$form['values_js']?> + // 04. FORM-LOGIC // --------------------------------------------------------------------------- |
