diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-29 05:24:19 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-29 05:24:19 +0300 |
| commit | 0294563513b7e589d2067fd0a4a824db9aa48180 (patch) | |
| tree | 15c5462bf333713edab9f3088c8bc35bb5ffc170 /public/app/views/templates/penalty.php | |
| parent | dfd5af8e07550b0715b157fa5c14f24e4be527fa (diff) | |
| download | gyraf1gov-0294563513b7e589d2067fd0a4a824db9aa48180.tar.gz gyraf1gov-0294563513b7e589d2067fd0a4a824db9aa48180.tar.bz2 gyraf1gov-0294563513b7e589d2067fd0a4a824db9aa48180.zip | |
beautify user-interface
Diffstat (limited to 'public/app/views/templates/penalty.php')
| -rw-r--r-- | public/app/views/templates/penalty.php | 141 |
1 files changed, 37 insertions, 104 deletions
diff --git a/public/app/views/templates/penalty.php b/public/app/views/templates/penalty.php index e913721..4709d60 100644 --- a/public/app/views/templates/penalty.php +++ b/public/app/views/templates/penalty.php @@ -52,121 +52,53 @@ </div> </body> + +<!-- SCRIPTS +//////////////////////////////////////////////////////////////////////////////// +--> + <script> -var values = {}; -var empty = ''; + var ref = { + organization: '<?=DEFAULT_SCHOOL?>', + ticket: '<?=$ticket?>' + }; +</script> -$(document).ready(function() { - // supplementary functions to select2 control +<?php // include select2 supplementary functions //////////////////////////////////////////////////////////////////////////// + Render::view('js/select2-supplementary'); +?> - /** 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; - } - - /** 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'); - } - - /** 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(); - } - - /** - * 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; - } - - /** - * 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; - } - } - - // intializations from form-definition - //////////////////////////////////////////////////////////////////////////// - <?=$form['init_js']?> +<script>// pass dynamic js prepared by form designer + $(document).ready(function() { + + // intializations from form-definition + //////////////////////////////////////////////////////////////////////// + <?=$form['init_js']?> + + }); +</script> - // track empty values +<?php // handle form submition //////////////////////////////////////////////////////////////////////////// + Render::view('js/submit/penalty-form'); +?> + + +<?php // load application pdf-designer + //////////////////////////////////////////////////////////////////////////// + Render::view('js/pdf-designer/penalty'); +?> - - + + +<!-- DEPRICATED: +<script> + $(document).ready(function() { // When form is submited //////////////////////////////////////////////////////////////////////////// @@ -219,5 +151,6 @@ $(document).ready(function() { }); </script> +--> </html> |
