summaryrefslogtreecommitdiff
path: root/public/app/views
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-06-01 03:33:18 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-06-01 03:33:18 +0300
commit864fbb806621c8167c49f7449486fbc3bdaca1a6 (patch)
tree1b5b5933dbb184b130c248d3281e709bd6286c5d /public/app/views
parent950798a91c0bed3f2d6e53182b0cff49f07eff0c (diff)
downloadgyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.gz
gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.bz2
gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.zip
user update; user petitions copy; fixed docker performance issues
Diffstat (limited to 'public/app/views')
-rw-r--r--public/app/views/components/header_includes.php96
-rw-r--r--public/app/views/components/menu.php4
-rw-r--r--public/app/views/components/own_petitions.php32
-rw-r--r--public/app/views/js/submit/application-form.php3
-rw-r--r--public/app/views/js/submit/penalty-form.php3
-rw-r--r--public/app/views/js/submit/update-properties.php38
-rw-r--r--public/app/views/templates/create_pdf.php69
-rw-r--r--public/app/views/user/panel.php13
-rw-r--r--public/app/views/user/update_properties.php70
9 files changed, 250 insertions, 78 deletions
diff --git a/public/app/views/components/header_includes.php b/public/app/views/components/header_includes.php
index c20811b..0600450 100644
--- a/public/app/views/components/header_includes.php
+++ b/public/app/views/components/header_includes.php
@@ -4,12 +4,15 @@
}
?>
-<!-- FONTS (CDN) -->
-
-<!-- Roboto slab
-<link rel="preconnect" href="https://fonts.googleapis.com">
-<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
-<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400&display=swap" rel="stylesheet"> -->
+<!-- FONTS (CDN)
+ /////////////////////////////////////////////////////////////////////////-->
+<?php /* DEPRICATED:
+ <!-- Roboto slab
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400&display=swap" rel="stylesheet"> -->
+ */
+?>
<!-- Fira Sans -->
<link rel="preconnect" href="https://fonts.googleapis.com">
@@ -20,7 +23,9 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
-<!-- LIBRARY (dependencies) CSS -->
+
+<!-- LIBRARY (dependencies) CSS
+ /////////////////////////////////////////////////////////////////////////-->
<!-- bootstap (CDN) -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous">
@@ -31,7 +36,10 @@
<!-- select2 css -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
-<!-- CUSTOM CSS -->
+
+
+<!-- CUSTOM CSS
+ /////////////////////////////////////////////////////////////////////////-->
<!-- bootstrap javascript (CDN) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/js/bootstrap.bundle.min.js" integrity="sha384-qKXV1j0HvMUeCBQ+QVp7JcfGl760yU08IQ+GpUo5hlbpg51QRiuqHAJz8+BrxE/N" crossorigin="anonymous"></script>
@@ -42,7 +50,10 @@
<!-- overides -->
<link href="/assets/css/overides.css" rel="stylesheet">
-<!-- JAVASCRIPT -->
+
+
+<!-- JAVASCRIPT
+ /////////////////////////////////////////////////////////////////////////-->
<!-- jQuery (CDN) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js" integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
@@ -50,20 +61,12 @@
<!-- basic cookie handling (vanilla js) -->
<script src="/assets/js/cookie.js"></script>
-<!-- datatables js -->
-<!--
-<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
-
-<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
--->
-
+<!-- pdfmake -->
<script src="<?=SITE_URL?>/assets/js/pdfmake/pdfmake.min.js"></script>
<script src="<?=SITE_URL?>/assets/js/pdfmake/vfs_fonts.js"></script>
-<!--
-<script src="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-colvis-2.3.6/b-html5-2.3.6/b-print-2.3.6/cr-1.6.2/date-1.4.0/fc-4.2.2/fh-3.3.2/kt-2.8.2/r-2.4.1/rr-1.3.3/sc-2.1.1/sl-1.6.2/sr-1.2.2/datatables.min.js"></script>-->
+<!-- datatables js -->
+<script src="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-colvis-2.3.6/b-html5-2.3.6/b-print-2.3.6/cr-1.6.2/date-1.4.0/fc-4.2.2/fh-3.3.2/kt-2.8.2/r-2.4.1/rr-1.3.3/sc-2.1.1/sl-1.6.2/sr-1.2.2/datatables.min.js"></script>
<!-- select2 js -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
@@ -71,36 +74,37 @@
<!-- marked -->
<script src="/assets/js/marked/marked.min.js"></script>
+<?php /* NOTE:
+ <!-- date handling in vanilla js ...
+ https://stackoverflow.com/questions/27267565/javascript-returning-incorrect-date-from-an-input-type-date
-<!-- date handling ...
-https://stackoverflow.com/questions/27267565/javascript-returning-incorrect-date-from-an-input-type-date
-
-// convert to UTC to avoid "date minus one" issues where the supplied date is interpreted incorrectly as
-// the previous date.
+ // convert to UTC to avoid "date minus one" issues where the supplied date is interpreted incorrectly as
+ // the previous date.
-date = new Date(document.getElementById('date').value);
-console.log("original date: " + date.toString());
-console.log("UTC date string: " + date.toUTCString());
+ date = new Date(document.getElementById('date').value);
+ console.log("original date: " + date.toString());
+ console.log("UTC date string: " + date.toUTCString());
-//produces local machine timezone, and therefore incorrect date value
+ //produces local machine timezone, and therefore incorrect date value
-date = new Date(date.toUTCString());
-console.log("UTC date string Date constructor: " + date.toString());
+ date = new Date(date.toUTCString());
+ console.log("UTC date string Date constructor: " + date.toString());
-utcDate = new Date(utcString.substr(0, utcString.indexOf("GMT")));
-console.log("UTC date string Date constructor (without 'GMT*'): " + utcDate.toString());
-console.log("UTC date number: " + date.getUTCDate());
-date.setDate(date.getUTCDate());
-date.setMonth(date.getUTCMonth());
-date.setFullYear(date.getUTCFullYear());
-console.log("UTC modified date: " + date.toString());
+ utcDate = new Date(utcString.substr(0, utcString.indexOf("GMT")));
+ console.log("UTC date string Date constructor (without 'GMT*'): " + utcDate.toString());
+ console.log("UTC date number: " + date.getUTCDate());
+ date.setDate(date.getUTCDate());
+ date.setMonth(date.getUTCMonth());
+ date.setFullYear(date.getUTCFullYear());
+ console.log("UTC modified date: " + date.toString());
-Output:
+ Output:
-original date: Fri Jan 29 2021 23:16:11 GMT-0600 (Central Standard Time)
-UTC date string: Sat, 30 Jan 2021 05:16:11 GMT
-UTC date string Date constructor: Fri Jan 29 2021 23:16:11 GMT-0600 (Central Standard Time)
-UTC date string Date constructor (without 'GMT*'): Sat Jan 30 2021 23:16:11 GMT-0600 (Central Standard Time)
-UTC date number: 30
-UTC modified date: Sat Jan 30 2021 23:16:11 GMT-0600 (Central Standard Time)
---> \ No newline at end of file
+ original date: Fri Jan 29 2021 23:16:11 GMT-0600 (Central Standard Time)
+ UTC date string: Sat, 30 Jan 2021 05:16:11 GMT
+ UTC date string Date constructor: Fri Jan 29 2021 23:16:11 GMT-0600 (Central Standard Time)
+ UTC date string Date constructor (without 'GMT*'): Sat Jan 30 2021 23:16:11 GMT-0600 (Central Standard Time)
+ UTC date number: 30
+ UTC modified date: Sat Jan 30 2021 23:16:11 GMT-0600 (Central Standard Time)
+ -->
+*/ \ No newline at end of file
diff --git a/public/app/views/components/menu.php b/public/app/views/components/menu.php
index 524547c..3e1748d 100644
--- a/public/app/views/components/menu.php
+++ b/public/app/views/components/menu.php
@@ -15,8 +15,8 @@
<li class="list-group-item"><a href="/user/petitions">Πρακτικά και αιτήσεις</a></li>
<li class="list-group-item separator">Προφίλ</li>
- <li class="list-group-item"><a href="/user/update">Ενημέρωση στοιχείων</a></li>
- <li class="list-group-item"><a href="/user/new-password">Αλλαγή password</a></li>
+ <li class="list-group-item"><a href="/user/update_form">Ενημέρωση στοιχείων</a></li>
+ <li class="list-group-item"><a href="/user/change_password">Αλλαγή password</a></li>
<?php if ($is_admin) : ?>
<li class="list-group-item separator">Διαχείριση</li>
diff --git a/public/app/views/components/own_petitions.php b/public/app/views/components/own_petitions.php
index 4b076c4..41e59b4 100644
--- a/public/app/views/components/own_petitions.php
+++ b/public/app/views/components/own_petitions.php
@@ -1,15 +1,18 @@
- <!-- title bar -->
- <div class="title-bar">
- <div><h5>Διαχείριση Αιτήσεων και Δοικητικών Εγγράφων</h5></div>
- <div>
- <!-- Button trigger modal -->
- <a type="button" class="btn pull-right" href="/admin/edit_lesson">
- <i class="fas fa-plus"></i> &nbsp; Νέο Μάθημα
- </a>
+<div class="manage">
+ <!-- title bar -->
+ <div class="title-bar">
+ <div class="row">
+ <h5 class="col-md-10">Διαχείριση Αιτήσεων και Δοικητικών Εγγράφων</h5>
+ <div class="col-md-2">
+ <a type="button" class="btn btn-sm btn-back2panel pull-right" href="/panel">
+ Επιστροφή
+ </a>
+ </div>
+ </div>
+
</div>
-</div>
-<div class="manage">
+
<div class="row">
<div class="col-md-12">
@@ -18,9 +21,9 @@
<table id="dt-petitions" class="table table-responsive dt-table" style="width:100%">
<thead>
<!--<th class="dt-id">α/α</th>-->
- <th class="dt-title">Τίτλος</th>
+ <th class="dt-subject">Θέμα</th>
<th class="dt-protocol">Αρ.Πρωτόκολλου</th>
- <th class="dt-signature">Signature</th>
+ <!-- <th class="dt-signature">Signature</th> -->
<th class="dt-datepost">Ημερ. Καταχώρισης</th>
<th class="dt-actions"></th>
</thead>
@@ -30,8 +33,5 @@
</div>
</div>
+
</div><!-- /manage -->
-
-
-
-
diff --git a/public/app/views/js/submit/application-form.php b/public/app/views/js/submit/application-form.php
index 168ca0d..272fbcb 100644
--- a/public/app/views/js/submit/application-form.php
+++ b/public/app/views/js/submit/application-form.php
@@ -21,7 +21,8 @@
position: selected_text($('select[name=position]')),
request: $('textarea[name=request]').val(),
now: Math.floor(Date.now() / 1000), // client timestamp
- ticket: ref.ticket
+ ticket: ref.ticket,
+ ref: ref
};
}
diff --git a/public/app/views/js/submit/penalty-form.php b/public/app/views/js/submit/penalty-form.php
index a5a8ec6..e3d2748 100644
--- a/public/app/views/js/submit/penalty-form.php
+++ b/public/app/views/js/submit/penalty-form.php
@@ -23,7 +23,8 @@
president: selected_text($('select[name=president]')),
now: Math.floor(Date.now() / 1000), // client timestamp
members: selected_multitexts($('select[name="members[]"]')),
- ticket: ref.ticket
+ ticket: ref.ticket,
+ ref: ref
};
}
diff --git a/public/app/views/js/submit/update-properties.php b/public/app/views/js/submit/update-properties.php
new file mode 100644
index 0000000..651ef3e
--- /dev/null
+++ b/public/app/views/js/submit/update-properties.php
@@ -0,0 +1,38 @@
+<script>
+ $(document).ready(function() {
+
+ // When form is submited
+ ////////////////////////////////////////////////////////////////////////////
+
+ $('form').submit( event => {
+ event.preventDefault();
+
+ // prepare data to POST
+ var data = {
+ // identification fields
+ id: $('input[name=id]').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(),
+ };
+ console.log(data);
+
+ var request = '/user/update_properties'; // 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
diff --git a/public/app/views/templates/create_pdf.php b/public/app/views/templates/create_pdf.php
new file mode 100644
index 0000000..19b2894
--- /dev/null
+++ b/public/app/views/templates/create_pdf.php
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title><?=SITE_TITLE?></title>
+
+ <style>
+ html,body{
+ padding:0; margin:0;
+ font-size:1.15em; font-family: Arial, Helvetica, Ubuntu, sans-serif;
+ color: #037; background: #eee;
+ line-height:1.2em;
+ }
+ h3 {
+ font-size: 2em; font-style: normal;
+ font-weight: 400;
+ color: #05a;
+ margin: 0; padding: 5px;
+ opacity: 0.27;
+ border-bottom: 1px solid #05a;
+ }
+ .container { display: flex; height: 100vh; align-items:center; }
+ .content { position: relative;
+ max-width:320px; width: 100%;
+ margin: auto auto; padding: 1.5em 1.5em 3em 1.5em;
+ text-align: center; justify-center: center;
+ opacity: .5;
+ }
+ .btn { font-size: 18px; padding: 4px 12px; }
+ </style>
+
+ <script src="<?=SITE_URL?>/assets/js/pdfmake/pdfmake.min.js"></script>
+ <script src="<?=SITE_URL?>/assets/js/pdfmake/vfs_fonts.js"></script>
+
+ <?php // load pdf-designer
+ ////////////////////////////////////////////////////////////////////////
+ Render::view('js/pdf-designer/'. $petition['type']);
+ ?>
+</head>
+<body>
+ <div class='container'>
+ <div class='content'>
+
+ <!--<h3>Παρακαλώ περιμένετ</h3>-->
+ Η διαδικασία λήψης του εγγράφου είναι σε εξέλιξη...<br />
+
+ </div>
+ </div>
+</body>
+<script>
+var data = <?=json_encode($petition, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)?>;
+
+pdfMake.fonts = {
+ FiraSans: {
+ normal: '<?=SITE_URL?>/assets/fonts/FiraSans-Light.ttf',
+ bold: '<?=SITE_URL?>/assets/fonts/FiraSans-Medium.ttf'
+ // italics: 'https://example.com/fonts/fontFile3.ttf',
+ // bolditalics: 'https://example.com/fonts/fontFile4.ttf'
+ },
+ FiraMono: {
+ normal: '<?=SITE_URL?>/assets/fonts/FiraMono-Regular.ttf',
+ }
+ }
+
+pdfMake.createPdf(
+ designer( data.form_structure, data.form_structure.ref )
+).download('<?=$petition['signature']?>.pdf');
+</script>
+</html> \ No newline at end of file
diff --git a/public/app/views/user/panel.php b/public/app/views/user/panel.php
index 80f4071..fbfdd0c 100644
--- a/public/app/views/user/panel.php
+++ b/public/app/views/user/panel.php
@@ -38,18 +38,6 @@
]);
?>
- <!-- content
- ** petitions datatable
- * change password -> link out (?)
- * update properties -> link out (?)
- ** admin petitions datatable
- * send invitations -> link out (?)
- * create member -> link out (?)
-
- TODO:
- switch / case (?)
- -->
-
</div>
</div>
@@ -110,6 +98,7 @@
</body>
+ <script src="/assets/js/panel/<?=$content?>.js"></script>
<!-- scripts
* handle show petition request
diff --git a/public/app/views/user/update_properties.php b/public/app/views/user/update_properties.php
new file mode 100644
index 0000000..35a1b1e
--- /dev/null
+++ b/public/app/views/user/update_properties.php
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title><?=SITE_TITLE?> - Ενημέρωση στοιχείων</title>
+
+ <?php // header includes
+ ////////////////////////////////////////////////////////////////////////
+ Render::view('components/header_includes');
+ ?>
+</head>
+<body class="office central-form">
+
+ <div class='container'>
+ <div class="content max540px">
+
+ <div class='content-form'>
+ <form method="post">
+ <div>
+ <h4>Ενημέρωση στοιχείων</h4>
+ <hr/>
+
+ <?=$form['html']?>
+
+ <br />
+ <button type="submit" class="btn btn-primary btn-sm col-12">Ενημέρωση</button>
+
+ </div>
+ </form>
+ </div>
+
+ </div>
+ </div>
+
+</body>
+
+<script>// initialize needed global variables
+ var values = {};
+ var empty = '';
+</script>
+
+
+<?php // include select2 supplementary functions
+ ////////////////////////////////////////////////////////////////////////////
+ Render::view('js/select2-supplementary');
+?>
+
+<script>
+$(document).ready(function() {
+
+ // intializations from form-definition
+ ////////////////////////////////////////////////////////////////////////////
+
+ <?=$form['init_js']?>
+
+
+ // set known values
+ ////////////////////////////////////////////////////////////////////////////
+
+ <?=$form['values_js']?>
+
+});
+</script>
+
+
+<?php // handle form submition
+ ////////////////////////////////////////////////////////////////////////////
+ Render::view('js/submit/invitation-form');
+?>
+</html>