summaryrefslogtreecommitdiff
path: root/public/app/views/user
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-04 03:02:01 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-04 03:02:01 +0300
commit63f714d5a78b765c117ebf6bbdfdbd748dd45644 (patch)
tree87a4db40e1ff699222ccfdf699a3904d1c665bfc /public/app/views/user
parent931a93cd7bae092e2752064568cebe407d2bf46e (diff)
downloadgyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.tar.gz
gyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.tar.bz2
gyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.zip
authentication; invitation; activation; base form setup
Diffstat (limited to 'public/app/views/user')
-rw-r--r--public/app/views/user/invitation.php (renamed from public/app/views/user/registration.php)96
1 files changed, 77 insertions, 19 deletions
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>