summaryrefslogtreecommitdiff
path: root/public/app/views/templates/application.php
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/templates/application.php
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/templates/application.php')
-rw-r--r--public/app/views/templates/application.php266
1 files changed, 107 insertions, 159 deletions
diff --git a/public/app/views/templates/application.php b/public/app/views/templates/application.php
index a6b2b6b..f1f45fb 100644
--- a/public/app/views/templates/application.php
+++ b/public/app/views/templates/application.php
@@ -12,7 +12,7 @@
</head>
<body class="office central-form">
-<div class='container'>
+ <div class='container'>
<div class="content max720px">
<div class='content-form'>
@@ -31,185 +31,133 @@
</form>
</div>
+ <!-- attachments -->
+ <?php /* exclude until beta version
<div class="info">
- <h4>Synhmena</h4>
- <ul>
- <li>uno</li>
- <li>duo</li>
- <li>tre</li>
- </ul>
- </div>
+ <div class="row form-group">
- </div>
- </div>
-
-</body>
-<script>
-var values = {};
-var empty = '';
+ <label class="control-label col-sm-12" for="media">Συνημμένα</label>
-$(document).ready(function() {
+ <div class="col-sm-12 post-media">
- // supplementary functions to select2 control
- ////////////////////////////////////////////////////////////////////////////
+ <!-- Button trigger modal -->
+ <button type="button" class="btn btn-sm btn-success pull-right over-bar"
+ data-bs-toggle="modal" data-bs-target="#editorModal" data-action="upload_file">
+ <i class="fas fa-plus"></i> &nbsp; Προσθήκη
+ </button>
- /** getValues
- * --- -- -- - - -
- * Get selected value(s) of Select2 control
- *
- * @param arg: source-element
- * @return (string) value(s) comma-separated
- */
- function getValues(srcElm) {
- var res;
- var obj = srcElm.select2('data'); // get delected data array
-
- if (obj.length === 0) return ''; // if empty list then nothig is selected
- else {
- var i = 0;
- obj.forEach(function(elm){ // loop through object elements array
-
- if (i) res += ',' + elm.id; // if not first item, prepend ',' befor value(id)
- else res = elm.id; // else set (first) checked value
-
- i++;
- });
- }
- return res;
- }
+ <ul id="files_list">
+ </ul>
- /** select2_set_text
- * --- -- -- - - -
- * select an (select2-)option by text
- * onto a (single) select2 control
- *
- * @param control = jquery selector,
- * @param t (string) = text of option
- */
- function select2_set_text(control, t) {
- 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');
- }
+ </div>
- /** get_id_of_text
- * --- -- -- - - -
- * get id (=value) of an option with `t` as text
- * onto a select2 control;
- *
- * Can be used on single or multiple select2 contols
- *
- * @param control = jquery selector,
- * @param t (string) = text of option
- */
- function get_id_of_text( control , t) {
- 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();
- }
+ </div>
+ </div>
+ */
+ ?>
+ </div>
+ </div>
- /**
- * get selected text of a select2 control
- */
- function selected_text(control) {
- if (typeof control.select2('data') === 'undefined') return false;
- else if (control.select2('data').length == 0) return false;
- else return control.select2('data')[0].text;
- }
+ <!-- MODAL for file uploads and preview -->
+ <div class="modal fade" id="editorModal" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog modal-lg" role="document">
+ <div class="modal-content">
+ <!-- content will be dynamic -->
+ </div>
+ </div>
+ </div>
- /**
- * get all selected texts from a multi-select2 contol
- */
- function selected_multitexts(control) {
- if (typeof control.select2('data') === 'undefined') return false;
- else if (control.select2('data').length == 0) return false;
- else {
- var result = [];
- control.select2('data').forEach( item => { result.push(item.text); });
- return result;
- }
- }
+</body>
- // intializations from form-definition
- ////////////////////////////////////////////////////////////////////////////
+<!-- SCRIPTS
+////////////////////////////////////////////////////////////////////////////////
+-->
- <?=$form['init_js']?>
+<script>// initialize needed global variables
+ var values = {};
+ var empty = '';
+</script>
- // track empty values
+<?php // include select2 supplementary functions
////////////////////////////////////////////////////////////////////////////
+ Render::view('js/select2-supplementary');
+?>
-
-
+<script>// pass dynamic js prepared by form designer
+ $(document).ready(function() {
- // When form is submited
- ////////////////////////////////////////////////////////////////////////////
+ // intializations from form-definition
+ ////////////////////////////////////////////////////////////////////////
+ <?=$form['init_js']?>
+
+ });
+</script>
- $('.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);
+<?php // handle form submition
+ ////////////////////////////////////////////////////////////////////////////
+ Render::view('js/submit/application-form');
+?>
- // send POST request
- // $.post(request, form_data)
- // .done(function( data ) {
- // $('.classroom .content-form').html(data.message)
- // });
- }
- });
+<?php // include attachments handling
+ ////////////////////////////////////////////////////////////////////////////
+ Render::view('js/attachments-handling');
+?>
+</html>
- });
-</script>
-</html>
+<!-- application pdf template
+ check: http://pdfmake.org/playground.html
+ // playground requires you to assign document definition to a variable called dd
+
+ var dd = {
+ content: [
+ 'APPLICATION:\n\n',
+ {
+ alignment: 'justify',
+ columns: [
+ {
+ text: [
+ 'NAME: My Name',
+ 'Father: I do',
+ 'Mother:Me too',
+ 'Specs: Some quite big Address Lorem ipsum dolor sit amet, consectetur adipisicing elit'
+ ].join('\n\n')
+ },
+ {
+ text:[
+ 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
+ 'Malit profecta versatur nomine ocurreret multavit, officiis viveremus aeternum.',
+ 'Quando nostros congressus susceperant concederetur leguntur iam, vigiliae democritea tantopere causae.',
+ 'Atilii plerumque ipsas potitur pertineant multis rem quaeri pro, legendum didicisse credere ex maluisset per videtis.',
+ 'Cur discordans praetereat aliae ruinae dirigentur orestem eodem, praetermittenda divinum.',
+ 'Collegisti, deteriora malint loquuntur officii cotidie finitas referri doleamus ambigua acute.',
+ 'Adhaesiones ratione beate arbitraretur detractis perdiscere, constituant hostis polyaeno.',
+ 'Diu concederetur.'
+ ].join('\n')
+ }
+ ]
+ },
+ '\n\nOh, don\'t forget, we can use everything from styling examples (named styles, custom overrides) here as well.',
+ '\n\nWow, you\'ve read the whole document! Congratulations :D'
+ ],
+ styles: {
+ header: {
+ fontSize: 18,
+ bold: true
+ },
+ bigger: {
+ fontSize: 15,
+ italics: true
+ }
+ },
+ defaultStyle: {
+ columnGap: 20
+ }
+
+ }
+--> \ No newline at end of file