From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- admin/survey/script/Chartjs.js | 28 + admin/survey/script/Chartjs/chart.js | 13 + admin/survey/script/DragDrop/dragdropInAdmin.js | 16 +- admin/survey/script/GDPR.js | 102 +- admin/survey/script/Maps/VnaprejMarkers.js | 2 +- admin/survey/script/appendMerge.js | 34 +- admin/survey/script/branching.js | 461 +++--- admin/survey/script/break.js | 36 +- admin/survey/script/cReport.js | 87 +- admin/survey/script/calendar/calendar.js | 2 +- admin/survey/script/charts.js | 8 +- admin/survey/script/collectData.js | 2 +- admin/survey/script/comments.js | 198 +++ admin/survey/script/conditionProfiles.js | 4 +- admin/survey/script/crosstab.js | 46 +- admin/survey/script/customizeImageView.js | 20 +- admin/survey/script/dataSettingProfiles.js | 6 +- .../script/datatables/jquery.dataTables.min.css | 2 +- admin/survey/script/datepicker.js | 6 +- admin/survey/script/domainChange.js | 28 + admin/survey/script/dostop.js | 2 +- admin/survey/script/folders.js | 4 +- admin/survey/script/inspect.js | 2 +- admin/survey/script/invitations.js | 316 ++-- .../jquery.selectbox-0.6.1.js | 7 +- admin/survey/script/js-lang.php | 35 +- admin/survey/script/library.js | 490 +++++- admin/survey/script/means.js | 21 +- admin/survey/script/missingProfiles.js | 4 +- admin/survey/script/missingValues.js | 6 +- admin/survey/script/mobile.js | 104 +- admin/survey/script/multiCrosstabs.js | 6 + admin/survey/script/notifications.js | 63 +- admin/survey/script/postProcess.js | 165 +- admin/survey/script/progressBar.js | 10 +- admin/survey/script/quota.js | 38 +- admin/survey/script/script.js | 1597 +++++++++++++------- admin/survey/script/script_analiza.js | 627 +++----- admin/survey/script/skupine.js | 12 +- admin/survey/script/slideshow.js | 4 +- admin/survey/script/statistika.js | 4 +- admin/survey/script/statusProfiles.js | 46 +- admin/survey/script/surveyCondition.js | 6 +- admin/survey/script/surveyList.js | 317 ++-- admin/survey/script/telephone.js | 64 +- admin/survey/script/themes.js | 68 +- admin/survey/script/timeProfiles.js | 4 +- admin/survey/script/ttest.js | 20 +- admin/survey/script/uporabniki_custom.js | 12 +- admin/survey/script/vprasanje.js | 377 ++++- admin/survey/script/vprasanjeDeleted.js | 86 ++ admin/survey/script/vprasanjeInline.js | 470 +++--- admin/survey/script/zankaProfiles.js | 47 +- admin/survey/script/zoom.js | 31 +- 54 files changed, 3916 insertions(+), 2250 deletions(-) create mode 100644 admin/survey/script/Chartjs.js create mode 100644 admin/survey/script/Chartjs/chart.js create mode 100644 admin/survey/script/comments.js create mode 100644 admin/survey/script/domainChange.js create mode 100644 admin/survey/script/vprasanjeDeleted.js (limited to 'admin/survey/script') diff --git a/admin/survey/script/Chartjs.js b/admin/survey/script/Chartjs.js new file mode 100644 index 0000000..d968d2f --- /dev/null +++ b/admin/survey/script/Chartjs.js @@ -0,0 +1,28 @@ +function diagnosticsChart(place,display) { + + const data = { + datasets: [{ + data: display, + backgroundColor: [ + 'rgb(229,229,229)', + 'rgb(30, 136, 229)', + ], + borderWidth: 0, //spacing between slices + }] + }; + + const config = { + type: 'doughnut', + data: data, + options: { + events: [], //no hover labels,animations,... + cutout: 30, //slice width + } + }; + + const myChart = new Chart( + document.getElementById(place), + config + ); + +} \ No newline at end of file diff --git a/admin/survey/script/Chartjs/chart.js b/admin/survey/script/Chartjs/chart.js new file mode 100644 index 0000000..27815c8 --- /dev/null +++ b/admin/survey/script/Chartjs/chart.js @@ -0,0 +1,13 @@ +/*! + * Chart.js v3.8.0 + * https://www.chartjs.org + * (c) 2022 Chart.js Contributors + * Released under the MIT License + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";const t="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function e(e,i,s){const n=s||(t=>Array.prototype.slice.call(t));let o=!1,a=[];return function(...s){a=n(s),o||(o=!0,t.call(window,(()=>{o=!1,e.apply(i,a)})))}}function i(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const s=t=>"start"===t?"left":"end"===t?"right":"center",n=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,o=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;var a=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=t.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}; +/*! + * @kurkle/color v0.2.1 + * https://github.com/kurkle/color#readme + * (c) 2022 Jukka Kurkela + * Released under the MIT License + */function r(t){return t+.5|0}const l=(t,e,i)=>Math.max(Math.min(t,i),e);function h(t){return l(r(2.55*t),0,255)}function c(t){return l(r(255*t),0,255)}function d(t){return l(r(t/2.55)/100,0,1)}function u(t){return l(r(100*t),0,100)}const f={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},g=[..."0123456789ABCDEF"],p=t=>g[15&t],m=t=>g[(240&t)>>4]+g[15&t],b=t=>(240&t)>>4==(15&t);function x(t){var e=(t=>b(t.r)&&b(t.g)&&b(t.b)&&b(t.a))(t)?p:m;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const _=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function y(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function v(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function w(t,e,i){const s=y(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function M(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e>16&255,o>>8&255,255&o]}return t}(),A.transparent=[0,0,0,0]);const e=A[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const L=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const R=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,E=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function I(t,e,i){if(t){let s=M(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=S(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function z(t,e){return t?Object.assign(e||{},t):t}function F(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=c(t[3]))):(e=z(t,{r:0,g:0,b:0,a:1})).a=c(e.a),e}function B(t){return"r"===t.charAt(0)?function(t){const e=L.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?h(t):l(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?h(i):l(i,0,255)),s=255&(e[4]?h(s):l(s,0,255)),n=255&(e[6]?h(n):l(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):D(t)}class V{constructor(t){if(t instanceof V)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=F(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*f[s[1]],g:255&17*f[s[2]],b:255&17*f[s[3]],a:5===o?17*f[s[4]]:255}:7!==o&&9!==o||(n={r:f[s[1]]<<4|f[s[2]],g:f[s[3]]<<4|f[s[4]],b:f[s[5]]<<4|f[s[6]],a:9===o?f[s[7]]<<4|f[s[8]]:255})),i=n||T(t)||B(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=z(this._rgb);return t&&(t.a=d(t.a)),t}set rgb(t){this._rgb=F(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${d(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?x(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=M(t),i=e[0],s=u(e[1]),n=u(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${d(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=E(d(t.r)),n=E(d(t.g)),o=E(d(t.b));return{r:c(R(s+i*(E(d(e.r))-s))),g:c(R(n+i*(E(d(e.g))-n))),b:c(R(o+i*(E(d(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new V(this.rgb)}alpha(t){return this._rgb.a=c(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=r(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return I(this._rgb,2,t),this}darken(t){return I(this._rgb,2,-t),this}saturate(t){return I(this._rgb,1,t),this}desaturate(t){return I(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=M(t);i[0]=P(i[0]+e),i=S(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function N(t){return new V(t)}function W(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function H(t){return W(t)?t:N(t)}function j(t){return W(t)?t:N(t).saturate(.5).darken(.1).hexString()}function $(){}const Y=function(){let t=0;return function(){return t++}}();function U(t){return null==t}function X(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function q(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const K=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function G(t,e){return K(t)?t:e}function Z(t,e){return void 0===t?e:t}const J=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,Q=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function tt(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function et(t,e,i,s){let n,o,a;if(X(t))if(o=t.length,s)for(n=o-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;ni;)t=t[e.slice(i,s)],i=s+1,s=ht(e,i);return t}function dt(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ut=t=>void 0!==t,ft=t=>"function"==typeof t,gt=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function pt(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const mt=Object.create(null),bt=Object.create(null);function xt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>j(e.backgroundColor),this.hoverBorderColor=(t,e)=>j(e.borderColor),this.hoverColor=(t,e)=>j(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return _t(this,t,e)}get(t){return xt(this,t)}describe(t,e){return _t(bt,t,e)}override(t,e){return _t(mt,t,e)}route(t,e,i,s){const n=xt(this,t),o=xt(this,i),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[s];return q(t)?Object.assign({},e,t):Z(t,e)},set(t){this[a]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function vt(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const wt=(t,e,i)=>vt(t,i,(s=>t[s][e]vt(t,i,(s=>t[s][e]>=i));function kt(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+dt(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function Dt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(St.forEach((e=>{delete t[e]})),delete t._chartjs)}function Ct(t){const e=new Set;let i,s;for(i=0,s=t.length;it-e)).pop(),e}function Wt(t){return!isNaN(parseFloat(t))&&isFinite(t)}function Ht(t,e,i){return Math.abs(t-e)=t}function $t(t,e,i){let s,n,o;for(s=0,n=t.length;sl&&h=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function ie(){return"undefined"!=typeof window&&"undefined"!=typeof document}function se(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ne(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const oe=t=>window.getComputedStyle(t,null);function ae(t,e){return oe(t).getPropertyValue(e)}const re=["top","right","bottom","left"];function le(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=re[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function he(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=oe(i),o="border-box"===n.boxSizing,a=le(n,"padding"),r=le(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const ce=t=>Math.round(10*t)/10;function de(t,e,i,s){const n=oe(t),o=le(n,"margin"),a=ne(n.maxWidth,t,"clientWidth")||Lt,r=ne(n.maxHeight,t,"clientHeight")||Lt,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=se(t);if(o){const t=o.getBoundingClientRect(),a=oe(o),r=le(a,"border","width"),l=le(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=ne(a.maxWidth,o,"clientWidth"),n=ne(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||Lt,maxHeight:n||Lt}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=le(n,"border","width"),e=le(n,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-o.width),c=Math.max(0,s?Math.floor(h/s):c-o.height),h=ce(Math.min(h,a,l.maxWidth)),c=ce(Math.min(c,r,l.maxHeight)),h&&!c&&(c=ce(h/2)),{width:h,height:c}}function ue(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const fe=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function ge(t,e){const i=ae(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function pe(t){return!t||U(t.size)||U(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function me(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function be(t,e,i,s){let n=(s=s||{}).data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},o=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let a=0;const r=i.length;let l,h,c,d,u;for(l=0;li.length){for(l=0;l0&&t.stroke()}}function ve(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==o.strokeColor;let l,h;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]);U(e.rotation)||t.rotate(e.rotation);e.color&&(t.fillStyle=e.color);e.textAlign&&(t.textAlign=e.textAlign);e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,o),l=0;lt[0])){ut(s)||(s=Ne("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>Oe([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Ee(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=Ne(Le(o,t),i),ut(n))return Re(t,n)?Be(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>We(t).includes(e),ownKeys:t=>We(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function Ae(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Te(t,s),setContext:e=>Ae(t,e,i,s),override:n=>Ae(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Ee(t,e,(()=>function(t,e,i){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=t;let r=s[e];ft(r)&&a.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t),e=e(o,a||s),r.delete(t),Re(t,e)&&(e=Be(n._scopes,n,t,e));return e}(e,r,t,i));X(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=i;if(ut(o.index)&&s(t))e=e[o.index%e.length];else if(q(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=Be(s,n,t,l);e.push(Ae(i,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable));Re(e,r)&&(r=Ae(r,n,o&&o[e],a));return r}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Te(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:ft(i)?i:()=>i,isIndexable:ft(s)?s:()=>s}}const Le=(t,e)=>t?t+dt(e):e,Re=(t,e)=>q(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Ee(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function Ie(t,e,i){return ft(t)?t(e,i):t}const ze=(t,e)=>!0===t?e:"string"==typeof t?ct(e,t):void 0;function Fe(t,e,i,s,n){for(const o of e){const e=ze(i,o);if(e){t.add(e);const o=Ie(e._fallback,i,n);if(ut(o)&&o!==i&&o!==s)return o}else if(!1===e&&ut(s)&&i!==s)return null}return!1}function Be(t,e,i,s){const n=e._rootScopes,o=Ie(e._fallback,i,s),a=[...t,...n],r=new Set;r.add(s);let l=Ve(r,a,i,o||i,s);return null!==l&&((!ut(o)||o===i||(l=Ve(r,a,o,l,s),null!==l))&&Oe(Array.from(r),[""],n,o,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];if(X(n)&&q(i))return i;return n}(e,i,s))))}function Ve(t,e,i,s,n){for(;i;)i=Fe(t,e,i,s,n);return i}function Ne(t,e){for(const i of e){if(!i)continue;const e=i[t];if(ut(e))return e}}function We(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function He(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;re"x"===t?"y":"x";function Ue(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=Kt(o,n),l=Kt(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function Xe(t,e="x"){const i=Ye(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=$e(t,0);for(a=0;a!t.skip))),"monotone"===e.cubicInterpolationMode)Xe(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o0===t||1===t,Ze=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*At/i),Je=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*At/i)+1,Qe={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*Et),easeOutSine:t=>Math.sin(t*Et),easeInOutSine:t=>-.5*(Math.cos(Ot*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Ge(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Ge(t)?t:Ze(t,.075,.3),easeOutElastic:t=>Ge(t)?t:Je(t,.075,.3),easeInOutElastic(t){const e=.1125;return Ge(t)?t:t<.5?.5*Ze(2*t,e,.45):.5+.5*Je(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-Qe.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*Qe.easeInBounce(2*t):.5*Qe.easeOutBounce(2*t-1)+.5};function ti(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function ei(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function ii(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=ti(t,n,i),r=ti(n,o,i),l=ti(o,e,i),h=ti(a,r,i),c=ti(r,l,i);return ti(h,c,i)}const si=new Map;function ni(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=si.get(i);return s||(s=new Intl.NumberFormat(t,e),si.set(i,s)),s}(e,i).format(t)}const oi=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),ai=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function ri(t,e){const i=(""+t).match(oi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function li(t,e){const i={},s=q(e),n=s?Object.keys(e):e,o=q(t)?s?i=>Z(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=+o(t)||0;return i}function hi(t){return li(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ci(t){return li(t,["topLeft","topRight","bottomLeft","bottomRight"])}function di(t){const e=hi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ui(t,e){t=t||{},e=e||yt.font;let i=Z(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=Z(t.style,e.style);s&&!(""+s).match(ai)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const n={family:Z(t.family,e.family),lineHeight:ri(Z(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:Z(t.weight,e.weight),string:""};return n.string=pe(n),n}function fi(t,e,i,s){let n,o,a,r=!0;for(n=0,o=t.length;ni&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function pi(t,e){return Object.assign(Object.create(t),e)}function mi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function bi(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function xi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function _i(t){return"angle"===t?{between:Jt,compare:Gt,normalize:Zt}:{between:ee,compare:(t,e)=>t-e,normalize:t=>t}}function yi({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function vi(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=_i(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=_i(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;hx||l(n,b,p)&&0!==r(n,b),v=()=>!x||0===r(o,p)||l(o,b,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==b&&(x=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(yi({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,b=p));return null!==_&&g.push(yi({start:_,end:d,loop:u,count:a,style:f})),g}function wi(t,e){const i=[],s=t.segments;for(let n=0;nn&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return ki(t,[{start:a,end:r,loop:o}],i,e);return ki(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r{t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ei={evaluateInteractionItems:Oi,modes:{index(t,e,i,s){const n=he(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Ai(t,n,o,s,a):Li(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=he(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Ai(t,n,o,s,a):Li(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;tAi(t,he(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=he(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Li(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>Ri(t,he(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Ri(t,he(e,t),"y",i.intersect,s)}};const Ii=["left","top","right","bottom"];function zi(t,e){return t.filter((t=>t.pos===e))}function Fi(t,e){return t.filter((t=>-1===Ii.indexOf(t.pos)&&t.box.axis===e))}function Bi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Vi(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Ii.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function $i(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;ot.box.fullSize)),!0),s=Bi(zi(e,"left"),!0),n=Bi(zi(e,"right")),o=Bi(zi(e,"top"),!0),a=Bi(zi(e,"bottom")),r=Fi(e,"x"),l=Fi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:zi(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;et(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},n);Wi(u,di(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Vi(l.concat(h),d);$i(r.fullSize,f,d,g),$i(l,f,d,g),$i(h,f,d,g)&&$i(l,f,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),Ui(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Ui(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},et(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class qi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Ki extends qi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Gi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Zi=t=>null===t||""===t;const Ji=!!fe&&{passive:!0};function Qi(t,e,i){t.canvas.removeEventListener(e,i,Ji)}function ts(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function es(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ts(i.addedNodes,s),e=e&&!ts(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function is(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ts(i.removedNodes,s),e=e&&!ts(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const ss=new Map;let ns=0;function os(){const t=window.devicePixelRatio;t!==ns&&(ns=t,ss.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function as(t,i,s){const n=t.canvas,o=n&&se(n);if(!o)return;const a=e(((t,e)=>{const i=o.clientWidth;s(t,e),i{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||a(i,s)}));return r.observe(o),function(t,e){ss.size||window.addEventListener("resize",os),ss.set(t,e)}(t,a),r}function rs(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){ss.delete(t),ss.size||window.removeEventListener("resize",os)}(t)}function ls(t,i,s){const n=t.canvas,o=e((e=>{null!==t.ctx&&s(function(t,e){const i=Gi[t.type]||t.type,{x:s,y:n}=he(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Ji)}(n,i,o),o}class hs extends qi{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Zi(n)){const e=ge(t,"width");void 0!==e&&(t.width=e)}if(Zi(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ge(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const s=i[t];U(s)?e.removeAttribute(t):e.setAttribute(t,s)}));const s=i.style||{};return Object.keys(s).forEach((t=>{e.style[t]=s[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:es,detach:is,resize:as}[e]||ls;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:rs,detach:rs,resize:rs}[e]||Qi)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return de(t,e,i,s)}isAttached(t){const e=se(t);return!(!e||!e.isConnected)}}function cs(t){return!ie()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ki:hs}var ds=Object.freeze({__proto__:null,_detectPlatform:cs,BasePlatform:qi,BasicPlatform:Ki,DomPlatform:hs});const us="transparent",fs={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=H(t||us),n=s.valid&&H(e||us);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class gs{constructor(t,e,i,s){const n=e[i];s=fi([t.to,s,n,t.from]);const o=fi([t.from,n,s]);this._active=!0,this._fn=t.fn||fs[t.type||typeof o],this._easing=Qe[t.easing]||Qe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=fi([t.to,e,s,t.from]),this._from=fi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),yt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),yt.describe("animations",{_fallback:"animation"}),yt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class ms{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!q(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const s=t[i];if(!q(s))return;const n={};for(const t of ps)n[t]=s[t];(X(s.properties)&&s.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,n)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new gs(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(a.add(this._chart,i),!0):void 0}}function bs(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function xs(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function Ms(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function Ss(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const Ps=t=>"reset"===t||"none"===t,Ds=(t,e)=>e?t:Object.assign({},t);class Cs{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ys(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Ss(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=Z(i.xAxisID,ks(t,"x")),o=e.yAxisID=Z(i.yAxisID,ks(t,"y")),a=e.rAxisID=Z(i.rAxisID,ks(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,o,a),h=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Dt(this._data,this),t._stacked&&Ss(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(q(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=X(s[t])?this.parseArrayData(i,s,t,e):q(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===l[a]||d&&l[a]t&&!e.hidden&&e._stacked&&{keys:xs(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let d,u;function f(){u=s[d];const e=u[a.axis];return!K(u[t.axis])||h>e||c=0;--d)if(!f()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s=0&&tthis.getContext(i,s)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Ds(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new ms(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ps(t)||this.chart._animationsDisabled}updateElement(t,e,i,s){Ps(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ps(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}Os.defaults={},Os.defaultRoutes=void 0;const As={values:t=>X(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=Ft(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ni(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(Ft(t)));return 1===s||2===s||5===s?As.numeric.call(this,t,e,i):""}};var Ts={formatters:As};function Ls(t,e){const i=t.options.ticks,s=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),n=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;is)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(n,e,s);if(o>0){let t,i;const s=o>1?Math.round((r-a)/(o-1)):null;for(Rs(e,l,h,U(s)?0:a-s,a),t=0,i=o-1;te.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ts.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),yt.route("scale.ticks","color","","color"),yt.route("scale.grid","color","","borderColor"),yt.route("scale.grid","borderColor","","borderColor"),yt.route("scale.title","color","","color"),yt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),yt.describe("scales",{_fallback:"scale"}),yt.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Es=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Is(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;oa+r)))return h}function Fs(t){return t.drawTicks?t.tickLength:0}function Bs(t,e){if(!t.display)return 0;const i=ui(t.font,e),s=di(t.padding);return(X(t.text)?t.text.length:1)*i.lineHeight+s.height}function Vs(t,e,i){let n=s(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class Ns extends Os{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=G(t,Number.POSITIVE_INFINITY),e=G(e,Number.NEGATIVE_INFINITY),i=G(i,Number.POSITIVE_INFINITY),s=G(s,Number.NEGATIVE_INFINITY),{min:G(t,i),max:G(e,s),minDefined:K(t),maxDefined:K(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;rs?s:i,s=n&&i>s?i:s,{min:G(i,G(s,i)),max:G(s,G(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){tt(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=gi(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Qt(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Fs(t.grid)-e.padding-Bs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Ut(Math.min(Math.asin(Qt((h.highest.height+6)/o,-1,1)),Math.asin(Qt(a/r,-1,1))-Math.asin(Qt(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){tt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){tt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Bs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Fs(n)+o):(t.height=this.maxHeight,t.width=Fs(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=Yt(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){tt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:n[t]||0,height:o[t]||0});return{first:v(0),last:v(e-1),widest:v(_),highest:v(y),widths:n,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return te(this._alignToPixels?xe(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:r/s:r*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:o}=s,a=n.offset,r=this.isHorizontal(),l=this.ticks.length+(a?1:0),h=Fs(n),c=[],d=n.setContext(this.getContext()),u=d.drawBorder?d.borderWidth:0,f=u/2,g=function(t){return xe(i,t,u)};let p,m,b,x,_,y,v,w,M,k,S,P;if("top"===o)p=g(this.bottom),y=this.bottom-h,w=p-f,k=g(t.top)+f,P=t.bottom;else if("bottom"===o)p=g(this.top),k=t.top,P=g(t.bottom)-f,y=p+f,w=this.top+h;else if("left"===o)p=g(this.right),_=this.right-h,v=p-f,M=g(t.left)+f,S=t.right;else if("right"===o)p=g(this.left),M=t.left,S=g(t.right)-f,_=p+f,v=this.left+h;else if("x"===e){if("center"===o)p=g((t.top+t.bottom)/2+.5);else if(q(o)){const t=Object.keys(o)[0],e=o[t];p=g(this.chart.scales[t].getPixelForValue(e))}k=t.top,P=t.bottom,y=p+f,w=y+h}else if("y"===e){if("center"===o)p=g((t.left+t.right)/2);else if(q(o)){const t=Object.keys(o)[0],e=o[t];p=g(this.chart.scales[t].getPixelForValue(e))}_=p-f,v=_-h,M=t.left,S=t.right}const D=Z(s.ticks.maxTicksLimit,l),C=Math.max(1,Math.ceil(l/D));for(m=0;me.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");yt.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&yt.describe(e,t.descriptors)}(t,o,i),this.override&&yt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in yt[s]&&(delete yt[s][i],this.override&&delete mt[i])}}var Hs=new class{constructor(){this.controllers=new Ws(Cs,"datasets",!0),this.elements=new Ws(Os,"elements"),this.plugins=new Ws(Object,"plugins"),this.scales=new Ws(Ns,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):et(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=dt(t);tt(i["before"+s],[],i),e[t](i),tt(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function $s(t,e){return e||!1!==t?!0===t?{}:t:null}function Ys(t,e,i,s){const n=t.pluginScopeKeys(e),o=t.getOptionScopes(i,n);return t.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Us(t,e){const i=yt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Xs(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function qs(t){const e=t.options||(t.options={});e.plugins=Z(e.plugins,{}),e.scales=function(t,e){const i=mt[t.type]||{scales:{}},s=e.scales||{},n=Us(t.type,e),o=Object.create(null),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!q(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const r=Xs(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,n),h=i.scales||{};o[r]=o[r]||t,a[t]=rt(Object.create(null),[{axis:r},e,h[r],h[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,r=i.indexAxis||Us(n,e),l=(mt[n]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),n=i[e+"AxisID"]||o[e]||e;a[n]=a[n]||Object.create(null),rt(a[n],[{axis:e},s[n],l[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];rt(e,[yt.scales[e.type],yt.scale])})),a}(t,e)}function Ks(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Gs=new Map,Zs=new Set;function Js(t,e){let i=Gs.get(t);return i||(i=e(),Gs.set(t,i),Zs.add(i)),i}const Qs=(t,e,i)=>{const s=ct(e,i);void 0!==s&&t.add(s)};class tn{constructor(t){this._config=function(t){return(t=t||{}).data=Ks(t.data),qs(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ks(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),qs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Js(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Js(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Js(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Js(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Qs(r,t,e)))),e.forEach((t=>Qs(r,s,t))),e.forEach((t=>Qs(r,mt[n]||{},t))),e.forEach((t=>Qs(r,yt,t))),e.forEach((t=>Qs(r,bt,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),Zs.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,mt[e]||{},yt.datasets[e]||{},{type:e},yt,bt]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=en(this._resolverCache,t,s);let r=o;if(function(t,e){const{isScriptable:i,isIndexable:s}=Te(t);for(const n of e){const e=i(n),o=s(n),a=(o||e)&&t[n];if(e&&(ft(a)||sn(a))||o&&X(a))return!0}return!1}(o,e)){n.$shared=!1;r=Ae(o,i=ft(i)?i():i,this.createResolver(t,i,a))}for(const t of e)n[t]=r[t];return n}createResolver(t,e,i=[""],s){const{resolver:n}=en(this._resolverCache,t,i);return q(e)?Ae(n,e,void 0,s):n}}function en(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:Oe(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const sn=t=>q(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||ft(t[i])),!1);const nn=["top","bottom","left","right","chartArea"];function on(t,e){return"top"===t||"bottom"===t||-1===nn.indexOf(t)&&"x"===e}function an(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function rn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),tt(i&&i.onComplete,[t],e)}function ln(t){const e=t.chart,i=e.options.animation;tt(i&&i.onProgress,[t],e)}function hn(t){return ie()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const cn={},dn=t=>{const e=hn(t);return Object.values(cn).filter((t=>t.canvas===e)).pop()};function un(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class fn{constructor(t,e){const s=this.config=new tn(e),n=hn(t),o=dn(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||cs(n)),this.platform.updateConfig(s);const l=this.platform.acquireContext(n,r.aspectRatio),h=l&&l.canvas,c=h&&h.height,d=h&&h.width;this.id=Y(),this.ctx=l,this.canvas=h,this.width=d,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new js,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=i((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],cn[this.id]=this,l&&h?(a.listen(this,"complete",rn),a.listen(this,"progress",ln),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return U(t)?e&&n?n:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ue(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return _e(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ue(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),tt(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){et(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=Xs(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),et(n,(e=>{const n=e.options,o=n.id,a=Xs(o,n),r=Z(n.type,e.dtype);void 0!==n.position&&on(n.position,a)===on(e.dposition)||(n.position=e.dposition),s[o]=!0;let l=null;if(o in i&&i[o].type===r)l=i[o];else{l=new(Hs.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(n,t)})),et(s,((t,e)=>{t||delete i[e]})),et(i,(t=>{Xi.configure(this,t,t.options),Xi.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(an("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){et(this.scales,(t=>{Xi.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);gt(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){un(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;tt.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Xi.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],et(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&we(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&Me(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ve(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ei.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=pi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);ut(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),a.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};et(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){et(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},et(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!it(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=pt(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,tt(n.onHover,[t,a,this],this),r&&tt(n.onClick,[t,a,this],this));const h=!it(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}const gn=()=>et(fn.instances,(t=>t._plugins.invalidate())),pn=!0;function mn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Object.defineProperties(fn,{defaults:{enumerable:pn,value:yt},instances:{enumerable:pn,value:cn},overrides:{enumerable:pn,value:mt},registry:{enumerable:pn,value:Hs},version:{enumerable:pn,value:"3.8.0"},getChart:{enumerable:pn,value:dn},register:{enumerable:pn,value:(...t)=>{Hs.add(...t),gn()}},unregister:{enumerable:pn,value:(...t)=>{Hs.remove(...t),gn()}}});class bn{constructor(t){this.options=t||{}}formats(){return mn()}parse(t,e){return mn()}format(t,e){return mn()}add(t,e,i){return mn()}diff(t,e,i){return mn()}startOf(t,e,i){return mn()}endOf(t,e){return mn()}}bn.override=function(t){Object.assign(bn.prototype,t)};var xn={_date:bn};function _n(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(ut(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;sMath.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function vn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;ht.x,i="left",s="right"):(e=t.base=i?1:-1)}(c,e,o)*n,d===o&&(p-=c/2);const t=e.getPixelForDecimal(0),i=e.getPixelForDecimal(1),s=Math.min(t,i),a=Math.max(t,i);p=Math.max(Math.min(p,a),s),h=p+c}if(p===e.getPixelForValue(o)){const t=Bt(c)*e.getLineWidthForValue(o)/2;p+=t,c-=t}return{size:c,base:p,head:h,center:h+c/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,o=Z(s.maxBarThickness,1/0);let a,r;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,l="flex"===s.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),a=s.getLabelForValue(n.y),r=n._custom;return{label:e.label,value:"("+o+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,r=this.resolveDataElementOptions(e,s),l=this.getSharedOptions(r),h=this.includeOptions(s,l),c=o.axis,d=a.axis;for(let r=e;r""}}}};class On extends Cs{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,o,a=t=>+i[t];if(q(i[t])){const{key:t="value"}=this._parsing;a=e=>+ct(i[e],t)}for(n=t,o=t+e;nJt(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>Jt(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(Et,c,u),b=g(Ot,h,d),x=g(Ot+Et,c,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,a=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(c,h,r),p=(i.width-o)/d,m=(i.height-o)/u,b=Math.max(Math.min(p,m)/2,0),x=Q(this.options.radius,b),_=(x-Math.max(x*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*x,this.offsetY=g*x,s.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/At)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,f=this.resolveDataElementOptions(e,s),g=this.getSharedOptions(f),p=this.includeOptions(s,g);let m,b=this._getRotation();for(m=0;m0&&!isNaN(t)?At*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ni(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s"spacing"!==t,_indexable:t=>"spacing"!==t},On.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return X(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class An extends Cs{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=function(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:h,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=Qt(Math.min(wt(r,a.axis,h).lo,i?s:wt(e,l,a.getPixelForValue(h)).lo),0,s-1)),o=u?Qt(Math.max(wt(r,a.axis,c).hi+1,i?0:wt(e,l,a.getPixelForValue(c)).hi+1),n,s)-n:s-n}return{start:n,count:o}}(e,s,o);this._drawStart=a,this._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(h),d=this.includeOptions(s,c),u=o.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=Wt(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||n||"none"===s;let x=e>0&&this.getParsed(e-1);for(let h=e;h0&&Math.abs(i[u]-x[u])>m,p&&(g.parsed=i,g.raw=l.data[h]),d&&(g.options=c||this.resolveDataElementOptions(h,e.active?"active":s)),b||this.updateElement(e,h,g,s),x=i}this.updateSharedOptions(c,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}An.id="line",An.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},An.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Tn extends Cs{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ni(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return He.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*Ot;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Yt(this.resolveDataElementOptions(t,e).angle||i):0}}Tn.id="polarArea",Tn.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Tn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Ln extends On{}Ln.id="pie",Ln.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Rn extends Cs{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return He.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var In=Object.freeze({__proto__:null,BarController:Dn,BubbleController:Cn,DoughnutController:On,LineController:An,PolarAreaController:Tn,PieController:Ln,RadarController:Rn,ScatterController:En});function zn(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+Et,s-Et),t.closePath(),t.clip()}function Fn(t,e,i,s){const n=li(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Qt(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Qt(n.innerStart,0,a),innerEnd:Qt(n.innerEnd,0,a)}}function Bn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Vn(t,e,i,s,n){const{x:o,y:a,startAngle:r,pixelMargin:l,innerRadius:h}=e,c=Math.max(e.outerRadius+s+i-l,0),d=h>0?h+s+i+l:0;let u=0;const f=n-r;if(s){const t=((h>0?h-s:0)+(c>0?c-s:0))/2;u=(f-(0!==t?f*t/(t+s):f))/2}const g=(f-Math.max(.001,f*c-i/Ot)/c)/2,p=r+g+u,m=n-g-u,{outerStart:b,outerEnd:x,innerStart:_,innerEnd:y}=Fn(e,d,c,m-p),v=c-b,w=c-x,M=p+b/v,k=m-x/w,S=d+_,P=d+y,D=p+_/S,C=m-y/P;if(t.beginPath(),t.arc(o,a,c,M,k),x>0){const e=Bn(w,k,o,a);t.arc(e.x,e.y,x,k,m+Et)}const O=Bn(P,m,o,a);if(t.lineTo(O.x,O.y),y>0){const e=Bn(P,C,o,a);t.arc(e.x,e.y,y,m+Et,C+Math.PI)}if(t.arc(o,a,d,m-y/d,p+_/d,!0),_>0){const e=Bn(S,D,o,a);t.arc(e.x,e.y,_,D+Math.PI,p-Et)}const A=Bn(v,p,o,a);if(t.lineTo(A.x,A.y),b>0){const e=Bn(v,M,o,a);t.arc(e.x,e.y,b,p-Et,M)}t.closePath()}function Nn(t,e,i,s,n){const{options:o}=e,{borderWidth:a,borderJoinStyle:r}=o,l="inner"===o.borderAlign;a&&(l?(t.lineWidth=2*a,t.lineJoin=r||"round"):(t.lineWidth=a,t.lineJoin=r||"bevel"),e.fullCircles&&function(t,e,i){const{x:s,y:n,startAngle:o,pixelMargin:a,fullCircles:r}=e,l=Math.max(e.outerRadius-a,0),h=e.innerRadius+a;let c;for(i&&zn(t,e,o+At),t.beginPath(),t.arc(s,n,h,o+At,o,!0),c=0;c=At||Jt(n,a,r),f=ee(o,l+d,h+d);return u&&f}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,n=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>At?Math.floor(i/At):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(s){o=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*o,Math.sin(e)*o),this.circumference>=Ot&&(o=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const a=function(t,e,i,s){const{fullCircles:n,startAngle:o,circumference:a}=e;let r=e.endAngle;if(n){Vn(t,e,i,s,o+At);for(let e=0;er&&o>r;return{count:s,start:l,loop:e.loop,ilen:h(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ig&&(g=i),m=(b*m+e)/++b):(_(),t.lineTo(e,i),u=s,b=0,f=g=i),p=i}_()}function Xn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?Un:Yn}Wn.id="arc",Wn.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},Wn.defaultRoutes={backgroundColor:"backgroundColor"};const qn="function"==typeof Path2D;function Kn(t,e,i,s){qn&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Hn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=Xn(e);for(const r of n)Hn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class Gn extends Os{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ke(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Mi(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=wi(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?ei:t.tension||"monotone"===t.cubicInterpolationMode?ii:ti}(i);let l,h;for(l=0,h=o.length;l"borderDash"!==t&&"fill"!==t};class Jn extends Os{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2){ro(t)}))}var ho={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void lo(t);const s=t.width;t.data.datasets.forEach(((e,n)=>{const{_data:o,indexAxis:a}=e,r=t.getDatasetMeta(n),l=o||e.data;if("y"===fi([a,t.options.indexAxis]))return;if(!r.controller.supportsDecimation)return;const h=t.scales[r.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let{start:c,count:d}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Qt(wt(e,o.axis,a).lo,0,i-1)),s=h?Qt(wt(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(r,l);if(d<=(i.threshold||4*s))return void ro(e);let u;switch(U(o)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;cu&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(l,c,d,s,i);break;case"min-max":u=function(t,e,i,s){let n,o,a,r,l,h,c,d,u,f,g=0,p=0;const m=[],b=e+i-1,x=t[e].x,_=t[b].x-x;for(n=e;nf&&(f=r,c=n),g=(p*g+o.x)/++p;else{const i=n-1;if(!U(h)&&!U(c)){const e=Math.min(h,c),s=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:g}),s!==d&&s!==i&&m.push({...t[s],x:g})}n>0&&i!==d&&m.push(t[i]),m.push(o),l=e,p=0,u=f=r,h=c=d=n}}return m}(l,c,d,s);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){lo(t)}};function co(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=Zt(n),o=Zt(o)),{property:t,start:n,end:o}}function uo(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function fo(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function go(t,e){let i=[],s=!1;return X(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=uo(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new Gn({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function po(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!K(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function mo(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=Z(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(q(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return K(n)&&Math.floor(n)===n?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function bo(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&vo(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;i&&vo(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;s&&!1!==s.fill&&"beforeDatasetDraw"===i.drawTime&&vo(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Do=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class Co extends Os{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=tt(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=ui(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=Do(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,n,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const p=i+e/2+n.measureText(t.text).width;o>0&&u+s+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:s},d=Math.max(d,p),u+=s+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=mi(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=n(i,this.left+s,this.right-this.lineWidths[o]);for(const l of e)o!==l.row&&(o=l.row,r=n(i,this.left+s,this.right-this.lineWidths[o])),l.top+=this.top+t+s,l.left=a.leftForLtr(a.x(r),l.width),r+=l.width+s}else{let o=0,r=n(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(const l of e)l.col!==o&&(o=l.col,r=n(i,this.top+t+s,this.bottom-this.columnSizes[o].height)),l.top=r,l.left+=this.left+s,l.left=a.leftForLtr(a.x(l.left),l.width),r+=l.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;we(t,this),this._draw(),Me(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:a,labels:r}=t,l=yt.color,h=mi(t.rtl,this.left,this.width),c=ui(r.font),{color:d,padding:u}=r,f=c.size,g=f/2;let p;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:b,itemHeight:x}=Do(r,f),_=this.isHorizontal(),y=this._computeTitleHeight();p=_?{x:n(a,this.left+u,this.right-i[0]),y:this.top+u+y,line:0}:{x:this.left+u,y:n(a,this.top+y+u,this.bottom-e[0].height),line:0},bi(this.ctx,t.textDirection);const v=x+u;this.legendItems.forEach(((w,M)=>{s.strokeStyle=w.fontColor||d,s.fillStyle=w.fontColor||d;const k=s.measureText(w.text).width,S=h.textAlign(w.textAlign||(w.textAlign=r.textAlign)),P=m+g+k;let D=p.x,C=p.y;h.setWidth(this.width),_?M>0&&D+P+u>this.right&&(C=p.y+=v,p.line++,D=p.x=n(a,this.left+u,this.right-i[p.line])):M>0&&C+v>this.bottom&&(D=p.x=D+e[p.line].width+u,p.line++,C=p.y=n(a,this.top+y+u,this.bottom-e[p.line].height));!function(t,e,i){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;s.save();const n=Z(i.lineWidth,1);if(s.fillStyle=Z(i.fillStyle,l),s.lineCap=Z(i.lineCap,"butt"),s.lineDashOffset=Z(i.lineDashOffset,0),s.lineJoin=Z(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=Z(i.strokeStyle,l),s.setLineDash(Z(i.lineDash,[])),r.usePointStyle){const o={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},a=h.xPlus(t,m/2);ye(s,o,a,e+g)}else{const o=e+Math.max((f-b)/2,0),a=h.leftForLtr(t,m),r=ci(i.borderRadius);s.beginPath(),Object.values(r).some((t=>0!==t))?Ce(s,{x:a,y:o,w:m,h:b,radius:r}):s.rect(a,o,m,b),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(D),C,w),D=o(S,D+m+g,_?D+P:this.right,t.rtl),function(t,e,i){Pe(s,i.text,t,e+x/2,c,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(D),C,w),_?p.x+=P+u:p.y+=v})),xi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ui(e.font),o=di(e.padding);if(!e.display)return;const a=mi(t.rtl,this.left,this.width),r=this.ctx,l=e.position,h=i.size/2,c=o.top+h;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=n(t.align,u,this.right-f);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);d=c+n(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const g=n(l,u,u+f);r.textAlign=a.textAlign(s(l)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,Pe(r,e.text,g,d,i)}_computeTitleHeight(){const t=this.options.title,e=ui(t.font),i=di(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(ee(t,this.left,this.right)&&ee(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const a=t.controller.getStyle(i?0:void 0),r=di(a.borderWidth);return{text:e[t.index].label,fillStyle:a.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(r.width+r.height)/4,strokeStyle:a.borderColor,pointStyle:s||a.pointStyle,rotation:a.rotation,textAlign:n||a.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Ao extends Os{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=X(i.text)?i.text.length:1;this._padding=di(i.padding);const n=s*ui(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:o,options:a}=this,r=a.align;let l,h,c,d=0;return this.isHorizontal()?(h=n(r,i,o),c=e+t,l=o-i):("left"===a.position?(h=i+t,c=n(r,s,e),d=-.5*Ot):(h=o-t,c=n(r,e,s),d=.5*Ot),l=s-e),{titleX:h,titleY:c,maxWidth:l,rotation:d}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ui(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:r,rotation:l}=this._drawArgs(n);Pe(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:l,textAlign:s(e.align),textBaseline:"middle",translation:[o,a]})}}var To={id:"title",_element:Ao,start(t,e,i){!function(t,e){const i=new Ao({ctx:t.ctx,options:e,chart:t});Xi.configure(t,i,e),Xi.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Xi.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;Xi.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Lo=new WeakMap;var Ro={id:"subtitle",start(t,e,i){const s=new Ao({ctx:t.ctx,options:i,chart:t});Xi.configure(t,s,i),Xi.addBox(t,s),Lo.set(t,s)},stop(t){Xi.removeBox(t,Lo.get(t)),Lo.delete(t)},beforeUpdate(t,e,i){const s=Lo.get(t);Xi.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function Fo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Bo(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=ui(e.bodyFont),h=ui(e.titleFont),c=ui(e.footerFont),d=o.length,u=n.length,f=s.length,g=di(e.padding);let p=g.height,m=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-f)*l.lineHeight+(b-1)*e.bodySpacing}u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let x=0;const _=function(t){m=Math.max(m,i.measureText(t).width+x)};return i.save(),i.font=h.string,et(t.title,_),i.font=l.string,et(t.beforeBody.concat(t.afterBody),_),x=e.displayColors?a+2+e.boxPadding:0,et(s,(t=>{et(t.before,_),et(t.lines,_),et(t.after,_)})),x=0,i.font=c.string,et(t.footer,_),i.restore(),m+=g.width,{width:m,height:p}}function Vo(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function No(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Vo(t,e,i,s),yAlign:s}}function Wo(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=ci(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Qt(g,0,s.width-e.width),y:Qt(p,0,s.height-e.height)}}function Ho(t,e,i){const s=di(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function jo(t){return Io([],zo(t))}function $o(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class Yo extends Os{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new ms(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,pi(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=Io(a,zo(s)),a=Io(a,zo(n)),a=Io(a,zo(o)),a}getBeforeBody(t,e){return jo(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return et(t,(t=>{const e={before:[],lines:[],after:[]},n=$o(i,t);Io(e.before,zo(n.beforeLabel.call(this,t))),Io(e.lines,n.label.call(this,t)),Io(e.after,zo(n.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return jo(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=Io(a,zo(s)),a=Io(a,zo(n)),a=Io(a,zo(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;at.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),et(l,(e=>{const i=$o(t.callbacks,e);s.push(i.labelColor.call(this,e)),n.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Eo[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Bo(this,i),a=Object.assign({},t,e),r=No(this.chart,i,a),l=Wo(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=ci(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,b,x,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,x=_+o,y=_-o):(p=d+f,m=p+o,x=_-o,y=_+o),b=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(x=u,_=x-o,p=m-o,b=m+o):(x=u+g,_=x+o,p=m+o,b=m-o),y=x),{x1:p,x2:m,x3:b,y1:x,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=mi(i.rtl,this.x,this.width);for(t.x=Ho(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=ui(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Ce(t,{x:e,y:g,w:l,h:r,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Ce(t,{x:i,y:g+1,w:l-2,h:r-2,radius:a}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,l,r),t.strokeRect(e,g,l,r),t.fillStyle=o.backgroundColor,t.fillRect(i,g+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=ui(i.bodyFont);let d=c.lineHeight,u=0;const f=mi(i.rtl,this.x,this.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+n},p=f.textAlign(o);let m,b,x,_,y,v,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ho(this,p,i),e.fillStyle=i.bodyColor,et(this.beforeBody,g),u=a&&"right"!==p?"center"===o?l/2+h:l+2+h:0,_=0,v=s.length;_0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Eo[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Bo(this,t),a=Object.assign({},i,this._size),r=No(e,t,a),l=Wo(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=di(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),bi(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),xi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!it(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!it(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Eo[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}Yo.positioners=Eo;var Uo={id:"tooltip",_element:Yo,positioners:Eo,afterInit(t,e,i){i&&(t.tooltip=new Yo({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",i))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:$,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Xo=Object.freeze({__proto__:null,Decimation:ho,Filler:Po,Legend:Oo,SubTitle:Ro,Title:To,Tooltip:Uo});function qo(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}class Ko extends Ns{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(U(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Qt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:qo(i,t,Z(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Go(t,e,{horizontal:i,minRotation:s}){const n=Yt(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}Ko.id="category",Ko.defaults={ticks:{callback:Ko.prototype.getLabelForValue}};class Zo extends Ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return U(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=Bt(s),e=Bt(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=1;(n>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*n)),a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=function(t,e){const i=[],{bounds:s,step:n,min:o,max:a,precision:r,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=n||1,f=h-1,{min:g,max:p}=e,m=!U(o),b=!U(a),x=!U(l),_=(p-g)/(c+1);let y,v,w,M,k=Vt((p-g)/f/u)*u;if(k<1e-14&&!m&&!b)return[{value:g},{value:p}];M=Math.ceil(p/k)-Math.floor(g/k),M>f&&(k=Vt(M*k/f/u)*u),U(r)||(y=Math.pow(10,r),k=Math.ceil(k*y)/y),"ticks"===s?(v=Math.floor(g/k)*k,w=Math.ceil(p/k)*k):(v=g,w=p),m&&b&&n&&jt((a-o)/n,k/1e3)?(M=Math.round(Math.min((a-o)/k,h)),k=(a-o)/M,v=o,w=a):x?(v=m?o:v,w=b?a:w,M=l-1,k=(w-v)/M):(M=(w-v)/k,M=Ht(M,Math.round(M),k/1e3)?Math.round(M):Math.ceil(M));const S=Math.max(Xt(k),Xt(v));y=Math.pow(10,U(r)?S:r),v=Math.round(v*y)/y,w=Math.round(w*y)/y;let P=0;for(m&&(d&&v!==o?(i.push({value:o}),v0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=K(t)?Math.max(0,t):null,this.max=K(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t,a=(t,e)=>Math.pow(10,Math.floor(Ft(t))+e);i===s&&(i<=0?(n(1),o(10)):(n(a(i,-1)),o(a(s,1)))),i<=0&&n(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&n(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(Ft(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=G(t.min,Math.pow(10,Math.floor(Ft(e.min)))),a=Math.floor(Ft(o)),r=Math.floor(o/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{n.push({value:o,major:Qo(o)}),++r,10===r&&(r=1,++a,l=a>=0?1:l),o=Math.round(r*Math.pow(10,a)*l)/l}while(an?{start:e-i,end:e}:{start:e,end:e+i}}function sa(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],n=[],o=t._pointLabels.length,a=t.options.pointLabels,r=a.centerPointLabels?Ot/o:0;for(let d=0;de.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.starte.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function oa(t){return 0===t||180===t?"center":t<180?"left":"right"}function aa(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function ra(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function la(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,At);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o{const i=tt(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?sa(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return Zt(t*(At/(this._pointLabels.length||1))+Yt(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(U(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(U(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t=0;n--){const e=s.setContext(t.getPointLabelContext(n)),o=ui(e.font),{x:a,y:r,textAlign:l,left:h,top:c,right:d,bottom:u}=t._pointLabelItems[n],{backdropColor:f}=e;if(!U(f)){const t=ci(e.borderRadius),s=di(e.backdropPadding);i.fillStyle=f;const n=h-s.left,o=c-s.top,a=d-h+s.width,r=u-c+s.height;Object.values(t).some((t=>0!==t))?(i.beginPath(),Ce(i,{x:n,y:o,w:a,h:r,radius:t}),i.fill()):i.fillRect(n,o,a,r)}Pe(i,t._pointLabels[n],a,r+o.lineHeight/2,o,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,n),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e){a=this.getDistanceFromCenterForValue(t.value);!function(t,e,i,s){const n=t.ctx,o=e.circular,{color:a,lineWidth:r}=e;!o&&!s||!a||!r||i<0||(n.save(),n.strokeStyle=a,n.lineWidth=r,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),la(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,s.setContext(this.getContext(e-1)),a,n)}})),i.display){for(t.save(),o=n-1;o>=0;o--){const s=i.setContext(this.getPointLabelContext(o)),{color:n,lineWidth:l}=s;l&&n&&(t.lineWidth=l,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),r=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(r.x,r.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=ui(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=di(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Pe(t,s.label,0,-n,l,{color:r.color})})),t.restore()}drawTitle(){}}ha.id="radialLinear",ha.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ts.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},ha.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},ha.descriptors={angleLines:{_fallback:"grid"}};const ca={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},da=Object.keys(ca);function ua(t,e){return t-e}function fa(t,e){if(U(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:o}=t._parseOpts;let a=e;return"function"==typeof s&&(a=s(a)),K(a)||(a="string"==typeof s?i.parse(a,s):i.parse(a)),null===a?null:(n&&(a="week"!==n||!Wt(o)&&!0!==o?i.startOf(a,n):i.startOf(a,"isoWeek",o)),+a)}function ga(t,e,i,s){const n=da.length;for(let o=da.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function ma(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a=0&&(e[l].major=!0);return e}(t,s,n,i):s}class ba extends Ns{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),s=this._adapter=new xn._date(t.adapters.date);rt(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:fa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}o&&a||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=K(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=K(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=kt(s,n,this.max);return this._unit=e.unit||(i.autoSkip?ga(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=da.length-1;o>=da.indexOf(i);o--){const i=da[o];if(ca[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return da[i?da.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=da.indexOf(t)+1,i=da.length;e+t.value)))}initOffsets(t){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Qt(s,0,o),n=Qt(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||ga(n.minUnit,e,i,this._getLabelCapacity(e)),a=Z(n.stepSize,1),r="week"===o&&n.isoWeekday,l=Wt(r)||!0===r,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const f="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;ct-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.time.displayFormats,a=this._unit,r=this._majorUnit,l=a&&o[a],h=r&&o[r],c=i[e],d=r&&h&&c&&c.major,u=this._adapter.format(t,s||(d?h:l)),f=n.ticks.callback;return f?tt(f,[u,e,i],this):u}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=wt(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=wt(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}ba.id="time",ba.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class _a extends ba{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=xa(e,this.min),this._tableRange=xa(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o'); + + //za checkboxe in tabele ne dovolimo, da so identifikator pri merge + if(dataTip != 2 && dataTip != 6) + $('ul#merge').append('
  • '); }); - } function merge_labels() { @@ -202,5 +204,21 @@ function merge_labels() { } }); - +} + +// Sortiranje box-ov pri dodajanju respondentov +function initAppendMergeConnectedSortable(){ + + // Na mobitelu ne inicializiramo sorrtiranja, ker potem gumbi niso klikabilni (na nekaterih androidih ne deluje ok) + if($(window).width() < 850) + return false; + + $('ul.connectedSortable').sortable({ + update: function(){ + append_refreshFieldsList(); + }, + forcePlaceholderSize: 'true', + tolerance: 'pointer', + placeholder: 'inv_field_placeholder' + }); } \ No newline at end of file diff --git a/admin/survey/script/branching.js b/admin/survey/script/branching.js index 613b205..6585325 100644 --- a/admin/survey/script/branching.js +++ b/admin/survey/script/branching.js @@ -49,10 +49,10 @@ function onload_init_branching() { if (locked) { $('#branching ul.first.locked').bind('click', function (event) { if ($("#prevent_unlock").val() == 1) { - alert(lang['srv_unlock_popup3']); + genericAlertPopup('srv_unlock_popup3'); } else { - alert(lang['srv_unlock_popup2']); + genericAlertPopup('srv_unlock_popup2'); } }); return; @@ -60,6 +60,7 @@ function onload_init_branching() { // funkcijo poklicemo ko se stran naloada in ob koncu vsakega ajax klica branching_struktura(); + $("body").ajaxStop(function () { branching_struktura(); }); @@ -83,6 +84,34 @@ function onload_init_branching() { branching_if_mouseleave(event); } }); + + // Copy paste iz worda - pocistimo text + $('div[contenteditable=true]').on('paste', function(e) { + + // Prevent the default action + e.preventDefault(); + + // Dobimo plain text iz clipboarda + var text = e.originalEvent.clipboardData.getData('text/plain'); + + if (document.queryCommandSupported('insertText')) {console.log('xxx' + text); + document.execCommand('insertText', false, text); + } + else {console.log('aaaa' + text); + // Insert text at the current position of caret + const range = document.getSelection().getRangeAt(0); + range.deleteContents(); + + const textNode = document.createTextNode(text); + range.insertNode(textNode); + range.selectNodeContents(textNode); + range.collapse(false); + + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + } + }); } // polovi vse click-e, ki se zgodijo v branchingu @@ -107,12 +136,12 @@ function branching_click(event) { } // spremeni tip skale (ordinalna/nominalna) za tip 1,3,6 - if (ta.is('div.spr_edit a.scale_ordnom')) { + if (ta.is('div.spr_edit .scale_ordnom button:not(.active)')) { var id = ta.parent().parent().attr('id'); id = id.replace('edit_', ''); value = ta.parent().parent().parent().find('.spremenljivka_content').attr('skala'); - if(value == 0) value = 1; + if(value == 0 || value == -1) value = 1; else value = 0; scale_ordnom(id, value); @@ -148,7 +177,7 @@ function branching_click(event) { } // preview spremenljivke - if (ta.is('div.spr_edit a.preview')) { + if (ta.is('div.spr_edit a.monitor')) { var id = ta.parent().attr('id'); id = id.replace('edit_', ''); preview_spremenljivka(id); @@ -239,7 +268,7 @@ function branching_click(event) { // plusminus if, blok - if (ta.is('a.pm')) { + if (ta.is('span.pm')) { var id = ta.parent().attr('id'); id = id.replace('branching_if', ''); plusminus(id); @@ -364,15 +393,20 @@ function branching_click(event) { } // pagebreak (klik na celo vrstico) - td = $(event.target).closest('li.drop span, li.nodrop span'); + td = $(event.target).closest('li.drop > div, li.nodrop > div'); if (td.hasClass('pb_new') || td.hasClass('pb_on')) { - var spr; - if (td.parent().attr('spr_pb')) - spr = td.parent().attr('spr_pb'); - else - spr = td.parent().attr('spr'); - if (!td.hasClass('permanent')) + + if (!td.hasClass('permanent')){ + var spr; + + if (td.parent().attr('spr_pb')) + spr = td.parent().attr('spr_pb'); + else + spr = td.parent().attr('spr'); + pagebreak(spr); + } + return false; } @@ -431,6 +465,7 @@ function branching_mouseover(event) { edit = edit.replace('branching_', ''); if (edit > 0) { if (branchborder.find('div.spr_edit').length == 0) { + var html_snippet; // Dodamo izbiro nominalne/ordinalne skale pri tipih 1, 3 in 6 @@ -443,24 +478,26 @@ function branching_mouseover(event) { scale = 1; if(scale == 1){ - scale_string = '' + lang['srv_skala_0'] + '' + - ' / ' + - '' + lang['srv_skala_1'] + ''; + scale_string = '
    ' + + '
    '; } else{ - scale_string = '' + lang['srv_skala_0'] + '' + - ' / ' + - '' + lang['srv_skala_1'] + ''; + scale_string = '
    ' + + '
    '; } } - html_snippet = /*'
    '+lang['srv_editirajspremenljivko']+' '+*/ - '
    ' + - scale_string + + // Svincnik - urejanje + html_snippet = '
    ' + + scale_string + ''; + // Glasovanje te ikone nima + if($('#branching').hasClass('branching_glasovanje')){ + + } // Disablamo ife, ce nima ustreznega paketa - if ($('#commercial_package').attr('value') == '1') { + else if ($('#commercial_package').attr('value') == '1') { html_snippet = html_snippet + ''; } @@ -483,8 +520,12 @@ function branching_mouseover(event) { signature = 1; } + // Glasovanje te ikone nima + if($('#branching').hasClass('branching_glasovanje')){ + + } // Disablamo kopiranje, ce nima ustreznega paketa za ta tip vprasanja - if ( ($('#commercial_package').attr('value') == '1' && ['17','18','24','26','27'].includes(tip)) + else if ( ($('#commercial_package').attr('value') == '1' && ['17','18','24','26','27'].includes(tip)) || (($('#commercial_package').attr('value') == '1' || $('#commercial_package').attr('value') == '2') && ['22','25'].includes(tip)) || (($('#commercial_package').attr('value') == '1' || $('#commercial_package').attr('value') == '2') && ['21'].includes(tip) && signature == 1) ) { @@ -496,15 +537,22 @@ function branching_mouseover(event) { ''; } - html_snippet = html_snippet + - ''; + // Kalkulacija in kvota nimata predogleda + if(!['22','25'].includes(tip)){ + html_snippet = html_snippet + + ''; + } + } // zarad tega so errorji if (vprasanje_tracking == 2) html_snippet += ''; - html_snippet += '' + - '
    '; + // Glasovanje te ikone nima + if(!$('#branching').hasClass('branching_glasovanje')){ + html_snippet += '' + '
    '; + } + branchborder.prepend(html_snippet); } @@ -520,6 +568,7 @@ function branching_mouseover(event) { html_snippet = '
    ' + '' + '' + + ''+ '
    '; branchborder.prepend(html_snippet); @@ -620,7 +669,7 @@ function branching_struktura() { // nastavimo droppable $('li.drop', $('#branching')).droppable({ - accept: '.spr, .if, .block, .endif, .endblock, .new_spr, .new_adv, .new_if, .new_block, .new_loop, .new_pb, .loop, .endloop', + accept: '.spr, .if, .block, .endif, .endblock, .new_spr, .new_if, .new_block, .new_loop, .new_pb, .loop, .endloop', hoverClass: 'branchinghover', tolerance: 'pointer', drop: function (e, ui) { @@ -642,12 +691,6 @@ function branching_struktura() { spremenljivka_new(spr, _if, endif, copy, tip, podtip, drop); } - } else if ($(ui.draggable).hasClass('new_adv')) { // nova advanced spremenljivka (odpre se popup za izbiro) - var spr = $(this).attr('spr'); - var _if = $(this).attr('if'); - var endif = $(this).attr('endif'); - toolbox_add_advanced(spr, _if, endif); - } else if ($(ui.draggable).hasClass('new_if')) { // nov if iz toolbox var spr = $(this).attr('spr'); var _if = $(this).attr('if'); @@ -681,53 +724,44 @@ function branching_struktura() { }); load_help(); // help moramo loadati tudi na zacetku in ob vsakem ajax klicu - - // paste from word alert - $('div[contenteditable=true]').off('paste', pasteFromWordAlert); - $('div[contenteditable=true]').on('paste', pasteFromWordAlert); - } -var pasteFromWord = false; -function pasteFromWordAlert() { - - if (pasteFromWord == true) return; - pasteFromWord = true; -} - -function pasteFromWordAlertClose() { - - $('#pasteFromWordAlert').hide(); - $('#fade').fadeOut('slow'); -} var is_new_spr_dragable = false; // gledamo ali vlečemo new_spr da skrbimo za skrivanje // inicializira toolbox na levi strani function init_toolbox() { - /*$('#toolbox, #toolbox_basic, #toolbox_settings').draggable({handle: '.handle'});*/ - $('p.new_spr:not(.user_access_locked), p.new_adv:not(.user_access_locked), p.new_if:not(.user_access_locked), p.new_block:not(.user_access_locked), p.new_loop:not(.user_access_locked), p.new_pb', '#toolbox_basic').draggable({ - start: function () { - is_new_spr_dragable = true, $('#toolbox_add_advanced').addClass('dragging') + $('.new_spr:not(.user_access_locked), .new_if:not(.user_access_locked), .new_block:not(.user_access_locked), .new_loop:not(.user_access_locked), .new_pb', '#toolbox_basic').draggable({ + start: function (e, ui) { + is_new_spr_dragable = true; + $('#toolbox_add_advanced').addClass('dragging'); + $(ui.helper).addClass("clone-dragging"); }, - stop: function () { - is_new_spr_dragable = false, $('#toolbox_add_advanced').removeClass('dragging') + stop: function (e, ui) { + is_new_spr_dragable = false; + $('#toolbox_add_advanced').removeClass('dragging'); + $(ui.helper).removeClass("clone-dragging"); }, revert: false, helper: 'clone', opacity: 0.9, appendTo: 'body', - distance: 5 + distance: 5, + cursor: 'pointer' }).bind('click', function (event) { var ta = $(event.target); - ta = $(ta).closest('p'); + ta = $(ta).closest('.new_spr, .new_if, .new_block, .new_loop'); + if (ta.hasClass('new_spr')) { // nova spremenljivka (iz toolboxa) - //$('html, body').animate({scrollTop: $('body').height()+$('#branching').height()}); // scrollamo na dno zaslona + var tip = ta.attr('tip'); var podtip = 0; - if (ta.hasClass('podtip')) podtip = ta.attr('podtip'); + + if (ta.hasClass('podtip')) + podtip = ta.attr('podtip'); + // pri kreiranju generatorja imen ustvarimo za njim se loop in nagovor, ki mu pripadata if (tip == '9_sn') { SN_generator_new(0, 1); @@ -736,78 +770,112 @@ function init_toolbox() { spremenljivka_new(0, 0, 1, 0, tip, podtip); } - } else if (ta.hasClass('new_adv')) { // nova spremenljivka advanced (prikaze se popup z vsemi tipi vprasanj) - //$('html, body').animate({scrollTop: $('body').height()+$('#branching').height()}); // scrollamo na dno zaslona - toolbox_add_advanced(0, 0, 1); - - } else if (ta.hasClass('new_if')) { // nov if iz toolbox + } + else if (ta.hasClass('new_if')) { // nov if iz toolbox $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona if_new(0, 0, 1, 0); - - } else if (ta.hasClass('new_block')) { // nov blok iz toolboxa + } + else if (ta.hasClass('new_block')) { // nov blok iz toolboxa $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona if_new(0, 0, 1, 1); - - } else if (ta.hasClass('new_loop')) { // nov loop iz toolboxa + } + else if (ta.hasClass('new_loop')) { // nov loop iz toolboxa $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona if_new(0, 0, 1, 2); } $('#toolbox_add_advanced').addClass('dragging'); + setTimeout(function () { $('#toolbox_add_advanced').removeClass('dragging'); }, 500); + event.stopPropagation(); }); // mousever preview vprasanja $('#toolbox_basic').bind('mouseover', function (event) { - var tip = $(event.target).closest('p.new_spr, p.new_adv, p.new_if, p.new_block, p.new_loop, p.new_sn'); + var tip = $(event.target).closest('.new_spr, .new_adv, .new_if, .new_block, .new_loop, .new_sn'); - if (tip.hasClass('adv')) { // tooltip za vprasanja v advanced toolboxu - if (tip.hasClass('podtip')) { // vprasanja s podtipom + // tooltip za vprasanja v advanced toolboxu + if (tip.hasClass('adv')) { + + // vprasanja s podtipom + if (tip.hasClass('podtip')) { show_tip_preview_subtype(-1, tip.attr('podtip'), tip.attr('tip')); } else if (tip.hasClass('new_sn')) { show_tip_preview_toolbox(tip.attr('tip'), 0, 1); } - else if (tip.hasClass('new_spr')) { // osnovna vprasanja, samo z tipom + // osnovna vprasanja, samo z tipom + else if (tip.hasClass('new_spr')) { show_tip_preview_toolbox(tip.attr('tip'), 0, 1); } } - else if (tip.hasClass('new_spr') && !is_new_spr_dragable) { // tooltip za vprasanja v osnovnemu toolboxu + // tooltip za vprasanja v osnovnemu toolboxu + else if (tip.hasClass('new_spr') && !is_new_spr_dragable) { var podtip = tip.attr('podtip'); show_tip_preview_toolbox(tip.attr('tip'), undefined, undefined, podtip); } else if (tip.hasClass('new_if') || tip.hasClass('new_block') || tip.hasClass('new_loop')) { show_tip_preview_toolbox(tip.attr('tip')); } - else if (tip.hasClass('new_adv')) { // gumb za + + // gumb za + + else if (tip.hasClass('new_adv')) { // prikazemo s CSSom } }).bind('mouseout', function (event) { $("#tip_preview").hide(); }); - - // max-height toolboxa - //$('#toolbox_basic').css('max-height', $(window).height()-188); } // prikaze popup za dodajanje naprednih tipov vprasanj -function toolbox_add_advanced(spr, _if, endif) { +function toolbox_add_advanced_popup() { $('#fade').fadeTo('slow', 1); - $('#fullscreen').show().load('ajax.php?t=branching&a=toolbox_add_advanced', { - anketa: srv_meta_anketa_id, - spr: spr, - 'if': _if, - endif: endif - }); + + $('#fullscreen').show().load('ajax.php?t=branching&a=toolbox_add_advanced', {anketa: srv_meta_anketa_id}, function(){ + + $('#toolbox_add_advanced_popup .new_spr:not(.user_access_locked), #toolbox_add_advanced_popup .new_if:not(.user_access_locked), #toolbox_add_advanced_popup .new_block:not(.user_access_locked), #toolbox_add_advanced_popup .new_loop:not(.user_access_locked)').click(function() { + var ta = $(event.target); + + if (ta.hasClass('new_spr')) { // nova spremenljivka (iz toolboxa) + + var tip = ta.attr('tip'); + var podtip = 0; + + if (ta.hasClass('podtip')) + podtip = ta.attr('podtip'); + + // pri kreiranju generatorja imen ustvarimo za njim se loop in nagovor, ki mu pripadata + if (tip == '9_sn') { + SN_generator_new(0, 1); + } + else { + spremenljivka_new(0, 0, 1, 0, tip, podtip); + } + + } + else if (ta.hasClass('new_if')) { // nov if iz toolbox + $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona + if_new(0, 0, 1, 0); + } + else if (ta.hasClass('new_block')) { // nov blok iz toolboxa + $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona + if_new(0, 0, 1, 1); + } + else if (ta.hasClass('new_loop')) { // nov loop iz toolboxa + $('html, body').animate({scrollTop: $('body').height() + $('#branching').height()}); // scrollamo na dno zaslona + if_new(0, 0, 1, 2); + } + }); + }); } + // ----------------------- funkcije, ki se klicejo iz htmlja // ----------------------- @@ -827,25 +895,10 @@ function change_mode(what, value) { } // spremeni hitre nastavitve pri formi -function change_form_quicksettings(what) { +function change_form_quicksettings() { - var status = $('#' + what).css('display'); - if (status == 'none') { - $('#' + what).show(); - if (what == 'form_settings_obvescanje') { - $('#obvescanje_switch').removeClass("plus").addClass("minus"); - } else { - $('#email_switch').removeClass("plus").addClass("minus"); - } - } - else { - $('#' + what).hide(); - if (what == 'form_settings_obvescanje') { - $('#obvescanje_switch').removeClass("minus").addClass("plus"); - } else { - $('#email_switch').removeClass("minus").addClass("plus"); - } - } + $('#form_settings_obvescanje').slideToggle(); + $('#obvescanje_switch').toggleClass("arrow2_d").toggleClass("arrow2_u"); vprasanje_save(); } @@ -860,7 +913,7 @@ function toolbox_advanced(checked) { } // doda nov if -function if_new(spremenljivka, _if, endif, tip, copy, no_content, follow_up) { +function if_new(spremenljivka, _if, endif, tip, copy=0, no_content=0, follow_up=0) { close_all_editing(); @@ -896,6 +949,9 @@ function if_new(spremenljivka, _if, endif, tip, copy, no_content, follow_up) { condition_editing(new_if_id); } } + else{ + actionNotePopup('condition_copy', 'success'); + } }); } @@ -934,6 +990,7 @@ function spremenljivka_new(spremenljivka, _if, endif, copy, tip, podtip, drop) { } else { refreshLeft(data.nova_spremenljivka_id); + actionNotePopup('question_copy', 'success'); } // dvojne gride moramo na novo shranit da se prepise grid v bazi @@ -1011,7 +1068,7 @@ function if_remove(_if, all, confirmed) { // Warning da brisemo vsebino pogoja in imamo ze podatke, ki jih bomo pobrisali if (data.substring(0, 3) === '

    ' || data.substring(0, 4) === '

    ') { $('#fade').fadeIn("fast"); - $('#dropped_alert').html(data).fadeIn("fast").css('width', '400px'); + $('#dropped_alert').html(data).fadeIn("fast").css('width', '600px'); } else{ $('#branching').html(data); @@ -1050,8 +1107,6 @@ function if_tip(_if, tip) { 'if': _if, anketa: srv_meta_anketa_id, tip: tip - }, function () { - centerDiv2Page('#div_condition_editing'); }); } @@ -1138,17 +1193,13 @@ function vrednost_condition_editing(vrednost) { 'ajax.php?t=branching&a=vrednost_condition_editing', { 'vrednost': vrednost, 'anketa': srv_meta_anketa_id - }, function () { - centerDiv2Page('#div_condition_editing'); - $('#div_condition_editing_conditions .clr_if').children('span').show(); //prikažemo zvezdico *IF } ); } function condition_editing(_if, odpreminus) { + close_all_editing(); - // zapremo knjiznico - $('#toolbox_library').hide(); $('li#branching_if' + _if).addClass('if_editing'); $('ul#if_' + _if).addClass('if_editing'); @@ -1202,16 +1253,16 @@ function condition_editing_close(_if, if_nova) { var plus = 0; - if ($('#branching_if' + _if + ' a.pm').hasClass('plus')) + if ($('#branching_if' + _if + ' span.pm').hasClass('plus')) plus = 1; $.post('ajax.php?t=branching&a=condition_editing_close', {anketa: srv_meta_anketa_id, 'if': _if, if_nova: if_nova}, function (data) { if (plus == 1) - $('#branching_if' + _if).html('' + data); + $('#branching_if' + _if).html('' + data); else - $('#branching_if' + _if).html('' + data); + $('#branching_if' + _if).html('' + data); if ($('#vprasanje').css('display') == 'block') { // refreshamo tudi preview pogoja v urejanju vprasanja @@ -1281,7 +1332,7 @@ function vrednost_condition_editing_close_save(vrednost, _if) { //če pa pogoja še nimamo potem moramo najprej narediti span element, kamor bomo vstavili IF pogoj //za checkox, radio in tisti, ki imajo div in ne tabele if (v.is('div')) { - v.append(''); + v.append(''); }//za vsa vprašanja, ki so v tabelah if (v.is('tr')) { v.find('td.grid_question').closest('td').append('*'); @@ -1308,9 +1359,7 @@ function condition_add(_if, conjunction, negation, vrednost) { 'noupdate': __vnosi + __analiza, 'anketa': srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); - $("#div_condition_editing_container").attr({scrollTop: $("#div_condition_editing_container").attr("scrollHeight")}); - $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event + $(".condition_editing_body").animate({ scrollTop: $('.condition_editing_body').prop("scrollHeight")}, 1000); }); } @@ -1485,7 +1534,6 @@ function bracket_edit_new(condition, vrednost, who, what) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event }); @@ -1501,12 +1549,35 @@ function conjunction_edit(condition, conjunction, negation) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); - $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event + var scroll_position = $(".condition_editing_body").scrollTop() + $('#condition_'+condition).position().top - $(".condition_editing_body").height()/2 + $('#condition_'+condition).height()/2; + $(".condition_editing_body").animate({ scrollTop: scroll_position }, 1000); }); } +function conjunction_dropdown_edit(condition) { + + var conj = $('#conjunction_dropdown_' + condition).val().split('_'); + + var conjunction = conj[0]; + var negation = conj[1]; + + $('#div_condition_editing_inner').load('ajax.php?t=branching&a=conjunction_edit', + { + condition: condition, + conjunction: conjunction, + negation: negation, + noupdate: __vnosi + __analiza, + anketa: srv_meta_anketa_id + }, function () { + + // Zascrollamo na pravo pozicijo + var scroll_position = $(".condition_editing_body").scrollTop() + $('#condition_'+condition).position().top - $(".condition_editing_body").height()/2 + $('#condition_'+condition).height()/2; + $(".condition_editing_body").animate({ scrollTop: scroll_position }, 1000); + } + ); +} + function fill_value(condition, vrednost) { var spr_id = document.getElementById('spremenljivka_' + condition); @@ -1519,15 +1590,16 @@ function fill_value(condition, vrednost) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); - $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event - }); + var scroll_position = $(".condition_editing_body").scrollTop() + $('#condition_'+condition).position().top - $(".condition_editing_body").height()/2 + $('#condition_'+condition).height()/2; + $(".condition_editing_body").animate({ scrollTop: scroll_position }, 1000); +}); } function edit_fill_value(condition) { $('#edit_fill_value_' + condition).show(); $('#preview_fill_value_' + condition).hide(); + $('#preview_fill_link_' + condition).hide(); $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event } @@ -1580,7 +1652,6 @@ function condition_remove(_if, condition, vrednost) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); $('#div_condition_editing_inner').resize(); // trigger, da se poklice resize event }); @@ -1618,8 +1689,6 @@ function calculation_editing_close(condition, vrednost) { anketa: srv_meta_anketa_id, condition: condition, vrednost: vrednost - }, function () { - centerDiv2Page('#div_condition_editing'); }); // kalkulacija kot tip vprasanja @@ -1638,9 +1707,8 @@ function calculation_editing_close(condition, vrednost) { 'ajax.php?t=branching&a=calculation_editing_close', { anketa: srv_meta_anketa_id, condition: condition - }, function () { - centerDiv2Page('#div_condition_editing'); - }); + } + ); } } } @@ -1665,8 +1733,7 @@ function calculation_add(condition, operator, vrednost) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - $("#calculation_editing_inner").attr({scrollTop: $("#calculation_editing_inner").attr("scrollHeight")}); - $('#calculation_editing_inner').scroll(); + $(".calculation_editing_body").animate({ scrollTop: $('.calculation_editing_body').prop("scrollHeight")}, 1000); }); } @@ -1680,7 +1747,6 @@ function calculation_operator_edit(calculation, operator) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); $('#calculation_editing_inner').scroll(); }); } @@ -1696,6 +1762,17 @@ function calculation_sort(condition) { }); } +function quota_sort(condition) { + + $('#quota_editing_inner').load('ajax.php?t=branching&a=quota_sort', { + 'condition': condition, + sortable: $('#quota_editing_inner').sortable('serialize'), + anketa: srv_meta_anketa_id + }, function () { + $('#quota_editing_inner').scroll(); + }); +} + function calculation_edit(calculation, vrednost) { var spr_id = document @@ -1740,7 +1817,6 @@ function calculation_bracket_edit_new(calculation, vrednost, who, what) { noupdate: __vnosi + __analiza, anketa: srv_meta_anketa_id }, function () { - centerDiv2Page('#div_condition_editing'); $('#calculation_editing_inner').scroll(); }); } @@ -1823,7 +1899,7 @@ function vprasanje_edit(spremenljivka, buffer) { function plusminus(id, odpremo) { - var a = $('#branching_if' + id + ' a.pm'); + var a = $('#branching_if' + id + ' span.pm'); // blok/if je prikazan, mi ga bomo skrili if (a.hasClass('minus') && odpremo != 1) { @@ -1952,13 +2028,39 @@ function intro_concl_preview(spremenljivka) { }); } +function toggle_missing_dropdown_table(spr){ + if($('[id="table_missings_menu_'+spr+'"]').last().css('display') == 'none') + $('[id="table_missings_menu_'+spr+'"]').last().css('display', 'inline'); + else + $('[id="table_missings_menu_'+spr+'"]').last().css('display', 'none'); +} + +function close_missing_menu(spr){ + $('[id="table_missings_menu_'+spr+'"]').last().css('display', 'none'); +} + // preklopi ordinalno/nominalno skalo function scale_ordnom(spremenljivka, value) { $('#branching_' + spremenljivka).load('ajax.php?t=branching&a=scale_ordnom', {spremenljivka: spremenljivka, value: value, anketa: srv_meta_anketa_id}, function () { - $('input[type="radio"][name="skala"]').not(':checked').prop("checked", true, function () { + + //as radio + /* $('input[type="checkbox"][name="skala"]').not(':checked').prop("checked", true, function () { vprasanje_save(); - }); + }); */ + + //as checkbox + if(value == 1){ + $('input[type="checkbox"][name="skala"]').prop("checked", false, function () { + vprasanje_save(); + }); + } + else { + $('input[type="checkbox"][name="skala"]').prop("checked", true, function () { + vprasanje_save(); + }); + } + show_scale_text(value); }); } @@ -2144,7 +2246,7 @@ function expandCollapseAllPlusMinus(what) { var id = $(this).attr('id').replace('branching_if', ''); - var a = $('#branching_if' + id + ' a.pm'); + var a = $('#branching_if' + id + ' span.pm'); if (what == 'expand') { // blok/if je skrit @@ -2184,12 +2286,6 @@ function branch_brisi_grupo(id, text) { } } -// document ready funkcijo sem prestavil na vrh strani, da je vse skupaj - -function centerDiv2Page(id) { - return false; -} - // prestevilci anketo v branchingu function prestevilci() { @@ -2220,10 +2316,9 @@ function alert_close_block() { } // hitre nastavitve -function quick_settings(spremenljivka, results, what) { +function quick_settings(results, what) { var status1 = $('#form_settings_obvescanje').css('display'); - //var status2 = $('#form_settings_vabila').css('display'); if (what == 'finish_author' || what == 'finish_respondent_cms' || what == 'finish_respondent' || what == 'finish_other') { if (results.checked == true) @@ -2232,23 +2327,18 @@ function quick_settings(spremenljivka, results, what) { results = 0; } - //$("#simple").load('ajax.php?a=form_settings', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, results: results, what: what}); - //$.post('ajax.php?a=form_settings', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, results: results, what: what}); - $("#quick_settings").load('ajax.php?t=branching&a=edit_quick_settings', { anketa: srv_meta_anketa_id, - spremenljivka: spremenljivka, results: results, what: what, - status1: status1, - status2: status2 + status1: status1 }); - if (what == 'finish_respondent') + /*if (what == 'finish_respondent') $("#branching").load('ajax.php?t=branching&a=refresh_left', { anketa: srv_meta_anketa_id, spremenljivka: spremenljivka - }); + });*/ } function calculation_edit_variable(spremenljivka) { @@ -2522,7 +2612,6 @@ function slider_edit_init(spremenljivka, min, max, def, slider_handle, slider_ha if (nakazi_odgovore == 1 && slider_handle == 1){//ce zelimo bunke za nakazovanje odgovorov $('#sliderbranching_' + spremenljivka).slider().removeClass("classic_slider"); //odstrani razred s klasicnimi crticami $('#sliderbranching_' + spremenljivka).slider().addClass("circle_slider"); //dodaj razred z bunkicami za nakazovanje - //$('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle } else if (nakazi_odgovore == 0 && slider_handle == 0){ //drugace $('#sliderbranching_' + spremenljivka).slider().addClass("classic_slider"); //dodaj klasicen razred @@ -2530,7 +2619,6 @@ function slider_edit_init(spremenljivka, min, max, def, slider_handle, slider_ha } else if (nakazi_odgovore == 1 && slider_handle == 0){ //drugace $('#sliderbranching_' + spremenljivka).slider().addClass("elipse_slider"); //dodaj klasicen razred - //$('#sliderbranching_' + spremenljivka).slider().removeClass("circle_slider"); //odstrani razred circle slider } //konec ureditve bunk in elips za nakazovanje moznih odgovorov @@ -2550,12 +2638,10 @@ function slider_edit_init(spremenljivka, min, max, def, slider_handle, slider_ha if (vmesne_Crtice == 1){//ce je potrebno pokazati vmesne črtice rest = "pip"; - //console.log('Črtice'); } else if (vmesne_Crtice == 0) { rest = false; - //console.log('Brez črtic'); } @@ -2669,7 +2755,6 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle //globalne spremenljivke, ki so potrebne za posodobitev drsnika v prevodih - konec $("#variabla_limit_" + spremenljivka).css('display', 'none'); - //$("input[name^='foo_" + spremenljivka + "']").parent().css('display', 'none'); //pokomnetiral zaradi skrivanja missing-ov var minmaxlabela = "label";//hrani nastavitev za minmax labele var rest = false; //hrani nastavitve za vmesne črtice z ("label") in brez label ("pip") ter odsotnost črtic (false) @@ -2693,7 +2778,6 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle if (nakazi_odgovore == 1 && slider_handle == 1){//ce zelimo bunke za nakazovanje odgovorov $('#sliderbranching_prevajanje' + spremenljivka).slider().removeClass("classic_slider"); //odstrani razred s klasicnimi crticami $('#sliderbranching_prevajanje' + spremenljivka).slider().addClass("circle_slider"); //dodaj razred z bunkicami za nakazovanje - //$('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle } else if (nakazi_odgovore == 0 && slider_handle == 0){ //drugace $('#sliderbranching_prevajanje' + spremenljivka).slider().addClass("classic_slider"); //dodaj klasicen razred @@ -2701,7 +2785,6 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle } else if (nakazi_odgovore == 1 && slider_handle == 0){ //drugace $('#sliderbranching_prevajanje' + spremenljivka).slider().addClass("elipse_slider"); //dodaj klasicen razred - //$('#sliderbranching_' + spremenljivka).slider().removeClass("circle_slider"); //odstrani razred circle slider } //konec ureditve bunk in elips za nakazovanje moznih odgovorov @@ -2721,12 +2804,10 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle if (vmesne_Crtice == 1){//ce je potrebno pokazati vmesne črtice rest = "pip"; - //console.log('Črtice'); } else if (vmesne_Crtice == 0) { rest = false; - //console.log('Brez črtic'); } @@ -2735,14 +2816,6 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle rest = "label"; } -/* if(tip_vmesne_descr_labele != 0 && prevod==''){ //ce se je izbralo prednalozene vmesne opisne labele in ni prevoda - vmesne_opisne_labele = vmesne_descr_labele.split(";"); - max = vmesne_opisne_labele.length-1; - }else if((slider_VmesneDescrLabel)||(tip_vmesne_descr_labele != 0 && prevod)){ //ce se je izbralo Brez oz. custom opisne labele ALI se je izbralo prednalozene vmesne opisne labele in je prevod - vmesne_opisne_labele = slider_CustomDescriptiveLabels.split(";"); - max = vmesne_opisne_labele.length; - } */ - if((slider_VmesneDescrLabel)||(tip_vmesne_descr_labele != 0)){ //ce se je izbralo Brez oz. custom opisne labele ALI se je izbralo prednalozene vmesne opisne labele vmesne_opisne_labele = slider_CustomDescriptiveLabels.split(";"); max = vmesne_opisne_labele.length; @@ -2757,7 +2830,8 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle slide: function (event, ui) { if (slider_window_number == 0){ //ce rabimo stevilo nad handle - // Sproti popravljamo vrednost v okencu ob slidu + + // Sproti popravljamo vrednost v okencu ob slidu $("#sliderTextbranching_" + spremenljivka).html(ui.value); // Premikamo okencek skupaj z sliderjem @@ -2769,12 +2843,7 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle }; // wait for the ui.handle to set its position setTimeout(delay, 5); - } - - //if (slider_handle == 1){//ce si zelimo skriti handle - //$('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('visibility', '');// - //} - + } }, // Prikazemo okencek s vrednostjo @@ -2805,19 +2874,11 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle } $('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('left', percent_def + '%'); - - - //if (slider_handle == 1){//ce si zelimo skriti handle - //$('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle - //$('#sliderbranching_' + spremenljivka + ' .special_slider').css('visibility', '');//skrij handle - //} - - + // Postavimo na zacetku okencek na pravo mesto if (slider_window_number == 0){ $("#sliderTextbranching_" + spremenljivka).position({ of: $('#sliderbranching_' + spremenljivka + ' .ui-slider-handle'), - //of: $('#sliderbranching_' + spremenljivka + ' .classic_slider'), offset: "0, -37" }); } @@ -2829,7 +2890,7 @@ function slider_edit_init_prevajanje(spremenljivka, min, max, def, slider_handle last: minmaxlabela, labels: vmesne_opisne_labele, }); - //$( ".selector" ).slider( "option", "value", 10 ); + $('#sliderbranching_prevajanje' + spremenljivka).slider("option", "value", def);//postavi rocico na mesto, kjer je izracunana default vrednost } //********************************************************* @@ -2868,7 +2929,6 @@ function slider_edit_grid_init(spremenljivka, vrednost, min, max, def, vmesne_la if (nakazi_odgovore == 1 && slider_handle == 1){//ce zelimo bunke za nakazovanje odgovorov $('#sliderbranching_' + spremenljivka + '_' + vrednost).slider().removeClass("classic_slider"); //odstrani razred s klasicnimi crticami $('#sliderbranching_' + spremenljivka + '_' + vrednost).slider().addClass("circle_slider"); //dodaj razred z bunkicami za nakazovanje - //$('#sliderbranching_' + spremenljivka + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle } else if (nakazi_odgovore == 0 && slider_handle == 0){ //drugace $('#sliderbranching_' + spremenljivka + '_' + vrednost).slider().addClass("classic_slider"); //dodaj klasicen razred @@ -2876,7 +2936,6 @@ function slider_edit_grid_init(spremenljivka, vrednost, min, max, def, vmesne_la } else if (nakazi_odgovore == 1 && slider_handle == 0){ //drugace $('#sliderbranching_' + spremenljivka + '_' + vrednost).slider().addClass("elipse_slider"); //dodaj klasicen razred - //$('#sliderbranching_' + spremenljivka).slider().removeClass("circle_slider"); //odstrani razred circle slider } //konec ureditve bunk in elips za nakazovanje moznih odgovorov @@ -2972,11 +3031,6 @@ function slider_edit_grid_init(spremenljivka, vrednost, min, max, def, vmesne_la } $('#sliderbranching_' + spremenljivka + '_' + vrednost + ' .ui-slider-handle').css('left', percent_def + '%'); - //if($('#slider_handle_'+spremenljivka+' option:selected').val() == 2){//ce si zelimo skriti handle - //if(slider_handle == 1){//ce si zelimo skriti handle - //$('#sliderbranching_' + spremenljivka + '_' + vrednost + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle - //$('#slider_' + spremenljivka + ' .ui-slider-handle.ui-state-default.ui-corner-all').css('visibility', 'hidden');//skrij handle - //} if (slider_window_number == 0){ // Postavimo na zacetku okencek na pravo mesto $("#sliderTextbranching_" + spremenljivka + "_" + vrednost).position({ @@ -2986,8 +3040,6 @@ function slider_edit_grid_init(spremenljivka, vrednost, min, max, def, vmesne_la }); } } - - //}); }) .slider("pips",{ rest: rest, @@ -3072,11 +3124,9 @@ function slider_edit_grid_init_prevajanje(spremenljivka, vrednost, min, max, def if (vmesne_Crtice == 1){//ce je potrebno pokazati vmesne črtice rest = "pip"; - //console.log('Črtice'); } else if (vmesne_Crtice == 0) { rest = false; - //console.log('Brez črtic'); } //if (vmesne_labels == 1) { @@ -3146,11 +3196,6 @@ function slider_edit_grid_init_prevajanje(spremenljivka, vrednost, min, max, def } $('#sliderbranching_prevajanje' + spremenljivka + '_' + vrednost + ' .ui-slider-handle').css('left', percent_def + '%'); - //if($('#slider_handle_'+spremenljivka+' option:selected').val() == 2){//ce si zelimo skriti handle - //if(slider_handle == 1){//ce si zelimo skriti handle - //$('#sliderbranching_' + spremenljivka + '_' + vrednost + ' .ui-slider-handle').css('visibility', 'hidden');//skrij handle - //$('#slider_' + spremenljivka + ' .ui-slider-handle.ui-state-default.ui-corner-all').css('visibility', 'hidden');//skrij handle - //} if (slider_window_number == 0){ // Postavimo na zacetku okencek na pravo mesto $("#sliderTextbranching_" + spremenljivka + "_" + vrednost).position({ @@ -3160,8 +3205,6 @@ function slider_edit_grid_init_prevajanje(spremenljivka, vrednost, min, max, def }); } } - - //}); }) .slider("pips",{ rest: rest, diff --git a/admin/survey/script/break.js b/admin/survey/script/break.js index f0603d5..018666a 100644 --- a/admin/survey/script/break.js +++ b/admin/survey/script/break.js @@ -3,18 +3,23 @@ function break_init() { function breakSpremenljivkaChange() { + // drugi dropdown var spr = $('#breakSpremenljivka').val(); var seq = $("#breakSpremenljivka option:selected").attr('seq'); + $("#breakResults").html(''); + $("#breakResults").load("ajax.php?t=break&a=spremenljivkaChange", {anketa:srv_meta_anketa_id, spr:spr, seq:seq}, function() { $("#breakResults").fadeTo(100, 1); }).show(); } function change_break_percent () { + var break_percent = $("#break_percent").is(':checked'); var crossChk1 = break_percent; + //ponastavimo tudi za crostabe $.post("ajax.php?t=crosstab&a=change_cb_percent", {anketa:srv_meta_anketa_id, crossChk1:crossChk1}, function() { $.post("ajax.php?t=break&a=change_break_percent", {anketa:srv_meta_anketa_id, break_percent:break_percent}, function() { @@ -31,6 +36,7 @@ function change_break_charts (break_charts) { } function doArchiveBreak() { + //preverimo ali obstaja vsebina breakResults if ($("#breakResults").length > 0 && $("#breakResults").html() != '') { $("#fullscreen").load('ajax.php?a=doArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran}, function() { @@ -38,11 +44,14 @@ function doArchiveBreak() { $('#fade').fadeTo('slow', 1); $('#fullscreen').show(); }); - } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + } + else { + genericAlertPopup('alert_no_archive_tables'); } } + function submitArchiveBreak() { + //preverimo ali obstaja vsebina meansa if ($("#breakResults").html().length > 0 ) { var content = $("#breakResults").html(); @@ -55,33 +64,40 @@ function submitArchiveBreak() { $("#fullscreen").load('ajax.php?a=submitArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, name:name, note:note, access:access, duration:duration, durationType:durationType, content:content}, function() { $("#fullscreen").show(); }); - } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + } + else { + genericAlertPopup('alert_no_archive_tables'); } } function createArchiveBreakBeforeEmail() { + //preverimo ali obstaja vsebina breakResults if ($("#breakResults").html().length > 0 ) { + var content = $("#breakResults").html(); + $.post('ajax.php?a=createArchiveBeforeEmail', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, content:content}, function(response) { if (parseInt(response) > 0) { var aid = parseInt(response); $("#fullscreen").load('ajax.php?a=emailArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, aid:aid}, function() { $('#fullscreen').show(); }); - } else { + } + else { if (parseInt(response) == -1) { - alert("Nothing to archive!"+response); - } else { - alert("Error while creating archive!"+response); + genericAlertPopup('alert_no_archive_response',response); + } + else { + genericAlertPopup('alert_archive_error_response',response); } $('#fullscreen').hide(); $('#fade').fadeOut('slow'); } }); - } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + } + else { + genericAlertPopup('alert_no_archive_tables'); } }; \ No newline at end of file diff --git a/admin/survey/script/cReport.js b/admin/survey/script/cReport.js index 9159b6e..c421d23 100644 --- a/admin/survey/script/cReport.js +++ b/admin/survey/script/cReport.js @@ -7,8 +7,8 @@ function creport_init () { // sortable za custom report $('.report_element').live('mouseover', function (event) { $('#custom_report_sortable').sortable({ - items: 'li', - handle: '.report_element_title', + items: 'li.report_element_standard, li.report_element_break', + handle: '.report_element_head', opacity: 0.8, revert: true, create:function(){ @@ -32,18 +32,23 @@ function creport_init () { }); $(".report_element_separator").live({ + mouseenter: function(){ - $(this).find('.add_element').stop().animate({opacity:1}, 500); + //if(!$(this).hasClass('last_separator')){ + $(this).find('.add_element').stop().animate({opacity:1}, 500); + //} }, mouseleave: function(){ - $(this).find('.add_element').stop().animate({opacity:0}, 500); + //if(!$(this).hasClass('last_separator')){ + $(this).find('.add_element').stop().animate({opacity:0}, 500); + //} } }); // click report elementa - $(".report_element_title").live("click", function(event) { + $(".report_element_head").live("click", function(event) { - var element = $(this).parent().parent(); + var element = $(this).parent(); var id = $(element).attr('id').substr(15); expandCustomReportElement(id); @@ -218,6 +223,7 @@ function addPBCustomReportElement(id) { // zbrise element iz custom reporta function deleteCustomReportElement(element_id) { $('#anketa_custom_report').load('ajax.php?t=custom_report&a=delete_element', {anketa: srv_meta_anketa_id, expanded: global_expanded, element_id:element_id}); + event.stopPropagation(); } // razsirjanje elementa v custom reportu @@ -260,6 +266,7 @@ function editCustomReportTTestVar(id) { // kopiranje elementa v custom reportu function copyCustomReportElement(id) { $('#anketa_custom_report').load('ajax.php?t=custom_report&a=copy_element', {anketa: srv_meta_anketa_id, expanded: global_expanded, element_id:id}); + event.stopPropagation(); } function printCustomReportElement(ime, id){ @@ -280,6 +287,8 @@ function printCustomReportElement(ime, id){ newWin.focus(); newWin.document.close(); + + event.stopPropagation(); } // alert za dodajanje vseh elementov istega tipa v custom report @@ -340,28 +349,14 @@ function addCustomReportAllElements(type) { * nastavi editor na contenteditable element za naslov */ function creport_load_editor (_this) { - - /*$(_this).css('display', 'none'); - var el = $(_this).parent().find('.creport_textarea'); - - var el_id = el.attr('el_id'); - - el.replaceWith(''+ - ''+lang['save']+''); - create_editor('report_element_texteditor_'+el_id);*/ - - - $(_this).css('display', 'none'); var el = $(_this).parent().find('.creport_text_inline'); var el_id = el.attr('el_id'); - - - el.replaceWith(''+ - ''+lang['save']+''); + el.replaceWith(''+ + '
    '); create_editor('report_element_texteditor_'+el_id); } @@ -370,17 +365,7 @@ function creport_load_editor (_this) { * shrani editor in nastavi nazaj contenteditable */ function creport_save_editor(el_id) { - - /*get_editor_close('report_element_texteditor_'+el_id); - - var el = $('#report_element_texteditor_'+el_id); - var parent = el.parent(); - - el.replaceWith(''+ + ''+ // Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo - '
    '+ + ''+ - // Gumb shrani - ''+ - ''+lang['save']+''+ - ''+ - - // Gumb zapri - ''+ - ''+lang['srv_zapri']+''+ - '

    '+ + // Gumb shrani / zapri + + ''+ '

    '); @@ -4951,6 +5005,125 @@ function close_API_window(){ } +// Prikaz popupap za izvoz paketa anket +function archive_surveys_display_export(){ + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow'); + $("#general_popup").load('ajax.php?t=archiveSurveys&a=display_export'); +} + +// Toggle checkboxov za seznam anket za izvoz +function archive_surveys_export_toggle(val){ + + // oznacimo vse checkboxe + if(val == 1){ + $(".survey_archive_checkbox").attr("checked", "true"); + $("#switch_on").addClass("displayNone"); + $("#switch_off").removeClass("displayNone"); + } + else{ + $('.survey_archive_checkbox').removeAttr('checked'); + $("#switch_off").addClass("displayNone"); + $("#switch_on").removeClass("displayNone"); + } + + archive_surveys_export_counter(); +} + +// Posodobimo stevilo oznacenih anket - counter +function archive_surveys_export_counter(){ + + var selectedCheckboxes = $('.survey_archive_checkbox:checked'); + var selectedCount = selectedCheckboxes.length; + + $('#mass_select_counter_number').text(selectedCount); +} + +// Ustvari paket anket +function archive_surveys_export(){ + + var form_serialize = $("#survey_archive_form").serializeArray(); + + $("#general_popup").load('ajax.php?t=archiveSurveys&a=export', form_serialize); +} + +// Download Izvoza paketa anket +function archive_surveys_download_export(url) { + + var link = $('', { + href: url, + target: '_blank', + download: url.substring(url.lastIndexOf('/') + 1) + }); + + link.on('click', function() { + $(this).remove(); + }); + + $('body').append(link); + link[0].click(); + + popupClose(); +} + +// Prikaz popupa za uvoz paketa anket +function archive_surveys_display_import(){ + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow'); + $("#general_popup").load('ajax.php?t=archiveSurveys&a=display_import'); +} + +// Izbran paket za uvoz - preverimo ce je zip in prikazemo gumb za uvoz +function archive_surveys_select_import(){ + + var fileInput = $('#archive_surveys_input')[0]; + var fileName = fileInput.value; + //var fileName = $('#archive_surveys_input').val(); + var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); + var fileSize = fileInput.files[0].size; + + var warningFileSize = 5 * 1024 * 1024; + var maxFileSize = 20 * 1024 * 1024; + + // Napaka - paket ni zip + if (fileExtension !== 'zip') { + $('#archive_surveys_error').removeClass('displayNone'); + $('#archive_surveys_import_button, #archive_surveys_error2, #archive_surveys_error3').addClass('displayNone'); + } + // Napaka - paket je vecji od 20 mb + else if (fileSize > maxFileSize) { + $('#archive_surveys_error3').removeClass('displayNone'); + $('#archive_surveys_import_button, #archive_surveys_error, #archive_surveys_error2').addClass('displayNone'); + } + // Opozorilo - paket je vecji od 5 mb + else if (fileSize > warningFileSize) { + $('#archive_surveys_error2, #archive_surveys_import_button').removeClass('displayNone'); + $('#archive_surveys_error, #archive_surveys_error3').addClass('displayNone'); + } + else { + $('#archive_surveys_import_button').removeClass('displayNone'); + $('#archive_surveys_error, #archive_surveys_error2, #archive_surveys_error2').addClass('displayNone'); + } +} + +// Izvedemo uvoz paketa anket +function archive_surveys_import(){ + + var formData = new FormData($('#restore')[0]); + + $.ajax({ + url: 'ajax.php?t=archiveSurveys&a=import', + type: 'POST', + data: formData, + processData: false, + contentType: false, + success: function(response) { + $("#general_popup").html(response); + } + }); +} + + // Nastavitve modula za chat function chat_save_settings() { @@ -4958,7 +5131,7 @@ function chat_save_settings() { var chat_type = $('input[name=chat_type]:checked').val(); $.post('ajax.php?t=chat&a=save_settings', {anketa: srv_meta_anketa_id, code:code, chat_type:chat_type}, function(){ - show_success_save(); + actionNotePopup('success_save', 'success'); }); } @@ -4970,7 +5143,7 @@ function quiz_save_settings() { var results_chart = $("input[name=quiz_results_chart]:checked").val(); $.post('ajax.php?t=quiz&a=save_settings', {anketa: srv_meta_anketa_id, results:results, results_chart:results_chart}, function(){ - show_success_save(); + actionNotePopup('success_save', 'success'); }); } @@ -4981,7 +5154,7 @@ function advanced_paradata_save_settings() { var collect_post_time = $("input[name=collect_post_time]:checked").val(); $.post('ajax.php?t=advanced_paradata&a=save_settings', {anketa: srv_meta_anketa_id, collect_post_time:collect_post_time}, function(){ - show_success_save(); + actionNotePopup('success_save', 'success'); }); } // brisanje vseh podatkov ankete pri naprednih parapodatkih @@ -5003,8 +5176,27 @@ function panel_save_settings() { var status_default = $('input[name=status_default]').val(); var url = $('input[name=url]').val(); - $("#globalSettingsInner").load('ajax.php?t=panel&a=save_settings', {anketa: srv_meta_anketa_id, user_id_name:user_id_name, status_name:status_name, status_default:status_default, url:url}, function(){ - show_success_save(); + var cookie_return = $('input[name=cookie_return]:checked').val(); + + var continue_later = 0; + continue_later = $('input[name=continue_later]:checked').val(); + + $("#globalSettingsInner").load('ajax.php?t=panel&a=save_settings', {anketa: srv_meta_anketa_id, user_id_name:user_id_name, status_name:status_name, status_default:status_default, url:url, cookie_return:cookie_return, continue_later:continue_later}, function(){ + actionNotePopup('success_save', 'success'); + }); +} + + +// Nastavitve modula za dostop z emailom +function email_access_save_settings() { + + var captcha = 0; + captcha = $('input[name=captcha]:checked').val(); + + var terms_text = $('textarea[name=terms_text]').val(); + + $("#globalSettingsInner").load('ajax.php?t=email_access&a=save_settings', {anketa:srv_meta_anketa_id, captcha:captcha, terms_text:terms_text}, function(){ + actionNotePopup('success_save', 'success'); }); } @@ -5102,7 +5294,6 @@ function setCheckedClass(element, type, ifId){ //Image HotSpot: brisemo obmocja iz slike image1.mapster('set', false, loop_id); //spucaj trenutno obmocje iz slike - //console.log(loop_id); } }); @@ -5139,9 +5330,6 @@ function evoli_tm_settings_add_oddelek(tm_id) { } -// Zakaj je to tukaj?? - ne sme biti tako, ker drugače povozi funkcijo z istim imenom v main/survey (ce se kdaj klice iz tam - recimo pri komentarjih) -//function checkBranching(){} - // Popravimo crte med vprasanji ce imamo blok s horizontalnim izrisom vprasanj function blockHorizontalLine(spr_id){ @@ -5187,11 +5375,11 @@ function save1kaRacunSettings(){ } // Gesla nista enaka else if(geslo1 != geslo2){ - alert(lang['cms_error_password_incorrect']); + genericAlertPopup('cms_error_password_incorrect'); } // Geslo ni dovolj kompleksno else if(!complexPassword(geslo1)){ - alert(lang['password_err_complex']); + genericAlertPopup('password_err_complex'); } // Pri popravljanju gesla ga opozorimo, da bo odjavljen else{ @@ -5241,14 +5429,17 @@ function stringContains(password, allowedChars){ * * @param id */ -function izbrisiAlternativniEmail(id){ - if (confirm(lang['delete_alternative_email'])) { +function izbrisiAlternativniEmail(id, email){ + + if (confirm(lang['alternative_email_delete'] + ' ' + email + '?')) { + $.post('ajax.php?a=editanketasettings&m=global_user_myProfile', { izbrisiAlternativniEmail: 1, - alternativniEmailId: id + alternativniEmailId: id }).success(function(response){ window.location.reload(); }); + } } @@ -5291,63 +5482,53 @@ function check_akronim() { /* START FUNKCIJA ZA UREJANJE zakljucka po deaktivaciji - popup v urejanju zakljucka */ function vprasanje_jezik_edit_zakljucek(id_value){ - /*$('#fade').fadeTo('slow', 1);*/ + $('#fade').fadeTo('slow', 1); var id = $("#"+id_value); - id.replaceWith(''); + ''+ + + ''+ + + // Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo + ''+ + + // Gumb shrani / zapri + '' + ); - create_editor(id_value); + create_editor('popup_'+id_value); } -function vprasanje_jezik_reset_zakljucek(id_value){ - - //$('#fade').fadeOut('slow'); - - var id = $('#'+id_value); - var old_val = $("textarea[name=old_val_"+id_value+"]").val(); - - var par = id.closest('.fixed-position'); - - CKEDITOR.instances[id_value].destroy(); +function vprasanje_jezik_reset_zakljucek(){ - par.replaceWith(''); - - // postavimo se na dno strani - $('html, body').animate({scrollTop:$(document).height()}, 100); + $('#fade').fadeOut('slow'); + $('#vrednost_edit').hide().html(); } function vprasanje_jezik_save_zakljucek(id_value){ - var id = $('#'+id_value); - var par = id.closest('.fixed-position'); - - CKEDITOR.instances[id_value].destroy(); + $('#fade').fadeOut('slow'); + + CKEDITOR.instances['popup_'+id_value].destroy(); - par.replaceWith(''); - - $('html, body').animate({scrollTop:$(document).height()}, 100, function(){ - vprasanje_save(true); - }); + var value = $('#popup_'+id_value).val(); + $('#'+id_value).val(value); + + $('html, body').animate({scrollTop:$(document).height()}, 100, function(){ + vprasanje_save(true); + }); + + $('#vrednost_edit').hide().html(); } + function prikaziGoogle2faKodo(){ $('#2fa-display').toggle(); } @@ -5460,13 +5641,8 @@ $(document).ready(function(){ function consultingPopupOpen(){ $('#fade').fadeTo('slow', 1); - $('#popup_note').html('').fadeIn('slow'); - $("#popup_note").load('ajax.php?a=consulting_popup_open', {anketa: srv_meta_anketa_id}); -} -function consultingPopupClose(){ - - $('#popup_note').fadeOut('slow').html(''); - $('#fade').fadeOut('slow'); + $('#general_popup').html('').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=consulting_popup_open', {anketa: srv_meta_anketa_id}); } @@ -5475,3 +5651,256 @@ function removeUploadFromData(usr_id, spr_id, code){ $("#fullscreen").load('ajax.php?t=postprocess&a=edit_data_question_upload_delete', {anketa: srv_meta_anketa_id, usr_id: usr_id, spr_id: spr_id, code: code}); } + +// Kopiranje URLja za anketo +function CopyToClipboard(copyText){ + var temp_copy = $('').val(copyText).appendTo('body').select() + document.execCommand('copy') + temp_copy.remove() +} + +// Popup - opozorilo na vsa vprašanja +function popupAlertAll(alert_type){ + + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=alert_all_popup', {alert_type:alert_type, anketa:srv_meta_anketa_id}); +} + + +//Generičen alert popup +function genericAlertPopup(name, optional_parameter, class_string){ + + if (optional_parameter === undefined) { + optional_parameter = ""; + } + if (class_string !== undefined) { + $('#general_popup').addClass(class_string); + } + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=genericAlertPopup', {name:name, optional_parameter:optional_parameter}); + +} + +//Toggle za prikaz nastavitev in opozoril v parapodatkih +function toggleParapodatki(){ + + var survey_ip = $('input[name=survey_ip]:checked').val(); + var survey_show_ip = $('input[name=survey_show_ip ]:checked').val(); + var show_email = $('input[name=show_email ]:checked').val(); + + if(survey_ip == '0') { + $("#save_IP_warning").removeClass('displayNone'); + $("#save_IP").removeClass('bottom0'); + $("#connect_IP").removeClass('displayNone'); + } + + else { + $("#save_IP_warning").addClass('displayNone'); + $("#save_IP").addClass('bottom0'); + $("#connect_IP").addClass('displayNone'); + } + + if(survey_show_ip == '1') + $("#connect_IP_warning").removeClass('displayNone'); + + else + $("#connect_IP_warning").addClass('displayNone'); + + if(show_email == '1') + $("#connect_identifier_warning").removeClass('displayNone'); + + else + $("#connect_identifier_warning").addClass('displayNone'); +} + + +function popupClose(){ + $('#general_popup').fadeOut('slow').html('').attr('class', 'divPopUp'); + $('#fade').fadeOut('slow'); +} + + +// Note popup spodaj levo +function actionNotePopup(name, type){ + + let anketa = (typeof srv_meta_anketa_id !== 'undefined') ? srv_meta_anketa_id : ''; + + $('#action_note_holder').html('').load('ajax.php?a=actionNotePopup', {anketa:anketa, name:name, type:type}, function(){ + + setTimeout(function(){ + actionNotePopupClose(); + }, 10000); + }); +} + +// Zapri note popup spodaj levo +function actionNotePopupClose(){ + + $('#action_note_holder .action_note_box').fadeOut(function(){ + $('#action_note_holder').html(''); + }); +} + +//Hide top_note div +function top_note_hide(id) { + + $('#'+id).addClass('displayNone'); + +} + +//Objava - pregled (gumbi) +function publishPopupOpen(name){ + + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=publish_popup_open', {anketa: srv_meta_anketa_id, name: name}); +} + +//Objava - check lepi link +function addPrettyURL(){ + $.post('ajax.php?a=nice_url_check', {anketa: srv_meta_anketa_id, nice_url: $('#nice_url').val()}, + function(response) { + console.log(response); + if(response==""){ + $.redirect('ajax.php?a=nice_url', {anketa: srv_meta_anketa_id, nice_url: $('#nice_url').val()}); + } + else{ + $('#add_url_error').html(response).fadeIn('slow'); + } + }); + return false; +} + +//Objava - prikaz dodajanje lepega linka +function toggleNiceURL(type) { + + if (type == 'show') { + $("#nice_url_button").addClass('displayNone'); + $("#nice_url_holder").removeClass('displayNone'); + } + else if (type == 'hide') { + $("#nice_url_button").removeClass('displayNone'); + $("#nice_url_holder").addClass('displayNone'); + } +} + +//Objava - privzete nastavitve +function togglePublishSettings() { + $("#srv_objava_info_more1, #srv_objava_info_more2").toggleClass("displayNone"); + $("#publish_settings_more").slideToggle('medium'); +} + +//Aktivnost - toggle dropdown checkboxes +function toggleAktivnostCheckboxes(type) { + if (type == 'units') { + $("#dataSettingsCheckboxes").fadeIn("medium"); + $("#dataSettingsCheckboxes").toggleClass("displayNone"); + $("#toggleDataCheckboxes").toggleClass("border_blue"); + } + else if (type == 'date') { + $("#dataSettingsCheckboxes_Date").fadeIn("medium"); + $("#dataSettingsCheckboxes_Date").toggleClass("displayNone"); + $("#toggleDataCheckboxes_Date").toggleClass("border_blue"); + + } +} + +function toggleAddComment (box_id) { + + var toggle = '#comment_toggle_' + box_id; + var wrapper = '#comment_wrapper_' + box_id; + + $(toggle).toggle(); + $(wrapper).toggle(); +} + +function closeCommentQtip (box_id) { + + var content = '#survey_comment_' + box_id; + $(content).closest('.qtip ').qtip("hide"); +} + +function toggleGrafiColorWheel () { + $("#chart_custom_skin_cover").css("pointer-events", "auto"); +} + +function toggleSurveyTopSettings() { + $("#top_napredne_gumb").toggleClass("border_blue"); + $("#top_napredne_dropdown").toggleClass("displayNone"); +} + +//Vprašalnik - enklikarhiv gumb +function oneClickArchive(){ + + $('#fade').fadeTo('slow', 1); + $('#general_popup').addClass('PopUpNarrow'); + $('#general_popup').html('').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=oneClickArchive', {anketa: srv_meta_anketa_id}); +} + + + +// kliči popup +function show_gdpr_messeage(id_sporocila, anketa){ + + $('#fade').fadeTo('slow', 1); + $('#general_popup').addClass('PopUpNarrow'); + $('#general_popup').html('hello').fadeIn('slow'); + $("#general_popup").load('ajax.php?a=show_gdpr_messeage', {id_sporocila: id_sporocila, anketa: anketa}); + +} + + +//Toggle za dodajanje uporabnika (admini in managerji) +function toggleAddUser(value){ + $('.add_user_option').addClass('displayNone'); + $("#add_user_option_"+value).removeClass('displayNone'); +} + + +function toggleAnketaOpomba () { + $("#dodaj-opombo").toggleClass('displayNone'); +} + +function toggleAnketaMapa () { + $("#dodaj-v-mapo").toggleClass('displayNone'); + $("#anketa-toggle").toggleClass('bottom0'); +} + +//lahko se klice na onclick in downloada file iz url +function download_file(url) { + const a = document.createElement('a') + a.href = url + a.download = url.split('/').pop() + document.body.appendChild(a) + a.click() + document.body.removeChild(a) +} + +//header when scrolling +$(function() { + $(window).on("scroll", { passive: true }, function() { + var header = $(".desktop_header"); + var top_center_settings = $("#branching .top_center_settings"); + + var scroll = $(window).scrollTop(); + + if (scroll > 190) { + top_center_settings.addClass("top_sticky"); + header.addClass("shrink_header"); + } + else if (0 < scroll && scroll <= 190) { + header.addClass("shrink_header"); + top_center_settings.removeClass("top_sticky"); + } + else if(scroll > 0){ + header.addClass("shrink_header"); + } + else { + header.removeClass("shrink_header"); + top_center_settings.removeClass("top_sticky"); + } + }); +}); \ No newline at end of file diff --git a/admin/survey/script/script_analiza.js b/admin/survey/script/script_analiza.js index e166278..9cd011c 100644 --- a/admin/survey/script/script_analiza.js +++ b/admin/survey/script/script_analiza.js @@ -1,5 +1,7 @@ function analiza_init () { + var srv_site_url = $("#srv_site_url").val(); + // dodamo klike za odpiranje divov profilov (ker so z linki ble tezave) $("#link_filter_profile").live("click", function(event) { if (event.button != 0) { // wasn't the left button - ignore @@ -9,15 +11,6 @@ function analiza_init () { return false; // "capture" the click }); -/* - $("#link_collect_data_setting").live("click", function(event) { - if (event.button != 0) { // wasn't the left button - ignore - return true; - } - show_collect_data_setting(); - return false; // "capture" the click - }); -*/ $("#link_status_casi").live("click", function(event) { if (event.button != 0) { // wasn't the left button - ignore return true; @@ -48,13 +41,13 @@ function analiza_init () { }); // brisanje vnosa - $('#dataTable td .delete_circle').live('click', function(event) { + $('#dataTable td .delete').live('click', function(event) { // polovimo user id var usr_id = $(this).parent().parent().find('.data_uid').html(); var row = $(this).parent().parent(); - var note = 'srv_ask_delete'; + var note = 'srv_ask_delete_data'; // Preverimo ce je med njimi tudi kaksno vabilo - dodatno opozorilo if($(this).parent().parent().find('.invitation_cell').length == 1){ @@ -70,20 +63,36 @@ function analiza_init () { if (response == '0') { row.hide(); } else { - alert(response); + genericAlertPopup('alert_parameter_response',response); } }); } else { - alert("Napaka pri brisanju!"); + genericAlertPopup('alert_delete_error'); } } }); }); + // klik na checkbox za oznacevanje za brisanje + $('#dataTable td .delete_data_row').live('click', function(event) { + + // Preverimo ce je kaksen checkbox oznacen - prikazemo gumb za mass delete + if($(this).is(':checked')){ + $("#switch_on").hide(); + $("#switch_off").show(); + $("#mass_delete_button").show(); + } + // Skrijemo gumb za mass delete + else if($('#dataTable td .delete_data_row:checked').length == 0){ + $("#switch_on").show(); + $("#switch_off").hide(); + $("#mass_delete_button").hide(); + } + }); // editiranje starega vnosa $('#dataTable td .edit_square').live('click', function(event) { // polovimo user id var uid = $(this).parent().parent().find('.data_uid').html(); - var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_id+'&usr_id='+uid+''; + var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_hash+'&usr_id='+uid+''; if (uid > 0 ){ window.open(href, '_blank'); } @@ -211,15 +220,7 @@ function analiza_init () { $("#span_color_residual_legend2").toggle(); }); - /* - $(document).ready(function() { - $('#dataTable tbody tr:odd').addClass('odd'); - - $('#dataTable tbody tr:even').addClass('even'); - - }); - */ // inspect za frekvence $("td.fr_inspect").live("click", function(event) { doInspectFromFrequency(this,event); @@ -249,36 +250,36 @@ function analiza_init () { $('.div_analiza_holder').live({ mouseenter: function(){ $(this).find('.div_analiza_icons').stop().animate({opacity:1}, 600); - $(this).find('.div_analiza_scale').stop().animate({opacity:1}, 600); + //$(this).find('.div_analiza_scale').stop().animate({opacity:1}, 600); }, mouseleave: function(){ $(this).find('.div_analiza_icons').stop().animate({opacity:0}, 600); - $(this).find('.div_analiza_scale').stop().animate({opacity:0}, 600); + //$(this).find('.div_analiza_scale').stop().animate({opacity:0}, 600); } }); + // prikazovanje gumbov za hitro skrolanje levo desno v podatkih - $('#tableContainer').live( - { - mouseenter: function() - { - var windowWidth = $(window).width(); //retrieve current window width - var dtWidth = $('#dataTable').outerWidth(); - if ( (dtWidth - windowWidth) > 0) - { - $(this).find('#dataTableScroller').stop().animate({opacity:1}, 600); - } - }, - mouseleave: function() - { - var windowWidth = $(window).width(); //retrieve current window width - var dtWidth = $('#dataTable').outerWidth(); - if ( (dtWidth - windowWidth) > 0) - { - $(this).find('#dataTableScroller').stop().animate({opacity:0}, 600); - } - } - }); + // Sirina in visina okna + var windowWidth = $(window).width(); + var windowHeight = $(window).height(); + + // Sirina in visina tabele + var tableWidth = $('#dataTable').width(); + var tableHeight = $('#dataTable').height(); + + // Puscice za scroll prikazemo samo ce je tabela prevelika + if(tableWidth > windowWidth && tableHeight > 0.8*windowHeight){ + + $('#tableContainer').live({ + mouseenter: function(){ + $(this).find('#dataTableScroller').stop().animate({opacity:1}, 600); + }, + mouseleave: function(){ + $(this).find('#dataTableScroller').stop().animate({opacity:0}, 600); + } + }); + } }; /** @@ -286,19 +287,21 @@ function analiza_init () { */ function statusCasiAction(action) { - $("#loading").show(); + if (action == 'change') { pid = $("#vnosi_current_status_casi").val(); $.post('ajax.php?a=vnosi_change_status_casi', {anketa: srv_meta_anketa_id, pid:pid}, function() { return reloadData(); }); - } else if (action == 'run') { - $("#loading").show(); + } + else if (action == 'run') { + pid = $("#status_casi .active").attr('value'); // polovimo statuse var statusCnt = 0; var srv_userstatus = ""; prefix=""; + $("input[name^=srv_userstatus]:checked").each(function() { srv_userstatus = srv_userstatus + prefix + $(this).attr('id'); prefix = ","; @@ -311,12 +314,13 @@ function statusCasiAction(action) { // osvezimo vnose return reloadData(); }); + // skrijemo vse dive $("#div_status_values").hide(200); - //$('#fade').fadeOut('slow'); $("#div_status_values").html(''); - } else if (action == 'run_rezanje') { - $("#loading").show(); + } + else if (action == 'run_rezanje') { + var rezanje = $("input[name=rezanje]:checked").val(); var rezanje_meja_sp = $("select[name=rezanje_meja_sp]").val(); var rezanje_meja_zg = $("select[name=rezanje_meja_zg]").val(); @@ -333,16 +337,19 @@ function statusCasiAction(action) { $("#div_status_values").hide(200); //$('#fade').fadeOut('slow'); $("#div_status_values").html(''); - } else if (action == 'cancle') { - $('#loading').hide(); + } + else if (action == 'cancle') { + $("#div_status_values").hide(200); $('#fade').fadeOut('slow'); $("#div_status_values").html(''); - } else if (action == 'newName') { // dodelimo novo ime profilu + } + else if (action == 'newName') { // dodelimo novo ime profilu $("#statusCasiCoverDiv").show(); $("#newProfile").show(); - } else if (action == 'newSave') { // shranimo kot nov profil in pozenemo - $("#loading").show(); + } + else if (action == 'newSave') { // shranimo kot nov profil in pozenemo + pid = $("#status_casi .active").attr('value'); name = $("#newProfileName").val(); $("#newProfile").hide(); @@ -366,15 +373,18 @@ function statusCasiAction(action) { $("#div_status_values").hide(200); $('#fade').fadeOut('slow'); $("#div_status_values").html(''); - } else if (action == 'deleteAsk') { // vprašamo po potrditvi + } + else if (action == 'deleteAsk') { // vprašamo po potrditvi $("#statusProfileCoverDiv").show(); $("#deleteProfileDiv").show(); - } else if (action == 'deleteCancle') { // prekicemo brisanje + } + else if (action == 'deleteCancle') { // prekicemo brisanje $("#deleteProfileDiv").hide(); $("#statusProfileCoverDiv").fadeOut(); - } else if (action == 'deleteConfirm') { // izbrisemo profil - $("#loading").show(); + } + else if (action == 'deleteConfirm') { // izbrisemo profil + pid = $("#status_casi .active").attr('value'); $.post('ajax.php?a=vnosi_delete_status_casi', {anketa: srv_meta_anketa_id, pid:pid}, function() { // dropdownu izberemo profil @@ -382,6 +392,7 @@ function statusCasiAction(action) { // osvezimo vnose return reloadData(); }); + $("#deleteProfileDiv").hide(); $("#statusProfileCoverDiv").fadeOut(); $("#div_status_values").hide(200); @@ -423,7 +434,7 @@ function vnosi_show_rezanje_casi() var left = width - (msg.width() )-42; var top = height/2 - (msg.height() / 2); // pozicioniramo na center strani - $("#div_status_values").show(200).draggable({delay:100, cancel: 'input, .buttonwrapper, select'}); + $("#div_status_values").show(200); } // prikaže skrit div za nastavitev manjkajočih vrednosti @@ -478,39 +489,22 @@ function showspremenljivkaSingleVarPopup(id) { }); } -function showSpremenljivkaTextAnswersPopup(id,seq) { - var size = "location=0,height=500,width=700,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0"; - var recipe = window.open('','RecipeWindow',size); - - $.post('ajax.php?t=analysis&a=showSpremenljivkaTextAnswersPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, id:id,seq:seq}, function(response) { - recipe.document.open(); - recipe.document.write(response); - recipe.document.close(); - recipe.focus(); - return false; - }); +function showSpremenljivkaTextAnswersPopup(id) { + $('#fade').fadeTo('slow', 1); + $('#analysis_popup').html('').fadeIn('slow'); + $('#analysis_popup').load('ajax.php?t=analysis&a=showSpremenljivkaTextAnswersPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, id:id}); } -function showAnalizaSingleVarPopup(id,zaPodstran,navedbe,loop) { - var size = "location=0,height=500,width=700,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0"; - var recipe = window.open('','RecipeWindow',size); - - $.post('ajax.php?t=analysis&a=showAnalizaSingleVarPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, podstran: zaPodstran, zaPodstran:zaPodstran, id:id,navedbe:navedbe,loop:loop}, function(response) { - recipe.document.open(); - recipe.document.write(response); - recipe.document.close(); - recipe.focus(); - return false; - }); - /* - $("#fullscreen").load('ajax.php?t=analysis&a=showAnalizaSingleVar', {anketa: srv_meta_anketa_id, podstran: zaPodstran, zaPodstran:zaPodstran, id:id}, function() { - $('#fullscreen').show(); - $('#fade').fadeTo('slow', 1); - }).draggable({handle: '#div_analiza_single_var_close, #div_analiza_single_var' }); - */ +function showAnalizaSingleVarPopup(id, zaPodstran, navedbe, loop, _this) { + + var title = encodeURIComponent($(_this).html()); + + $('#fade').fadeTo('slow', 1); + $('#analysis_popup').html('').fadeIn('slow'); + $('#analysis_popup').load('ajax.php?t=analysis&a=showAnalizaSingleVarPopup&setSkipCreate=1', {anketa:srv_meta_anketa_id, podstran:zaPodstran, zaPodstran:zaPodstran, id:id, navedbe:navedbe, loop:loop, title:title}); } -function showAnalizaSingleChartPopup(id,zaPodstran) { +function showAnalizaSingleChartPopup(id, zaPodstran) { var size = "location=0,height=550,width=830,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0"; var recipe = window.open('','RecipeWindow',size); @@ -543,7 +537,7 @@ function hideAnalizaSingleVarPopup() { } function show_single_missing(id, what) { - // + if (what == 0) { $('tr[name=missing_detail_'+id+']').each(function() {$(this).removeClass('displayNone');}); $("#single_missing_0"+id).hide(); @@ -553,7 +547,8 @@ function show_single_missing(id, what) { $("#single_missing_percent_"+id).hide(); $("#single_missing_title_"+id).hide(); - } else { + } + else { $('tr[name=missing_detail_'+id+']').each(function() {$(this).addClass('displayNone');}); $("#single_missing_0"+id).show(); $("#single_missing_1"+id).hide(); @@ -561,7 +556,6 @@ function show_single_missing(id, what) { $("#single_missing_suma_freq_"+id).hide(); $("#single_missing_percent_"+id).show(); $("#single_missing_title_"+id).show(); - } } @@ -687,27 +681,6 @@ function renameFilterProfile() { }); } -/*function showHideRenameFilterProfile(showhide) { - if (showhide=='true') { - //$("#filterProfileCoverDiv").show(); - $("#renameFilterProfileDiv").show(); - } - else { - //$("#filterProfileCoverDiv").hide(); - $("#renameFilterProfileDiv").hide(); - } -} -function showHideDeleteFilterProfile(showhide) { - if (showhide=='true') { - //$("#filterProfileCoverDiv").show(); - $("#deleteFilterProfileDiv").show(); - } - else { - //$("#filterProfileCoverDiv").hide(); - $("#deleteFilterProfileDiv").hide(); - } -}*/ - function toggle_click_missing(what) { var variabla = $(what).attr('id').substr(14); // odrezemo prvih 14 znakov : click_missing_ @@ -718,85 +691,85 @@ function toggle_click_missing(what) { } if (state == 0) { - // odstranimo spodnjo polno črto, ostane rdeca crtkana - $("#anl_click_missing_tr_"+variabla).removeClass('anl_bb'); - $("#anl_click_missing_tr_"+variabla).addClass('anl_dash_red_bb'); - // nič od missingov še ni vidno. prikažemo osnovne missinge in skupo sumo - $("#click_missing_1_"+variabla).show(); - $("#click_missing_suma_"+variabla).show(); - $(what).attr('value',1); - // skrijemo osnovni link za vklop manjkajocih (manjkajoci) - $("#click_missing_"+variabla).hide(); - $("#single_missing_title_"+variabla).show(); - } else if (state == 1 || state == 2 || state == ""){ - // dodamo spodnjo polno črto, skrijemo rdeco crtkana - $("#anl_click_missing_tr_"+variabla).addClass('anl_bb'); - $("#anl_click_missing_tr_"+variabla).removeClass('anl_dash_red_bb'); - // nič od missingov še ni vidno. prikažemo osnovne missinge in skupo sumo - $("#click_missing_1_"+variabla).hide(); - $("#click_missing_suma_"+variabla).hide(); - $(what).attr('value',0); - $("#click_missing_"+variabla).show(); - $("#single_missing_title_"+variabla).hide(); + + // Odpremo missinge in skupno sumo + $('tr[name=missing_detail_'+variabla+']').each(function() { + $(this).removeClass('displayNone'); + }); + + $(what).attr('value', 1); + + // Zamenjamo puscico + $(what).find('.arrow2_d').removeClass('arrow2_d').addClass('arrow2_u'); + } + else if (state == 1 || state == 2 || state == ""){ + + // Zapremo missinge + $('tr[name=missing_detail_'+variabla+']').each(function() { + $(this).addClass('displayNone'); + }); + + $(what).attr('value', 0); + + // Zamenjamo puscico + $(what).find('.arrow2_u').removeClass('arrow2_u').addClass('arrow2_d'); } } -function show_single_percent(id,status) { +function show_single_percent(id, status) { - if (status == 0) { - // pokazemo frekvence in skrijemo procente - $('[name=single_sums_percent_'+id+']').each(function() {$(this).hide();}); - $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).show();}); - $('[name=single_sums_percent_cnt_'+id+']').removeClass('anl_dash_bb'); + // Vklop/izklop frekvenc + if (status == 1) { - // popravimo css link-e - $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).addClass("displayNone"); - $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).removeClass("displayNone"); - $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).addClass("displayNone"); - - } else if (status == 1) { - // pokazemo oboje - $('[name=single_sums_percent_cnt_'+id+']').addClass('anl_dash_bb'); - $('[name=single_sums_percent_'+id+']').each(function() {$(this).show();}); - $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).show();}); - - // popravimo css link-e - $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).removeClass("displayNone"); - $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).addClass("displayNone"); - $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).addClass("displayNone"); - - // skrijemo še vrednosti v vrstici z procenti - $("#span_do_hide_1"+id).hide(); - $("#span_do_hide_2"+id).hide(); - $("#span_do_hide_3"+id).hide(); - $("#span_do_hide_4"+id).hide(); - $("#span_do_hide_5"+id).hide(); - - } else { - $('[name=single_sums_percent_cnt_'+id+']').removeClass('anl_dash_bb'); - // pokazemo procente skrijemo frekvence - $('[name=single_sums_percent_'+id+']').each(function() {$(this).show();}); - $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).hide();}); - - // popravimo css link-e - $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).addClass("displayNone"); - $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).addClass("displayNone"); - $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).removeClass("displayNone"); - - // skrijemo še vrednosti v vrstici z procenti - $("#span_do_hide_1"+id).show(); - $("#span_do_hide_2"+id).show(); - $("#span_do_hide_3"+id).show(); - $("#span_do_hide_4"+id).show(); - $("#span_do_hide_5"+id).show(); + // Ugasnemo - samo ce je drug vklopljen + if($('#freq-p_button_1_'+id).hasClass('active')){ - } + if($('#freq-p_button_2_'+id).hasClass('active')){ + $('[name=single_sums_percent_cnt_'+id+']').each(function() { + $(this).hide().parent().parent().removeClass('freq_row'); + }); + + $('#freq-p_button_1_'+id).removeClass('active'); + } + } + // Prizgemo + else{ + $('[name=single_sums_percent_cnt_'+id+']').each(function() { + $(this).show().parent().parent().addClass('freq_row'); + }); + + $('#freq-p_button_1_'+id).addClass('active'); + } + } + // Vklop/izklop procentov + else if (status == 2) { + + // Ugasnemo - samo ce je drug vklopljen + if($('#freq-p_button_2_'+id).hasClass('active')){ + + if($('#freq-p_button_1_'+id).hasClass('active')){ + $('[name=single_sums_percent_'+id+']').each(function() { + $(this).hide().parent().parent().removeClass('percent_row'); + }); + + $('#freq-p_button_2_'+id).removeClass('active'); + } + } + // Prizgemo + else{ + $('[name=single_sums_percent_'+id+']').each(function() { + $(this).show().parent().parent().addClass('percent_row'); + }); + + $('#freq-p_button_2_'+id).addClass('active'); + } + } } function printAnaliza(ime) { if(ime == 'Crosstab') - var divToPrint=document.getElementById('crosstab_table'); + var divToPrint=document.getElementById('crosstab_tables'); else if(ime == 'MultiCrosstab') var divToPrint=document.getElementById('mc_holder'); else if(ime == 'Means') @@ -857,10 +830,11 @@ function scrollToProfile(_target) { } function cancleArchiveAnaliza() { - $('#fullscreen').hide(); + $('#fullscreen').hide().removeClass('PopUpNarrow').removeClass('divPopUp'); $('#fade').fadeOut('slow'); } function doArchiveAnaliza() { + $("#fullscreen").addClass('PopUpNarrow').addClass('divPopUp'); $("#fullscreen").load('ajax.php?a=doArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran}, function() { $('#fade').fadeTo('slow', 1); @@ -885,7 +859,7 @@ function submitArchiveAnaliza() { } function closeArchiveAnaliza() { - $('#fullscreen').hide(); + $('#fullscreen').hide().removeClass('PopUpNarrow').removeClass('divPopUp'); $('#fade').fadeOut('slow'); } @@ -935,7 +909,7 @@ function saveArchiveAnaliza(aid) { }); } else { - alert('Napaka!'); + genericAlertPopup('error'); $('#fullscreen').hide(); $('#fade').fadeOut('slow'); @@ -951,7 +925,7 @@ function saveArchiveAnaliza(aid) { function toggleAnalysisArchiveAccessPassword() { var value = $("input[name=newAnalysisArchiveAccess]:checked").val(); var pass_div = document.getElementById("newAnalysisArchiveAccessPasswordDiv"); - value == 2 ? pass_div.style.visibility='visible' : pass_div.style.visibility='hidden'; + value == 2 ? pass_div.style.display='block' : pass_div.style.display='none'; } function AnalysisArchiveDelete(aid) { @@ -968,7 +942,7 @@ function doDeleteArchiveAnaliza(aid) { $('#fade').fadeOut('slow'); }); } else { - alert('Napaka!'); + genericAlertPopup('error'); $('#fullscreen').hide(); $('#fade').fadeOut('slow'); } @@ -984,15 +958,15 @@ function createArchiveBeforeEmail() { if (parseInt(response) > 0) { var aid = parseInt(response); $("#fullscreen").load('ajax.php?a=emailArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, aid:aid}, function() { - $('#fullscreen').show(); + $('#fullscreen').addClass("divPopUp").show(); }); } else { if (parseInt(response) == -1) { - alert("Nothing to archive!"+response); + genericAlertPopup('alert_no_archive_response',response); } else { - alert("Error while creating archive!"+response); + genericAlertPopup('alert_archive_error_response',response); } - $('#fullscreen').hide(); + $('#fullscreen').removeClass("PopUpNarrow divPopUp").hide(); $('#fade').fadeOut('slow'); } }); @@ -1003,173 +977,45 @@ function showHidenTextRow($sequence) { } -function showHidenTextTable(spid,num_records,loop_id) { +function showHidenTextTable(spid, num_records, loop_id) { + + var srv_site_url = $("#srv_site_url").val(); + if ($("#srv_meta_podstran").length == 0 ) { var podstran = srv_meta_podstran; - } else { + } + else { var podstran = $("#srv_meta_podstran").val(); } + if ($("#srv_meta_anketa_id").length == 0 ) { var srv_meta_anketa_id = srv_meta_anketa_id; - } else { + } + else { var srv_meta_anketa_id = $("#srv_meta_anketa_id").val(); } if (podstran == 'frequency') { - $('#freq_'+spid+'[loop="'+loop_id+'"]').load('ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id}); - } else if (podstran == 'sumarnik') { - $('#sum_'+spid+'[loop="'+loop_id+'"]').load('ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id}); - } else if (podstran == 'charts') { - $('#chart_'+spid+'_loop_'+loop_id).load('ajax.php?t=charts&a=show_spid_more_table', {anketa:srv_meta_anketa_id, spid:spid, num_records:num_records, loop:loop_id}); - } -} -/* -var intervalPB=''; -var hasStarted=false; - -function createCollectData(auto) { - var _automatic = '&automatic=false'; - if (arguments.length > 0 ) { - if (auto == true) { - _automatic = ''; - } + $('#freq_'+spid+'[loop="'+loop_id+'"]').load(srv_site_url+'/admin/survey/ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id}); + } + else if (podstran == 'sumarnik') { + $('#sum_'+spid+'[loop="'+loop_id+'"]').load(srv_site_url+'/admin/survey/ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id}); + } + else if (podstran == 'charts') { + $('#chart_'+spid+'_loop_'+loop_id).load(srv_site_url+'/admin/survey/ajax.php?t=charts&a=show_spid_more_table', {anketa:srv_meta_anketa_id, spid:spid, num_records:num_records, loop:loop_id}); } - - if (hasStarted == false) { - // skrijemo tekst z file statusom - $('#vnosi_file_status').hide(); - - // nalozimo div za izris poteka - $('#fade').fadeTo('slow', 1); - $('#fullscreen').show(); - - $("#fullscreen").load('prepareDataCrontab.php?action=LoadProgresBar', {anketa: srv_meta_anketa_id}, function () { - $('#pbAllPercent div').css('width','0%'); - $('#pbCurrPercent div').css('width','0%'); - $('#pbRowPercent div').css('width','0%'); - - $('#pbAllPercent').css('visibility','visible'); - $('#pbCurrPercent').css('visibility','visible'); - $('#hpbRowPercent, #pbRowPercent').css('visibility','visible'); - - $.ajax({ - cache: false, - type: 'post', - url: 'prepareDataCrontab.php?action=collectSingle'+_automatic+'&anketa='+srv_meta_anketa_id, - beforeSend: start_display_progressBar() - }); - }); - } -} - -var pbLabels= new Array() -pbLabels['1'] = lang['srv_collectdata_progress_status1']; -pbLabels['2'] = lang['srv_collectdata_progress_status2']; -pbLabels['3'] = lang['srv_collectdata_progress_status3']; -pbLabels['8'] = lang['srv_collectdata_progress_status8']; -pbLabels['9'] = lang['srv_collectdata_progress_status9'] -pbLabels['-1'] = lang['srv_collectdata_progress_status0'] - -function start_display_progressBar(type) { - if (type == undefined) type = 'true'; - if (intervalPB=="") { - $('#start').css('visibility','hidden'); - intervalPB=window.setInterval("display_progressBar('"+type+"')",750); // interval = 400 ms - $('#loader').css('display','inline'); - } else { - stop_display_progressBar(); - } } -function stop_display_progressBar() { - $("#loading").show(); - if (intervalPB!="") { - $('#start').css('visibility','visible'); - window.clearInterval(intervalPB); - intervalPB=""; +function show_navedbe(spid, status) { -// $('#fade').fadeOut('slow'); - $('#fullscreen').hide(); - $('#fullscreen').html(''); - - hasStarted = true; - return reloadData(); - } -} -function display_progressBar(type) { - if (type == undefined) type = 'true'; - $.ajax({ - cache: false, - type: 'get', - url: 'getCollectTimer.php?ajaxTimer='+type, - success: function(response) { - var data = jQuery.parseJSON(response); - - $('#actionLabel').html(pbLabels[data.id]+' ('+data.t+')'); - $('#pbAllPercent div').css('width',data.pa+'%'); - if ( data.id == '2') { - // na koliko % smo v header datoteki - $('#pbCurrPercent div').css('width',data.ph+'%'); - $('#pbCurrPercentLabel').html(data.ph+'%'); - // na katerem zapisu smo - $('#pbRowPercent div').css('width',data.pr+'%'); - $('#pbRowPercentLabel').html(data.nr); - - } - if ( data.id == '3') { -// $('#hpbRowPercent, #pbRowPercent').css('visibility','visible'); - // na koliko % smo v data datoteki - $('#pbCurrPercent div').css('width',data.pd+'%'); - $('#pbCurrPercentLabel').html(data.pd+'%'); - // na katerem zapisu smo - $('#pbRowPercent div').css('width',data.pr+'%'); - $('#pbRowPercentLabel').html(data.nr); - } - - if ( data.id == '9' || data.id == '-1' ) { // 9 = konec - hasStarted = true; - // konec prenosa - $('#pbCurrPercent div').css('width','100%'); - $('#pbRowPercent div').css('width','100%'); - $('#pbCurrPercentLabel').html('100%'); - $('#pbRowPercentLabel').html('100%'); - stop_display_progressBar(); - } - } - }); -} -*/ -function show_navedbe(spid,status) { - if (status == 1) { - // vidno je oboje - // pokažemo pravilne linke -// $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).addClass('displayNone'); }); - $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).removeClass('displayNone'); }); - $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).addClass('displayNone'); }); - $("#div_navedbe_1_"+spid).removeClass('displayNone'); - $("#div_navedbe_2_"+spid).addClass('displayNone'); - - } else if (status == 2) { - // pokažemo samo navedbe - // pokažemo pravilne linke -// $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).removeClass('displayNone'); }); - $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).addClass('displayNone'); }); - $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).removeClass('displayNone'); }); - $("#div_navedbe_1_"+spid).addClass('displayNone'); - $("#div_navedbe_2_"+spid).removeClass('displayNone'); - /* - } else { - - // pokažemo samo odgovore - - // pokažemo pravilne linke - $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).addClass('displayNone'); }); - $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).removeClass('displayNone'); }); - $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).addClass('displayNone'); }); - $("#div_navedbe_1_"+spid).removeClass('displayNone'); - $("#div_navedbe_2_"+spid).addClass('displayNone'); -*/ - } + if (status == 1) { + $("#div_navedbe_1_"+spid).removeClass('displayNone'); + $("#div_navedbe_2_"+spid).addClass('displayNone'); + } + else if (status == 2) { + $("#div_navedbe_1_"+spid).addClass('displayNone'); + $("#div_navedbe_2_"+spid).removeClass('displayNone'); + } } // Pobrisemo vec vnosov hkrati @@ -1177,7 +1023,7 @@ function deleteMultipleData(){ var userArray = new Array; - var note = 'srv_ask_delete'; + var note = 'srv_ask_delete_multiple_data'; // Napolnimo array z checkanimi userji $('#div_vnosi_data input:checked').each(function() { @@ -1205,7 +1051,7 @@ function deleteMultipleData(){ }); } else { - alert(lang["srv_data_delete_not_selected"]); + genericAlertPopup('srv_data_delete_not_selected'); } } @@ -1215,11 +1061,13 @@ function selectAll(val){ $(".delete_data_row").attr("checked", "true"); $("#switch_on").hide(); $("#switch_off").show(); + $("#mass_delete_button").show(); } else{ $('.delete_data_row').removeAttr('checked'); $("#switch_off").hide(); $("#switch_on").show(); + $("#mass_delete_button").hide(); } } @@ -1238,11 +1086,11 @@ function quickEditAction(action, usr_id){ var href = srv_site_url+'admin/survey/index.php?anketa='+srv_meta_anketa_id+'&a=data&m=quick_edit'; window.location = href; } else { - alert(response); + genericAlertPopup('alert_parameter_response',response); } }); } else { - alert("Napaka pri brisanju!"); + genericAlertPopup('alert_delete_error'); } } }); @@ -1250,7 +1098,7 @@ function quickEditAction(action, usr_id){ // editiranje starega vnosa if(action == 'edit'){ - var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_id+'&usr_id='+usr_id+''; + var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_hash+'&usr_id='+usr_id+''; if (usr_id > 0 ){ window.open(href, '_blank'); } @@ -1305,7 +1153,7 @@ function quickEditAction(action, usr_id){ window.location = href; }); } else { - alert("Napaka pri kopiranju!"); + genericAlertPopup('alert_copy_error'); } } }); @@ -1419,7 +1267,7 @@ function doArchiveChart() { $('#fullscreen').show(); }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } } function submitArchiveChart() { @@ -1438,7 +1286,7 @@ function submitArchiveChart() { $("#fullscreen").show(); }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } } @@ -1456,9 +1304,9 @@ function createArchiveChartBeforeEmail() { }); } else { if (parseInt(response) == -1) { - alert("Nothing to archive!"+response); + genericAlertPopup('alert_no_archive_response',response); } else { - alert("Error while creating archive!"+response); + genericAlertPopup('alert_archive_error_response',response); } $('#fullscreen').hide(); $('#fade').fadeOut('slow'); @@ -1466,7 +1314,7 @@ function createArchiveChartBeforeEmail() { }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } }; @@ -1501,23 +1349,6 @@ function printCurrentAnalysis(spid) { pri.print(); } -/* - * $.fn.center = function() { - this.css({ - 'position': 'fixed', - 'left': '50%', - 'top': '50%' - }); - this.css({ - 'margin-left': -this.width() / 2 + 'px', - 'margin-top': -this.height() / 2 + 'px' - }); - - return this; - } - - - */ $.fn.followTo = function ( pos ) { var $this = this, @@ -1541,37 +1372,35 @@ $.fn.followTo = function ( pos ) { }; +// Horizontalen scroll tabele s podatki pri kliku na puscice +function dataTableScroll(where){ + var scroll_width = $(window).width() / 4 * 3; -/** - * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com - * Dual licensed under MIT and GPL. - * @author Ariel Flesler - * @version 1.4.3.1 - */ -//(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); - - -/** - * Copyright (c) 2007-2014 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com - * Licensed under MIT - * @author Ariel Flesler - * @version 1.4.14 - */ -//(function(k){'use strict';k(['jquery'],function($){var j=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};j.defaults={axis:'xy',duration:0,limit:!0};j.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(f,g,h){if(typeof g=='object'){h=g;g=0}if(typeof h=='function')h={onAfter:h};if(f=='max')f=9e9;h=$.extend({},j.defaults,h);g=g||h.duration;h.queue=h.queue&&h.axis.length>1;if(h.queue)g/=2;h.offset=both(h.offset);h.over=both(h.over);return this._scrollable().each(function(){if(f==null)return;var d=this,$elem=$(d),targ=f,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}var e=$.isFunction(h.offset)&&h.offset(d,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=j.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=e[pos]||0;if(h.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*h.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&h.queue){if(old!=attr[key])animate(h.onAfterFirst);delete attr[key]}});animate(h.onAfter);function animate(a){$elem.animate(attr,g,h.easing,a&&function(){a.call(this,targ,h)})}}).end()};j.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}return j})}(typeof define==='function'&&define.amd?define:function(a,b){if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}})); - -function dataTableScroll(where) -{ if (where == 'left'){ - //$(window).scrollTo('-=500px', 300, { axis:'x' }); - - var leftPos = $('html').scrollLeft(); - $("html").animate({scrollLeft: leftPos - 700}, 800); + var leftPos = $('#tableContainer').scrollLeft(); + $("#tableContainer").animate({scrollLeft: leftPos - scroll_width}, 600); } if (where == 'right'){ - //$(window).scrollTo('+=500px', 300, { axis:'x' }); - - var leftPos = $('html').scrollLeft(); - $("html").animate({scrollLeft: leftPos + 700}, 800); + var leftPos = $('#tableContainer').scrollLeft(); + $("#tableContainer").animate({scrollLeft: leftPos + scroll_width}, 600); } +} + +// Prikaz ikon (frekvence, sums...) pri kliku na 3 pikice +function show_settings_survey_analysis(id_of_element){ + + if($('#options'+id_of_element).is(":visible")){ + $('#options'+id_of_element).hide(); + } + else{ + $('.options').hide(); + $('#options'+id_of_element).show(); + } +} + +// Zapremo popup z analizo +function closeAnalizaPopup(){ + $('#analysis_popup').fadeOut('slow').html(''); + $('#fade').fadeOut('slow'); } \ No newline at end of file diff --git a/admin/survey/script/skupine.js b/admin/survey/script/skupine.js index 5f782cc..dae555a 100644 --- a/admin/survey/script/skupine.js +++ b/admin/survey/script/skupine.js @@ -5,8 +5,12 @@ function add_skupina(skupine){ var text = $('input[name=skupina]').val(); $.post('ajax.php?t=skupine&a=add_skupina', {anketa: srv_meta_anketa_id, spr_id:spr_id, text:text, skupine:skupine}, function(response){ - //window.location.reload(); - $(response).insertBefore('.add_skupina_button'); + $('#groups_table').removeClass('displayNone'); + $('#groups_table tr:last').after(response); + $('input[name=skupina]').val('').focus(); + + $('#passwords_table').removeClass('displayNone'); + $('#passwords_table tr:last').after(response); $('input[name=skupina]').val('').focus(); }); } @@ -20,11 +24,11 @@ function add_skupina_enter(skupine, event){ } // brisanje skupine -function delete_skupina(skupine, vre_id, text){ +function delete_skupina(skupine, vre_id){ var spr_id = $('#skupine_spr_id').val(); - $.post('ajax.php?t=skupine&a=delete_skupina', {anketa: srv_meta_anketa_id, skupine:skupine, spr_id:spr_id, vre_id:vre_id, text:text}, function(){ + $.post('ajax.php?t=skupine&a=delete_skupina', {anketa: srv_meta_anketa_id, skupine:skupine, spr_id:spr_id, vre_id:vre_id}, function(){ window.location.reload(); }); } diff --git a/admin/survey/script/slideshow.js b/admin/survey/script/slideshow.js index 00cdfe2..914cd67 100644 --- a/admin/survey/script/slideshow.js +++ b/admin/survey/script/slideshow.js @@ -19,7 +19,7 @@ function slideshow_reset_interval() { } else { // ne moremo resetriat, ker checkbox ni izbran - alert("Error! Select checkbox"); + genericAlertPopup('alert_checkbox_error'); } } @@ -37,7 +37,7 @@ function slideshow_save_settings() { $.post('ajax.php?t=slideshow&a=save_settings', {anketa: srv_meta_anketa_id, timer:timer, fixed_interval:fixed_interval, save_entries:save_entries, autostart:autostart, next_btn:next_btn, back_btn:back_btn, pause_btn:pause_btn},function(){ - show_success_save(); + actionNotePopup('success_save', 'success'); }); } \ No newline at end of file diff --git a/admin/survey/script/statistika.js b/admin/survey/script/statistika.js index db3598d..1f4497c 100644 --- a/admin/survey/script/statistika.js +++ b/admin/survey/script/statistika.js @@ -97,7 +97,7 @@ function renameStatisticProfile() { if (response > 0) { $("#statistic_profile .active").html(name); } else if (response < 0){ - alert("Error!"); + genericAlertPopup('error'); } }); } @@ -145,7 +145,7 @@ function create_new_statistic_interval_filter() { $("#div_statistic_date_select").load("ajax.php?t=dashboard&a=loadStatisticProfile", {anketa:srv_meta_anketa_id}); } else { // prišlo je do napake; - alert(response); + genericAlertPopup('alert_parameter_response',response); } }); } diff --git a/admin/survey/script/statusProfiles.js b/admin/survey/script/statusProfiles.js index 087ac4d..720e963 100644 --- a/admin/survey/script/statusProfiles.js +++ b/admin/survey/script/statusProfiles.js @@ -185,20 +185,55 @@ function statusProfileRefreshData(pid) { return reloadData('status'); } -function showColectDataSetting() { - $('#fade').fadeTo('slow', 1); - $('#fullscreen').html('').fadeIn('slow'); - $("#fullscreen").load('ajax.php?t=statusProfile&a=showColectDataSetting', {anketa:srv_meta_anketa_id}); +// Klik na novo generiranje datoteke s podatki +function changeColectDataStatus() { + + // Preverimo, ce imamo prevec neustreznih - potem ponudimo popup za brisanje neustreznih + let invalid_answers_count = 0; + $.post('ajax.php?a=dataCountNeustrezne', {anketa: srv_meta_anketa_id}, function(response) { + invalid_answers_count = response; + + // Imamo prevec neustreznih enot - prikazemo popup za brisanje + if(invalid_answers_count > 1000){ + showInvalidResponsesWarning(); + } + // Na novo zgeneriramo datoteko s podatki + else{ + refreshDataFile(); + } + }); } +// Prikazemo popup za brisanje neustreznih enot +function showInvalidResponsesWarning() { + + $('#fade').fadeTo('slow', 1); + $('#general_popup').addClass('PopUpNarrow'); + $('#general_popup').html('').fadeIn('slow'); + //$("#general_popup").load('ajax.php?a=oneClickArchive', {anketa: srv_meta_anketa_id}); + $("#general_popup").load('ajax.php?t=statusProfile&a=showInvalidResponsesWarning', {anketa:srv_meta_anketa_id}); +} -function changeColectDataStatus() { +// Na novo zgeneriramo datoteko s podatki +function refreshDataFile(){ + var collect_all_status = $('input[name="collect_all_status"]').is(':checked') ? '0' : '1'; + $.post('ajax.php?t=statusProfile&a=saveCollectDataSetting', {anketa: srv_meta_anketa_id, collect_all_status:collect_all_status}, function(response) { return reloadData('status'); }); } +// Pobrišemo neustrezne enote +function deleteInvalidAnswers() { + + $.post('ajax.php?a=dataDeleteNeustrezne', {anketa: srv_meta_anketa_id}, function(response) { + + // Potem na novo zgeneriramo datoteko s podatki + refreshDataFile(); + }); +} + function changeOnlyValidRadio() { var checked = $('input[name=statusOnlyValid]:checked').val(); @@ -206,5 +241,4 @@ function changeOnlyValidRadio() { $.post('ajax.php?t=statusProfile&a=changeOnlyValidRadio', {anketa: srv_meta_anketa_id,meta_akcija: srv_meta_akcija, podstran: srv_meta_podstran, checked:checked}, function(response) { return reloadData('status'); }); - } \ No newline at end of file diff --git a/admin/survey/script/surveyCondition.js b/admin/survey/script/surveyCondition.js index 3670c7e..7223b66 100644 --- a/admin/survey/script/surveyCondition.js +++ b/admin/survey/script/surveyCondition.js @@ -19,7 +19,7 @@ function newSurveyCondition() } else { - alert('Error! (errCode:'+data.error+')'); + genericAlertPopup('alert_error_code',data.error); } } ) @@ -47,7 +47,7 @@ function deleteSurveyCondition(cid) } else { - alert('Error! (errCode:'+data.error+')'); + genericAlertPopup('alert_error_code',data.error); } } ); @@ -73,7 +73,7 @@ function renameSurveyCondition() } else { - alert(data.errorMsg+''); + genericAlertPopup('alert_parameter_dataerrormsg'); } } ); diff --git a/admin/survey/script/surveyList.js b/admin/survey/script/surveyList.js index 5000e72..c7261ef 100644 --- a/admin/survey/script/surveyList.js +++ b/admin/survey/script/surveyList.js @@ -1,37 +1,116 @@ +/** Izbrise anketo + * + * @param anketa + * @param confirmtext + * @return + */ + function anketa_delete_list (anketa, confirmtext) { + if (confirm(confirmtext)) { + $("#anketa_list_"+anketa).slideUp(); + $.post('ajax.php?a=anketa_delete', {anketa: anketa, 'inList': 'true'}, function(response) { + if (response == '0') { + window.location = 'index.php'; + } + }); + } +} + +/** doda/odstrani anketo v sistemsko knjiznico in refresa ikono za knjiznico ankete + * + */ +function surveyList_knjiznica (anketa) { + $("ul#surveyList").find("li#anketa_list_"+anketa).find(".sl_lib_glb").load('ajax.php?t=surveyList&a=surveyList_knjiznica', {anketa: anketa}); +} + +/** navadnega uporabnika obvesti da nima dostopa za dodajanje v sistemsko knjiznico + * + */ +function surveyList_knjiznica_noaccess (msg) { + genericAlertPopup('alert_parameter_msg'); +} + +/** doda/odstrani anketo v uporabnisko knjiznico in refresa ikono za knjiznico ankete +* +*/ +function surveyList_myknjiznica (anketa) { + $("ul#surveyList").find("li#anketa_list_"+anketa).find(".sl_lib_usr").load('ajax.php?t=surveyList&a=surveyList_myknjiznica', {anketa: anketa}); + //$('#folders').load('ajax.php?t=folders&a=folders_myknjiznica', {anketa: anketa}); +} + +function surveyList_myknjiznica_new (anketa) { + $.post('ajax.php?t=surveyList&a=surveyList_myknjiznica_new', {anketa: anketa}, function() { + window.location.reload(true); + }); +} + +function surveyList_knjiznica_new (anketa) { + $.post('ajax.php?t=surveyList&a=surveyList_knjiznica_new', {anketa: anketa}, function() { + window.location.reload(true); + }); +} + +// Prikaz vec na tri pikice v tabeli anket +function surveyList_show_more(ank_id){ + + if($('#survey_other_box_'+ank_id).hasClass('displayNone')){ + $('.survey_other_box').addClass('displayNone'); + $('#survey_other_box_'+ank_id).removeClass('displayNone'); + } + else{ + $('.survey_other_box').addClass('displayNone'); + } + +} + + + +/* MOJE ANKETE - pogled z mapami */ + +// Preklopimo med prikazom folderjev in navadnim prikazom +function switchFolder(show){ + if(show == 1) + var show_folders = 0; + else + var show_folders = 1; + + $('#survey_list').load('ajax.php?a=surveyList_folders', {show_folders:show_folders}, function(){ + $('body').toggleClass('body_mySurveys_folders'); + $('body').toggleClass('body_mySurveys'); + }); +} + // inicializiramo drag/drop anket in folderjev -function surveyList_folder_init() { +function mySurvey_folder_init() { - $('#survey_list div.droppable').droppable({ - accept: '.mySurvey_draggable', + $('#survey_list .mySurvey_droppable').droppable({ + accept: '#survey_list .mySurvey_draggable', hoverClass: 'folderhover', tolerance: 'pointer', drop: function (e, ui) { // Drop folderja - if($(ui.draggable).hasClass('folder_title')){ - var drag_folder = $(ui.draggable).attr('folder_id'); - var parent = $(this).attr('folder_id'); + if($(ui.draggable).hasClass('folder_item')){ + + var drag_folder_id = $(ui.draggable).attr('folder_id'); + var parent_folder_id = $(this).attr('folder_id'); - $.post('ajax.php?t=surveyList&a=folder_dropped', {parent: parent, drag_folder: drag_folder}, function(){ - window.location.reload(); - }); + $('#survey_list').load('ajax.php?t=surveyListFolders&a=mysurvey_folder_drop', {parent_folder_id: parent_folder_id, drag_folder_id: drag_folder_id}); } // Drop ankete if($(ui.draggable).hasClass('anketa_list')){ - var drag_survey = $(ui.draggable).attr('anketa_id'); - var parent = $(this).attr('folder_id'); - $.post('ajax.php?t=surveyList&a=survey_dropped', {parent: parent, drag_survey: drag_survey}, function(){ - window.location.reload(); - }); + var drag_survey_id = $(ui.draggable).attr('anketa_id'); + var parent_folder_id = $(this).attr('folder_id'); + + $('#survey_list').load('ajax.php?t=surveyListFolders&a=mysurvey_survey_drop', {parent_folder_id: parent_folder_id, drag_survey_id: drag_survey_id}); } } }); - $('.mySurvey_draggable').draggable({ + $('#survey_list .mySurvey_draggable').draggable({ revert: 'invalid', - opacitiy: '0.7', + opacitiy: '0.9', helper: 'clone', cursor: 'move', cursorAt: { left: 20 }, @@ -41,127 +120,149 @@ function surveyList_folder_init() { }); } -// prikazemo/skrijemo ankete v folderju -function toggle_folder (folder) { - - var open = 0; - if($('#folder_content_'+folder).hasClass('closed')){ - open = 1; - } - - $.post('ajax.php?t=surveyList&a=folder_toggle', {folder: folder, open: open}, function(){ - if(open == 1){ - $('#folder_content_'+folder).removeClass('closed'); - $('#folder_'+folder).find('.plus').removeClass('plus').addClass('minus'); - } - else{ - $('#folder_content_'+folder).addClass('closed'); - $('#folder_'+folder).find('.minus').removeClass('minus').addClass('plus'); - } - }); -} +// Razpremo/skrcimo folder +function mySurvey_folder_toggle(folder_id){ -// Pobrisemo folder -function delete_folder (folder) { - $.post('ajax.php?t=surveyList&a=folder_delete', {folder: folder}, function(){ - window.location.reload(); - }); + if($('#folder_item_'+folder_id).hasClass('open')) + var open = 0; + else + var open = 1; + + $.post('ajax.php?t=surveyListFolders&a=mysurvey_folder_toggle', {folder_id: folder_id, open: open}, function(){ + + if($('#folder_item_'+folder_id).hasClass('open')){ + $('#folder_item_'+folder_id).removeClass('open'); + $('#folder_list_'+folder_id).slideUp(); + } + else{ + $('#folder_item_'+folder_id).addClass('open'); + $('#folder_list_'+folder_id).slideDown(); + } + }); + + event.stopPropagation(); } -// Ustvarimo folder -function create_folder (parent) { - - $('#survey_list').load('ajax.php?t=surveyList&a=folder_create', {parent: parent}, function(){ - - var added_folder_id = $('#new_added_folder').val(); +// Aktiviramo folder +function mySurvey_folder_activate(folder_id){ + + $('#right_content').load('ajax.php?t=surveyListFolders&a=mysurvey_folder_activate', {folder_id: folder_id}, function(){ + + // Pobrisemo aktivni class aktivnega + $('.folder_item').removeClass('active'); - edit_title_folder(added_folder_id); + // Dodamo aktivni class novemu + $('#folder_item_'+folder_id).addClass('active'); }); } -// Urejamo ime folderja -function edit_title_folder (folder) { - - var text = $('#folder_title_text_'+folder).text(); +// Prikazemo opcije za urejanje folderja +function mySurvey_folder_show_edit(element){ + + if($(element).parent().find('.folder_item_settings').hasClass('displayNone')){ + $('.folder_item_settings').addClass('displayNone'); + $('.dots_ver_folder').removeClass('active'); + $(element).parent().find('.folder_item_settings').removeClass('displayNone'); + $(element).addClass('active'); + } + else{ + $('.folder_item_settings').addClass('displayNone'); + $('.dots_ver_folder').removeClass('active'); + $(element).parent().find('.folder_item_settings').addClass('displayNone'); + $(element).removeClass('active'); + } - $('#folder_title_text_'+folder).html(''); - $('#folder_title_edit_'+folder).select(); + event.stopPropagation(); } -// Preimenujemo folder -function rename_folder(folder){ - var text = $('#folder_title_edit_'+folder).val(); - $.post('ajax.php?t=surveyList&a=folder_rename', {folder: folder, text: text}, function(){ - $('#folder_title_text_'+folder).html(''+text+''); - }); +// Zaprtje dodatnega popupa +function mySurvey_folder_close_popup(){ + $('#fade').fadeOut('slow'); + $("#mySurvey_additional_popup").fadeOut().html(); } -// Kopiramo folder -function copy_folder(folder){ - $.post('ajax.php?t=surveyList&a=folder_copy', {folder: folder}, function(){ - window.location.reload(); - }); +// Ime novega folderja +function mySurvey_folder_add_popup(parent_folder_id){ + + $('#fade').fadeTo('slow', 1); + $("#mySurvey_additional_popup").fadeIn(); + $("#mySurvey_additional_popup").load('ajax.php?t=surveyListFolders&a=mysurvey_folder_add_popup', {folder_id: parent_folder_id}); } +// Dodamo nov folder +function mySurvey_folder_add(parent_folder_id){ -// Preklopimo med prikazom folderjev in navadnim prikazom -function switchFolder(show){ - if(show == 1) - var show_folders = 0; - else - var show_folders = 1; + var folder_name = $("#mySurvey_folder_name").val(); - $('#survey_list').load('ajax.php?a=surveyList_folders', {show_folders:show_folders}); + $("#left_content").load('ajax.php?t=surveyListFolders&a=mysurvey_folder_add', {folder_id: parent_folder_id, folder_name: folder_name}, function(){ + mySurvey_folder_close_popup(); + }); } +// Ime obstojecega folderja +function mySurvey_folder_rename_popup(folder_id, folder_name){ -/** Izbrise anketo - * - * @param anketa - * @param confirmtext - * @return - */ -function anketa_delete_list (anketa, confirmtext) { - if (confirm(confirmtext)) { - $("#anketa_list_"+anketa).slideUp(); - $.post('ajax.php?a=anketa_delete', {anketa: anketa, 'inList': 'true'}, function(response) { - if (response == '0') { - window.location = 'index.php'; - } - }); - } + $('#fade').fadeTo('slow', 1); + $("#mySurvey_additional_popup").fadeIn(); + $("#mySurvey_additional_popup").load('ajax.php?t=surveyListFolders&a=mysurvey_folder_rename_popup', {folder_id: folder_id, folder_name: folder_name}); } +// Preimenujemo obstojeci folder +function mySurvey_folder_rename(folder_id){ -/** doda/odstrani anketo v sistemsko knjiznico in refresa ikono za knjiznico ankete - * - */ -function surveyList_knjiznica (anketa) { - $("ul#surveyList").find("li#anketa_list_"+anketa).find(".sl_lib_glb").load('ajax.php?t=surveyList&a=surveyList_knjiznica', {anketa: anketa}); -} -/** navadnega uporabnika obvesti da nima dostopa za dodajanje v sistemsko knjiznico - * - */ -function surveyList_knjiznica_noaccess (msg) { - alert(msg); + var folder_name = $("#mySurvey_folder_name").val(); + + $("#left_content").load('ajax.php?t=surveyListFolders&a=mysurvey_folder_rename', {folder_id: folder_id, folder_name: folder_name}, function(){ + mySurvey_folder_close_popup(); + }); } -/** doda/odstrani anketo v uporabnisko knjiznico in refresa ikono za knjiznico ankete -* -*/ -function surveyList_myknjiznica (anketa) { - $("ul#surveyList").find("li#anketa_list_"+anketa).find(".sl_lib_usr").load('ajax.php?t=surveyList&a=surveyList_myknjiznica', {anketa: anketa}); - //$('#folders').load('ajax.php?t=folders&a=folders_myknjiznica', {anketa: anketa}); +// Pobrisemo obstojeci folder +function mySurvey_folder_delete(folder_id){ + + $("#survey_list").load('ajax.php?t=surveyListFolders&a=mysurvey_folder_delete', {folder_id: folder_id}); } -function surveyList_myknjiznica_new (anketa) { - $.post('ajax.php?t=surveyList&a=surveyList_myknjiznica_new', {anketa: anketa}, function() { - window.location.reload(); + + + +/* + +// prikazemo/skrijemo ankete v folderju +function toggle_folder (folder) { + + var open = 0; + if($('#folder_content_'+folder).hasClass('closed')){ + open = 1; + } + + $.post('ajax.php?t=surveyList&a=folder_toggle', {folder: folder, open: open}, function(){ + if(open == 1){ + $('#folder_content_'+folder).removeClass('closed'); + //$('#folder_'+folder).find('.arrow2_u').removeClass('arrow2_u').addClass('arrow2_d'); + + $('#folder_'+folder).removeClass('closed').addClass('open'); + } + else{ + $('#folder_content_'+folder).addClass('closed'); + //$('#folder_'+folder).find('.arrow2_d').removeClass('arrow2_d').addClass('arrow2_u'); + + $('#folder_'+folder).removeClass('open').addClass('closed'); + } }); } -function surveyList_knjiznica_new (anketa) { - $.post('ajax.php?t=surveyList&a=surveyList_knjiznica_new', {anketa: anketa}, function() { + + +// Kopiramo folder +function copy_folder(folder){ + + $.post('ajax.php?t=surveyList&a=folder_copy', {folder: folder}, function(){ window.location.reload(); }); } + +*/ + + + diff --git a/admin/survey/script/telephone.js b/admin/survey/script/telephone.js index 26d126a..f97b082 100644 --- a/admin/survey/script/telephone.js +++ b/admin/survey/script/telephone.js @@ -1,3 +1,34 @@ +// meta podatki +var srv_meta_anketa_id = $("#srv_meta_anketa").val(); + +// avtomatsko vsake 30 sekund preverimo, ce se je pojavila kaksna nova stevilka +function preveri_nove_stevilke () { + $.timer(30000, function (timer) { + + $('#preveri_stevilke').load('ajax.php?t=telefon&a=preveri_stevilke', {anketa: srv_meta_anketa_id}); + timer.stop(); + }); +} + +// dashboard filter na datum +function tel_date_filter () { + + // Ce imamo nastavljen datum "od" + var dateFrom = $('#tel_dash_dateFrom').val(); + var dateFromText = ''; + if(dateFrom != '') + dateFromText = '&date_from=' + dateFrom; + + // Ce imamo nastavljen datum "do" + var dateTo = $('#tel_dash_dateTo').val(); + var dateToText = ''; + if(dateTo != '') + dateToText = '&date_to=' + dateTo; + + var srv_site_url = $("#srv_site_url").val(); + srv_site_url += 'admin/survey/index.php?anketa='+srv_meta_anketa_id+'&a=telephone&m=dashboard'+dateFromText+dateToText; + window.location.href = srv_site_url; +} function showPhnList(pid) { $("#globalSettingsInner").load('ajax.php?t=telephone&m=recipients_lists', {anketa:srv_meta_anketa_id, pid:pid }); @@ -8,7 +39,7 @@ function phn_settings_save() { form_serialize[form_serialize.length] = {name:'anketa', value:srv_meta_anketa_id} $("#globalSettingsInner").load('ajax.php?t=telephone&m=settings_save', form_serialize, function(){ - show_success_save(); + actionNotePopup('success_save', 'success'); }); } @@ -45,10 +76,10 @@ function phn_add_recipients() { $elm.next().find('a').addClass('active'); $elm.removeClass('inv_ff_left_on').addClass('inv_ff_right_on').next().next().addClass('inv_ff_left_on'); } else { - alert(lang['srv_invitation_note1']); + genericAlertPopup('srv_invitation_note1',null,'PopUpNarrow'); } } else { - alert(lang['srv_invitation_note2']); + genericAlertPopup('srv_invitation_note2',null,'PopUpNarrow'); } return true; @@ -79,7 +110,7 @@ function phnStartSurvey(usr_id){ window.location = return_data.reloadUrl; return false; } else { - alert(return_data.msg); + genericAlertPopup('alert_parameter_datamsg'); } }, async: false @@ -87,7 +118,7 @@ function phnStartSurvey(usr_id){ } -function phnNextActionChange() { +function phnNextActionChange(phnNextAction) { var phnNextAction = $("input[name=phnNextAction]:checked").val(); $.post('ajax.php?t=telephone&m=setNextAction', {anketa:srv_meta_anketa_id,noNavi:'true',phnNextAction:phnNextAction}); } @@ -177,13 +208,13 @@ function phnGetNewProfileName() { $('#fullscreen').html('').fadeIn('slow'); $("#fullscreen").load('ajax.php?t=telephone&m=getProfileName', {anketa:srv_meta_anketa_id, recipients_list:recipients_list, fields:fields, noNavi:'true', pid:pid}); } else { - alert(lang['srv_invitation_note1']); + genericAlertPopup('srv_invitation_note1',null,'PopUpNarrow'); } } else { - alert(lang['srv_invitation_note2']); + genericAlertPopup('srv_invitation_note2',null,'PopUpNarrow'); } } else { - alert('Invalid PID!'); + genericAlertPopup('alert_invalidPID',null,'PopUpNarrow'); } } @@ -241,3 +272,20 @@ function phnUndoStatus(usr_id) { phnGoToUser(usr_id); }); } + +// Sortiranje box-ov pri dodajanju respondentov +function initTelephoneConnectedSortable(){ + + // Na mobitelu ne inicializiramo sorrtiranja, ker potem gumbi niso klikabilni (na nekaterih androidih ne deluje ok) + if($(window).width() < 850) + return false; + + $('ul.connectedSortable').sortable({ + update: function(){ + refreshFieldsList(); + }, + forcePlaceholderSize:'true', + tolerance:'pointer', + placeholder:'inv_field_placeholder' + }); +} diff --git a/admin/survey/script/themes.js b/admin/survey/script/themes.js index 0ec5257..d48ebc1 100644 --- a/admin/survey/script/themes.js +++ b/admin/survey/script/themes.js @@ -10,13 +10,13 @@ function themes_init() { $.post("ajax.php?t=theme&a=changeProgressbar", {anketa:srv_meta_anketa_id, progressbar:progressbar}, function() {}); }); - $("a.theme_links_preview").live('click', function(event) { + $("div.theme_links_preview").live('click', function(event) { event.preventDefault(); event.stopPropagation(); window.open($(this).attr('src')+'&size=full', '_blank'); }); - $("a.theme_delete.theme").live('click', function(event) { + $("div.theme_delete.theme").live('click', function(event) { event.preventDefault(); event.stopPropagation(); @@ -27,13 +27,6 @@ function themes_init() { }); } }); - - /*$("#div_theme_group span.theme_links_rename").live('click', function(event) { - var theme = $(this).attr('theme'); - $('#fade').fadeTo('slow', 1); - $('#fullscreen').html('').fadeIn('slow'); - $("#fullscreen").load('ajax.php?t=theme&a=theme_rename', {anketa:srv_meta_anketa_id, theme:theme}); - });*/ $("#theme_rename_confirm").live('click', function(event) { var theme_new_name = $("#theme_new_name").val(); @@ -64,20 +57,6 @@ function themes_init() { return false; }); - // change theme - $("#div_theme_group img.theme").live('click', function(event) { - event.preventDefault(); - event.stopPropagation(); - var css = $(this).attr('css'); - var gid = $(this).attr('gid'); - $.post("ajax.php?t=theme&a=changeTheme", {anketa:srv_meta_anketa_id, gid:gid,css:css}, function(data) { - $("#div_theme_group_holder").html(data.group_themes); - $('#div_theme_groups').html(data.theme_name); - $('#div_theme_group_holder').append('
    '+lang['srv_success_save']+'
    '); - show_success_save(); - }, 'json'); - }); - //change checkbox value $('#izbira-checkbox-gumbov').change(function(){ var izbira = $(this).find(":selected").val(); @@ -222,6 +201,45 @@ function te_change_name (_this) { function toggle_custom_themes () { - $('.user_themes_button').toggleClass("plus minus"); - $('#div_theme_group.custom').toggle('medium'); + $('.user_themes_button').toggleClass("fa-angle-up"); + $('.div_theme_group.custom').slideToggle('medium'); +} + +function changeTheme (gid, css) { + $.post("ajax.php?t=theme&a=changeTheme", {anketa:srv_meta_anketa_id, gid:gid,css:css}, function(data) { + $("#div_theme_group_holder").html(data.group_themes); + $('#div_theme_groups').html(data.theme_name); + $('#div_theme_group_holder').append('
    '+lang['srv_success_save']+'
    '); + actionNotePopup('success_save', 'success'); + }, 'json'); +} + +function show_settings(id_of_element){ + + if($('#additional_settings_'+id_of_element).hasClass('displayNone')){ + $('.buttons-window').addClass('displayNone'); + $('#additional_settings_'+id_of_element).removeClass('displayNone'); + } + else{ + $('.buttons-window').addClass('displayNone'); + } +} + + +function show_settings_mobile(id_of_element){ + + // var options = document.getElementsByClassName("options_mobile"+id_of_element)[0]; + var options = document.getElementById("options_mobile"+id_of_element); + var additional_settings = document.getElementById("additional_settings_mobile_"+id_of_element); + + additional_settings.classList.toggle("active"); + + + if($('#additional_settings_mobile_'+id_of_element).hasClass('displayNone')){ + $('.buttons-window').addClass('displayNone'); + $('#additional_settings_mobile_'+id_of_element).removeClass('displayNone'); + } + else{ + $('.buttons-window').addClass('displayNone'); + } } \ No newline at end of file diff --git a/admin/survey/script/timeProfiles.js b/admin/survey/script/timeProfiles.js index 619f7f7..50833ad 100644 --- a/admin/survey/script/timeProfiles.js +++ b/admin/survey/script/timeProfiles.js @@ -117,7 +117,7 @@ function timeProfileAction(action) { var stat_interval = $("#stat_interval").val(); if (type == 1 && stat_interval == '') { // če je type 1 (intervalni način) in interval ni izbran, damo opozorilo - alert(lang['srv_time_profile_error_interval']); + genericAlertPopup('srv_time_profile_error_interval'); return false; } else { $.post("ajax.php?t=timeProfile&a=saveProfile", {anketa:srv_meta_anketa_id, pid:pid, type:type, startDate:startDate,endDate:endDate,stat_interval:stat_interval}, function(response) { @@ -125,7 +125,7 @@ function timeProfileAction(action) { }); } } else { - alert(action); + genericAlertPopup('alert_parameter_action',action); return false; } } \ No newline at end of file diff --git a/admin/survey/script/ttest.js b/admin/survey/script/ttest.js index 6daf350..edea283 100644 --- a/admin/survey/script/ttest.js +++ b/admin/survey/script/ttest.js @@ -17,6 +17,7 @@ function ttestSpremenljivkaChange() { $('#ttestNumerusSpan').addClass('gray'); } function ttestVariableChange() { + // prvi dropdown var seq = new Array(); var spr = new Array(); @@ -24,6 +25,7 @@ function ttestVariableChange() { $('#ttestNumerus').each(function(index,el) { spr.push($(el).val()); }); + // omogočimo $('#ttestNumerus').attr('disabled',false).focus().attr('size', 1); $('#ttestNumerusSpan').removeClass('gray'); @@ -40,11 +42,13 @@ function ttestVariableChange() { var seq2 = $("#ttestSpremenljivka option:selected").attr('seq2'); var label2 = $("#ttestSpremenljivka option:selected").html(); + // variable iz checkboxov var sub_conditions = new Array(); $('#ttestVariablesSpan input:checked').each(function(index,el) { sub_conditions.push($(el).val()); }); + $("#ttestResults").load("ajax.php?t=ttest&a=variableChange", {anketa:srv_meta_anketa_id, sub_conditions:sub_conditions, spr:spr, seq:seq, grd:grd, spr2:spr2, seq2:seq2, grid2:grid2, label2:label2}, function() { // preverimo da samo dva izbrana checkboxa var cnt = $("input[name=subTtest]:checked").length; @@ -54,9 +58,9 @@ function ttestVariableChange() { $(this).attr("disabled", true); $(this).parent().addClass("gray"); }); - $("#ttestVariablesSpan").removeClass('active'); - - } else if (cnt < 2) { + $("#ttestVariablesSpan").removeClass('active'); + } + else if (cnt < 2) { // onemogočimo $('#ttestNumerus').attr('disabled',true); $('#ttestNumerusSpan').addClass('gray'); @@ -80,7 +84,7 @@ function doArchiveTTest() { $('#fullscreen').show(); }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } } function submitArchiveTTest() { @@ -97,7 +101,7 @@ function submitArchiveTTest() { $("#fullscreen").show(); }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } } @@ -113,9 +117,9 @@ function createArchiveTTestBeforeEmail() { }); } else { if (parseInt(response) == -1) { - alert("Nothing to archive!"+response); + genericAlertPopup('alert_no_archive_response',response); } else { - alert("Error while creating archive!"+response); + genericAlertPopup('alert_archive_error_response',response); } $('#fullscreen').hide(); $('#fade').fadeOut('slow'); @@ -123,6 +127,6 @@ function createArchiveTTestBeforeEmail() { }); } else { - alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.'); + genericAlertPopup('alert_no_archive_tables'); } }; \ No newline at end of file diff --git a/admin/survey/script/uporabniki_custom.js b/admin/survey/script/uporabniki_custom.js index 13c9d24..a5df8e8 100644 --- a/admin/survey/script/uporabniki_custom.js +++ b/admin/survey/script/uporabniki_custom.js @@ -1,7 +1,13 @@ //Uporabimo custom funkcijo pri uporabnikih, dokler se ne posodobi jQuery $(document).ready(function () { - onload_init(); + // Search na vrhu po pritisku na enter skoci na drupal search + $('#searchSurvey').keypress(function (e) { + if (e.which == 13) { + executeDrupalSearch(); + return false; + } + }); $('#xtradiv strong').on("click", function (event) { $('#xtradivSettings').toggle(); @@ -12,7 +18,7 @@ $(document).ready(function () { function language_change (lang) { $.post('ajax.php?t=surveyList&a=language_change', {lang: lang}, function () { - /*window.location.reload();*/ - window.location = window.location.href.split("?")[0]; + window.location.reload(); + //window.location = window.location.href.split("?")[0]; }); } diff --git a/admin/survey/script/vprasanje.js b/admin/survey/script/vprasanje.js index 886d689..a2f6363 100644 --- a/admin/survey/script/vprasanje.js +++ b/admin/survey/script/vprasanje.js @@ -11,7 +11,7 @@ function onload_init_vprasanje() { }); } // prikaze fullscreen urejanje vprasanja -function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { +function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close, focus_last) { if (locked) return; //za ureditev custom opisnih label pri drsniku @@ -25,10 +25,7 @@ function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { if ( ! (no_close==true) ) close_all_editing(); - - // zapremo knjiznico - $('#toolbox_library').hide(); - + // ce smo v formi zapremo hitre nastavitve desno zgoraj $('#form_settings_obvescanje').hide(); $('#email_switch').attr("src", "img_0/plus.png"); @@ -58,7 +55,8 @@ function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { // odpremo okno za dodajanje nove kategorije var last = $('#branching_'+spremenljivka+' .variabla:last-child div.vrednost_inline'); - inline_nova_vrednost(last); + + inline_nova_vrednost(last, focus_last); //Preklop na tab za urejanje label grafov if(chart_edit == 1){ vprasanje_tab(spremenljivka, 4); } @@ -115,7 +113,7 @@ function vprasanje_pozicija (spremenljivka) { var elHeight = $(id).height(); //$('#vprasanje_float_editing').css('top', elTop-163).show(); - $('#vprasanje_float_editing').css('margin-top', elTop-163).show(); + $('#vprasanje_float_editing').css('margin-top', elTop-224).show(); var floatingTop = $('#vprasanje_float_editing').offset().top - 40; // ker je premaknjeno navzgor var floatingHeight = $('#vprasanje_float_editing').height() + 40; @@ -177,18 +175,15 @@ function vprasanje_save (silentsave, spr, callback) { id = '#'+spremenljivka; var form_serialize = $("form[name=vprasanje_edit]").serialize() || {spremenljivka: spremenljivka}; - + if (silentsave != true) { $('#calculation').fadeOut('fast').html(''); $('#vprasanje_float_editing').hide().html(''); $(id).removeClass('spr_editing'); - - // prikazemo knjiznico ce je odprta - $('#toolbox_library').show(); } - + $.post('ajax.php?t=vprasanje&a=vprasanje_save&silentsave='+silentsave, form_serialize, function (data) { if (silentsave != true) { @@ -206,6 +201,10 @@ function vprasanje_save (silentsave, spr, callback) { else { $(id).html(data); + + // ker se z zgornjo kodo pobrise vrstica desno zgoraj (hitre nastavitve - celotni div se nadomesti z novo vsebino) jo je potrebno na novo izrisati + let fake_event = {target: id}; + branching_mouseover(fake_event); // odpremo okno za dodajanje nove kategorije var last = $('#branching_'+spremenljivka+' .variabla:last-child div.vrednost_inline'); @@ -250,10 +249,13 @@ function vprasanje_cancel () { // pobrise vrednost (v srv_vrednost) function vrednost_delete(spremenljivka, vrednost, tip, other) { - + $('#vrednost_'+vrednost).remove(); // popravimo še čhekbox za missinge + //star nacin $("#missing_value_"+other).attr('checked', false); + //nov nacin + $("#missing_value_"+spremenljivka+"_"+other).attr('checked', false); $.post('ajax.php?t=vprasanje&a=vrednost_delete', {spremenljivka: spremenljivka, vrednost: vrednost, other: other, anketa: srv_meta_anketa_id}, function() { if(tip == 17) edit_ranking_moznosti(); }); @@ -481,6 +483,7 @@ function vrednost_cancel () { function vrednost_fastadd (spremenljivka) { $('#fade').fadeTo('slow', 1); + $('#vrednost_edit').addClass('PopUpNarrow'); $('#vrednost_edit').show().load('ajax.php?t=vprasanje&a=vrednost_fastadd', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id}); } @@ -521,6 +524,26 @@ function show_timer (value) { function show_dostop (value) { $('#dostop').toggle(); + + //ce se odkljuka "skrij za respondente" (visible) nastavi dostop na 4 (vidno vsem) + if(!value){ + $('#_dostop').prop('checked', false); + } +} + +// prikaze/skrije opcije reminder (obvezno, neobvezno vprasanje) +function show_reminders (value) { + + $('#reminders').toggle(); + + //ce se nastasvi na 0, se more narediti uncheck za radio + if(value == 0){ + $('#reminder_1').prop('checked', false); + $('#reminder_2').prop('checked', false); + } + else + $('#reminder_1').prop('checked', true); + } function change_number(id1, id2) { @@ -601,12 +624,31 @@ function change_subtype_number (spremenljivka) { vprasanje_fullscreen(spremenljivka); }); } -function change_tip(spremenljivka, tip) { +function change_tip(spremenljivka, tip, confirmed) { - $.post('ajax.php?t=vprasanje&a=change_tip', {spremenljivka: spremenljivka, tip: tip, anketa: srv_meta_anketa_id}, function (data) { - vprasanje_fullscreen(spremenljivka, data, false, true); - vprasanje_save(true); - }); + var old_tip = $('li#branching_'+spremenljivka).attr('tip'); + + $.post('ajax.php?t=vprasanje&a=change_tip', {spremenljivka: spremenljivka, tip: tip, confirmed: confirmed, anketa: srv_meta_anketa_id}, + function (data) { + + try { + var data_json = JSON.parse(data); + + if (data_json.error == 1) { + $('#fade').fadeIn("fast"); + $('#dropped_alert').html(data_json.output).fadeIn("fast").css('width', '600px'); + + return; + } + } + catch(e){} + + $('li#branching_'+spremenljivka).attr('tip', tip); + $('li#branching_'+spremenljivka).removeClass('spr_tip_'+old_tip).addClass('spr_tip_'+tip); + + vprasanje_fullscreen(spremenljivka, data, false, true); + vprasanje_save(true); + }); } function change_demografija(spremenljivka, podtip) { @@ -632,9 +674,9 @@ function change_limittype(limittype) { } } -function num_limit(field, checked) { +function num_limit(field, checkbox_id) { - if(checked){ + if($('#'+checkbox_id).is(':checked')){ document.getElementById(field).disabled = false; } @@ -643,6 +685,18 @@ function num_limit(field, checked) { } } +function changeGridAlign(spremenljivka, enota){ + var tip = $('#spremenljivka_tip_'+spremenljivka+' option:selected').val(); + + //"izberi iz seznama" ima po default postavitev na levo, ostale na sredino + //sprememba v seznam + if(tip == 6 && enota == 6) + $('#gridAlign').val(2); //poravnavo uredi na desno + //sprememba iz seznama + else if(tip == 6 && enota != 6) + $('#gridAlign').val(0); //poravnavo uredi na sredino +} + function change_diferencial(spremenljivka, enota){ if(enota == 3) $('.grid_subtitle').css('display', 'block'); @@ -741,11 +795,145 @@ function get_editor_close(id) { // prikaze field da manager doda nek komentar obstojecemu komentarju na vprasanje -function comment_on_comment (id) { +function comment_on_comment (id, user, date, spr_id) { $('#comment_on_comment_'+id).html( - '

    ' + - '' + '
    '+lang['for']+': '+user+' ('+date+')
    '+ + '' + + '
    '+ + ''+ + ''+ + '
    ' + ); + $(".options_dropdown").addClass("displayNone"); + + var toggle = '#comment_toggle_' + spr_id + '_4'; + + $(toggle).toggle(); +} + +// prikaze field da manager doda nek komentar obstojecemu komentarju na vprasanje respondenta +function comment_on_comment_resp (id, user, date) { + $('#comment_on_comment_resp_'+id).html( + '
    '+lang['for']+': '+user+' ('+date+')
    '+ + '' + + '
    '+ + ''+ + ''+ + '
    ' + ); + $(".options_dropdown").addClass("displayNone"); +} + +// prikaze field da manager doda nek komentar obstojecemu splosnemu komentarju +function comment_on_comment_splosni (id, user, date) { + $('#comment_on_comment_splosni_'+id).html( + '
    '+lang['for']+': '+user+' ('+date+')
    '+ + '' + + '
    '+ + ''+ + ''+ + '
    ' + ); + $(".options_dropdown").addClass("displayNone"); + + var toggle = '#comment_toggle_' + spr_id + '_4'; + + $(toggle).toggle(); +} + +// prikaze field da manager doda nek komentar obstojecemu splosnemu komentarju respondenta +function comment_on_comment_splosni_resp (id, user, date) { + $('#comment_on_comment_splosni_resp_'+id).html( + '
    '+lang['for']+': '+user+' ('+date+')
    '+ + '' + + '
    '+ + ''+ + ''+ + '
    ' ); + $(".options_dropdown").addClass("displayNone"); + + var toggle = '#comment_toggle_' + spr_id + '_4'; + + $(toggle).toggle(); +} + +function comment_delete (id) { + $.post("ajax.php?a=comment_delete", {id: id, anketa: srv_meta_anketa_id}, function(){ + + $(".options_dropdown").addClass("displayNone"); + $("#comment_box_"+id).remove(); + }); +} + +function respondent_comment_delete (id) { + $.post("ajax.php?a=respondent_comment_delete", {id: id, anketa: srv_meta_anketa_id}, function(){ + + $(".options_dropdown").addClass("displayNone"); + $("#comment_box_"+id).remove(); + }); +} + +function survey_respondent_comment_delete (id) { + $.post("ajax.php?a=survey_respondent_comment_delete", {id: id, anketa: srv_meta_anketa_id}, function(){ + + $(".options_dropdown").addClass("displayNone"); + $("#comment_box_"+id).remove(); + }); +} + +function survey_comment_delete (id) { + $.post("ajax.php?a=survey_comment_delete", {id: id, anketa: srv_meta_anketa_id}, function(){ + + $(".options_dropdown").addClass("displayNone"); + $("#comment_box_"+id).remove(); + }); +} + +function question_comment_solve(ocena, id){ + + $.post("ajax.php?a=comment_ocena", {type: 'question_comment', ocena: ocena, id: id, anketa: srv_meta_anketa_id}, function () { + + if(ocena == '2'){ + $('#comment_box_'+id).addClass('archived').find('.solve').html( + '

    '+ + ''+ + lang['srv_comments_unarchive']+ + '

    ' + ); + } + else{ + $('#comment_box_'+id).removeClass('archived').find('.solve').html( + '

    '+ + ''+ + lang['srv_comments_archive']+ + '

    ' + ); + } + }); +} + +function question_respondent_comment_solve(text2, id){ + + $.post("ajax.php?a=comment_ocena", {type: 'respondent_comment', text2: text2, id: id, anketa: srv_meta_anketa_id}, function () { + + if(text2 == '2'){ + $('#comment_box_'+id).addClass('archived').find('.solve').html( + '

    '+ + ''+ + lang['srv_comments_unarchive']+ + '

    ' + ); + } + else{ + $('#comment_box_'+id).removeClass('archived').find('.solve').html( + '

    '+ + ''+ + lang['srv_comments_archive']+ + '

    ' + ); + } + }); } @@ -838,22 +1026,81 @@ function validation_if_remove (spremenljivka, _if) { } -function grid_plus_minus (type) { +function grid_plus_minus (type, confirm='0') { var selected = $('#grids_count').val(); - if (type == '1') + // Dodajamo stolpec + if (type == '1'){ selected = parseInt(selected) + 1; - else if (type == '0') - selected = parseInt(selected) - 1; - - if (selected >= 2 && selected <= 12) - $('#grids_count').val( selected ); - - vprasanje_save(true); - - return false; + + if (selected >= 2 && selected <= 12) + $('#grids_count').val( selected ); + vprasanje_save(true); + + return false; + } + // Brisemo stolpec + else if (type == '0'){ + selected = parseInt(selected) - 1; + + // Preverimo, ce imamo podatke - potem opozorimo da se lahko izgubijo podatki + $.post('ajax.php?t=vprasanje&a=grid_delete_check', {anketa: srv_meta_anketa_id}, + function(data) { + + // Nimamo podatkov - normalno nadaljujemo + if (!data || confirm === '1'){ + if (selected >= 2 && selected <= 12) + $('#grids_count').val( selected ); + + vprasanje_save(true); + + return false; + } + else{ + // Imamo podatke - prikazemo popup z opozorilom + $('#fade').fadeIn("fast"); + $('#dropped_alert').html(data.output).fadeIn("fast").css('width', '600px'); + } + }, 'json' + ); + } +} + +// Dodamo/odstranimo missing stolpec iz vprasanj tipa tabela +function grid_add_remove_missing (checkbox, spremenljivka, confirm='0') { + + // Dodajamo missing stolpec - ne rabimo nicesar preverjati + if ($(checkbox).is(":checked")){ + + // Shranimo spremembo + vprasanje_save(true, spremenljivka); + } + // Brisemo stolpec + else{ + + // Preverimo, ce imamo podatke - potem opozorimo da se lahko izgubijo podatki + $.post('ajax.php?t=vprasanje&a=grid_delete_missing_check', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka}, + function(data) { + + // Nimamo podatkov oz. smo potrdili brisanje - normalno nadaljujemo + if (!data || confirm === '1'){ + // Shranimo spremembo + vprasanje_save(true, spremenljivka); + } + else{ + // Imamo podatke - prikazemo popup z opozorilom + $('#fade').fadeIn("fast"); + $('#dropped_alert').html(data.output).fadeIn("fast").css('width', '600px'); + } + + }, 'json' + ); + } + + // Zapremo meni z missingi + close_missing_menu(spremenljivka); } function grid_multiple_add (spr_id) { @@ -925,27 +1172,30 @@ function grid_multiple_save (spr) { } -function show_alert_missing(){ +function show_alert_missing(sprid){ - if($('#missing_value_-97').attr("checked")) + if($('#missing_value_-97').attr("checked") || $('#missing_value_'+sprid+'-97').attr("checked")) var missing_97 = 1; else var missing_97 = 0; - if($('#missing_value_-98').attr("checked")) + if($('#missing_value_-98').attr("checked") || $('#missing_value_'+sprid+'-98').attr("checked")) var missing_98 = 1; else var missing_98 = 0; - if($('#missing_value_-99').attr("checked")) + if($('#missing_value_-99').attr("checked") || $('#missing_value_'+sprid+'-99').attr("checked")) var missing_99 = 1; else var missing_99 = 0; - var reminder = $('select[name=reminder]').val(); + //samo preveri, ce je reminder vklopljen - ne preveri ali je soft ali hard (to pridobi iz radio) + var reminder = $('input[type=checkbox][name=reminder]').is(':checked'); + //var reminder_type = $('input[type=radio][name=reminder]').val(); if(reminder == 1 || reminder == 2){ - if(missing_97 == 1){ + + /* if(missing_97 == 1){ $('#alert_show_97').prop('disabled', false); $('#alert_show_97_text').removeClass('gray'); } @@ -973,20 +1223,22 @@ function show_alert_missing(){ $('#alert_show_99').prop('disabled', true); $('#alert_show_99').attr("checked", false); $('#alert_show_99_text').addClass('gray'); - } + } */ } else{ - $('#alert_show_97').prop('disabled', true); - $('#alert_show_97').attr("checked", false); - $('#alert_show_97_text').addClass('gray'); + $('#alert_show_96_'+sprid).attr("checked", false); + + //$('#alert_show_97').prop('disabled', true); + $('#alert_show_97_'+sprid).attr("checked", false); + //$('#alert_show_97_text').addClass('gray'); - $('#alert_show_98').prop('disabled', true); - $('#alert_show_98').attr("checked", false); - $('#alert_show_98_text').addClass('gray'); + //$('#alert_show_98').prop('disabled', true); + $('#alert_show_98_'+sprid).attr("checked", false); + //$('#alert_show_98_text').addClass('gray'); - $('#alert_show_99').prop('disabled', true); - $('#alert_show_99').attr("checked", false); - $('#alert_show_99_text').addClass('gray'); + //$('#alert_show_99').prop('disabled', true); + $('#alert_show_99_'+sprid).attr("checked", false); + //$('#alert_show_99_text').addClass('gray'); } } @@ -1625,7 +1877,7 @@ function checkCheckboxLimits(spremenljivka, value, checkbox_limit_name){ //ce je min limit vecji od max limit, je potrebno javiti opozorilo in vrednost min limita dati na 0 //if(min_value > max_value){ if(max_value!=0 && min_value > max_value){ - alert(lang['srv_checkbox_min_limit_error_msg']); //opozorilo v obliki pop-up okna + genericAlertPopup('srv_checkbox_min_limit_error_msg'); //opozorilo v obliki pop-up okna $('#checkbox_min_limit_' + spremenljivka).val(0); //spremeni vrednost min limita na 0 oz. Ne } } @@ -1637,4 +1889,25 @@ function toggleCheckboxMinLimitReminder(spremenljivka, checkbox_min_limit){ }else{ $('#checkboxLimitReminder_' + spremenljivka).css('display', 'none'); //skrij nastavitve za opozorilo } -} \ No newline at end of file +} + + +// Fieldset toggle +function fieldsetToggle(element){ + + $(element).next('.fieldset_holder').slideToggle(function(){ + //$('#vprasanje_edit').animate({scrollTop: $(this).offset().top}, 2000); + }); + + $(element).find('.faicon').toggleClass('arrow2_d').toggleClass('arrow2_u'); + +} + +// Gumb dodaj kategorijo - doda okno za novo kategorijo in ga fokusira +function add_question_category(spremenljivka){ + + var last = $('#branching_'+spremenljivka+' .variabla:last-child div.vrednost_inline'); + + inline_nova_vrednost(last, true); +} + diff --git a/admin/survey/script/vprasanjeDeleted.js b/admin/survey/script/vprasanjeDeleted.js new file mode 100644 index 0000000..ee2f644 --- /dev/null +++ b/admin/survey/script/vprasanjeDeleted.js @@ -0,0 +1,86 @@ +// Odpremo knjiznico v urejanju ankete +function displayVprasanjeDeletedPopup(){ + + $('#fade').fadeTo('slow', 1); + $('#general_popup').html('').addClass('vprasanje_deleted_popup').fadeIn('slow'); + + $("#general_popup").load('ajax.php?t=vprasanjeDeleted&a=displayVprasanjeDeletedPopup', {anketa: srv_meta_anketa_id}); +} + + +// Klik na posamezen item na desni +function selectVprasanjeDeletedItem(item_id){ + + if($('#question_item_holder_'+item_id).hasClass('active')){ + $('#question_item_holder_'+item_id).removeClass('active'); + $('#question_item_check_'+item_id).attr("checked", false); + } + else{ + $('#question_item_holder_'+item_id).addClass('active'); + $('#question_item_check_'+item_id).attr("checked", true); + } + + // Prestejemo oznacene iteme + var count = $('.question_item_check:checkbox:checked').length; + $('#selected_item_counter').html(count); + + // Nastavimo gumb dodaj kot disabled glede na to ce imamo elemente ali ne + if(count > 0){ + $("#insert_vprasanje_deleted_button").prop('disabled', false); + } + else{ + $("#insert_vprasanje_deleted_button").prop('disabled', true); + } +} + +function deleteVprasanjeDeleted(item_id, item_type){ + + $.post('ajax.php?t=vprasanjeDeleted&a=deleteItem', {anketa: srv_meta_anketa_id, item_id: item_id, item_type: item_type}, function(){ + $('#question_item_holder_'+item_id).remove(); + }); + + event.stopPropagation(); +} + +// Restavriramo pobrisano vprasanje nazaj v anketo na konec +function insertVprasanjeDeletedItemsIntoSurvey(){ + + var items = []; + + var prev = false; + var note = '1'; + + $('.question_item_check:checkbox:checked').each(function(){ + var id_string = $(this).attr("id"); + var id = id_string.substring(20); + + items.push(id); + + // Preverimo za obvestilo, ce dodajamo vec elementov in ce so razlicni + if(prev){ + note = '1m'; + } + + prev = true; + }); + + $("#branching").load('ajax.php?t=vprasanjeDeleted&a=addIntoSurvey', {anketa: srv_meta_anketa_id, items: items}, function(){ + + popupClose(); + actionNotePopup('lib_add_to_survey_'+note, 'success'); + }); +} + + +// Predogled pobrisanega vprasanjaoz. vprasanja iz knjiznice +function previewVprasanje(spr_id){ + + $('#vprasanje_preview').load('ajax.php?a=preview_spremenljivka_lib', {anketa: srv_meta_anketa_id, spremenljivka: spr_id, podstran: srv_meta_podstran}).removeClass('displayNone'); + + event.stopPropagation(); +} + +// Predogled pobrisanega vprasanja +function closePreviewVprasanje(){ + $('#vprasanje_preview').addClass('displayNone').empty(); +} diff --git a/admin/survey/script/vprasanjeInline.js b/admin/survey/script/vprasanjeInline.js index 73974dd..1cef4ab 100644 --- a/admin/survey/script/vprasanjeInline.js +++ b/admin/survey/script/vprasanjeInline.js @@ -70,8 +70,10 @@ function onload_init_inline () { $("div.variable_inline").live('focus', function() { close_all_editing($(this).closest('.spremenljivka_content').attr('spr_id')); }).live('keyup', function () { + var variable = $(this).html(); var tip = $(this).closest('.spremenljivka_content').attr('tip'); + if($.trim(variable).length && tip != 1){ variable = variable.replace(/(<([^>]+)>)/ig,""); var variable1 = check_valid_variable(variable); @@ -79,6 +81,13 @@ function onload_init_inline () { $(this).html(variable1); } } + else if($.trim(variable).length && tip == 1){ + variable = variable.replace(/(<([^>]+)>)/ig,""); + var variable1 = check_valid_radio_variable(variable); + if (variable1 != variable){ + $(this).html(variable1); + } + } }).live('keypress', function (event) { enterKeyPressHandler(event); }).live('blur', function () { @@ -100,7 +109,6 @@ function onload_init_inline () { inline_nova_vrednost(this); // tale je ce urejamo kategorijo, da se pojavi cim kliknemo }, keypress: function (event) { - //console.log("keypress"); var evt = event || window.event; var charCode = evt.which || evt.keyCode; if (charCode == 9) return; // ce gremo s tabom naprej, da ne doda nove kategorije @@ -113,6 +121,7 @@ function onload_init_inline () { // ko zacnemo pisati v polje za dodajanje nove vrednosti, jo takoj kreiramo, da dobimo nov ID - naprej gre potem isto kot urejanje // new="waiting" nam pove, da se je izvrsil post, drugace se ob tipkanju veckrat dodaja if (div.attr('id') == 'variabla_new' && div.attr('new') != 'waiting' && ( div.find('div.vrednost_inline:first').html() != '' || div.find('div.vrednost_inline:last').html() != '' )) { + var spr_id = div.closest('.spremenljivka_content').attr('spr_id'); div.attr('new', 'waiting'); $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_new', { @@ -122,7 +131,9 @@ function onload_init_inline () { div.attr('id', 'variabla_' + data); div.attr('new', ''); div.find('div.vrednost_inline').attr('id', 'vre_id_' + data).attr('vre_id', data); + div.find('div.icons_holder').css('display', 'inline'); div.find('span.inline_hidden').attr('odg_id', data); + div.find('span.correct').attr('vre_id', data); div.find('span.inline_if_follow').attr('onclick', 'follow_up_condition(\''+data+'\'); return false;'); div.find('span.inline_if_not').attr('onclick', 'vrednost_condition_editing(\''+data+'\'); return false;'); @@ -218,8 +229,30 @@ function onload_init_inline () { }); // urejanje vrednosti grida - $("div.grid_variable_inline").live('blur', function () { - var spr_id = $(this).closest('div.spremenljivka_content').attr('spr_id'); + $("div.grid_variable_inline").live('focus', function() { + close_all_editing($(this).closest('.spremenljivka_content').attr('spr_id')); + }).live('keyup', function () { + + var variable = $(this).html(); + var tip = $(this).closest('.spremenljivka_content').attr('tip'); + + if($.trim(variable).length && tip != 6){ + variable = variable.replace(/(<([^>]+)>)/ig,""); + var variable1 = check_valid_variable(variable); + if (variable1 != variable){ + $(this).html(variable1); + } + } + else if($.trim(variable).length && tip == 6){ + variable = variable.replace(/(<([^>]+)>)/ig,""); + var variable1 = check_valid_radio_variable(variable); + if (variable1 != variable){ + $(this).html(variable1); + } + } + }).live('keypress', function (event) { + enterKeyPressHandler(event); + }).live('blur', function () { inline_variable_grid(spr_id, this); }); @@ -416,11 +449,6 @@ function inline_vprasanje_float_editing_click(event) { function inline_naslov (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } // shranimo if (parseInt(spremenljivka) == -1) { // uvod @@ -436,11 +464,6 @@ function inline_naslov (spremenljivka, _this) { function inline_textfield (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } // shranimo if (parseInt(spremenljivka) == -1) { // uvod @@ -454,14 +477,7 @@ function inline_textfield (spremenljivka, _this) { // shrani vsebino za hotspot vprasanje function inline_hotspot (spremenljivka, _this) { - - //if ($(_this).attr('contenteditable') != 'true') return; - - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - + // shranimo $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html()} ); } @@ -471,11 +487,6 @@ function inline_info (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - $.post('ajax.php?t=vprasanjeinline&a=inline_info_save', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, info: $(_this).html()}); } @@ -485,7 +496,6 @@ function inline_vrednost_variable(vre_id, _this) { if ($(_this).attr('contenteditable') != 'true') return; $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_variable_save', {vre_id: vre_id, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, variable: $(_this).html()}); - } // shrani variablo vprasanja @@ -502,25 +512,15 @@ function inline_variable (spremenljivka, _this) { function inline_vrednost (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - //var vnosi = $('#spremenljivka_contentdiv3444 div.variabla').length; - //var vnosi = $('#variable_holder div.variabla').length; - //var vnosi = $('.edit_mode div.variabla').length; - var vnosi = $('.edit_mode div.vrednost_inline').length; - //console.log(spremenljivka); - //console.log(vnosi); + var vnosi = $('.edit_mode div.vrednost_inline').length; - // dodatek may: shranimo vrednost textaree in inputa pri text fieldih - if ($(_this).attr('ETF') == 'true') { - $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).val()} ); - } - else { - $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html()} ); - } - //$.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html(), sbSize: vnosi}); + // dodatek may: shranimo vrednost textaree in inputa pri text fieldih + if ($(_this).attr('ETF') == 'true') { + $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).val()} ); + } + else { + $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html()} ); + } } // shrani ime hotspot obmocja @@ -528,31 +528,16 @@ function inline_hotspot_vrednost (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - //var vnosi = $('#spremenljivka_contentdiv3444 div.variabla').length; - //var vnosi = $('#variable_holder div.variabla').length; - //var vnosi = $('.edit_mode div.variabla').length; var vnosi = $('.edit_mode div.vrednost_inline').length; - //console.log(spremenljivka); - //console.log(vnosi); - $.post('ajax.php?t=vprasanjeinline&a=inline_hotspot_vrednost_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html()} ); - //$.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_naslov_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html(), sbSize: vnosi}); + + $.post('ajax.php?t=vprasanjeinline&a=inline_hotspot_vrednost_save', {spremenljivka:spremenljivka, vrednost: $(_this).attr('vre_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, naslov: $(_this).html()} ); } // shrani grid vprasanja function inline_grid (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - // String zaenkrat pustimo kot html - //var string = $(_this).text(); var string = $(_this).html(); // pri dvojni tabeli popravimo se desna polja @@ -575,12 +560,7 @@ function inline_subtitle_grid (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - //$.post('ajax.php?t=vprasanjeinline&a=inline_grid_subtitle_save', {spremenljivka: spremenljivka, subtitle: $(_this).attr('grid_subtitle'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, value: $(_this).html()}); - $.post('ajax.php?t=vprasanjeinline&a=inline_grid_subtitle_save', {spremenljivka: spremenljivka, subtitle: $(_this).attr('grid_subtitle'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, value: $(_this).text(), grid_id: $(_this).attr('grid_id')}); + $.post('ajax.php?t=vprasanjeinline&a=inline_grid_subtitle_save', {spremenljivka: spremenljivka, subtitle: $(_this).attr('grid_subtitle'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, value: $(_this).text(), grid_id: $(_this).attr('grid_id')}); } // pobrise vrednost (v srv_vrednost) @@ -590,7 +570,9 @@ function inline_vrednost_delete(spremenljivka, vrednost, confirmed/*, tip, other //ce je posebna vrednost, se rabi dodat callbaack in se lahko brise tudi zadnja vednost //special vrednost je recimo marker na mapi - ni html taga z id="variabla_"+vrednost var special_vrednost = ($("#variabla_"+vrednost).length < 1); - + + var other = $("#variabla_"+vrednost).attr('other'); + if ( confirmed==1 || confirm(text) ) { if (confirmed == undefined) confirmed = 1; @@ -605,9 +587,11 @@ function inline_vrednost_delete(spremenljivka, vrednost, confirmed/*, tip, other //ce je navadna vrednost, kot rec. radio ali checkbox if(!special_vrednost){ // popravimo se chekbox za missinge - var other = $("#variabla_"+vrednost).attr('other'); if (other != '0') { - $("#missing_value_"+other).attr('checked', false); + //star nacin + $("#missing_value_"+other).attr('checked', false); + //nov nacin + $("#missing_value_"+spremenljivka+"_"+other).attr('checked', false); } // odstranimo element @@ -622,9 +606,6 @@ function inline_vrednost_delete(spremenljivka, vrednost, confirmed/*, tip, other else{ callback(); } - - - } else if (data.error == 1) { $('#fade').fadeIn("fast"); @@ -633,29 +614,43 @@ function inline_vrednost_delete(spremenljivka, vrednost, confirmed/*, tip, other else if (data.error == 2) { $('#fade').fadeIn("fast"); - $('#dropped_alert').html(data.output).fadeIn("fast").css('width', '400px'); + $('#dropped_alert').html(data.output).fadeIn("fast").css('width', '600px'); + //ce je missing + /* var missing = $("#missing_value_"+spremenljivka+"_"+other); + + if(missing){ + $('#brisivrednostcancel').attr('onClick', $('#brisivrednostcancel').attr('onClick')+' $(\'#missing_value_'+spremenljivka+'_'+other+'\').attr(\'checked\', true);'); + } */ + //ce je posebna vrednost, se rabi dodat callbaack if(special_vrednost){ //treba je dodati callback - sori, vem da je grdo - glej funkcijo ajax_vrednost_delete v class.Vprasanje.php document.getElementById('brisivrednostchecked').onclick = function(){inline_vrednost_delete(spremenljivka, vrednost, 1, callback); $('#dropped_alert').html('').hide(); return false;} - + + var missing = $("#missing_value_"+spremenljivka+"_"+other); + $('#fade').fadeOut("fast"); } } }, 'json' ); - + } + else{ + //ce stisne cancel, nazaj vklopi check + $("#missing_value_"+spremenljivka+"_"+other).attr('checked', true); } } // narise polje za dodajanje vrednosti -function inline_nova_vrednost (_this) { - +function inline_nova_vrednost (_this, focus) { // ce je anketa zaklenjena if ($(_this).attr('contenteditable') != 'true') return; + + // Ce smo na mobitelu tega ni + if ($('.mobile_header:visible').length != 0) return; // ce imamo v edit modu vprasanja same default odgovore (to je ob novem vprasanju in ce se nic ne spreminja) var variable_holder = $(_this).closest('.variable_holder'); @@ -664,7 +659,7 @@ function inline_nova_vrednost (_this) { if ( $(this).find('.vrednost_inline').attr('default') != '1' ) _default = 0; }); if (_default == 1) return; - + var tip = $(_this).closest('.spremenljivka_content').attr('tip'); // Disablamo ife, ce nima ustreznega paketa @@ -674,13 +669,12 @@ function inline_nova_vrednost (_this) { else{ var if_class_locked = ''; } - + // ce je zadnje polje in ce lahko znotraj tega parenta dodajamo vrednosti if ( $(_this).closest('.variabla').is(':last-child') && $(_this).closest('.variabla').parent().hasClass('allow_new') ) { - // ce ni prazno (da pri novem ne dodamo takoj) && ce je attr new tudi ne dodamo, ker pocakamo da se zgenerira nov id - if ($(_this).html() != '' && $(_this).attr('vre_id') != 'new') { + if ($(_this).html() != '' && $(_this).attr('vre_id') != 'new' && $(_this).attr('vre_id') != 'new_2') { var spremenljivka = $(_this).closest('.spremenljivka_content').attr('spr_id'); //dobimo id spremenljivke var orientation = $('#spremenljivka_content_'+spremenljivka).attr('spr_orientation'); //dobimo orientacijo iz dodanega parametra, ker iz prejsnje varianta ne gre, ko je urejevalno okno zaprto @@ -688,36 +682,47 @@ function inline_nova_vrednost (_this) { // radio, checkbox, roleta if (tip <= 3) { - if(tip <= 3 && orientation != 7 && orientation != 8){ var new_div = '
    '+ ''; //if (tip <= 2) if (tip <= 2 && orientation != 6) - new_div += ''; - + new_div += ''; + // Ikona za hiter upload slike (ce je vklopljena) if($(_this).closest('.variabla').parent().find('.image_upload').length){ - new_div += ''; + new_div += ''; new_div += '
    '+lang['srv_new_vrednost']+'
    '+ - ' '+lang['srv_novavrednost_drugo']+''+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - '
    '; + ' '+lang['srv_novavrednost_drugo']+''+ + ' '+ + + '
    '+ + ' '+ + (($(_this).closest('.variabla').parent().find('.correct').length) ? ' ' : '')+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + + ''; } else{ new_div += '
    '+lang['srv_new_vrednost']+'
    '+ - ' '+lang['srv_novavrednost_drugo']+''+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ''; + ' '+lang['srv_novavrednost_drugo']+''+ + ' '+ + + '
    '+ + ' '+ + (($(_this).closest('.variabla').parent().find('.correct').length) ? ' ' : '')+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + + ''; } } else if(tip <= 3 && orientation == 7){ @@ -727,14 +732,20 @@ function inline_nova_vrednost (_this) { ''; new_div += '
    '+lang['srv_new_vrednost']+'
    '+ - ' '+lang['srv_novavrednost_drugo']+''+ + ' '+lang['srv_novavrednost_drugo']+''+ + ' '+ + ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ''; + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + + ''; } } else if(tip <= 2 && orientation == 8){ //ce imamo radio ali checkbox z drag-drop @@ -742,21 +753,31 @@ function inline_nova_vrednost (_this) { var new_div = '
    '; if($(_this).closest('.variabla').parent().find('.image_upload').length){ - new_div += ''+ + new_div += ''+ ''+ - ' '+ - ' '+ - ' '+ - ' '+ - '
    '+lang['srv_new_vrednost']+'
    '+ + + '
    '+lang['srv_new_vrednost']+'
    '+ + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + '
    '; } else{ new_div += ''+ - ' '+ - ' '+ - ' '+ - ' '+ + '
    '+lang['srv_new_vrednost']+'
    '+ + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + ''; } } @@ -765,12 +786,10 @@ function inline_nova_vrednost (_this) { //drag and drop grid var new_div = '
    '+ ''+ - ' '+ - ' '+ - ' '+ - ' '+ + '
    '+lang['srv_new_vrednost']+'
    '+ - '
    '; + + ''; // ranking } else if (tip == 17) { @@ -779,14 +798,19 @@ function inline_nova_vrednost (_this) { var new_div = '
    '+ ''+ - ' '+ - ' '+ - ' '+ - ' '+ + ' '+ '
    '+lang['srv_new_vrednost']+'
    '+ + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + '
    '; } @@ -795,52 +819,90 @@ function inline_nova_vrednost (_this) { var new_div = '
    '+ ''+ - ' '+ - ' '+ - ' '+ - ' '+ + '
    '+lang['srv_new_vrednost']+'
    '+ - '
    '; + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + + ''; } // vsota } else if (tip == 18) { - var new_div = '
    '+ + var text_width = $(_this).closest('.variabla').find('.vrednost_inline_vsota')[0].style.width; + + var new_div = '
    '+ ''+ - ' '+ - ' '+ - ' '+ - ' '+ - '
    '+lang['srv_new_vrednost']+'
    '+ + + '
    '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
    '+ + + '
    '+lang['srv_new_vrednost']+'
    '+ ' '+ '
    '; // tabele } else { - var new_div = $( '' + $(_this).closest('.variabla').html() + '' ); new_div.find('*').removeAttr('id'); - new_div.find('div').attr('id', 'vre_id_new').attr('vre_id', 'new').attr('default', '1').html(lang['srv_new_vrednost']); + new_div.find('div.vrednost_inline').attr('id', 'vre_id_new').attr('vre_id', 'new').attr('default', '1').html(lang['srv_new_vrednost_grid']); + new_div.find('div.icons_holder').css('display', 'none'); // odstani input polje drugo, ce dodajamo za poljem drugo - new_div.find('input[type=text]').remove(); + new_div.find('input[type=text]:disabled').remove(); new_div.find('span.inline_other').remove(); new_div.find('span.red').remove(); + + //child pri maxDiff je drugi, ker prvi je radio + let child = (tip == 6 && enota == 5) ? 'td:nth-child(2)' : 'td:first-child'; // dodamo opcijo za drugo - new_div.find('td:first-child').append(' '+lang['srv_novavrednost_drugo']+''); + new_div.find(child).append(' '+lang['srv_novavrednost_drugo']+''); if (new_div.find('div').length > 1){ //new_div.find('div:last').attr('id', 'vre_id_new_2').attr('vre_id', 'new_2').html(''); - new_div.find('div:last').attr('id', 'vre_id_new_2').attr('vre_id', 'new_2').attr('default', '1').html(lang['srv_new_vrednost']); + new_div.find('div:last').attr('id', 'vre_id_new_2').attr('vre_id', 'new_2').attr('default', '1').html(lang['srv_new_vrednost_grid']); } + + let icons = + ' '+ + ' '+ + ' '+ + ' '; + + new_div.find('div.icons_holder').html(icons); } $(_this).closest('.variabla').parent().append(new_div); + //executed when DOM is ready, after manipulation + $(function(){ + //pripni missinge v variabla_new + if (tip <= 3) { + $.post('ajax.php?t=branching&a=get_missing_block', {spremenljivka: spremenljivka, lang_id: srv_meta_lang_id, anketa: srv_meta_anketa_id}, function (data) { + if(data){ + $('[id="missing_block_'+spremenljivka+'"]').last().html(data); + } + }); + } + }); + + // Po potrebi izvedemo focus na novi variabli + if(focus === true) + $('#branching_'+spremenljivka).find('#vre_id_new').focus(); } - } + } } // skrije (odstrani) polje za dodajanje vrednosti @@ -863,45 +925,15 @@ function inline_nova_vrednost_hide (spr_id, vre_id) { } -// Pocisti text ce je bil pastan -function inline_clear_paste(_this){ - - // text ki je bil pastan - var temp = $(_this).html(); - - // pocistimo tage - dodamo

    ce je slucajno prazen - drugace vrne prazen string - temp = $('

    '+temp+'

    ').text(); - - // shranimo nazaj - $(_this).html(temp); - - pasteFromWord = false; -} - -// doda novo vrednost (mv = missing value) -/*function inline_vrednost_new (spremenljivka, other, tip, mv) { - - $.post('ajax.php?t=vprasanjeinline&a=inline_vrednost_new', {spremenljivka: spremenljivka, other: other, anketa: srv_meta_anketa_id, mv:mv}, function (data) { - - if ( $('#vprasanje_preview').is(':visible') ) { - $('#vprasanje_preview').html(data); - } else { - $('#branching_'+spremenljivka+'').html(data); - } - $('#spremenljivka_content_'+spremenljivka+' div.variable_holder div').last().click(); - //$('#vprasanje_edit').attr({scrollTop: $('#vprasanje_edit').height()}); - //if(tip == 17) edit_ranking_moznosti(); - - }); - -}*/ /** * nastavi editor na contenteditable element za naslov */ function inline_load_editor (_this) { + $(_this).css('display', 'none'); var el = $(_this).parent().find('div[contenteditable].naslov_inline'); + if (el.attr('contenteditable') == 'true') { var spr_id = el.attr('spr_id'); @@ -911,38 +943,28 @@ function inline_load_editor (_this) { var def_pogoj = 'default="'+def_text+'"'; el.replaceWith(''+ - ''+lang['save']+''); + '
    '); editor_display(spr_id); } - } function inline_load_editor_hotspot (_this, vre_id) { - //console.log(_this); + $(_this).css('display', 'none'); - //var el = $(_this).parent().find('div[contenteditable].naslov_inline'); - -// echo '
    lang_id!=null ? ' default="1"':'').'>' . $row1['naslov'].'
    '; - + var el = $(_this).parent().find('.vrednost_inline_hotspot'); - //if (el.attr('contenteditable') == 'true') { - var spr_id = el.attr('spr_id'); - var def_text = el.attr('default'); - var def_pogoj = ''; - if(def_text == 1) - var def_pogoj = 'default="'+def_text+'"'; - - //el.replaceWith(''+ - //''+lang['save']+''); - - el.replaceWith(''+ - ''+lang['save']+''); - - editor_display_hotspot(vre_id); - //} - //console.log("HotSpot editor"); + var spr_id = el.attr('spr_id'); + var def_text = el.attr('default'); + var def_pogoj = ''; + if(def_text == 1) + var def_pogoj = 'default="'+def_text+'"'; + + el.replaceWith(''+ + '
    '); + + editor_display_hotspot(vre_id); } function inline_save_editor_hotspot(vre_id, spr_id, postsave) { @@ -953,7 +975,7 @@ function inline_save_editor_hotspot(vre_id, spr_id, postsave) { var parent = el.parent(); el.replaceWith('
    '+el.val()+'
    '); - parent.find('span.buttonwrapper').remove(); + parent.find('div.button_holder').remove(); if ( postsave != false ) inline_hotspot(spr_id, parent.find('div.vrednost_inline_hotspot')); @@ -972,12 +994,13 @@ function inline_save_editor(spr_id, postsave) { var parent = el.parent(); el.replaceWith('
    '+el.val()+'
    '); - parent.find('span.buttonwrapper').remove(); + parent.find('div.button_holder').remove(); if ( postsave != false ) inline_naslov(spr_id, parent.find('div.naslov_inline')); $('#spremenljivka_content_'+spr_id+' span.display_editor').css('display', 'inline-block'); + $('#spremenljivka_content_'+spr_id+' div.missing_dropdown_link').css('display', 'inline-block'); } /** @@ -1026,37 +1049,25 @@ function enterKeyPressHandler(evt) { function inline_minmaxlabel (spremenljivka, _this, tiplabele) { if ($(_this).attr('contenteditable') != 'true') return; - - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - + //posljemo podatke v funkcijo za dinamicno shranjevanje - //$.post('ajax.php?t=vprasanjeinline&a=inline_grid_naslov_save', {spremenljivka: spremenljivka, grid: $(_this).attr('grd_id'), anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, label: $(_this).html()}); $.post('ajax.php?t=vprasanjeinline&a=inline_label_save', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, tiplabele: tiplabele, label: $(_this).html()}); - //vprasanje_save(true, spremenljivka); - //vprasanje_save(true); } // shrani labele podrocij @ sliders function inline_labele_podrocij(spremenljivka, _this, tiplabele){ - if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } + + if ($(_this).attr('contenteditable') != 'true') return; + //posljemo podatke v funkcijo za dinamicno shranjevanje $.post('ajax.php?t=vprasanjeinline&a=inline_labele_podrocij_save', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, tiplabele: tiplabele, label: $(_this).html()}); } // shrani in posodobi custom opisne labele @ sliders function inline_opisne_labele(spremenljivka, _this, tiplabele){ - if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } + + if ($(_this).attr('contenteditable') != 'true') return; + //posljemo podatke v funkcijo za dinamicno shranjevanje $.post('ajax.php?t=vprasanjeinline&a=inline_opisne_labele_save', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, tiplabele: tiplabele, label: $(_this).html()}); } @@ -1065,12 +1076,7 @@ function inline_opisne_labele(spremenljivka, _this, tiplabele){ function inline_variabla_vsota (spremenljivka, _this) { if ($(_this).attr('contenteditable') != 'true') return; - - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } - + $.post('ajax.php?t=vprasanjeinline&a=inline_variabla_vsota_save', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, inline_variabla_vsota: $(_this).html()}); } @@ -1108,9 +1114,7 @@ function inline_hotspot_delete_region(spr_id, region_index, vre_id){ }); //update variable in vrstni_red v srv_hotspot_regions - //$.post('ajax.php?t=vprasanjeinline&a=inline_hotspot_update_region', {spr_id: spr_id, vre_id: vre_id}); $.post('ajax.php?t=vprasanjeinline&a=inline_hotspot_update_region', {spr_id: spr_id}); - } //funkcija za preurejanje obstojecega obmocja @@ -1121,13 +1125,9 @@ function inline_hotspot_edit_region(spr_id, region_index, vre_id){ // shrani nadnaslove @ uporaba traku function trak_inline_nadnaslov(spremenljivka, _this, tiplabele, grid){ - if ($(_this).attr('contenteditable') != 'true') return; - // Pocistimo text pri copy/paste - if(pasteFromWord == true){ - inline_clear_paste(_this); - } + if ($(_this).attr('contenteditable') != 'true') return; + //posljemo podatke v funkcijo za dinamicno shranjevanje - //$.post('ajax.php?t=vprasanjeinline&a=inline_labele_podrocij_save', {anketa: srv_meta_anketa_id, grid: grid, spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, tiplabele: tiplabele, label: $(_this).html()}); $.post('ajax.php?t=vprasanjeinline&a=inline_nadnaslov_save', {anketa: srv_meta_anketa_id, grid: grid, spremenljivka: spremenljivka, anketa: srv_meta_anketa_id, lang_id: srv_meta_lang_id, tiplabele: tiplabele, label: $(_this).html()}); -} \ No newline at end of file +} diff --git a/admin/survey/script/zankaProfiles.js b/admin/survey/script/zankaProfiles.js index 43c0cc5..ff251a3 100644 --- a/admin/survey/script/zankaProfiles.js +++ b/admin/survey/script/zankaProfiles.js @@ -15,6 +15,7 @@ function changeViewZankaProfile(pid){ // funkcije ki skrbijo za profil zank function zankaProfileAction(action) { + if (action == 'showProfiles') { $('#fade').fadeTo('slow', 1); // poiščemo center strani @@ -26,19 +27,23 @@ function zankaProfileAction(action) { var top = height / 2 - (msg.height() / 2); }).show(200).draggable( { delay : 100, cancel : '#fs_list, input, .buttonwrapper, .select' }); - } else if (action == 'cancle') { + } + else if (action == 'cancle') { $("#div_zanka_profiles").hide(200); $('#fade').fadeOut('slow'); $("#div_zanka_profiles").html(''); return reloadData(); - } else if (action == 'newName') { // dodelimo novo ime profilu + } + else if (action == 'newName') { // dodelimo novo ime profilu $("#zankaProfileCoverDiv").show(); $("#newProfileDiv").show(); - } else if (action == 'newCancle') { // preklicemo nov profil + } + else if (action == 'newCancle') { // preklicemo nov profil $("#zankaProfileCoverDiv").hide(); $("#newProfileDiv").hide(); - } else if (action == 'newCreate') { // shranimo kot nov profil in pozenemo + } + else if (action == 'newCreate') { // shranimo kot nov profil in pozenemo var profileName = $("#newProfileName").val(); var data = $.dds.serialize( 'fs_list_4' ); var mnozenje = 0; @@ -46,13 +51,16 @@ function zankaProfileAction(action) { $.post('ajax.php?t=zankaProfile&a=createProfile', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, profileName:profileName, data:data, mnozenje:mnozenje }, function(newId) { zankaProfileAction('showProfiles'); }); - } else if (action == 'deleteAsk') { // vprašamo po potrditvi za brisanje + } + else if (action == 'deleteAsk') { // vprašamo po potrditvi za brisanje $("#zankaProfileCoverDiv").show(); $("#deleteProfileDiv").show(); - } else if (action == 'deleteCancle') { // preklicemo brisanje + } + else if (action == 'deleteCancle') { // preklicemo brisanje $("#deleteProfileDiv").hide(); $("#zankaProfileCoverDiv").fadeOut(); - } else if (action == 'deleteConfirm') { // izbrisemo profil + } + else if (action == 'deleteConfirm') { // izbrisemo profil var pid = $("#zanka_profile .active").attr('value'); $.post('ajax.php?t=zankaProfile&a=delete_profile', { anketa : srv_meta_anketa_id, pid : pid }, function() { $("#div_zanka_profiles").load( @@ -64,13 +72,16 @@ function zankaProfileAction(action) { }); $("#deleteProfileDiv").hide(); $("#zankaProfileCoverDiv").fadeOut(); - } else if (action == 'renameAsk') { // vprašamo za preimenovanje + } + else if (action == 'renameAsk') { // vprašamo za preimenovanje $("#renameProfileDiv").show(); $("#zankaProfileCoverDiv").fadeIn(); - } else if (action == 'renameCancle') { // preklicemo preimenovanje + } + else if (action == 'renameCancle') { // preklicemo preimenovanje $("#renameProfileDiv").hide(); $("#zankaProfileCoverDiv").fadeOut(); - } else if (action == 'renameConfirm') { // preimenujemo profil + } + else if (action == 'renameConfirm') { // preimenujemo profil var pid = $("#zanka_profile .active").attr('value'); var name = $("#renameProfileName").val(); @@ -84,7 +95,8 @@ function zankaProfileAction(action) { $("#zankaProfileCoverDiv").fadeOut(); }); }); - } else if (action == 'run' || action == 'runSession') { // shranimo kot nov profil in pozenemo + } + else if (action == 'run' || action == 'runSession') { // shranimo kot nov profil in pozenemo var pid = $("#zanka_profile .active").attr('value'); var data = $.dds.serialize( 'fs_list_4' ); var mnozenje = 0; @@ -92,24 +104,21 @@ function zankaProfileAction(action) { // ce imamo mnozjenje pustimo max 2 variabli if ( mnozenje * $("#fs_list_4 li").length > 2) { - alert(lang['srv_loop_multiplication_error']); + genericAlertPopup('srv_loop_multiplication_error'); } else { $.post('ajax.php?t=zankaProfile&a=run', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, data:data, mnozenje:mnozenje, run:action, pid:pid }, function() { -// window.location.reload(); -// return ''; return reloadData('zanka'); }); } - } else if (action == 'change') { + } + else if (action == 'change') { $("#loading").show(); var pid = $("#current_zanka_profile").val(); $.post('ajax.php?t=zankaProfile&a=change_profile', { anketa : srv_meta_anketa_id, pid : pid}, function() { -// window.location.reload(); -// return ''; return reloadData(); }); } else { - alert('Missing action:'+action) + genericAlertPopup('alert_missing_action',action) }; -} \ No newline at end of file +} diff --git a/admin/survey/script/zoom.js b/admin/survey/script/zoom.js index d43700d..debc254 100644 --- a/admin/survey/script/zoom.js +++ b/admin/survey/script/zoom.js @@ -85,7 +85,7 @@ function zoomProfileAction(action) { //$("#zoom_cover_div").show(); $("#zoom_div div#newProfileDiv").show(); } else { - alert('Najprej izberite variable'); + genericAlertPopup('alert_choose_variables'); } } else if (action == 'newCancel'){ @@ -110,10 +110,10 @@ function zoomProfileAction(action) { // dropdownu dodamo nov prodil in ga izberemo //$("#current_condition_profile").append( $("").attr("value", newId).attr( "selected", true).text(name)); } else { - alert(data.msg); + genericAlertPopup('alert_parameter_datamsg',data.msg); } } else { - alert(data.msg); + genericAlertPopup('alert_parameter_datamsg',data.msg); } }); //$("#zoom_cover_div").hide(); @@ -130,7 +130,7 @@ function zoomProfileAction(action) { $("#zoom_div div#deleteProfileDiv").hide(); //$("#zoom_cover_div").fadeOut(); } else { - alert(action); + genericAlertPopup('alert_parameter_action',action); } } @@ -156,25 +156,14 @@ function toggleAllZoom(what) { $.post('ajax.php?t=zoom&a=togleExtended', { anketa : srv_meta_anketa_id, what:what}, function() { if (what == 0) { - $("#div_zoom_condition ul").parent().show(); - $("#div_zoom_condition #zoomSpritesMinus").show(); - $("#div_zoom_condition #zoomSpritesPlus").hide(); + $("#div_zoom_condition ul").parent().removeClass('displayNone'); + $("#div_zoom_condition #zoomSpritesMinus").removeClass('displayNone'); + $("#div_zoom_condition #zoomSpritesPlus").addClass('displayNone'); } else { - $("#div_zoom_condition ul").parent().hide(); - $("#div_zoom_condition #zoomSpritesMinus").hide(); - $("#div_zoom_condition #zoomSpritesPlus").show(); + $("#div_zoom_condition ul").parent().addClass('displayNone'); + $("#div_zoom_condition #zoomSpritesMinus").addClass('displayNone'); + $("#div_zoom_condition #zoomSpritesPlus").removeClass('displayNone'); } - /* - if (what == 0) { - $("#div_zoom_condition ul li div:nth-child(2)").show(); - $("#div_zoom_condition #zoomSpritesMinus").show(); - $("#div_zoom_condition #zoomSpritesPlus").hide(); - } else { - $("#div_zoom_condition ul li div:nth-child(2)").hide(); - $("#div_zoom_condition #zoomSpritesMinus").hide(); - $("#div_zoom_condition #zoomSpritesPlus").show(); - } - */ }); } -- cgit v1.2.3