From 10b2d9448baffc5c65375c6757ea12034d4fe8ca Mon Sep 17 00:00:00 2001 From: Metabox Date: Sat, 10 Aug 2019 05:09:25 +1000 Subject: [PATCH] Dropdown interaction and date widged, search view. --- htdocs/cgi-bin/config.cgi | 5 ++-- htdocs/cgi-bin/main.cgi | 4 +-- htdocs/cgi-bin/wsrc/main.css | 3 ++- htdocs/cgi-bin/wsrc/main.js | 52 ++++++++++++++++++++++++++---------- 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 0326108..54051bd 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -173,7 +173,7 @@ my $frm = qq(
WARNING! Removing or changing categories is permanent! Each category one must have an unique ID. Blank a category name to remove it. LOG records will change to the - Unspecified (id 1) category! And the category Unspecified, can't be removed! + Unspecified (id 1) category! And the categories Unspecified, Income and Expense can't be removed!
@@ -483,7 +483,7 @@ elsif ($change == 1){ if($pnm ne $cnm || $pds ne $cds){ - if($cid!=1 && $pnm eq ""){ + if( ($cid!=1 && $cid!=32 && $cid!=35) && $pnm eq ""){ $s = "SELECT rowid, ID_CAT FROM LOG WHERE ID_CAT =".$cid.";"; $d = $db->prepare($s); @@ -1001,6 +1001,7 @@ sub cats{ my $cats = qq('; diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index be7d6e1..88b1d1c 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -715,8 +715,8 @@ _TXT View by Date: - From:    - To:  + From:    + To:     diff --git a/htdocs/cgi-bin/wsrc/main.css b/htdocs/cgi-bin/wsrc/main.css index c8a550c..eb96a95 100644 --- a/htdocs/cgi-bin/wsrc/main.css +++ b/htdocs/cgi-bin/wsrc/main.css @@ -224,4 +224,5 @@ img { #btnRTF { float: right; -} \ No newline at end of file +} + diff --git a/htdocs/cgi-bin/wsrc/main.js b/htdocs/cgi-bin/wsrc/main.js index 3e1ee82..893bfc9 100644 --- a/htdocs/cgi-bin/wsrc/main.js +++ b/htdocs/cgi-bin/wsrc/main.js @@ -1,5 +1,5 @@ /* - Programed in vim by: Will Budic + Programed by: Will Budic Open Source License -> https://choosealicense.com/licenses/isc/ */ @@ -15,6 +15,9 @@ var _show_all = true; var DEF_BACKGROUND = 'white'; +var RTF_DOC_RESIZED = false; +var RTF_DOC_ORIG; + function loadedBody(toggle) { @@ -32,6 +35,15 @@ function loadedBody(toggle) { firstDay: 1 }); + $('#srh_date_from').datepicker({ + dateFormat: 'yy-mm-dd', + firstDay: 1 + }); + + $('#srh_date_to').datepicker({ + dateFormat: 'yy-mm-dd', + firstDay: 1 + }); $('#ed').poshytip({ content: "Select here date and time of your log.", className: 'tip-yellowsimple', @@ -136,11 +148,30 @@ function loadedBody(toggle) { DEF_BACKGROUND = RGBToHex($('#editor-container').css('background-color')); $("#fldBG").val(DEF_BACKGROUND); + // $( function() { + var amf = $( "#amf" );//Amount Field Type dropdown + var ec = $( "#ec" ); //Category dropdown + + $( amf ).selectmenu({style: "dropdown", width:120, + change: function( event, data ) { + var evv =ec.val(); + if(ec.val()<2||evv==32||evv==35||data.item.value == 0){ + var sel = null; + if(data.item.label == "Income"){ sel = 35; } + else if(data.item.label == "Expense"){sel = 32; } + else if(data.item.value == 0 && (evv == 35||evv==32)){sel = 1; } + if(sel){ + ec.val(sel); + ec.selectmenu("refresh"); + } + } + }}); + } -function encodeText(el) { +function encodeText(el){ var el = $("#frm_entry [name=log]"); var txt = el.val(); txt = txt.replace(/\r\n/g, "\\n"); @@ -350,10 +381,6 @@ function viewAll() { return false; } - - -var RTF_DOC_RESIZED = false; -var RTF_DOC_ORIG; function resizeDoc() { var css = $("#editor-container").prop('style'); if(RTF_DOC_RESIZED){ @@ -698,20 +725,17 @@ function editorBackground(reset){ function RGBToHex(rgb) { // Choose correct separator - let sep = rgb.indexOf(",") > -1 ? "," : " "; + var sep = rgb.indexOf(",") > -1 ? "," : " "; // Turn "rgb(r,g,b)" into [r,g,b] rgb = rgb.substr(4).split(")")[0].split(sep); - let r = (+rgb[0]).toString(16), + var r = (+rgb[0]).toString(16), g = (+rgb[1]).toString(16), b = (+rgb[2]).toString(16); - if (r.length == 1) - r = "0" + r; - if (g.length == 1) - g = "0" + g; - if (b.length == 1) - b = "0" + b; + if (r.length == 1) r = "0" + r; + if (g.length == 1) g = "0" + g; + if (b.length == 1) b = "0" + b; return "#" + r + g + b; } -- 2.34.1