summaryrefslogtreecommitdiff
path: root/public/app/controllers
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-05 04:07:05 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-05 04:07:05 +0300
commit537673748f0b01539fc5839c2af1bacbefafc86d (patch)
treec2032ff9efb06257bbf70f3329524d86bc2cb6e3 /public/app/controllers
parent63f714d5a78b765c117ebf6bbdfdbd748dd45644 (diff)
downloadgyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.tar.gz
gyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.tar.bz2
gyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.zip
the penalty form (input, new record)
Diffstat (limited to 'public/app/controllers')
-rw-r--r--public/app/controllers/Auth.php19
-rw-r--r--public/app/controllers/JsonToForm.php4
-rw-r--r--public/app/controllers/Office.php7
3 files changed, 23 insertions, 7 deletions
diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php
index 118b4d0..f1e9819 100644
--- a/public/app/controllers/Auth.php
+++ b/public/app/controllers/Auth.php
@@ -62,9 +62,17 @@ class Auth {
// set cookie for connected user
setcookie(
CONNECTION_COOKIE,
- 'connected;'. $user->getName(),
- time()+60*60*10, // 10 hours
- '/'
+ rawurlencode(json_encode(
+ [ 'rid' => $record['role_id'], 'name' => $user->getName() ],
+ JSON_UNESCAPED_UNICODE
+ )),
+ [
+ 'expires' =>time()+60*60*10, // 10 hours
+ 'path' => '/',
+ // 'domain' => COOKIE_DOMAIN,
+ 'secure' => COOKIE_SECURE,
+ 'samesite' => COOKIE_SAMESITE
+ ]
);
// login OK, set Token in session
@@ -174,7 +182,10 @@ class Auth {
]);
- Render::view('user/invitation', ['form' => $form]);
+ Render::view('user/invitation', [
+ 'form' => $form,
+ 'invitation_number' => $user->invitation
+ ]);
}
diff --git a/public/app/controllers/JsonToForm.php b/public/app/controllers/JsonToForm.php
index 5df650d..7df8098 100644
--- a/public/app/controllers/JsonToForm.php
+++ b/public/app/controllers/JsonToForm.php
@@ -219,7 +219,7 @@ class JsonToForm
// print_r([ $set_value, $name, ($default_values->$name ?? 'none') ]);
$appendKey = in_array('append-key', $attributes) ? true : false; // append key (for selects)
- $required = in_array('required', $attributes) ? '' : ''; // required
+ $required = in_array('required', $attributes) ? 'required' : ''; // required
$asterisk = in_array('required', $attributes) ? '*' : ''; // asterisk in label if required
$html .= "
@@ -239,7 +239,7 @@ class JsonToForm
// prepare initialization of select2 (multiple)
$initSelectsJS .= "
var {$name} = $('#{$name}');
- {$name}.select2({ width: '100%', placeholde: '{$label}' });";
+ {$name}.select2({ width: '100%' });";
if ($set_value) { // if default value is set
$initSelectsJS .= "
diff --git a/public/app/controllers/Office.php b/public/app/controllers/Office.php
index cfadde3..44428af 100644
--- a/public/app/controllers/Office.php
+++ b/public/app/controllers/Office.php
@@ -160,6 +160,11 @@ class Office {
}
+ private static function render_common_petition($opts)
+ {
+
+ }
+
private static function render_penalty_form($opts)
{
$user_id = $opts['user']->getID();
@@ -193,7 +198,7 @@ class Office {
// get Form's HTML and Jsvascript
$form = JsonToForm::json_form($form_setup, [
- ['name' => 'id', 'value' => $user_id] // pass user identity
+ ['name' => 'user_id', 'value' => $user_id] // pass user identity
]);
Render::view('templates/penalty', ['form' => $form]);