dealposbooks 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdpartylicenses.txt +36 -0
- package/chunk-3RX6VPXR.js +2 -0
- package/chunk-4KSABCT6.js +1 -0
- package/chunk-4WX4CTCF.js +1 -0
- package/{chunk-HW5TOHIY.js → chunk-6SHWLH3C.js} +1 -1
- package/{chunk-CWSZS6PH.js → chunk-AVVIJQVC.js} +1 -1
- package/{chunk-72KCMRAD.js → chunk-BFBSEK4H.js} +1 -1
- package/chunk-BMZ2A6GT.js +1 -0
- package/{chunk-PLNF5Z47.js → chunk-C6OIY3SK.js} +1 -1
- package/{chunk-TEV7GODP.js → chunk-CGUMLMMW.js} +1 -1
- package/chunk-CUPI27LK.js +1 -0
- package/{chunk-L36U5L2E.js → chunk-D7G3TZFD.js} +1 -1
- package/{chunk-WNZ52LDQ.js → chunk-ECOKK22J.js} +6 -6
- package/{chunk-DKKZGADB.js → chunk-FJNTF5KS.js} +1 -1
- package/{chunk-JGJNDRVZ.js → chunk-FRUVZQE2.js} +1 -1
- package/chunk-FT6T65H6.js +191 -0
- package/{chunk-RJKIW354.js → chunk-G7QGHGLM.js} +1 -1
- package/{chunk-ZKTMMTSB.js → chunk-HTIWSCTK.js} +1 -1
- package/chunk-KSOH6FOP.js +160 -0
- package/{chunk-2JEYUHX6.js → chunk-L3OWH62Z.js} +1 -1
- package/{chunk-NY4Q6KXA.js → chunk-LVEM3QDX.js} +2 -2
- package/chunk-MYWX5CJP.js +1 -0
- package/chunk-NFJLN5KP.js +1 -0
- package/{chunk-6YT5EOQ2.js → chunk-NHEOQJVG.js} +1 -1
- package/chunk-OB4H7LE4.js +1 -0
- package/{chunk-XJB6ZB5C.js → chunk-OM3AWD5C.js} +1 -1
- package/chunk-P7OQDOZ5.js +1 -0
- package/chunk-PFEDDKVG.js +235 -0
- package/{chunk-YYGEKYKY.js → chunk-PJF5SBZS.js} +2 -2
- package/{chunk-M3DGMI2G.js → chunk-QHTRP332.js} +1 -1
- package/{chunk-VILWNFJE.js → chunk-RYKEISKQ.js} +1 -1
- package/{chunk-USDU2OMR.js → chunk-SKH7LGD3.js} +1 -1
- package/{chunk-3O5WB452.js → chunk-SMINY2HR.js} +1 -1
- package/{chunk-RVDH4GNB.js → chunk-T4BLJS6I.js} +1 -1
- package/{chunk-UAPZHEQX.js → chunk-T6W6HJCE.js} +1 -1
- package/{chunk-37O3IGUE.js → chunk-UJUUMHOE.js} +1 -1
- package/{chunk-KWULO2RL.js → chunk-ULH6XT2Q.js} +1 -1
- package/{chunk-G4OXNPYG.js → chunk-WB6KUPUB.js} +1 -1
- package/chunk-WKMCCUUK.js +1 -0
- package/chunk-WQNK5ZUV.js +1 -0
- package/chunk-XTTFTDKZ.js +1 -0
- package/{chunk-CJM6YIDJ.js → chunk-XVXUJ33X.js} +1 -1
- package/{chunk-JGV5HMBT.js → chunk-ZNSZA7QK.js} +1 -1
- package/index.html +2 -2
- package/main-ZQK6GRTL.js +1 -0
- package/package.json +1 -1
- package/chunk-4F4YTU5A.js +0 -1
- package/chunk-B44UAABO.js +0 -1
- package/chunk-CDSOHE7R.js +0 -1
- package/chunk-D7GU77BZ.js +0 -1
- package/chunk-DGUB5VQV.js +0 -1
- package/chunk-KFF6NEEA.js +0 -1
- package/chunk-KHWYFU3R.js +0 -191
- package/chunk-LHGT7WC7.js +0 -237
- package/chunk-NYMK6LUH.js +0 -1
- package/chunk-OCLF4BGI.js +0 -160
- package/chunk-QAAN4NVX.js +0 -1
- package/chunk-QCF3XBU5.js +0 -1
- package/chunk-SWKKEI7U.js +0 -1
- package/chunk-V3VYMXUU.js +0 -1
- package/chunk-WY5VYTM5.js +0 -1
- package/main-T2PMTIHB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Nn}from"./chunk-
|
|
1
|
+
import{a as Nn}from"./chunk-C6OIY3SK.js";import{a as Hi}from"./chunk-7HQ6WSSU.js";import{b as ha,c as ga}from"./chunk-WB6KUPUB.js";import{a as pa}from"./chunk-ZZCZU47E.js";import{a as Ve}from"./chunk-G4XX7EU2.js";import{a as On,b as Ki,c as Wi}from"./chunk-UJUUMHOE.js";import{a as Ho}from"./chunk-D7G3TZFD.js";import{a as hi,b as gi}from"./chunk-AVVIJQVC.js";import{a as He}from"./chunk-NAZKZSVO.js";import"./chunk-CGUMLMMW.js";import"./chunk-XVXUJ33X.js";import{a as Hn,b as qn}from"./chunk-36254LID.js";import{d as aa,e as Tn,g as Ji,h as Gi,i as In,j as Fn,k as jt,m as ma,n as da,o as $t}from"./chunk-G7QGHGLM.js";import{i as di,j as pi}from"./chunk-SMINY2HR.js";import{a as mi,b as Ut}from"./chunk-BFBSEK4H.js";import{a as ra,b as sa,c as ca,d as ua,e as ji,f as $i,g as Pt}from"./chunk-LVEM3QDX.js";import{a as Et,c as Pn,e as kn,f as ci,g as ui,h as Wn,m as oa,o as zi,p as la,r as ft,s as zt,v as Ui}from"./chunk-ULH6XT2Q.js";import{A as Kn,C as ta,S as En,da as ia,ea as bi,ga as Rt,ka as Bi,na,oa as li,pa as $e,q as Jn,qa as Bt,r as ri,t as si,v as Gn}from"./chunk-ZQDTA2BC.js";import{a as Ri,b as qo,c as Qo,d as Zo,e as Yo,f as Xo,g as ea}from"./chunk-QSMNYWAY.js";import{c as Cn,e as Ko}from"./chunk-7BUIG2V4.js";import{a as Jo,b as Ti,c as at,e as Ii,f as Fi,g as At,h as B,l as Oi,m as Ni,n as Di,o as Vi,p as bn,q as Go,t as Ai}from"./chunk-WKMCCUUK.js";import{a as Mi,d as Wo}from"./chunk-P7OQDOZ5.js";import{c as Li,d as Lt,f as Tt,g as xn,h as Mt,i as jn,k as $n}from"./chunk-S35HUXPS.js";import{b as _n,e as jo,k as $o,m as ai,p as Sn,w as wn}from"./chunk-OM3AWD5C.js";import{d as Ro,k as gt,l as Bo,m as zo,n as Ye,o as ni,p as Dt,q as Uo,r as yn,s as Vt,t as Le,v as oi}from"./chunk-DFW6MEY3.js";import{$ as Fe,$b as ce,Ac as ii,Bb as ht,Bc as fn,Ca as qe,Da as pn,Db as Xt,Dc as Ao,E as mn,Eb as O,Gc as Lo,Ha as ko,I as Ei,Ic as Be,Jc as Ze,Ka as Ae,Kc as en,Lb as No,Lc as me,Mb as se,Nb as v,Ob as ei,Pb as Do,Qb as xt,Rb as Qe,Tb as ze,Ub as Nt,Uc as tt,Vb as Un,Vc as ki,W as wo,Wb as St,Wc as ut,Xb as wt,Y as Xi,Yb as p,Yc as vn,Zb as m,Zc as Mo,_b as D,ac as ue,bc as Ue,c as zn,cc as q,ea as Co,eb as To,fa as lt,fb as Io,g as Wt,ga as Ft,gc as $,hc as P,ic as Pi,jb as g,jc as ti,ka as dn,kb as Ht,kc as ke,la as K,lc as ot,mc as Q,nc as Z,o as xi,oc as Vo,pc as x,qb as Fo,qc as re,rb as Oo,rc as ct,sa as xo,sc as gn,t as kt,ta as M,ua as R,va as Eo,wa as We,xb as we,xc as je,ya as Po,yb as Ot,yc as De,zb as hn,zc as ge}from"./chunk-A63HKFUG.js";import{a as ve,b as Ie,d as So,e as _i}from"./chunk-EQDQRRRY.js";var Sa=So((nn,Xn)=>{var ba,tn;ba=nn,tn=()=>(()=>{var n={d:(s,_)=>{for(var k in _)n.o(_,k)&&!n.o(s,k)&&Object.defineProperty(s,k,{enumerable:!0,get:_[k]})},o:(s,_)=>Object.prototype.hasOwnProperty.call(s,_)},h={};n.d(h,{default:()=>Yi});var t={allowedTagList:["b","caption","cite","code","const","dd","del","div","dfn","dt","em","h1","h2","h3","h4","h5","h6","input","ins","kdb","label","li","option","output","p","q","s","sample","span","strong","td","th","u"]};Object.freeze(t.allowedTagList),Object.defineProperty(t,"allowedTagList",{configurable:!1,writable:!1}),t.fromCharCodeKeyCode={0:"LaunchCalculator",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",91:"OS",92:"OSRight",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",173:"-",182:"MyComputer",183:"MyCalculator",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Meta",225:"AltGraph"},Object.freeze(t.fromCharCodeKeyCode),Object.defineProperty(t,"fromCharCodeKeyCode",{configurable:!1,writable:!1}),t.keyName={Unidentified:"Unidentified",AndroidDefault:"AndroidDefault",Alt:"Alt",AltGr:"AltGraph",CapsLock:"CapsLock",Ctrl:"Control",Fn:"Fn",FnLock:"FnLock",Hyper:"Hyper",Meta:"Meta",OSLeft:"OS",OSRight:"OS",Command:"OS",NumLock:"NumLock",ScrollLock:"ScrollLock",Shift:"Shift",Super:"Super",Symbol:"Symbol",SymbolLock:"SymbolLock",Enter:"Enter",Tab:"Tab",Space:" ",LeftArrow:"ArrowLeft",UpArrow:"ArrowUp",RightArrow:"ArrowRight",DownArrow:"ArrowDown",End:"End",Home:"Home",PageUp:"PageUp",PageDown:"PageDown",Backspace:"Backspace",Clear:"Clear",Copy:"Copy",CrSel:"CrSel",Cut:"Cut",Delete:"Delete",EraseEof:"EraseEof",ExSel:"ExSel",Insert:"Insert",Paste:"Paste",Redo:"Redo",Undo:"Undo",Accept:"Accept",Again:"Again",Attn:"Attn",Cancel:"Cancel",ContextMenu:"ContextMenu",Esc:"Escape",Execute:"Execute",Find:"Find",Finish:"Finish",Help:"Help",Pause:"Pause",Play:"Play",Props:"Props",Select:"Select",ZoomIn:"ZoomIn",ZoomOut:"ZoomOut",BrightnessDown:"BrightnessDown",BrightnessUp:"BrightnessUp",Eject:"Eject",LogOff:"LogOff",Power:"Power",PowerOff:"PowerOff",PrintScreen:"PrintScreen",Hibernate:"Hibernate",Standby:"Standby",WakeUp:"WakeUp",Compose:"Compose",Dead:"Dead",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",Print:"Print",num0:"0",num1:"1",num2:"2",num3:"3",num4:"4",num5:"5",num6:"6",num7:"7",num8:"8",num9:"9",a:"a",b:"b",c:"c",d:"d",e:"e",f:"f",g:"g",h:"h",i:"i",j:"j",k:"k",l:"l",m:"m",n:"n",o:"o",p:"p",q:"q",r:"r",s:"s",t:"t",u:"u",v:"v",w:"w",x:"x",y:"y",z:"z",A:"A",B:"B",C:"C",D:"D",E:"E",F:"F",G:"G",H:"H",I:"I",J:"J",K:"K",L:"L",M:"M",N:"N",O:"O",P:"P",Q:"Q",R:"R",S:"S",T:"T",U:"U",V:"V",W:"W",X:"X",Y:"Y",Z:"Z",Semicolon:";",Equal:"=",Comma:",",Hyphen:"-",Minus:"-",Plus:"+",Dot:".",Slash:"/",Backquote:"`",LeftParenthesis:"(",RightParenthesis:")",LeftBracket:"[",RightBracket:"]",Backslash:"\\",Quote:"'",numpad0:"0",numpad1:"1",numpad2:"2",numpad3:"3",numpad4:"4",numpad5:"5",numpad6:"6",numpad7:"7",numpad8:"8",numpad9:"9",NumpadDot:".",NumpadDotAlt:",",NumpadMultiply:"*",NumpadPlus:"+",NumpadMinus:"-",NumpadSubtract:"-",NumpadSlash:"/",NumpadDotObsoleteBrowsers:"Decimal",NumpadMultiplyObsoleteBrowsers:"Multiply",NumpadPlusObsoleteBrowsers:"Add",NumpadMinusObsoleteBrowsers:"Subtract",NumpadSlashObsoleteBrowsers:"Divide",_allFnKeys:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"],_someNonPrintableKeys:["Tab","Enter","Shift","ShiftLeft","ShiftRight","Control","ControlLeft","ControlRight","Alt","AltLeft","AltRight","Pause","CapsLock","Escape"],_directionKeys:["PageUp","PageDown","End","Home","ArrowDown","ArrowLeft","ArrowRight","ArrowUp"]},Object.freeze(t.keyName._allFnKeys),Object.freeze(t.keyName._someNonPrintableKeys),Object.freeze(t.keyName._directionKeys),Object.freeze(t.keyName),Object.defineProperty(t,"keyName",{configurable:!1,writable:!1}),Object.freeze(t);let l=t;function c(s){return function(_){if(Array.isArray(_))return ye(_)}(s)||function(_){if(typeof Symbol<"u"&&_[Symbol.iterator]!=null||_["@@iterator"]!=null)return Array.from(_)}(s)||L(s)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function y(){return y=Object.assign?Object.assign.bind():function(s){for(var _=1;_<arguments.length;_++){var k=arguments[_];for(var I in k)Object.prototype.hasOwnProperty.call(k,I)&&(s[I]=k[I])}return s},y.apply(this,arguments)}function F(s,_){return function(k){if(Array.isArray(k))return k}(s)||function(k,I){var e=k==null?null:typeof Symbol<"u"&&k[Symbol.iterator]||k["@@iterator"];if(e!=null){var i,r,o,u,f=[],S=!0,E=!1;try{if(o=(e=e.call(k)).next,I===0){if(Object(e)!==e)return;S=!1}else for(;!(S=(i=o.call(e)).done)&&(f.push(i.value),f.length!==I);S=!0);}catch(N){E=!0,r=N}finally{try{if(!S&&e.return!=null&&(u=e.return(),Object(u)!==u))return}finally{if(E)throw r}}return f}}(s,_)||L(s,_)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function L(s,_){if(s){if(typeof s=="string")return ye(s,_);var k=Object.prototype.toString.call(s).slice(8,-1);return k==="Object"&&s.constructor&&(k=s.constructor.name),k==="Map"||k==="Set"?Array.from(s):k==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k)?ye(s,_):void 0}}function ye(s,_){(_==null||_>s.length)&&(_=s.length);for(var k=0,I=new Array(_);k<_;k++)I[k]=s[k];return I}function Ce(s){return Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},Ce(s)}function vt(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(Ce(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(Ce(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),Ce(i)==="symbol"?i:String(i)),I)}var e,i}var a=function(){function s(){(function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")})(this,s)}var _,k,I;return _=s,I=[{key:"isNull",value:function(e){return e===null}},{key:"isUndefined",value:function(e){return e===void 0}},{key:"isUndefinedOrNullOrEmpty",value:function(e){return e==null||e===""}},{key:"isString",value:function(e){return typeof e=="string"||e instanceof String}},{key:"isEmptyString",value:function(e){return e===""}},{key:"isBoolean",value:function(e){return typeof e=="boolean"}},{key:"isTrueOrFalseString",value:function(e){var i=String(e).toLowerCase();return i==="true"||i==="false"}},{key:"isObject",value:function(e){return Ce(e)==="object"&&e!==null&&!Array.isArray(e)}},{key:"isEmptyObj",value:function(e){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))return!1;return!0}},{key:"isNumberStrict",value:function(e){return typeof e=="number"}},{key:"isNumber",value:function(e){return!this.isArray(e)&&!isNaN(parseFloat(e))&&isFinite(e)}},{key:"isDigit",value:function(e){return/\d/.test(e)}},{key:"isNumberOrArabic",value:function(e){var i=this.arabicToLatinNumbers(e,!1,!0,!0);return this.isNumber(i)}},{key:"isInt",value:function(e){return typeof e=="number"&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)}},{key:"isFunction",value:function(e){return typeof e=="function"}},{key:"contains",value:function(e,i){return!(!this.isString(e)||!this.isString(i)||e===""||i==="")&&e.indexOf(i)!==-1}},{key:"isInArray",value:function(e,i){return!(!this.isArray(i)||i===[]||this.isUndefined(e))&&i.indexOf(e)!==-1}},{key:"isArray",value:function(e){if(Object.prototype.toString.call([])==="[object Array]")return Array.isArray(e)||Ce(e)==="object"&&Object.prototype.toString.call(e)==="[object Array]";throw new Error("toString message changed for Object Array")}},{key:"isElement",value:function(e){return typeof Element<"u"&&e instanceof Element}},{key:"isInputElement",value:function(e){return this.isElement(e)&&e.tagName.toLowerCase()==="input"}},{key:"decimalPlaces",value:function(e){var i=F(e.split("."),2)[1];return this.isUndefined(i)?0:i.length}},{key:"indexFirstNonZeroDecimalPlace",value:function(e){var i=F(String(Math.abs(e)).split("."),2)[1];if(this.isUndefined(i))return 0;var r=i.lastIndexOf("0");return r===-1?r=0:r+=2,r}},{key:"keyCodeNumber",value:function(e){return e.which===void 0?e.keyCode:e.which}},{key:"character",value:function(e){var i;if(e.key==="Unidentified"||e.key===void 0||this.isSeleniumBot()){var r=this.keyCodeNumber(e);if(r===229)return l.keyName.AndroidDefault;var o=l.fromCharCodeKeyCode[r];i=s.isUndefinedOrNullOrEmpty(o)?String.fromCharCode(r):o}else switch(e.key){case"Add":i=l.keyName.NumpadPlus;break;case"Apps":i=l.keyName.ContextMenu;break;case"Crsel":i=l.keyName.CrSel;break;case"Decimal":i=e.char?e.char:l.keyName.NumpadDot;break;case"Del":i=l.keyName.Delete;break;case"Divide":i=l.keyName.NumpadSlash;break;case"Down":i=l.keyName.DownArrow;break;case"Esc":i=l.keyName.Esc;break;case"Exsel":i=l.keyName.ExSel;break;case"Left":i=l.keyName.LeftArrow;break;case"Meta":case"Super":i=l.keyName.OSLeft;break;case"Multiply":i=l.keyName.NumpadMultiply;break;case"Right":i=l.keyName.RightArrow;break;case"Spacebar":i=l.keyName.Space;break;case"Subtract":i=l.keyName.NumpadMinus;break;case"Up":i=l.keyName.UpArrow;break;default:i=e.key}return i}},{key:"browser",value:function(){var e,i=navigator.userAgent,r=i.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(r[1])?{name:"ie",version:(e=/\brv[ :]+(\d+)/g.exec(i)||[])[1]||""}:r[1]==="Chrome"&&(e=i.match(/\b(OPR|Edge)\/(\d+)/))!==null?{name:e[1].replace("OPR","opera"),version:e[2]}:(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],(e=i.match(/version\/(\d+)/i))!==null&&r.splice(1,1,e[1]),{name:r[0].toLowerCase(),version:r[1]})}},{key:"isSeleniumBot",value:function(){return window.navigator.webdriver===!0}},{key:"isNegative",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-",r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return e===i||e!==""&&(s.isNumber(e)?e<0:r?this.contains(e,i):this.isNegativeStrict(e,i))}},{key:"isNegativeStrict",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-";return e.charAt(0)===i}},{key:"isNegativeWithBrackets",value:function(e,i,r){return e.charAt(0)===i&&this.contains(e,r)}},{key:"isZeroOrHasNoValue",value:function(e){return!/[1-9]/g.test(e)}},{key:"setRawNegativeSign",value:function(e){return this.isNegativeStrict(e,"-")?e:"-".concat(e)}},{key:"replaceCharAt",value:function(e,i,r){return"".concat(e.substr(0,i)).concat(r).concat(e.substr(i+r.length))}},{key:"clampToRangeLimits",value:function(e,i){return Math.max(i.minimumValue,Math.min(i.maximumValue,e))}},{key:"countNumberCharactersOnTheCaretLeftSide",value:function(e,i,r){for(var o=new RegExp("[0-9".concat(r,"-]")),u=0,f=0;f<i;f++)o.test(e[f])&&u++;return u}},{key:"findCaretPositionInFormattedNumber",value:function(e,i,r,o){var u,f=r.length,S=e.length,E=0;for(u=0;u<f&&E<S&&E<i;u++)(e[E]===r[u]||e[E]==="."&&r[u]===o)&&E++;return u}},{key:"countCharInText",value:function(e,i){for(var r=0,o=0;o<i.length;o++)i[o]===e&&r++;return r}},{key:"convertCharacterCountToIndexPosition",value:function(e){return Math.max(e,e-1)}},{key:"getElementSelection",value:function(e){var i,r={};try{i=this.isUndefined(e.selectionStart)}catch{i=!1}try{if(i){var o=window.getSelection().getRangeAt(0);r.start=o.startOffset,r.end=o.endOffset,r.length=r.end-r.start}else r.start=e.selectionStart,r.end=e.selectionEnd,r.length=r.end-r.start}catch{r.start=0,r.end=0,r.length=0}return r}},{key:"setElementSelection",value:function(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(this.isUndefinedOrNullOrEmpty(r)&&(r=i),this.isInputElement(e))e.setSelectionRange(i,r);else if(!s.isNull(e.firstChild)){var o=document.createRange();o.setStart(e.firstChild,i),o.setEnd(e.firstChild,r);var u=window.getSelection();u.removeAllRanges(),u.addRange(o)}}},{key:"throwError",value:function(e){throw new Error(e)}},{key:"warning",value:function(e){(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&console.warn("Warning: ".concat(e))}},{key:"isWheelEvent",value:function(e){return e instanceof WheelEvent}},{key:"isWheelUpEvent",value:function(e){return this.isWheelEvent(e)&&!this.isUndefinedOrNullOrEmpty(e.deltaY)||this.throwError("The event passed as a parameter is not a valid wheel event, '".concat(e.type,"' given.")),e.deltaY<0}},{key:"isWheelDownEvent",value:function(e){return this.isWheelEvent(e)&&!this.isUndefinedOrNullOrEmpty(e.deltaY)||this.throwError("The event passed as a parameter is not a valid wheel event, '".concat(e.type,"' given.")),e.deltaY>0}},{key:"isWheelEventWithZeroDeltaY",value:function(e){return this.isWheelEvent(e)&&!this.isUndefinedOrNullOrEmpty(e.deltaY)&&e.deltaY===0}},{key:"forceDecimalPlaces",value:function(e,i){var r=F(String(e).split("."),2),o=r[0],u=r[1];return u?"".concat(o,".").concat(u.substr(0,i)):e}},{key:"roundToNearest",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;return e===0?0:(i===0&&this.throwError("The `stepPlace` used to round is equal to `0`. This value must not be equal to zero."),Math.round(e/i)*i)}},{key:"modifyAndRoundToNearestAuto",value:function(e,i,r){e=Number(this.forceDecimalPlaces(e,r));var o=Math.abs(e);if(o>=0&&o<1){var u,f=Math.pow(10,-r);if(e===0)return i?f:-f;var S,E=r,N=this.indexFirstNonZeroDecimalPlace(e);return u=N>=E-1?f:Math.pow(10,-(N+1)),S=i?e+u:e-u,this.roundToNearest(S,u)}e=parseInt(e,10);var d,T=Math.abs(e).toString().length;switch(T){case 1:d=0;break;case 2:case 3:d=1;break;case 4:case 5:d=2;break;default:d=T-3}var A,G=Math.pow(10,d);return(A=i?e+G:e-G)<=10&&A>=-10?A:this.roundToNearest(A,G)}},{key:"addAndRoundToNearestAuto",value:function(e,i){return this.modifyAndRoundToNearestAuto(e,!0,i)}},{key:"subtractAndRoundToNearestAuto",value:function(e,i){return this.modifyAndRoundToNearestAuto(e,!1,i)}},{key:"arabicToLatinNumbers",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],o=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(this.isNull(e))return e;var u=e.toString();if(u==="")return e;if(u.match(/[٠١٢٣٤٥٦٧٨٩۴۵۶]/g)===null)return i&&(u=Number(u)),u;r&&(u=u.replace(/٫/,".")),o&&(u=u.replace(/٬/g,"")),u=u.replace(/[٠١٢٣٤٥٦٧٨٩]/g,function(S){return S.charCodeAt(0)-1632}).replace(/[۰۱۲۳۴۵۶۷۸۹]/g,function(S){return S.charCodeAt(0)-1776});var f=Number(u);return isNaN(f)?f:(i&&(u=f),u)}},{key:"triggerEvent",value:function(e){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,u=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],f=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];window.CustomEvent?i=new CustomEvent(e,{detail:o,bubbles:u,cancelable:f}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,u,f,{detail:o}),r.dispatchEvent(i)}},{key:"parseStr",value:function(e){var i,r,o,u,f={};if(e===0&&1/e<0&&(e="-0"),e=e.toString(),this.isNegativeStrict(e,"-")?(e=e.slice(1),f.s=-1):f.s=1,(i=e.indexOf("."))>-1&&(e=e.replace(".","")),i<0&&(i=e.length),(r=e.search(/[1-9]/i)===-1?e.length:e.search(/[1-9]/i))===(o=e.length))f.e=0,f.c=[0];else{for(u=o-1;e.charAt(u)==="0";u-=1)o-=1;for(o-=1,f.e=i-r-1,f.c=[],i=0;r<=o;r+=1)f.c[i]=+e.charAt(r),i+=1}return f}},{key:"testMinMax",value:function(e,i){var r=i.c,o=e.c,u=i.s,f=e.s,S=i.e,E=e.e;if(!r[0]||!o[0])return r[0]?u:o[0]?-f:0;if(u!==f)return u;var N=u<0;if(S!==E)return S>E^N?1:-1;for(u=-1,f=(S=r.length)<(E=o.length)?S:E,u+=1;u<f;u+=1)if(r[u]!==o[u])return r[u]>o[u]^N?1:-1;return S===E?0:S>E^N?1:-1}},{key:"randomString",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5;return Math.random().toString(36).substr(2,e)}},{key:"domElement",value:function(e){var i;return i=s.isString(e)?document.querySelector(e):e,i}},{key:"getElementValue",value:function(e){return e.tagName.toLowerCase()==="input"?e.value:this.text(e)}},{key:"setElementValue",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;e.tagName.toLowerCase()==="input"?e.value=i:e.textContent=i}},{key:"setInvalidState",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Invalid";(i===""||this.isNull(i))&&this.throwError("Cannot set the invalid state with an empty message."),e.setCustomValidity(i)}},{key:"setValidState",value:function(e){e.setCustomValidity("")}},{key:"cloneObject",value:function(e){return y({},e)}},{key:"camelize",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-",r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],o=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3];if(this.isNull(e))return null;r&&(e=e.replace(/^data-/,""));var u=e.split(i).map(function(f){return"".concat(f.charAt(0).toUpperCase()).concat(f.slice(1))});return u=u.join(""),o&&(u="".concat(u.charAt(0).toLowerCase()).concat(u.slice(1))),u}},{key:"text",value:function(e){var i=e.nodeType;return i===Node.ELEMENT_NODE||i===Node.DOCUMENT_NODE||i===Node.DOCUMENT_FRAGMENT_NODE?e.textContent:i===Node.TEXT_NODE?e.nodeValue:""}},{key:"setText",value:function(e,i){var r=e.nodeType;r!==Node.ELEMENT_NODE&&r!==Node.DOCUMENT_NODE&&r!==Node.DOCUMENT_FRAGMENT_NODE||(e.textContent=i)}},{key:"filterOut",value:function(e,i){var r=this;return e.filter(function(o){return!r.isInArray(o,i)})}},{key:"trimPaddedZerosFromDecimalPlaces",value:function(e){if((e=String(e))==="")return"";var i=F(e.split("."),2),r=i[0],o=i[1];if(this.isUndefinedOrNullOrEmpty(o))return r;var u=o.replace(/0+$/g,"");return u===""?r:"".concat(r,".").concat(u)}},{key:"getHoveredElement",value:function(){var e=c(document.querySelectorAll(":hover"));return e[e.length-1]}},{key:"arrayTrim",value:function(e,i){var r=e.length;return r===0||i>r?e:i<0?[]:(e.length=parseInt(i,10),e)}},{key:"arrayUnique",value:function(){var e;return c(new Set((e=[]).concat.apply(e,arguments)))}},{key:"mergeMaps",value:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return new Map(i.reduce(function(o,u){return o.concat(c(u))},[]))}},{key:"objectKeyLookup",value:function(e,i){var r=Object.entries(e).find(function(u){return u[1]===i}),o=null;return r!==void 0&&(o=r[0]),o}},{key:"insertAt",value:function(e,i,r){if(r>(e=String(e)).length)throw new Error("The given index is out of the string range.");if(i.length!==1)throw new Error("The given string `char` should be only one character long.");return e===""&&r===0?i:"".concat(e.slice(0,r)).concat(i).concat(e.slice(r))}},{key:"scientificToDecimal",value:function(e){var i=Number(e);if(isNaN(i))return NaN;if(e=String(e),!this.contains(e,"e")&&!this.contains(e,"E"))return e;var r=F(e.split(/e/i),2),o=r[0],u=r[1],f=o<0;f&&(o=o.replace("-",""));var S=+u<0;S&&(u=u.replace("-",""));var E,N=F(o.split(/\./),2),d=N[0],T=N[1];return S?(E=d.length>u?this.insertAt(d,".",d.length-u):"0.".concat("0".repeat(u-d.length)).concat(d),E="".concat(E).concat(T||"")):T?(o="".concat(d).concat(T),E=u<T.length?this.insertAt(o,".",+u+d.length):"".concat(o).concat("0".repeat(u-T.length))):(o=o.replace(".",""),E="".concat(o).concat("0".repeat(Number(u)))),f&&(E="-".concat(E)),E}}],(k=null)&&vt(_.prototype,k),I&&vt(_,I),Object.defineProperty(_,"prototype",{writable:!1}),s}();function yt(s){return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},yt(s)}function Qt(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(yt(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(yt(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),yt(i)==="symbol"?i:String(i)),I)}var e,i}var Zt=function(){function s(e){if(function(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}(this,s),e===null)throw new Error("Invalid AST")}var _,k,I;return _=s,(k=[{key:"evaluate",value:function(e){if(e==null)throw new Error("Invalid AST sub-tree");if(e.type==="number")return e.value;if(e.type==="unaryMinus")return-this.evaluate(e.left);var i=this.evaluate(e.left),r=this.evaluate(e.right);switch(e.type){case"op_+":return Number(i)+Number(r);case"op_-":return i-r;case"op_*":return i*r;case"op_/":return i/r;default:throw new Error("Invalid operator '".concat(e.type,"'"))}}}])&&Qt(_.prototype,k),I&&Qt(_,I),Object.defineProperty(_,"prototype",{writable:!1}),s}();function Jt(s){return Jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},Jt(s)}function rn(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(Jt(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(Jt(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),Jt(i)==="symbol"?i:String(i)),I)}var e,i}var _t=function(){function s(){(function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")})(this,s)}var _,k,I;return _=s,I=[{key:"createNode",value:function(e,i,r){var o=new s;return o.type=e,o.left=i,o.right=r,o}},{key:"createUnaryNode",value:function(e){var i=new s;return i.type="unaryMinus",i.left=e,i.right=null,i}},{key:"createLeaf",value:function(e){var i=new s;return i.type="number",i.value=e,i}}],(k=null)&&rn(_.prototype,k),I&&rn(_,I),Object.defineProperty(_,"prototype",{writable:!1}),s}();function Yt(s){return Yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},Yt(s)}function wi(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(Yt(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(Yt(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),Yt(i)==="symbol"?i:String(i)),I)}var e,i}function It(s,_,k){return _&&wi(s.prototype,_),k&&wi(s,k),Object.defineProperty(s,"prototype",{writable:!1}),s}var _e=It(function s(_,k,I){(function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")})(this,s),this.type=_,this.value=k,this.symbol=I});function w(s){return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},w(s)}function C(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(w(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(w(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),w(i)==="symbol"?i:String(i)),I)}var e,i}var V=function(){function s(e){(function(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")})(this,s),this.text=e,this.textLength=e.length,this.index=0,this.token=new _e("Error",0,0)}var _,k,I;return _=s,k=[{key:"_skipSpaces",value:function(){for(;this.text[this.index]===" "&&this.index<=this.textLength;)this.index++}},{key:"getIndex",value:function(){return this.index}},{key:"getNextToken",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:".";if(this._skipSpaces(),this.textLength===this.index)return this.token.type="EOT",this.token;if(a.isDigit(this.text[this.index]))return this.token.type="num",this.token.value=this._getNumber(e),this.token;switch(this.token.type="Error",this.text[this.index]){case"+":this.token.type="+";break;case"-":this.token.type="-";break;case"*":this.token.type="*";break;case"/":this.token.type="/";break;case"(":this.token.type="(";break;case")":this.token.type=")"}if(this.token.type==="Error")throw new Error("Unexpected token '".concat(this.token.symbol,"' at position '").concat(this.token.index,"' in the token function"));return this.token.symbol=this.text[this.index],this.index++,this.token}},{key:"_getNumber",value:function(e){this._skipSpaces();for(var i=this.index;this.index<=this.textLength&&a.isDigit(this.text[this.index]);)this.index++;for(this.text[this.index]===e&&this.index++;this.index<=this.textLength&&a.isDigit(this.text[this.index]);)this.index++;if(this.index===i)throw new Error("No number has been found while it was expected");return this.text.substring(i,this.index).replace(e,".")}}],k&&C(_.prototype,k),I&&C(_,I),Object.defineProperty(_,"prototype",{writable:!1}),s}();function z(s){return z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},z(s)}function U(s,_){for(var k=0;k<_.length;k++){var I=_[k];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(s,(e=I.key,i=void 0,i=function(r,o){if(z(r)!=="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var f=u.call(r,o||"default");if(z(f)!=="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}(e,"string"),z(i)==="symbol"?i:String(i)),I)}var e,i}var te=function(){function s(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".";return function(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}(this,s),this.text=e,this.decimalCharacter=i,this.lexer=new V(e),this.token=this.lexer.getNextToken(this.decimalCharacter),this._exp()}var _,k,I;return _=s,(k=[{key:"_exp",value:function(){var e=this._term(),i=this._moreExp();return _t.createNode("op_+",e,i)}},{key:"_moreExp",value:function(){var e,i;switch(this.token.type){case"+":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._term(),i=this._moreExp(),_t.createNode("op_+",i,e);case"-":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._term(),i=this._moreExp(),_t.createNode("op_-",i,e)}return _t.createLeaf(0)}},{key:"_term",value:function(){var e=this._factor(),i=this._moreTerms();return _t.createNode("op_*",e,i)}},{key:"_moreTerms",value:function(){var e,i;switch(this.token.type){case"*":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._factor(),i=this._moreTerms(),_t.createNode("op_*",i,e);case"/":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._factor(),i=this._moreTerms(),_t.createNode("op_/",i,e)}return _t.createLeaf(1)}},{key:"_factor",value:function(){var e,i,r;switch(this.token.type){case"num":return r=this.token.value,this.token=this.lexer.getNextToken(this.decimalCharacter),_t.createLeaf(r);case"-":return this.token=this.lexer.getNextToken(this.decimalCharacter),i=this._factor(),_t.createUnaryNode(i);case"(":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._exp(),this._match(")"),e;default:throw new Error("Unexpected token '".concat(this.token.symbol,"' with type '").concat(this.token.type,"' at position '").concat(this.token.index,"' in the factor function"))}}},{key:"_match",value:function(e){var i=this.lexer.getIndex()-1;if(this.text[i]!==e)throw new Error("Unexpected token '".concat(this.token.symbol,"' at position '").concat(i,"' in the match function"));this.token=this.lexer.getNextToken(this.decimalCharacter)}}])&&U(_.prototype,k),I&&U(_,I),Object.defineProperty(_,"prototype",{writable:!1}),s}();function Te(s){return function(_){if(Array.isArray(_))return Y(_)}(s)||function(_){if(typeof Symbol<"u"&&_[Symbol.iterator]!=null||_["@@iterator"]!=null)return Array.from(_)}(s)||rt(s)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ie(s,_){return function(k){if(Array.isArray(k))return k}(s)||function(k,I){var e=k==null?null:typeof Symbol<"u"&&k[Symbol.iterator]||k["@@iterator"];if(e!=null){var i,r,o,u,f=[],S=!0,E=!1;try{if(o=(e=e.call(k)).next,I===0){if(Object(e)!==e)return;S=!1}else for(;!(S=(i=o.call(e)).done)&&(f.push(i.value),f.length!==I);S=!0);}catch(N){E=!0,r=N}finally{try{if(!S&&e.return!=null&&(u=e.return(),Object(u)!==u))return}finally{if(E)throw r}}return f}}(s,_)||rt(s,_)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -11,7 +11,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11
11
|
`&&(V=`
|
|
12
12
|
`);var J=0,Je=!1;this.parse=function(H,oe,j){if(typeof H!="string")throw new Error("Input must be a string");var b=H.length,fe=C.length,Oe=V.length,st=z.length,ae=_e(U),le=[],xe=[],X=[],be=J=0;if(!H)return Me();if(Te||Te!==!1&&H.indexOf(Y)===-1){for(var Ee=H.split(V),Se=0;Se<Ee.length;Se++){if(X=Ee[Se],J+=X.length,Se!==Ee.length-1)J+=V.length;else if(j)return Me();if(!z||X.substring(0,st)!==z){if(ae){if(le=[],Ne(X.split(C)),bt(),Je)return Me()}else Ne(X.split(C));if(te&&te<=Se)return le=le.slice(0,te),Me(!0)}}return Me()}for(var pe=H.indexOf(C,J),ee=H.indexOf(V,J),Ge=new RegExp(Zt(de)+Zt(Y),"g"),he=H.indexOf(Y,J);;)if(H[J]===Y)for(he=J,J++;;){if((he=H.indexOf(Y,he+1))===-1)return j||xe.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:le.length,index:J}),Ke();if(he===b-1)return Ke(H.substring(J,he).replace(Ge,Y));if(Y===de&&H[he+1]===de)he++;else if(Y===de||he===0||H[he-1]!==de){pe!==-1&&pe<he+1&&(pe=H.indexOf(C,he+1));var Pe=Gt((ee=ee!==-1&&ee<he+1?H.indexOf(V,he+1):ee)===-1?pe:Math.min(pe,ee));if(H.substr(he+1+Pe,fe)===C){X.push(H.substring(J,he).replace(Ge,Y)),H[J=he+1+Pe+fe]!==Y&&(he=H.indexOf(Y,J)),pe=H.indexOf(C,J),ee=H.indexOf(V,J);break}if(Pe=Gt(ee),H.substring(he+1+Pe,he+1+Pe+Oe)===V){if(X.push(H.substring(J,he).replace(Ge,Y)),Kt(he+1+Pe+Oe),pe=H.indexOf(C,J),he=H.indexOf(Y,J),ae&&(bt(),Je))return Me();if(te&&le.length>=te)return Me(!0);break}xe.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:le.length,index:J}),he++}}else if(z&&X.length===0&&H.substring(J,J+st)===z){if(ee===-1)return Me();J=ee+Oe,ee=H.indexOf(V,J),pe=H.indexOf(C,J)}else if(pe!==-1&&(pe<ee||ee===-1))X.push(H.substring(J,pe)),J=pe+fe,pe=H.indexOf(C,J);else{if(ee===-1)break;if(X.push(H.substring(J,ee)),Kt(ee+Oe),ae&&(bt(),Je))return Me();if(te&&le.length>=te)return Me(!0)}return Ke();function Ne(Re){le.push(Re),be=J}function Gt(Re){var et=0;return et=Re!==-1&&(Re=H.substring(he+1,Re))&&Re.trim()===""?Re.length:et}function Ke(Re){return j||(Re===void 0&&(Re=H.substring(J)),X.push(Re),J=b,Ne(X),ae&&bt()),Me()}function Kt(Re){J=Re,Ne(X),X=[],ee=H.indexOf(V,J)}function Me(Re){if(w.header&&!oe&&le.length&&!rt){var et=le[0],Ct={},Yi=new Set(et);let s=!1;for(let _=0;_<et.length;_++){let k=et[_];if(Ct[k=_e(w.transformHeader)?w.transformHeader(k,_):k]){let I,e=Ct[k];for(;I=k+"_"+e,e++,Yi.has(I););Yi.add(I),et[_]=I,Ct[k]++,s=!0,(ie=ie===null?{}:ie)[I]=k}else Ct[k]=1,et[_]=k;Yi.add(k)}s&&console.warn("Duplicate headers found and renamed."),rt=!0}return{data:le,errors:xe,meta:{delimiter:C,linebreak:V,aborted:Je,truncated:!!Re,cursor:be+(oe||0),renamedHeaders:ie}}}function bt(){U(Me()),le=[],xe=[]}},this.abort=function(){Je=!0},this.getCharIndex=function(){return J}}function rn(w){var C=w.data,V=y[C.workerId],z=!1;if(C.error)V.userError(C.error,C.file);else if(C.results&&C.results.data){var U={abort:function(){z=!0,_t(C.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Yt,resume:Yt};if(_e(V.userStep)){for(var te=0;te<C.results.data.length&&(V.userStep({data:C.results.data[te],errors:C.results.errors,meta:C.results.meta},U),!z);te++);delete C.results}else _e(V.userChunk)&&(V.userChunk(C.results,U,C.file),delete C.results)}C.finished&&!z&&_t(C.workerId,C.results)}function _t(w,C){var V=y[w];_e(V.userComplete)&&V.userComplete(C),V.terminate(),delete y[w]}function Yt(){throw new Error("Not implemented.")}function wi(w){if(typeof w!="object"||w===null)return w;var C,V=Array.isArray(w)?[]:{};for(C in w)V[C]=wi(w[C]);return V}function It(w,C){return function(){w.apply(C,arguments)}}function _e(w){return typeof w=="function"}return L.parse=function(w,C){var V=(C=C||{}).dynamicTyping||!1;if(_e(V)&&(C.dynamicTypingFunction=V,V={}),C.dynamicTyping=V,C.transform=!!_e(C.transform)&&C.transform,!C.worker||!L.WORKERS_SUPPORTED)return V=null,L.NODE_STREAM_INPUT,typeof w=="string"?(w=(z=>z.charCodeAt(0)!==65279?z:z.slice(1))(w),V=new(C.download?Ce:a)(C)):w.readable===!0&&_e(w.read)&&_e(w.on)?V=new yt(C):(h.File&&w instanceof File||w instanceof Object)&&(V=new vt(C)),V.stream(w);(V=(()=>{var z;return!!L.WORKERS_SUPPORTED&&(z=(()=>{var U=h.URL||h.webkitURL||null,te=n.toString();return L.BLOB_URL||(L.BLOB_URL=U.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",te,")();"],{type:"text/javascript"})))})(),(z=new h.Worker(z)).onmessage=rn,z.id=F++,y[z.id]=z)})()).userStep=C.step,V.userChunk=C.chunk,V.userComplete=C.complete,V.userError=C.error,C.step=_e(C.step),C.chunk=_e(C.chunk),C.complete=_e(C.complete),C.error=_e(C.error),delete C.worker,V.postMessage({input:w,config:C,workerId:V.id})},L.unparse=function(w,C){var V=!1,z=!0,U=",",te=`\r
|
|
13
13
|
`,Te='"',ie=Te+Te,rt=!1,Y=null,de=!1,J=((()=>{if(typeof C=="object"){if(typeof C.delimiter!="string"||L.BAD_DELIMITERS.filter(function(oe){return C.delimiter.indexOf(oe)!==-1}).length||(U=C.delimiter),typeof C.quotes!="boolean"&&typeof C.quotes!="function"&&!Array.isArray(C.quotes)||(V=C.quotes),typeof C.skipEmptyLines!="boolean"&&typeof C.skipEmptyLines!="string"||(rt=C.skipEmptyLines),typeof C.newline=="string"&&(te=C.newline),typeof C.quoteChar=="string"&&(Te=C.quoteChar),typeof C.header=="boolean"&&(z=C.header),Array.isArray(C.columns)){if(C.columns.length===0)throw new Error("Option columns is empty");Y=C.columns}C.escapeChar!==void 0&&(ie=C.escapeChar+Te),C.escapeFormulae instanceof RegExp?de=C.escapeFormulae:typeof C.escapeFormulae=="boolean"&&C.escapeFormulae&&(de=/^[=+\-@\t\r].*$/)}})(),new RegExp(Zt(Te),"g"));if(typeof w=="string"&&(w=JSON.parse(w)),Array.isArray(w)){if(!w.length||Array.isArray(w[0]))return Je(null,w,rt);if(typeof w[0]=="object")return Je(Y||Object.keys(w[0]),w,rt)}else if(typeof w=="object")return typeof w.data=="string"&&(w.data=JSON.parse(w.data)),Array.isArray(w.data)&&(w.fields||(w.fields=w.meta&&w.meta.fields||Y),w.fields||(w.fields=Array.isArray(w.data[0])?w.fields:typeof w.data[0]=="object"?Object.keys(w.data[0]):[]),Array.isArray(w.data[0])||typeof w.data[0]=="object"||(w.data=[w.data])),Je(w.fields||[],w.data||[],rt);throw new Error("Unable to serialize unrecognized input");function Je(oe,j,b){var fe="",Oe=(typeof oe=="string"&&(oe=JSON.parse(oe)),typeof j=="string"&&(j=JSON.parse(j)),Array.isArray(oe)&&0<oe.length),st=!Array.isArray(j[0]);if(Oe&&z){for(var ae=0;ae<oe.length;ae++)0<ae&&(fe+=U),fe+=H(oe[ae],ae);0<j.length&&(fe+=te)}for(var le=0;le<j.length;le++){var xe=(Oe?oe:j[le]).length,X=!1,be=Oe?Object.keys(j[le]).length===0:j[le].length===0;if(b&&!Oe&&(X=b==="greedy"?j[le].join("").trim()==="":j[le].length===1&&j[le][0].length===0),b==="greedy"&&Oe){for(var Ee=[],Se=0;Se<xe;Se++){var pe=st?oe[Se]:Se;Ee.push(j[le][pe])}X=Ee.join("").trim()===""}if(!X){for(var ee=0;ee<xe;ee++){0<ee&&!be&&(fe+=U);var Ge=Oe&&st?oe[ee]:ee;fe+=H(j[le][Ge],ee)}le<j.length-1&&(!b||0<xe&&!be)&&(fe+=te)}}return fe}function H(oe,j){var b,fe;return oe==null?"":oe.constructor===Date?JSON.stringify(oe).slice(1,25):(fe=!1,de&&typeof oe=="string"&&de.test(oe)&&(oe="'"+oe,fe=!0),b=oe.toString().replace(J,ie),(fe=fe||V===!0||typeof V=="function"&&V(oe,j)||Array.isArray(V)&&V[j]||((Oe,st)=>{for(var ae=0;ae<st.length;ae++)if(-1<Oe.indexOf(st[ae]))return!0;return!1})(b,L.BAD_DELIMITERS)||-1<b.indexOf(U)||b.charAt(0)===" "||b.charAt(b.length-1)===" ")?Te+b+Te:b)}},L.RECORD_SEP="",L.UNIT_SEP="",L.BYTE_ORDER_MARK="\uFEFF",L.BAD_DELIMITERS=["\r",`
|
|
14
|
-
`,'"',L.BYTE_ORDER_MARK],L.WORKERS_SUPPORTED=!l&&!!h.Worker,L.NODE_STREAM_INPUT=1,L.LocalChunkSize=10485760,L.RemoteChunkSize=5242880,L.DefaultDelimiter=",",L.Parser=Jt,L.ParserHandle=Qt,L.NetworkStreamer=Ce,L.FileStreamer=vt,L.StringStreamer=a,L.ReadableStreamStreamer=yt,h.jQuery&&((t=h.jQuery).fn.parse=function(w){var C=w.config||{},V=[];return this.each(function(te){if(!(t(this).prop("tagName").toUpperCase()==="INPUT"&&t(this).attr("type").toLowerCase()==="file"&&h.FileReader)||!this.files||this.files.length===0)return!0;for(var Te=0;Te<this.files.length;Te++)V.push({file:this.files[Te],inputElem:this,instanceConfig:t.extend({},C)})}),z(),this;function z(){if(V.length===0)_e(w.complete)&&w.complete();else{var te,Te,ie,rt,Y=V[0];if(_e(w.before)){var de=w.before(Y.file,Y.inputElem);if(typeof de=="object"){if(de.action==="abort")return te="AbortError",Te=Y.file,ie=Y.inputElem,rt=de.reason,void(_e(w.error)&&w.error({name:te},Te,ie,rt));if(de.action==="skip")return void U();typeof de.config=="object"&&(Y.instanceConfig=t.extend(Y.instanceConfig,de.config))}else if(de==="skip")return void U()}var J=Y.instanceConfig.complete;Y.instanceConfig.complete=function(Je){_e(J)&&J(Je,Y.file,Y.inputElem),U()},L.parse(Y.file,Y.instanceConfig)}}function U(){V.splice(0,1),z()}}),c&&(h.onmessage=function(w){w=w.data,L.WORKER_ID===void 0&&w&&(L.WORKER_ID=w.workerId),typeof w.input=="string"?h.postMessage({workerId:L.WORKER_ID,results:L.parse(w.input,w.config),finished:!0}):(h.File&&w.input instanceof File||w.input instanceof Object)&&(w=L.parse(w.input,w.config))&&h.postMessage({workerId:L.WORKER_ID,results:w,finished:!0})}),(Ce.prototype=Object.create(ye.prototype)).constructor=Ce,(vt.prototype=Object.create(ye.prototype)).constructor=vt,(a.prototype=Object.create(a.prototype)).constructor=a,(yt.prototype=Object.create(ye.prototype)).constructor=yt,L})});var fa=(()=>{class n extends oa{pathId;ngOnInit(){this.pathId="url(#"+bi()+")"}static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["UploadIcon"]],features:[ht],decls:6,vars:7,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M6.58942 9.82197C6.70165 9.93405 6.85328 9.99793 7.012 10C7.17071 9.99793 7.32234 9.93405 7.43458 9.82197C7.54681 9.7099 7.61079 9.55849 7.61286 9.4V2.04798L9.79204 4.22402C9.84752 4.28011 9.91365 4.32457 9.98657 4.35479C10.0595 4.38502 10.1377 4.40039 10.2167 4.40002C10.2956 4.40039 10.3738 4.38502 10.4467 4.35479C10.5197 4.32457 10.5858 4.28011 10.6413 4.22402C10.7538 4.11152 10.817 3.95902 10.817 3.80002C10.817 3.64102 10.7538 3.48852 10.6413 3.37602L7.45127 0.190618C7.44656 0.185584 7.44176 0.180622 7.43687 0.175736C7.32419 0.063214 7.17136 0 7.012 0C6.85264 0 6.69981 0.063214 6.58712 0.175736C6.58181 0.181045 6.5766 0.186443 6.5715 0.191927L3.38282 3.37602C3.27669 3.48976 3.2189 3.6402 3.22165 3.79564C3.2244 3.95108 3.28746 4.09939 3.39755 4.20932C3.50764 4.31925 3.65616 4.38222 3.81182 4.38496C3.96749 4.3877 4.11814 4.33001 4.23204 4.22402L6.41113 2.04807V9.4C6.41321 9.55849 6.47718 9.7099 6.58942 9.82197ZM11.9952 14H2.02883C1.751 13.9887 1.47813 13.9228 1.22584 13.8061C0.973545 13.6894 0.746779 13.5241 0.558517 13.3197C0.370254 13.1154 0.22419 12.876 0.128681 12.6152C0.0331723 12.3545 -0.00990605 12.0775 0.0019109 11.8V9.40005C0.0019109 9.24092 0.065216 9.08831 0.1779 8.97579C0.290584 8.86326 0.443416 8.80005 0.602775 8.80005C0.762134 8.80005 0.914966 8.86326 1.02765 8.97579C1.14033 9.08831 1.20364 9.24092 1.20364 9.40005V11.8C1.18295 12.0376 1.25463 12.274 1.40379 12.4602C1.55296 12.6463 1.76817 12.7681 2.00479 12.8H11.9952C12.2318 12.7681 12.447 12.6463 12.5962 12.4602C12.7453 12.274 12.817 12.0376 12.7963 11.8V9.40005C12.7963 9.24092 12.8596 9.08831 12.9723 8.97579C13.085 8.86326 13.2378 8.80005 13.3972 8.80005C13.5565 8.80005 13.7094 8.86326 13.8221 8.97579C13.9347 9.08831 13.998 9.24092 13.998 9.40005V11.8C14.022 12.3563 13.8251 12.8996 13.45 13.3116C13.0749 13.7236 12.552 13.971 11.9952 14Z","fill","currentColor"],[3,"id"],["width","14","height","14","fill","white"]],template:function(l,c){l&1&&(Eo(),p(0,"svg",0)(1,"g"),D(2,"path",1),m(),p(3,"defs")(4,"clipPath",2),D(5,"rect",3),m()()()),l&2&&(Qe(c.getClassNames()),se("aria-label",c.ariaLabel)("aria-hidden",c.ariaHidden)("role",c.role),g(),se("clip-path",c.pathId),g(3),v("id",c.pathId))},encapsulation:2})}return n})();var Xe=(()=>{class n{constructor(){this.#e=K(Wo),this.authService=K(Ho)}#e;getJournalEntryLoader(){return this.#e.get("","api/JournalLoader/JournalEntry")}getJournalReceiveMoney(){return this.#e.get("","api/JournalLoader/ReceiveJournal")}getJournalRecordExpenseLoader(){return this.#e.get("","api/JournalLoader/RecordExpense")}getJournalEntryData(t){return this.#e.post("","api/Journal/JournalEntry",t)}getJournalEntryInfo(t){let l={ID:t};return this.#e.get("","/api/Journal/Info",{params:l})}getJournalEntryForm(t){return this.#e.get("",`api/journalloader/form/${t}`).pipe()}getJournalEntryCount(){return this.#e.post("","api/Journal/JournalEntryCount",{})}getJournalEntryCustomerSuggestions(t){let l={Prefix:t,Count:100};return this.#e.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:l})}getJournalEntrySupplierSuggestions(t){let l={Prefix:t,Count:100};return this.#e.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:l})}submitJournalEntry(t){return this.#e.post(void 0,"api/journal/submit",t,{observe:"response"})}deleteJournalEntry(t){let l={params:{ID:t.join(",")}};return this.#e.delete(void 0,"/api/Journal/delete",l)}fetchCategoryOptions(){return this.#e.get("","api/ChartOfAccount/CategoryOptions")}submitChartAccount(t,l={}){return this.#e.post("","api/ChartOfAccount/Submit",t,l)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var Ya={filter:{transID:"",bulkID:"",rowCount:10,pageNumber:1,orderBy:0,orderbyCreated:0,auditEditor:!1,listOutletID:[],searchAudit:!1},data:[],count:0},Qn=qo(Xo(Ya),ea("JournalEntryStore"),Qo(n=>({first:ut(()=>(n.filter().pageNumber-1)*n.filter().rowCount+1),end:ut(()=>Math.min(n.filter().pageNumber*n.filter().rowCount,n.count())),selectedItems:ut(()=>n.data().filter(h=>h.checked))})),Yo(n=>{let h=K(Xe);return{updateCount(t){Ri(n,l=>Ie(ve({},l),{count:t}))},updateFilter(t){Ri(n,l=>Ie(ve({},l),{filter:ve(ve({},l.filter),t)}))},loadJournalEntryLoader:Hn(zn(Xi(()=>h.getJournalEntryLoader().pipe(qn({next:t=>{console.log("response",t),Ri(n,l=>Ie(ve({},l),{filter:Ie(ve({},t.filter),{pageNumber:1})})),console.log("store",n)},error(t){console.log("error",t)}}))))),loadJournalEntryData:Hn(zn(mn(t=>!!t),Xi(t=>h.getJournalEntryData(t).pipe(kt(l=>Ie(ve({},l),{data:l.data.map(c=>Ie(ve({},c),{checked:!1}))})),qn({next(l){console.log("response",l),Ri(n,c=>Ie(ve({},c),{data:l.data}))},error(l){console.log("error",l)}}))))),updateData:t=>{Ri(n,l=>Ie(ve({},l),{data:t}))}}}),Zo({onInit(n){n.loadJournalEntryLoader()}}));var er=["filterRef"],tr=["class","page"],ir=n=>[n];function nr(n,h){if(n&1){let t=q();p(0,"button",13),$("click",function(){M(t);let c=P();return R(c.onDeleteJournalEntry())}),x(1," Delete "),m()}}function or(n,h){n&1&&(p(0,"tr")(1,"th",14),D(2,"p-tableHeaderCheckbox"),m(),p(3,"th"),x(4,"Outlet"),m(),p(5,"th"),x(6,"Number"),m(),p(7,"th"),x(8,"Date/Name"),m(),p(9,"th"),x(10,"Description"),m(),p(11,"th"),x(12,"Code"),m(),p(13,"th"),x(14,"Account"),m(),p(15,"th"),x(16,"Debit"),m(),p(17,"th"),x(18,"Credit"),m()())}function ar(n,h){if(n&1&&x(0),n&2){let t=h.$implicit;ct(" ",t.note," ")}}function rr(n,h){if(n&1&&(p(0,"span"),x(1),m()),n&2){let t=h.$implicit;g(),re(t.accountCode)}}function sr(n,h){if(n&1&&(p(0,"span"),x(1),m()),n&2){let t=h.$implicit;g(),re(t.accountName)}}function lr(n,h){if(n&1&&(p(0,"span"),x(1),Be(2,"number"),m()),n&2){let t=h.$implicit;g(),re(Ze(2,1,t.debitAmount))}}function cr(n,h){if(n&1&&(p(0,"span"),x(1),Be(2,"number"),m()),n&2){let t=h.$implicit;g(),re(Ze(2,1,t.creditAmount))}}function ur(n,h){if(n&1&&(p(0,"tr")(1,"td"),D(2,"p-tableCheckbox",15),m(),p(3,"td"),x(4),m(),p(5,"td")(6,"a",16),x(7),m()(),p(8,"td"),x(9),Be(10,"date"),m(),p(11,"td"),St(12,ar,1,1,null,null,Nt),m(),p(14,"td")(15,"div",17),St(16,rr,2,1,"span",null,Nt),m()(),p(18,"td")(19,"div",17),St(20,sr,2,1,"span",null,Nt),m()(),p(22,"td")(23,"div",17),St(24,lr,3,3,"span",null,Nt),m()(),p(26,"td")(27,"div",17),St(28,cr,3,3,"span",null,Nt),m()()()),n&2){let t=h.$implicit;g(2),v("value",t),g(2),re(t.outletName),g(2),v("routerLink",ge(8,ir,t.id)),g(),re(t.number),g(2),re(en(10,5,t.date,"dd MMM y")),g(3),wt(t.items),g(4),wt(t.items),g(4),wt(t.items),g(4),wt(t.items),g(4),wt(t.items)}}function mr(n,h){if(n&1&&x(0),n&2){let t=P(2);ct(" ",t.JournalEntryStore.count()," ")}}function dr(n,h){if(n&1){let t=q();p(0,"p-button",19),$("onClick",function(){M(t);let c=P(2);return R(c.getJournalEntryCount())}),m()}n&2&&v("rounded",!0)("text",!0)}function pr(n,h){if(n&1&&(x(0),O(1,mr,1,1)(2,dr,1,2,"p-button",18),x(3," entries ")),n&2){let t=P();gn(" Showing ",t.JournalEntryStore.first()," to ",t.JournalEntryStore.end()," of "),g(),ze(t.JournalEntryStore.count()?1:2)}}function hr(n,h){n&1&&(p(0,"div",20)(1,"div",21)(2,"h5",22),x(3,"Card title"),m(),p(4,"h6",23),x(5,"Card subtitle"),m(),p(6,"p",24),x(7," Some quick example text to build on the card title and make up the bulk of the card's content. "),m(),p(8,"a",25),x(9,"Card link"),m(),p(10,"a",25),x(11,"Another link"),m()()())}var va=(()=>{class n{constructor(){this.JournalEntryStore=K(Qn),this.modalService=K(Cn),this.journalEntryService=K(Xe)}ngOnInit(){console.log("Journal Entry Page");let t=this.JournalEntryStore.filter;this.JournalEntryStore.loadJournalEntryData(t)}onFilterChange(t){console.log("Filter Change",t),this.modalService.open(this.templateRef)}onRowSelect(t){this.updateRowSelection(t.data,!0)}onRowUnselect(t){this.updateRowSelection(t.data,!1)}updateRowSelection(t,l){this.JournalEntryStore.updateData(this.JournalEntryStore.data().map(c=>c.id===t.id?Ie(ve({},c),{checked:l}):c))}onHeaderCheckboxToggle(t){let l=this.JournalEntryStore.data().map(c=>Ie(ve({},c),{checked:t.checked}));this.JournalEntryStore.updateData(l)}onPageChange(t){let l=t.first/t.rows;this.JournalEntryStore.updateFilter({pageNumber:l+1})}next(){this.JournalEntryStore.updateFilter({pageNumber:this.JournalEntryStore.filter().pageNumber+1})}prev(){this.JournalEntryStore.filter().pageNumber<=1||this.JournalEntryStore.updateFilter({pageNumber:this.JournalEntryStore.filter().pageNumber-1})}getJournalEntryCount(){this.journalEntryService.getJournalEntryCount().pipe(Fe(t=>this.JournalEntryStore.updateCount(t.count))).subscribe()}onDeleteJournalEntry(){let l=this.JournalEntryStore.selectedItems().map(c=>c.id);this.journalEntryService.deleteJournalEntry(l).pipe(Fe(()=>{this.JournalEntryStore.loadJournalEntryData(this.JournalEntryStore.filter())})).subscribe()}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry",8,"page"]],viewQuery:function(l,c){if(l&1&&ot(er,7),l&2){let y;Q(y=Z())&&(c.templateRef=y.first)}},features:[je([Qn])],attrs:tr,decls:23,vars:9,consts:[["header",""],["body",""],["paginatorleft",""],["filterRef",""],["pageTitle","Manual Journal",3,"eventFilterChange","isSearchableInput"],["ngProjectAs","action-button",5,["action-button"]],["class","btn btn-danger rounded",3,"click",4,"ngIf"],["role","group","aria-label","Basic example",1,"btn-group"],["type","button",1,"btn","btn-light"],["type","button","routerLink","add",1,"btn","btn-primary","rounded","d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-plus"],["ngProjectAs","content",5,["content"]],["stripedRows","","dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","totalRecords","lazy","rows","scrollable","scrollHeight"],[1,"btn","btn-danger","rounded",3,"click"],[2,"width","4rem"],[3,"value"],[1,"link","link-primary",3,"routerLink"],[1,"d-flex","flex-column"],["icon","fa-light fa-question","severity","primary",3,"rounded","text"],["icon","fa-light fa-question","severity","primary",3,"onClick","rounded","text"],[1,"card",2,"width","18rem"],[1,"card-body"],[1,"card-title"],[1,"card-subtitle","mb-2","text-body-secondary"],[1,"card-text"],["href","#",1,"card-link"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),$("eventFilterChange",function(L){return M(y),R(c.onFilterChange(L))}),ce(1,5),O(2,nr,2,0,"button",6),p(3,"div",7)(4,"button",8),x(5,"Import"),m(),p(6,"button",8),x(7,"Export"),m()(),p(8,"a",9),D(9,"i",10),p(10,"span"),x(11,"Add"),m()(),ue(),ce(12,11),p(13,"p-card")(14,"p-table",12),$("onPage",function(L){return M(y),R(c.onPageChange(L))})("onRowSelect",function(L){return M(y),R(c.onRowSelect(L))})("onRowUnselect",function(L){return M(y),R(c.onRowUnselect(L))})("onHeaderCheckboxToggle",function(L){return M(y),R(c.onHeaderCheckboxToggle(L))}),O(15,or,19,0,"ng-template",null,0,me)(17,ur,30,10,"ng-template",null,1,me)(19,pr,4,3,"ng-template",null,2,me),m()(),ue(),m(),O(21,hr,12,0,"ng-template",null,3,me)}l&2&&(v("isSearchableInput",!0),g(2),v("ngIf",c.JournalEntryStore.selectedItems().length),g(12),v("value",c.JournalEntryStore.data())("paginator",!0)("totalRecords",c.JournalEntryStore.count())("lazy",!0)("rows",c.JournalEntryStore.filter().rowCount)("scrollable",!0)("scrollHeight","calc(100vh - 200px)"))},dependencies:[Pt,Le,Ye,Vt,yn,pa,Ko,wn,Sn,jt,Ut,ma,da,zt,ft,$t,pi],encapsulation:2,changeDetection:0})}}return n})();var gr=["header"],fr=["icons"],vr=["content"],yr=["footer"],_r=["headericons"],br=["contentWrapper"],Sr=["*",[["p-header"]],[["p-footer"]]],wr=["*","p-header","p-footer"],Cr=(n,h)=>({"p-panel p-component":!0,"p-panel-toggleable":n,"p-panel-expanded":h}),xr=n=>({transitionParams:n,height:"0",opacity:"0"}),Er=n=>({value:"hidden",params:n}),Pr=n=>({transitionParams:n,height:"*",opacity:"1"}),kr=n=>({value:"visible",params:n}),Tr=(n,h,t)=>({"p-panel-icons-start":n,"p-panel-icons-end":h,"p-panel-icons-center":t}),Ir=n=>({$implicit:n});function Fr(n,h){if(n&1&&(p(0,"span",12),x(1),m()),n&2){let t=P(2);se("id",t.id+"_header"),g(),re(t._header)}}function Or(n,h){n&1&&Ue(0)}function Nr(n,h){}function Dr(n,h){n&1&&O(0,Nr,0,0,"ng-template")}function Vr(n,h){if(n&1&&D(0,"span"),n&2){let t=P(6);Qe(t.expandIcon)}}function Ar(n,h){n&1&&D(0,"MinusIcon")}function Lr(n,h){if(n&1&&(ce(0),O(1,Vr,1,2,"span",16)(2,Ar,1,0,"MinusIcon",14),ue()),n&2){let t=P(5);g(),v("ngIf",t.expandIcon),g(),v("ngIf",!t.expandIcon)}}function Mr(n,h){if(n&1&&D(0,"span"),n&2){let t=P(6);Qe(t.collapseIcon)}}function Rr(n,h){n&1&&D(0,"PlusIcon")}function Br(n,h){if(n&1&&(ce(0),O(1,Mr,1,2,"span",16)(2,Rr,1,0,"PlusIcon",14),ue()),n&2){let t=P(5);g(),v("ngIf",t.collapseIcon),g(),v("ngIf",!t.collapseIcon)}}function zr(n,h){if(n&1&&(ce(0),O(1,Lr,3,2,"ng-container",14)(2,Br,3,2,"ng-container",14),ue()),n&2){let t=P(4);g(),v("ngIf",!t.collapsed),g(),v("ngIf",t.collapsed)}}function Ur(n,h){}function jr(n,h){n&1&&O(0,Ur,0,0,"ng-template")}function $r(n,h){if(n&1&&O(0,zr,3,2,"ng-container",14)(1,jr,1,0,null,15),n&2){let t=P(3);v("ngIf",!t.headerIconsTemplate&&!t._headerIconsTemplate&&!(t.toggleButtonProps!=null&&t.toggleButtonProps.icon)),g(),v("ngTemplateOutlet",t.headerIconsTemplate||t._headerIconsTemplate)("ngTemplateOutletContext",ge(3,Ir,t.collapsed))}}function Jr(n,h){if(n&1){let t=q();p(0,"p-button",13),$("click",function(c){M(t);let y=P(2);return R(y.onIconClick(c))})("keydown",function(c){M(t);let y=P(2);return R(y.onKeyDown(c))}),O(1,$r,2,5,"ng-template",null,1,me),m()}if(n&2){let t=P(2);v("text",!0)("rounded",!0)("buttonProps",t.toggleButtonProps),se("id",t.id+"_header")("aria-label",t.buttonAriaLabel)("aria-controls",t.id+"_content")("aria-expanded",!t.collapsed)}}function Gr(n,h){if(n&1){let t=q();p(0,"div",8),$("click",function(c){M(t);let y=P();return R(y.onHeaderClick(c))}),O(1,Fr,2,2,"span",9),ti(2,1),O(3,Or,1,0,"ng-container",6),p(4,"div",10),O(5,Dr,1,0,null,6)(6,Jr,3,7,"p-button",11),m()()}if(n&2){let t=P();se("id",t.id+"-titlebar"),g(),v("ngIf",t._header),g(2),v("ngTemplateOutlet",t.headerTemplate||t._headerTemplate),g(),v("ngClass",fn(6,Tr,t.iconPos==="start",t.iconPos==="end",t.iconPos==="center")),g(),v("ngTemplateOutlet",t.iconTemplate||t._iconTemplate),g(),v("ngIf",t.toggleable)}}function Kr(n,h){n&1&&Ue(0)}function Wr(n,h){n&1&&Ue(0)}function Hr(n,h){if(n&1&&(p(0,"div",17),ti(1,2),O(2,Wr,1,0,"ng-container",6),m()),n&2){let t=P();g(2),v("ngTemplateOutlet",t.footerTemplate||t._footerTemplate)}}var qr=({dt:n})=>`
|
|
14
|
+
`,'"',L.BYTE_ORDER_MARK],L.WORKERS_SUPPORTED=!l&&!!h.Worker,L.NODE_STREAM_INPUT=1,L.LocalChunkSize=10485760,L.RemoteChunkSize=5242880,L.DefaultDelimiter=",",L.Parser=Jt,L.ParserHandle=Qt,L.NetworkStreamer=Ce,L.FileStreamer=vt,L.StringStreamer=a,L.ReadableStreamStreamer=yt,h.jQuery&&((t=h.jQuery).fn.parse=function(w){var C=w.config||{},V=[];return this.each(function(te){if(!(t(this).prop("tagName").toUpperCase()==="INPUT"&&t(this).attr("type").toLowerCase()==="file"&&h.FileReader)||!this.files||this.files.length===0)return!0;for(var Te=0;Te<this.files.length;Te++)V.push({file:this.files[Te],inputElem:this,instanceConfig:t.extend({},C)})}),z(),this;function z(){if(V.length===0)_e(w.complete)&&w.complete();else{var te,Te,ie,rt,Y=V[0];if(_e(w.before)){var de=w.before(Y.file,Y.inputElem);if(typeof de=="object"){if(de.action==="abort")return te="AbortError",Te=Y.file,ie=Y.inputElem,rt=de.reason,void(_e(w.error)&&w.error({name:te},Te,ie,rt));if(de.action==="skip")return void U();typeof de.config=="object"&&(Y.instanceConfig=t.extend(Y.instanceConfig,de.config))}else if(de==="skip")return void U()}var J=Y.instanceConfig.complete;Y.instanceConfig.complete=function(Je){_e(J)&&J(Je,Y.file,Y.inputElem),U()},L.parse(Y.file,Y.instanceConfig)}}function U(){V.splice(0,1),z()}}),c&&(h.onmessage=function(w){w=w.data,L.WORKER_ID===void 0&&w&&(L.WORKER_ID=w.workerId),typeof w.input=="string"?h.postMessage({workerId:L.WORKER_ID,results:L.parse(w.input,w.config),finished:!0}):(h.File&&w.input instanceof File||w.input instanceof Object)&&(w=L.parse(w.input,w.config))&&h.postMessage({workerId:L.WORKER_ID,results:w,finished:!0})}),(Ce.prototype=Object.create(ye.prototype)).constructor=Ce,(vt.prototype=Object.create(ye.prototype)).constructor=vt,(a.prototype=Object.create(a.prototype)).constructor=a,(yt.prototype=Object.create(ye.prototype)).constructor=yt,L})});var fa=(()=>{class n extends oa{pathId;ngOnInit(){this.pathId="url(#"+bi()+")"}static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["UploadIcon"]],features:[ht],decls:6,vars:7,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M6.58942 9.82197C6.70165 9.93405 6.85328 9.99793 7.012 10C7.17071 9.99793 7.32234 9.93405 7.43458 9.82197C7.54681 9.7099 7.61079 9.55849 7.61286 9.4V2.04798L9.79204 4.22402C9.84752 4.28011 9.91365 4.32457 9.98657 4.35479C10.0595 4.38502 10.1377 4.40039 10.2167 4.40002C10.2956 4.40039 10.3738 4.38502 10.4467 4.35479C10.5197 4.32457 10.5858 4.28011 10.6413 4.22402C10.7538 4.11152 10.817 3.95902 10.817 3.80002C10.817 3.64102 10.7538 3.48852 10.6413 3.37602L7.45127 0.190618C7.44656 0.185584 7.44176 0.180622 7.43687 0.175736C7.32419 0.063214 7.17136 0 7.012 0C6.85264 0 6.69981 0.063214 6.58712 0.175736C6.58181 0.181045 6.5766 0.186443 6.5715 0.191927L3.38282 3.37602C3.27669 3.48976 3.2189 3.6402 3.22165 3.79564C3.2244 3.95108 3.28746 4.09939 3.39755 4.20932C3.50764 4.31925 3.65616 4.38222 3.81182 4.38496C3.96749 4.3877 4.11814 4.33001 4.23204 4.22402L6.41113 2.04807V9.4C6.41321 9.55849 6.47718 9.7099 6.58942 9.82197ZM11.9952 14H2.02883C1.751 13.9887 1.47813 13.9228 1.22584 13.8061C0.973545 13.6894 0.746779 13.5241 0.558517 13.3197C0.370254 13.1154 0.22419 12.876 0.128681 12.6152C0.0331723 12.3545 -0.00990605 12.0775 0.0019109 11.8V9.40005C0.0019109 9.24092 0.065216 9.08831 0.1779 8.97579C0.290584 8.86326 0.443416 8.80005 0.602775 8.80005C0.762134 8.80005 0.914966 8.86326 1.02765 8.97579C1.14033 9.08831 1.20364 9.24092 1.20364 9.40005V11.8C1.18295 12.0376 1.25463 12.274 1.40379 12.4602C1.55296 12.6463 1.76817 12.7681 2.00479 12.8H11.9952C12.2318 12.7681 12.447 12.6463 12.5962 12.4602C12.7453 12.274 12.817 12.0376 12.7963 11.8V9.40005C12.7963 9.24092 12.8596 9.08831 12.9723 8.97579C13.085 8.86326 13.2378 8.80005 13.3972 8.80005C13.5565 8.80005 13.7094 8.86326 13.8221 8.97579C13.9347 9.08831 13.998 9.24092 13.998 9.40005V11.8C14.022 12.3563 13.8251 12.8996 13.45 13.3116C13.0749 13.7236 12.552 13.971 11.9952 14Z","fill","currentColor"],[3,"id"],["width","14","height","14","fill","white"]],template:function(l,c){l&1&&(Eo(),p(0,"svg",0)(1,"g"),D(2,"path",1),m(),p(3,"defs")(4,"clipPath",2),D(5,"rect",3),m()()()),l&2&&(Qe(c.getClassNames()),se("aria-label",c.ariaLabel)("aria-hidden",c.ariaHidden)("role",c.role),g(),se("clip-path",c.pathId),g(3),v("id",c.pathId))},encapsulation:2})}return n})();var Xe=(()=>{class n{constructor(){this.#e=K(Wo),this.authService=K(Ho)}#e;getJournalEntryLoader(){return this.#e.get("","api/JournalLoader/JournalEntry")}getJournalReceiveMoney(){return this.#e.get("","api/JournalLoader/ReceiveJournal")}getJournalRecordExpenseLoader(){return this.#e.get("","api/JournalLoader/RecordExpense")}getJournalEntryData(t){return this.#e.post("","api/Journal/JournalEntry",t)}getJournalEntryInfo(t){let l={ID:t};return this.#e.get("","/api/Journal/Info",{params:l})}getJournalEntryForm(t){return this.#e.get("",`api/journalloader/form/${t}`).pipe()}getJournalEntryCount(){return this.#e.post("","api/Journal/JournalEntryCount",{})}getJournalEntryCustomerSuggestions(t){let l={Prefix:t,Count:100};return this.#e.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:l})}getJournalEntrySupplierSuggestions(t){let l={Prefix:t,Count:100};return this.#e.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:l})}submitJournalEntry(t){return this.#e.post(void 0,"api/journal/submit",t,{observe:"response"})}deleteJournalEntry(t){let l={params:{ID:t.join(",")}};return this.#e.delete(void 0,"/api/Journal/delete",l)}fetchCategoryOptions(){return this.#e.get("","api/ChartOfAccount/CategoryOptions")}submitChartAccount(t,l={}){return this.#e.post("","api/ChartOfAccount/Submit",t,l)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var Ya={filter:{transID:"",bulkID:"",rowCount:10,pageNumber:1,orderBy:0,orderbyCreated:0,auditEditor:!1,listOutletID:[],searchAudit:!1},data:[],count:0},Qn=qo(Xo(Ya),ea("JournalEntryStore"),Qo(n=>({first:ut(()=>(n.filter().pageNumber-1)*n.filter().rowCount+1),end:ut(()=>Math.min(n.filter().pageNumber*n.filter().rowCount,n.count())),selectedItems:ut(()=>n.data().filter(h=>h.checked))})),Yo(n=>{let h=K(Xe);return{updateCount(t){Ri(n,l=>Ie(ve({},l),{count:t}))},updateFilter(t){Ri(n,l=>Ie(ve({},l),{filter:ve(ve({},l.filter),t)}))},loadJournalEntryLoader:Hn(zn(Xi(()=>h.getJournalEntryLoader().pipe(qn({next:t=>{console.log("response",t),Ri(n,l=>Ie(ve({},l),{filter:Ie(ve({},t.filter),{pageNumber:1})})),console.log("store",n)},error(t){console.log("error",t)}}))))),loadJournalEntryData:Hn(zn(mn(t=>!!t),Xi(t=>h.getJournalEntryData(t).pipe(kt(l=>Ie(ve({},l),{data:l.data.map(c=>Ie(ve({},c),{checked:!1}))})),qn({next(l){console.log("response",l),Ri(n,c=>Ie(ve({},c),{data:l.data}))},error(l){console.log("error",l)}}))))),updateData:t=>{Ri(n,l=>Ie(ve({},l),{data:t}))}}}),Zo({onInit(n){n.loadJournalEntryLoader()}}));var er=["filterRef"],tr=["class","page"],ir=n=>[n];function nr(n,h){if(n&1){let t=q();p(0,"button",13),$("click",function(){M(t);let c=P();return R(c.onDeleteJournalEntry())}),x(1," Delete "),m()}}function or(n,h){n&1&&(p(0,"tr")(1,"th",14),D(2,"p-tableHeaderCheckbox"),m(),p(3,"th"),x(4,"Outlet"),m(),p(5,"th"),x(6,"Number"),m(),p(7,"th"),x(8,"Date/Name"),m(),p(9,"th"),x(10,"Description"),m(),p(11,"th"),x(12,"Code"),m(),p(13,"th"),x(14,"Account"),m(),p(15,"th"),x(16,"Debit"),m(),p(17,"th"),x(18,"Credit"),m()())}function ar(n,h){if(n&1&&x(0),n&2){let t=h.$implicit;ct(" ",t.note," ")}}function rr(n,h){if(n&1&&(p(0,"span"),x(1),m()),n&2){let t=h.$implicit;g(),re(t.accountCode)}}function sr(n,h){if(n&1&&(p(0,"span"),x(1),m()),n&2){let t=h.$implicit;g(),re(t.accountName)}}function lr(n,h){if(n&1&&(p(0,"span"),x(1),Be(2,"number"),m()),n&2){let t=h.$implicit;g(),re(Ze(2,1,t.debitAmount))}}function cr(n,h){if(n&1&&(p(0,"span"),x(1),Be(2,"number"),m()),n&2){let t=h.$implicit;g(),re(Ze(2,1,t.creditAmount))}}function ur(n,h){if(n&1&&(p(0,"tr")(1,"td"),D(2,"p-tableCheckbox",15),m(),p(3,"td"),x(4),m(),p(5,"td")(6,"a",16),x(7),m()(),p(8,"td"),x(9),Be(10,"date"),m(),p(11,"td"),St(12,ar,1,1,null,null,Nt),m(),p(14,"td")(15,"div",17),St(16,rr,2,1,"span",null,Nt),m()(),p(18,"td")(19,"div",17),St(20,sr,2,1,"span",null,Nt),m()(),p(22,"td")(23,"div",17),St(24,lr,3,3,"span",null,Nt),m()(),p(26,"td")(27,"div",17),St(28,cr,3,3,"span",null,Nt),m()()()),n&2){let t=h.$implicit;g(2),v("value",t),g(2),re(t.outletName),g(2),v("routerLink",ge(8,ir,t.id)),g(),re(t.number),g(2),re(en(10,5,t.date,"dd MMM y")),g(3),wt(t.items),g(4),wt(t.items),g(4),wt(t.items),g(4),wt(t.items),g(4),wt(t.items)}}function mr(n,h){if(n&1&&x(0),n&2){let t=P(2);ct(" ",t.JournalEntryStore.count()," ")}}function dr(n,h){if(n&1){let t=q();p(0,"p-button",19),$("onClick",function(){M(t);let c=P(2);return R(c.getJournalEntryCount())}),m()}n&2&&v("rounded",!0)("text",!0)}function pr(n,h){if(n&1&&(x(0),O(1,mr,1,1)(2,dr,1,2,"p-button",18),x(3," entries ")),n&2){let t=P();gn(" Showing ",t.JournalEntryStore.first()," to ",t.JournalEntryStore.end()," of "),g(),ze(t.JournalEntryStore.count()?1:2)}}function hr(n,h){n&1&&(p(0,"div",20)(1,"div",21)(2,"h5",22),x(3,"Card title"),m(),p(4,"h6",23),x(5,"Card subtitle"),m(),p(6,"p",24),x(7," Some quick example text to build on the card title and make up the bulk of the card's content. "),m(),p(8,"a",25),x(9,"Card link"),m(),p(10,"a",25),x(11,"Another link"),m()()())}var va=(()=>{class n{constructor(){this.JournalEntryStore=K(Qn),this.modalService=K(Cn),this.journalEntryService=K(Xe)}ngOnInit(){console.log("Journal Entry Page");let t=this.JournalEntryStore.filter;this.JournalEntryStore.loadJournalEntryData(t)}onFilterChange(t){console.log("Filter Change",t),this.modalService.open(this.templateRef)}onRowSelect(t){this.updateRowSelection(t.data,!0)}onRowUnselect(t){this.updateRowSelection(t.data,!1)}updateRowSelection(t,l){this.JournalEntryStore.updateData(this.JournalEntryStore.data().map(c=>c.id===t.id?Ie(ve({},c),{checked:l}):c))}onHeaderCheckboxToggle(t){let l=this.JournalEntryStore.data().map(c=>Ie(ve({},c),{checked:t.checked}));this.JournalEntryStore.updateData(l)}onPageChange(t){let l=t.first/t.rows;this.JournalEntryStore.updateFilter({pageNumber:l+1})}next(){this.JournalEntryStore.updateFilter({pageNumber:this.JournalEntryStore.filter().pageNumber+1})}prev(){this.JournalEntryStore.filter().pageNumber<=1||this.JournalEntryStore.updateFilter({pageNumber:this.JournalEntryStore.filter().pageNumber-1})}getJournalEntryCount(){this.journalEntryService.getJournalEntryCount().pipe(Fe(t=>this.JournalEntryStore.updateCount(t.count))).subscribe()}onDeleteJournalEntry(){let l=this.JournalEntryStore.selectedItems().map(c=>c.id);this.journalEntryService.deleteJournalEntry(l).pipe(Fe(()=>{this.JournalEntryStore.loadJournalEntryData(this.JournalEntryStore.filter())})).subscribe()}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry",8,"page"]],viewQuery:function(l,c){if(l&1&&ot(er,7),l&2){let y;Q(y=Z())&&(c.templateRef=y.first)}},features:[je([Qn])],attrs:tr,decls:23,vars:9,consts:[["header",""],["body",""],["paginatorleft",""],["filterRef",""],["pageTitle","Manual Journal",3,"eventFilterChange","isSearchableInput"],["ngProjectAs","action-button",5,["action-button"]],["class","btn btn-danger rounded",3,"click",4,"ngIf"],["role","group","aria-label","Basic example",1,"btn-group"],["type","button",1,"btn","btn-light"],["type","button","routerLink","add",1,"btn","btn-primary","rounded","d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-plus"],["ngProjectAs","content",5,["content"]],["stripedRows","","dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","totalRecords","lazy","rows","scrollable","scrollHeight"],[1,"btn","btn-danger","rounded",3,"click"],[2,"width","4rem"],[3,"value"],[1,"link","link-primary",3,"routerLink"],[1,"d-flex","flex-column"],["icon","fa-light fa-question","severity","primary",3,"rounded","text"],["icon","fa-light fa-question","severity","primary",3,"onClick","rounded","text"],[1,"card",2,"width","18rem"],[1,"card-body"],[1,"card-title"],[1,"card-subtitle","mb-2","text-body-secondary"],[1,"card-text"],["href","#",1,"card-link"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),$("eventFilterChange",function(L){return M(y),R(c.onFilterChange(L))}),ce(1,5),O(2,nr,2,0,"button",6),p(3,"div",7)(4,"button",8),x(5,"Import"),m(),p(6,"button",8),x(7,"Export"),m()(),p(8,"a",9),D(9,"i",10),p(10,"span"),x(11,"Add"),m()(),ue(),ce(12,11),p(13,"p-card")(14,"p-table",12),$("onPage",function(L){return M(y),R(c.onPageChange(L))})("onRowSelect",function(L){return M(y),R(c.onRowSelect(L))})("onRowUnselect",function(L){return M(y),R(c.onRowUnselect(L))})("onHeaderCheckboxToggle",function(L){return M(y),R(c.onHeaderCheckboxToggle(L))}),O(15,or,19,0,"ng-template",null,0,me)(17,ur,30,10,"ng-template",null,1,me)(19,pr,4,3,"ng-template",null,2,me),m()(),ue(),m(),O(21,hr,12,0,"ng-template",null,3,me)}l&2&&(v("isSearchableInput",!0),g(2),v("ngIf",c.JournalEntryStore.selectedItems().length),g(12),v("value",c.JournalEntryStore.data())("paginator",!0)("totalRecords",c.JournalEntryStore.count())("lazy",!0)("rows",c.JournalEntryStore.filter().rowCount)("scrollable",!0)("scrollHeight","calc(100vh - 200px)"))},dependencies:[Pt,Le,Ye,Vt,yn,pa,Ko,wn,Sn,$t,jt,ma,da,zt,ft,Ut,mi],encapsulation:2,changeDetection:0})}}return n})();var gr=["header"],fr=["icons"],vr=["content"],yr=["footer"],_r=["headericons"],br=["contentWrapper"],Sr=["*",[["p-header"]],[["p-footer"]]],wr=["*","p-header","p-footer"],Cr=(n,h)=>({"p-panel p-component":!0,"p-panel-toggleable":n,"p-panel-expanded":h}),xr=n=>({transitionParams:n,height:"0",opacity:"0"}),Er=n=>({value:"hidden",params:n}),Pr=n=>({transitionParams:n,height:"*",opacity:"1"}),kr=n=>({value:"visible",params:n}),Tr=(n,h,t)=>({"p-panel-icons-start":n,"p-panel-icons-end":h,"p-panel-icons-center":t}),Ir=n=>({$implicit:n});function Fr(n,h){if(n&1&&(p(0,"span",12),x(1),m()),n&2){let t=P(2);se("id",t.id+"_header"),g(),re(t._header)}}function Or(n,h){n&1&&Ue(0)}function Nr(n,h){}function Dr(n,h){n&1&&O(0,Nr,0,0,"ng-template")}function Vr(n,h){if(n&1&&D(0,"span"),n&2){let t=P(6);Qe(t.expandIcon)}}function Ar(n,h){n&1&&D(0,"MinusIcon")}function Lr(n,h){if(n&1&&(ce(0),O(1,Vr,1,2,"span",16)(2,Ar,1,0,"MinusIcon",14),ue()),n&2){let t=P(5);g(),v("ngIf",t.expandIcon),g(),v("ngIf",!t.expandIcon)}}function Mr(n,h){if(n&1&&D(0,"span"),n&2){let t=P(6);Qe(t.collapseIcon)}}function Rr(n,h){n&1&&D(0,"PlusIcon")}function Br(n,h){if(n&1&&(ce(0),O(1,Mr,1,2,"span",16)(2,Rr,1,0,"PlusIcon",14),ue()),n&2){let t=P(5);g(),v("ngIf",t.collapseIcon),g(),v("ngIf",!t.collapseIcon)}}function zr(n,h){if(n&1&&(ce(0),O(1,Lr,3,2,"ng-container",14)(2,Br,3,2,"ng-container",14),ue()),n&2){let t=P(4);g(),v("ngIf",!t.collapsed),g(),v("ngIf",t.collapsed)}}function Ur(n,h){}function jr(n,h){n&1&&O(0,Ur,0,0,"ng-template")}function $r(n,h){if(n&1&&O(0,zr,3,2,"ng-container",14)(1,jr,1,0,null,15),n&2){let t=P(3);v("ngIf",!t.headerIconsTemplate&&!t._headerIconsTemplate&&!(t.toggleButtonProps!=null&&t.toggleButtonProps.icon)),g(),v("ngTemplateOutlet",t.headerIconsTemplate||t._headerIconsTemplate)("ngTemplateOutletContext",ge(3,Ir,t.collapsed))}}function Jr(n,h){if(n&1){let t=q();p(0,"p-button",13),$("click",function(c){M(t);let y=P(2);return R(y.onIconClick(c))})("keydown",function(c){M(t);let y=P(2);return R(y.onKeyDown(c))}),O(1,$r,2,5,"ng-template",null,1,me),m()}if(n&2){let t=P(2);v("text",!0)("rounded",!0)("buttonProps",t.toggleButtonProps),se("id",t.id+"_header")("aria-label",t.buttonAriaLabel)("aria-controls",t.id+"_content")("aria-expanded",!t.collapsed)}}function Gr(n,h){if(n&1){let t=q();p(0,"div",8),$("click",function(c){M(t);let y=P();return R(y.onHeaderClick(c))}),O(1,Fr,2,2,"span",9),ti(2,1),O(3,Or,1,0,"ng-container",6),p(4,"div",10),O(5,Dr,1,0,null,6)(6,Jr,3,7,"p-button",11),m()()}if(n&2){let t=P();se("id",t.id+"-titlebar"),g(),v("ngIf",t._header),g(2),v("ngTemplateOutlet",t.headerTemplate||t._headerTemplate),g(),v("ngClass",fn(6,Tr,t.iconPos==="start",t.iconPos==="end",t.iconPos==="center")),g(),v("ngTemplateOutlet",t.iconTemplate||t._iconTemplate),g(),v("ngIf",t.toggleable)}}function Kr(n,h){n&1&&Ue(0)}function Wr(n,h){n&1&&Ue(0)}function Hr(n,h){if(n&1&&(p(0,"div",17),ti(1,2),O(2,Wr,1,0,"ng-container",6),m()),n&2){let t=P();g(2),v("ngTemplateOutlet",t.footerTemplate||t._footerTemplate)}}var qr=({dt:n})=>`
|
|
15
15
|
.p-panel {
|
|
16
16
|
border: 1px solid ${n("panel.border.color")};
|
|
17
17
|
border-radius: ${n("panel.border.radius")};
|
|
@@ -559,7 +559,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
559
559
|
justify-content: center;
|
|
560
560
|
gap: ${n("fileupload.basic.gap")};
|
|
561
561
|
}
|
|
562
|
-
`,Zl={root:({instance:n})=>`p-fileupload p-fileupload-${n.mode} p-component`,header:"p-fileupload-header",pcChooseButton:"p-fileupload-choose-button",pcUploadButton:"p-fileupload-upload-button",pcCancelButton:"p-fileupload-cancel-button",content:"p-fileupload-content",fileList:"p-fileupload-file-list",file:"p-fileupload-file",fileThumbnail:"p-fileupload-file-thumbnail",fileInfo:"p-fileupload-file-info",fileName:"p-fileupload-file-name",fileSize:"p-fileupload-file-size",pcFileBadge:"p-fileupload-file-badge",fileActions:"p-fileupload-file-actions",pcFileRemoveButton:"p-fileupload-file-remove-button"},ka=(()=>{class n extends Rt{name="fileupload";theme=Ql;classes=Zl;static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var Si=(()=>{class n extends Et{name;url;method="post";multiple;accept;disabled;auto;withCredentials;maxFileSize;invalidFileSizeMessageSummary="{0}: Invalid file size, ";invalidFileSizeMessageDetail="maximum upload size is {0}.";invalidFileTypeMessageSummary="{0}: Invalid file type, ";invalidFileTypeMessageDetail="allowed file types: {0}.";invalidFileLimitMessageDetail="limit is {0} at most.";invalidFileLimitMessageSummary="Maximum number of files exceeded, ";style;styleClass;previewWidth=50;chooseLabel;uploadLabel;cancelLabel;chooseIcon;uploadIcon;cancelIcon;showUploadButton=!0;showCancelButton=!0;mode="advanced";headers;customUpload;fileLimit;uploadStyleClass;cancelStyleClass;removeStyleClass;chooseStyleClass;chooseButtonProps;uploadButtonProps={severity:"secondary"};cancelButtonProps={severity:"secondary"};onBeforeUpload=new qe;onSend=new qe;onUpload=new qe;onError=new qe;onClear=new qe;onRemove=new qe;onSelect=new qe;onProgress=new qe;uploadHandler=new qe;onImageError=new qe;onRemoveUploadedFile=new qe;fileTemplate;headerTemplate;contentTemplate;toolbarTemplate;chooseIconTemplate;fileLabelTemplate;uploadIconTemplate;cancelIconTemplate;emptyTemplate;advancedFileInput;basicFileInput;content;set files(t){this._files=[];for(let l=0;l<t.length;l++){let c=t[l];this.validate(c)&&(this.isImage(c)&&(c.objectURL=this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(t[l]))),this._files.push(t[l]))}}get files(){return this._files}get basicButtonLabel(){return this.auto||!this.hasFiles()?this.chooseLabel:this.uploadLabel??this.files[0].name}_files=[];progress=0;dragHighlight;msgs;uploadedFileCount=0;focus;uploading;duplicateIEEvent;translationSubscription;dragOverListener;uploadedFiles=[];sanitizer=K($o);zone=K(pn);http=K(jo);_componentStyle=K(ka);ngOnInit(){super.ngOnInit(),this.translationSubscription=this.config.translationObserver.subscribe(()=>{this.cd.markForCheck()})}ngAfterViewInit(){super.ngAfterViewInit(),oi(this.platformId)&&this.mode==="advanced"&&this.zone.runOutsideAngular(()=>{this.content&&(this.dragOverListener=this.renderer.listen(this.content.nativeElement,"dragover",this.onDragOver.bind(this)))})}_headerTemplate;_contentTemplate;_toolbarTemplate;_chooseIconTemplate;_uploadIconTemplate;_cancelIconTemplate;_emptyTemplate;_fileTemplate;_fileLabelTemplate;templates;ngAfterContentInit(){this.templates?.forEach(t=>{switch(t.getType()){case"header":this._headerTemplate=t.template;break;case"file":this._fileTemplate=t.template;break;case"content":this._contentTemplate=t.template;break;case"toolbar":this._toolbarTemplate=t.template;break;case"chooseicon":this._chooseIconTemplate=t.template;break;case"uploadicon":this._uploadIconTemplate=t.template;break;case"cancelicon":this._cancelIconTemplate=t.template;break;case"empty":this._emptyTemplate=t.template;break;case"filelabel":this._fileLabelTemplate=t.template;break;default:this._fileTemplate=t.template;break}})}basicFileChosenLabel(){return this.auto?this.chooseButtonLabel:this.hasFiles()?this.files&&this.files.length===1?this.files[0].name:this.config.getTranslation("fileChosenMessage")?.replace("{0}",this.files.length):this.config.getTranslation("noFileChosenMessage")||""}getTranslation(t){return this.config.getTranslation(t)}choose(){this.advancedFileInput?.nativeElement.click()}onFileSelect(t){if(t.type!=="drop"&&this.isIE11()&&this.duplicateIEEvent){this.duplicateIEEvent=!1;return}this.msgs=[],this.multiple||(this.files=[]);let l=t.dataTransfer?t.dataTransfer.files:t.target.files;for(let c=0;c<l.length;c++){let y=l[c];this.isFileSelected(y)||this.validate(y)&&(this.isImage(y)&&(y.objectURL=this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(l[c]))),this.files.push(l[c]))}this.onSelect.emit({originalEvent:t,files:l,currentFiles:this.files}),this.checkFileLimit(l),this.hasFiles()&&this.auto&&(this.mode!=="advanced"||!this.isFileLimitExceeded())&&this.upload(),t.type!=="drop"&&this.isIE11()?this.clearIEInput():this.clearInputElement()}isFileSelected(t){for(let l of this.files)if(l.name+l.type+l.size===t.name+t.type+t.size)return!0;return!1}isIE11(){if(oi(this.platformId))return!!this.document.defaultView.MSInputMethodContext&&!!this.document.documentMode}validate(t){if(this.msgs=this.msgs||[],this.accept&&!this.isFileTypeValid(t)){let l=`${this.invalidFileTypeMessageSummary.replace("{0}",t.name)} ${this.invalidFileTypeMessageDetail.replace("{0}",this.accept)}`;return this.msgs.push({severity:"error",text:l}),!1}if(this.maxFileSize&&t.size>this.maxFileSize){let l=`${this.invalidFileSizeMessageSummary.replace("{0}",t.name)} ${this.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.maxFileSize))}`;return this.msgs.push({severity:"error",text:l}),!1}return!0}isFileTypeValid(t){let l=this.accept?.split(",").map(c=>c.trim());for(let c of l)if(this.isWildcard(c)?this.getTypeClass(t.type)===this.getTypeClass(c):t.type==c||this.getFileExtension(t).toLowerCase()===c.toLowerCase())return!0;return!1}getTypeClass(t){return t.substring(0,t.indexOf("/"))}isWildcard(t){return t.indexOf("*")!==-1}getFileExtension(t){return"."+t.name.split(".").pop()}isImage(t){return/^image\//.test(t.type)}onImageLoad(t){window.URL.revokeObjectURL(t.src)}uploader(){if(this.customUpload)this.fileLimit&&(this.uploadedFileCount+=this.files.length),this.uploadHandler.emit({files:this.files}),this.cd.markForCheck();else{this.uploading=!0,this.msgs=[];let t=new FormData;this.onBeforeUpload.emit({formData:t});for(let l=0;l<this.files.length;l++)t.append(this.name,this.files[l],this.files[l].name);this.http.request(this.method,this.url,{body:t,headers:this.headers,reportProgress:!0,observe:"events",withCredentials:this.withCredentials}).subscribe(l=>{switch(l.type){case _n.Sent:this.onSend.emit({originalEvent:l,formData:t});break;case _n.Response:this.uploading=!1,this.progress=0,l.status>=200&&l.status<300?(this.fileLimit&&(this.uploadedFileCount+=this.files.length),this.onUpload.emit({originalEvent:l,files:this.files})):this.onError.emit({files:this.files}),this.uploadedFiles.push(...this.files),this.clear();break;case _n.UploadProgress:{l.loaded&&(this.progress=Math.round(l.loaded*100/l.total)),this.onProgress.emit({originalEvent:l,progress:this.progress});break}}this.cd.markForCheck()},l=>{this.uploading=!1,this.onError.emit({files:this.files,error:l})})}}clear(){this.files=[],this.uploadedFileCount=0,this.onClear.emit(),this.clearInputElement(),this.cd.markForCheck()}remove(t,l){this.clearInputElement(),this.onRemove.emit({originalEvent:t,file:this.files[l]}),this.files.splice(l,1),this.checkFileLimit(this.files)}removeUploadedFile(t){let l=this.uploadedFiles.splice(t,1)[0];this.uploadedFiles=[...this.uploadedFiles],this.onRemoveUploadedFile.emit({file:l,files:this.uploadedFiles})}isFileLimitExceeded(){let l=this.auto?this.files.length:this.files.length+this.uploadedFileCount;return this.fileLimit&&this.fileLimit<=l&&this.focus&&(this.focus=!1),this.fileLimit&&this.fileLimit<l}isChooseDisabled(){return this.auto?this.fileLimit&&this.fileLimit<=this.files.length:this.fileLimit&&this.fileLimit<=this.files.length+this.uploadedFileCount}checkFileLimit(t){this.msgs??=[];let l=this.msgs.length>0&&this.fileLimit&&this.fileLimit<t.length;if(this.isFileLimitExceeded()||l){let c=`${this.invalidFileLimitMessageSummary.replace("{0}",this.fileLimit.toString())} ${this.invalidFileLimitMessageDetail.replace("{0}",this.fileLimit.toString())}`;this.msgs.push({severity:"error",text:c})}}clearInputElement(){this.advancedFileInput&&this.advancedFileInput.nativeElement&&(this.advancedFileInput.nativeElement.value=""),this.basicFileInput&&this.basicFileInput.nativeElement&&(this.basicFileInput.nativeElement.value="")}clearIEInput(){this.advancedFileInput&&this.advancedFileInput.nativeElement&&(this.duplicateIEEvent=!0,this.advancedFileInput.nativeElement.value="")}hasFiles(){return this.files&&this.files.length>0}hasUploadedFiles(){return this.uploadedFiles&&this.uploadedFiles.length>0}onDragEnter(t){this.disabled||(t.stopPropagation(),t.preventDefault())}onDragOver(t){this.disabled||(ri(this.content?.nativeElement,"p-fileupload-highlight"),this.dragHighlight=!0,t.stopPropagation(),t.preventDefault())}onDragLeave(t){this.disabled||si(this.content?.nativeElement,"p-fileupload-highlight")}onDrop(t){if(!this.disabled){si(this.content?.nativeElement,"p-fileupload-highlight"),t.stopPropagation(),t.preventDefault();let l=t.dataTransfer?t.dataTransfer.files:t.target.files;(this.multiple||l&&l.length===1)&&this.onFileSelect(t)}}onFocus(){this.focus=!0}onBlur(){this.focus=!1}formatSize(t){let y=this.getTranslation(Bt.FILE_SIZE_TYPES);if(t===0)return`0 ${y[0]}`;let F=Math.floor(Math.log(t)/Math.log(1024));return`${(t/Math.pow(1024,F)).toFixed(3)} ${y[F]}`}upload(){this.hasFiles()&&this.uploader()}onBasicUploaderClick(){this.basicFileInput?.nativeElement.click()}onBasicKeydown(t){switch(t.code){case"Space":case"Enter":this.onBasicUploaderClick(),t.preventDefault();break}}imageError(t){this.onImageError.emit(t)}getBlockableElement(){return this.el.nativeElement.children[0]}get chooseButtonLabel(){return this.chooseLabel||this.config.getTranslation(Bt.CHOOSE)}get uploadButtonLabel(){return this.uploadLabel||this.config.getTranslation(Bt.UPLOAD)}get cancelButtonLabel(){return this.cancelLabel||this.config.getTranslation(Bt.CANCEL)}get browseFilesLabel(){return this.config.getTranslation(Bt.ARIA)[Bt.BROWSE_FILES]}get pendingLabel(){return this.config.getTranslation(Bt.PENDING)}ngOnDestroy(){this.content&&this.content.nativeElement&&this.dragOverListener&&(this.dragOverListener(),this.dragOverListener=null),this.translationSubscription&&this.translationSubscription.unsubscribe(),super.ngOnDestroy()}static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["p-fileupload"],["p-fileUpload"]],contentQueries:function(l,c,y){if(l&1&&(ke(y,Ns,4),ke(y,Ds,4),ke(y,Pa,4),ke(y,Vs,4),ke(y,As,4),ke(y,Ls,4),ke(y,Ms,4),ke(y,Rs,4),ke(y,Bs,4),ke(y,li,4)),l&2){let F;Q(F=Z())&&(c.fileTemplate=F.first),Q(F=Z())&&(c.headerTemplate=F.first),Q(F=Z())&&(c.contentTemplate=F.first),Q(F=Z())&&(c.toolbarTemplate=F.first),Q(F=Z())&&(c.chooseIconTemplate=F.first),Q(F=Z())&&(c.fileLabelTemplate=F.first),Q(F=Z())&&(c.uploadIconTemplate=F.first),Q(F=Z())&&(c.cancelIconTemplate=F.first),Q(F=Z())&&(c.emptyTemplate=F.first),Q(F=Z())&&(c.templates=F)}},viewQuery:function(l,c){if(l&1&&(ot(zs,5),ot(Us,5),ot(Pa,5)),l&2){let y;Q(y=Z())&&(c.advancedFileInput=y.first),Q(y=Z())&&(c.basicFileInput=y.first),Q(y=Z())&&(c.content=y.first)}},inputs:{name:"name",url:"url",method:"method",multiple:[2,"multiple","multiple",tt],accept:"accept",disabled:[2,"disabled","disabled",tt],auto:[2,"auto","auto",tt],withCredentials:[2,"withCredentials","withCredentials",tt],maxFileSize:[2,"maxFileSize","maxFileSize",ki],invalidFileSizeMessageSummary:"invalidFileSizeMessageSummary",invalidFileSizeMessageDetail:"invalidFileSizeMessageDetail",invalidFileTypeMessageSummary:"invalidFileTypeMessageSummary",invalidFileTypeMessageDetail:"invalidFileTypeMessageDetail",invalidFileLimitMessageDetail:"invalidFileLimitMessageDetail",invalidFileLimitMessageSummary:"invalidFileLimitMessageSummary",style:"style",styleClass:"styleClass",previewWidth:[2,"previewWidth","previewWidth",ki],chooseLabel:"chooseLabel",uploadLabel:"uploadLabel",cancelLabel:"cancelLabel",chooseIcon:"chooseIcon",uploadIcon:"uploadIcon",cancelIcon:"cancelIcon",showUploadButton:[2,"showUploadButton","showUploadButton",tt],showCancelButton:[2,"showCancelButton","showCancelButton",tt],mode:"mode",headers:"headers",customUpload:[2,"customUpload","customUpload",tt],fileLimit:[2,"fileLimit","fileLimit",t=>ki(t,null)],uploadStyleClass:"uploadStyleClass",cancelStyleClass:"cancelStyleClass",removeStyleClass:"removeStyleClass",chooseStyleClass:"chooseStyleClass",chooseButtonProps:"chooseButtonProps",uploadButtonProps:"uploadButtonProps",cancelButtonProps:"cancelButtonProps",files:"files"},outputs:{onBeforeUpload:"onBeforeUpload",onSend:"onSend",onUpload:"onUpload",onError:"onError",onClear:"onClear",onRemove:"onRemove",onSelect:"onSelect",onProgress:"onProgress",uploadHandler:"uploadHandler",onImageError:"onImageError",onRemoveUploadedFile:"onRemoveUploadedFile"},features:[je([ka]),Xt,ht],decls:2,vars:2,consts:[["advancedfileinput",""],["content",""],["icon",""],["basicfileinput",""],[3,"ngClass","ngStyle","class",4,"ngIf"],[3,"ngClass","class",4,"ngIf"],[3,"ngClass","ngStyle"],["type","file",3,"change","multiple","accept","disabled"],[1,"p-fileupload-header"],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngTemplateOutlet"],[1,"p-fileupload-content",3,"dragenter","dragleave","drop"],[3,"value","showValue",4,"ngIf"],[3,"severity","text"],["class","p-fileupload-file-list",4,"ngIf"],["tabindex","0",3,"focus","blur","onClick","keydown.enter","styleClass","disabled","label","buttonProps"],[3,"class",4,"ngIf"],[3,"label","disabled","styleClass","buttonProps","onClick",4,"ngIf"],[3,"onClick","label","disabled","styleClass","buttonProps"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],[3,"value","showValue"],[1,"p-fileupload-file-list"],[1,"p-fileupload-file"],["ngFor","",3,"ngForOf","ngForTemplate"],["class","p-fileupload-file",4,"ngFor","ngForOf"],["class","p-fileupload-file-thumbnail",3,"src","width","error",4,"ngIf"],[1,"p-fileupload-file-info"],[1,"p-fileupload-file-name"],[1,"p-fileupload-file-size"],[1,"p-fileupload-file-actions"],["text","","rounded","","severity","danger",3,"onClick","disabled","styleClass"],[1,"p-fileupload-file-thumbnail",3,"error","src","width"],["tabindex","0",3,"onClick","keydown","styleClass","disabled","label","buttonProps"],["type","file",3,"change","focus","blur","accept","multiple","disabled"],["class","p-button-icon p-button-icon-left",3,"ngClass",4,"ngIf"],[1,"p-button-icon","p-button-icon-left",3,"ngClass"],[3,"styleClass",4,"ngIf"],["class","p-button-icon p-button-icon-left",4,"ngIf"],[3,"styleClass"],[1,"p-button-icon","p-button-icon-left"],["class","p-button-icon p-button-icon-left pi",3,"ngClass",4,"ngIf"],[1,"p-button-icon","p-button-icon-left","pi",3,"ngClass"],[3,"class"]],template:function(l,c){l&1&&O(0,Il,15,39,"div",4)(1,ql,9,16,"div",5),l&2&&(v("ngIf",c.mode==="advanced"),g(),v("ngIf",c.mode==="basic"))},dependencies:[Le,gt,zo,Ye,Dt,ni,ft,Ea,Ca,Tn,fa,zi,$e],encapsulation:2,changeDetection:0})}return n})(),Qi=(()=>{class n{static \u0275fac=function(l){return new(l||n)};static \u0275mod=Ot({type:n});static \u0275inj=Ft({imports:[Si,$e,$e]})}return n})();var io=_i(On()),Ta=n=>(0,io.default)(n).isSame((0,io.default)("0001-01-01T00:00:00"));var Yl=["class","page"],Xl=()=>({width:"25rem"}),ec=()=>({width:"100%"}),tc=()=>({width:"50%"}),ic=()=>({});function nc(n,h){n&1&&(p(0,"tr")(1,"th"),x(2,"Account"),m(),p(3,"th",40),x(4,"Amount"),m(),p(5,"th",40),x(6,"Note"),m(),D(7,"th",41),m())}function oc(n,h){if(n&1&&(p(0,"div",49)(1,"div"),x(2),m()()),n&2){let t=P().$implicit;g(2),re(t.value)}}function ac(n,h){if(n&1&&O(0,oc,3,1,"div",48),n&2){let t=h.$implicit;v("ngIf",t)}}function rc(n,h){if(n&1&&(p(0,"div",49)(1,"div"),x(2),m()()),n&2){let t=h.$implicit;g(2),re(t.value)}}function sc(n,h){if(n&1){let t=q();p(0,"div",50)(1,"p-button",51),$("onClick",function(){M(t);let c=P(2);return R(c.addIitemVisible.set(!c.addIitemVisible()))}),m()()}}function lc(n,h){if(n&1){let t=q();p(0,"tr",42)(1,"td")(2,"p-select",43),O(3,ac,1,1,"ng-template",null,4,me)(5,rc,3,1,"ng-template",null,5,me)(7,sc,2,0,"ng-template",null,2,me),m()(),p(9,"td"),D(10,"input",44),m(),p(11,"td"),D(12,"textarea",45),m(),p(13,"td")(14,"button",46),$("click",function(){let c=M(t).rowIndex,y=P();return R(y.removeItem(c))}),D(15,"i",47),m()()()}if(n&2){let t=h.rowIndex,l=P();v("formGroupName",t),g(2),xt(De(7,tc)),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",l.journalRecordExpense().options.accounts),g(8),v("autoNumeric",De(8,ic))}}function cc(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",52)(3,"button",53),$("click",function(){M(t);let c=P();return R(c.addItem())}),x(4," Add "),m(),p(5,"span"),x(6,"Total :"),m()()(),p(7,"td"),x(8),Be(9,"async"),Be(10,"number"),m(),D(11,"td",54),m()}if(n&2){let t=P();g(8),re(Ze(10,3,Ze(9,1,t.totalDebitAmount$)))}}var Da=(()=>{class n{constructor(){this.fb=K(Go),this.journalRecordExpense=Ae(null),this.activatedRoute=K(ai),this.journalService=K(Xe),this.toasr=K(Mi),this.file=Ae(null),this.addIitemVisible=Ae(!1)}ngOnInit(){this.initForm(),this.loadJournalForm(),this.initFormAddItemCOA(),this.totalDebitAmount$=this.form.controls.items.valueChanges.pipe(kt(t=>t.reduce((l,c)=>l+c.debitAmount,0)),He("response"))}loadCategories(){this.categories$||(this.categories$=this.journalService.fetchCategoryOptions().pipe(wo(1)))}initFormAddItemCOA(){this.formAddItemCOA=this.fb.group({ID:this.fb.control(Ve.toString()),Name:this.fb.control(""),Code:this.fb.control(""),Note:this.fb.control(""),CategoryID:this.fb.control(""),OutletID:this.fb.control(Ve.toString()),Balance:this.fb.control(0)})}onaddItemCOA(){if(this.formAddItemCOA.invalid){this.formAddItemCOA.markAllAsTouched();return}let t=Object.entries(this.formAddItemCOA.getRawValue()).reduce((l,[c,y])=>(c==="CategoryID"?l[c]=y.key||y:l[c]=y,l),{});this.journalService.submitChartAccount(t).pipe(Fe(()=>{this.toasr.success("Add COA Success","Success"),this.loadJournalForm(),this.formAddItemCOA.reset(),this.addIitemVisible.update(l=>!l)})).subscribe()}loadJournalForm(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>{this.patchForm(t.form),this.journalRecordExpense.set(t)})).subscribe()}initForm(){this.form=this.fb.group({order:this.buildOrderGroup(this.fb),items:this.fb.array([]),additionalAccountID:this.fb.control(""),file:this.fb.control("")}),this.form.controls.order.controls.date.disable()}buildOrderGroup(t){return t.group({id:t.control(""),number:t.control(""),date:t.control(new Date),note:t.control(""),entryTypeID:t.control(0),referenceID:t.control(""),referenceTypeID:t.control(0),referenceText:t.control(""),contactID:t.control(""),detailReferenceID:t.control(""),creatorID:t.control(""),created:t.control(""),modifierID:t.control(""),modified:t.control(""),entityID:t.control(""),statusID:t.control(""),contactName:t.control("")})}buildItemGroup(t){return t.group({id:t.control(Ve.toString()),journalID:t.control(Ve.toString()),accountID:t.control(""),debitAmount:t.control(0),creditAmount:t.control(0),index:t.control(0),note:t.control("")})}patchForm(t){if(!t)return;this.form.controls.order.patchValue({id:t.order.id,number:t.order.number,date:Ta(t.order.date)?(0,no.default)().toDate():(0,no.default)(t.order.date).toDate(),note:t.order.note,entryTypeID:t.order.entryTypeID,referenceID:t.order.referenceID,referenceTypeID:t.order.referenceTypeID,referenceText:t.order.referenceText,contactID:t.order.contactID,detailReferenceID:t.order.detailReferenceID,creatorID:t.order.creatorID,created:t.order.created,modifierID:t.order.modifierID,modified:t.order.modified,entityID:t.order.entityID,statusID:t.order.statusID,contactName:t.order.contactName});let l=this.form.controls.items;l.clear(),t.items.forEach(c=>{let y=this.buildItemGroup(this.fb);y.patchValue(c),l.push(y)}),this.form.patchValue({items:void 0,order:void 0,additionalAccountID:t.additionalAccountID??"",file:t.file??""})}openDialogAddItemCOA(){this.addIitemVisible.update(t=>!t)}addItem(){let t=this.form.controls.items,l=this.buildItemGroup(this.fb);t.push(l)}removeItem(t){this.form.controls.items.removeAt(t)}search(t){let l=t.query;this.supplierSuggestions$=this.journalService.getJournalEntrySupplierSuggestions(l).pipe(He("response"))}onUpload(t){this.file.set(t.currentFiles[0])}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):y==="file"?c[y]=F.length>0?F:null:c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.file()),l}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-record-expense",8,"page"]],attrs:Yl,decls:81,vars:26,consts:[["header",""],["body",""],["footer",""],["fu",""],["selectedItem",""],["item",""],["pageTitle","Record Expense"],["ngProjectAs","action-button",5,["action-button"]],[1,"btn","btn-secondary","rounded"],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],[1,"row"],["formGroupName","order",1,"col"],[1,"d-flex","flex-column"],["for","outlet"],["inputId","outlet","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an outlet","filterBy","name",3,"virtualScroll","virtualScrollItemSize","options","filter"],["styleClass","w-100","formControlName","date"],["formControlName","number","type","text","pInputText",""],[1,"col"],["inputId","outlet","formControlName","additionalAccountID","optionLabel","value","optionValue","key","placeholder","",3,"virtualScroll","virtualScrollItemSize","options"],["formArrayName","items",3,"value"],["formGroupName","order",1,"row"],["for",""],["styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",3,"completeMethod","suggestions"],["rows","1","pTextarea","","formControlName","note","placeholder","e.g. Electricity & Phone Bill for Decemeber",3,"autoResize"],[1,"form-group","d-flex","flex-column"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["header","Add New Account",3,"modal","visible","closable"],[1,"row","row-gap-3",3,"formGroup"],["for","username",1,"font-semibold","w-24"],["formControlName","Name","pInputText","","id","username","autocomplete","off",1,"flex-auto"],["for","email",1,"font-semibold","w-24"],["formControlName","Code","pInputText","","id","email","autocomplete","off",1,"flex-auto"],[1,"col-12"],["for","password",1,"font-semibold","w-24"],["formControlName","CategoryID","containerStyleClass","w-100","appendTo","body","placeholder","Select Item",3,"onFocus","options"],[1,"d-flex","justify-content-end","gap-2"],["label","Cancel","severity","secondary",3,"click"],["label","Save",3,"click"],[2,"width","10%"],[2,"width","5%"],[3,"formGroupName"],["filter","","filterBy","value","styleClass","w-50","appendTo","body","formControlName","accountID","optionLabel","value","optionValue","key","placeholder","Select an account",3,"virtualScroll","virtualScrollItemSize","options"],["type","text","pInputText","","formControlName","debitAmount",3,"autoNumeric"],["autoResize","","rows","1","pTextarea","","formControlName","note"],[1,"btn","btn-link",3,"click"],[1,"fa-light","fa-trash","text-danger"],["class","flex items-center gap-2",4,"ngIf"],[1,"flex","items-center","gap-2"],[1,"p-3"],["label","Add New","fluid","","severity","secondary","text","","size","small","icon","pi pi-plus",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","rounded",3,"click"],["colspan","2"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",6),ce(1,7),p(2,"button",8),x(3,"Cancel"),m(),p(4,"button",9),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(5," Save "),m(),ue(),ce(6,10),p(7,"div",11)(8,"p-panel")(9,"div",12)(10,"div",13)(11,"div",14)(12,"label",15),x(13,"Outlet"),m(),D(14,"p-select",16),m()(),p(15,"div",13)(16,"div",14)(17,"label",15),x(18,"Date"),m(),D(19,"p-datepicker",17),m()(),p(20,"div",13)(21,"div",14)(22,"label",15),x(23,"Number"),m(),D(24,"input",18),m()(),p(25,"div",19)(26,"div",14)(27,"label",15),x(28,"Account"),m(),D(29,"p-select",20),m()()(),D(30,"hr"),p(31,"p-table",21),O(32,nc,8,0,"ng-template",null,0,me)(34,lc,16,9,"ng-template",null,1,me)(36,cc,12,5,"ng-template",null,2,me),m(),D(38,"hr"),p(39,"div",22)(40,"div",19)(41,"div",12)(42,"div",19)(43,"div",14)(44,"label",23),x(45,"Supplier"),m(),p(46,"p-autocomplete",24),Be(47,"async"),$("completeMethod",function(L){return M(y),R(c.search(L))}),m()()(),p(48,"div",19)(49,"div",14)(50,"label",23),x(51,"Note"),m(),D(52,"textarea",25),m()(),p(53,"div",19)(54,"div",26)(55,"label",23),x(56,"Upload"),m(),p(57,"p-fileupload",27,3),$("onSelect",function(L){return M(y),R(c.onUpload(L))}),m()()()()()()()(),ue(),m(),p(59,"p-dialog",28)(60,"div",29)(61,"div",19)(62,"div",14)(63,"label",30),x(64,"Name"),m(),D(65,"input",31),m()(),p(66,"div",19)(67,"div",14)(68,"label",32),x(69,"Code"),m(),D(70,"input",33),m()(),p(71,"div",34)(72,"div",14)(73,"label",35),x(74,"Category"),m(),p(75,"p-treeselect",36),Be(76,"async"),$("onFocus",function(){return M(y),R(c.loadCategories())}),m()()(),p(77,"div",19)(78,"div",37)(79,"p-button",38),$("click",function(){return M(y),R(c.addIitemVisible.set(!c.addIitemVisible()))}),m(),p(80,"p-button",39),$("click",function(){return M(y),R(c.onaddItemCOA())}),m()()()()()}l&2&&(g(7),v("formGroup",c.form),g(7),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",c.journalRecordExpense().options.entities)("filter",!0),g(15),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",c.journalRecordExpense().options.paymentAccounts),g(2),v("value",c.form.controls.items.controls),g(15),v("suggestions",Ze(47,20,c.supplierSuggestions$)),g(6),v("autoResize",!0),g(7),xt(De(24,Xl)),v("modal",!0)("visible",c.addIitemVisible())("closable",!1),g(),v("formGroup",c.formAddItemCOA),g(15),xt(De(25,ec)),v("options",Ze(76,22,c.categories$)))},dependencies:[Pt,Le,Ye,Uo,Vt,_a,Yn,di,mi,Gi,Ji,ui,ci,$t,jt,Ut,Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,qi,gi,hi,Wi,Ki,Qi,Si,zt,ft,$i,ji,ga,ha],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var uc=["filterRef"],mc=["class","page"];function dc(n,h){n&1&&(p(0,"div",10)(1,"div",5)(2,"h5",11),x(3,"Card title"),m(),p(4,"h6",12),x(5,"Card subtitle"),m(),p(6,"p",13),x(7," Some quick example text to build on the card title and make up the bulk of the card's content. "),m(),p(8,"a",14),x(9,"Card link"),m(),p(10,"a",14),x(11,"Another link"),m()()())}var Va=(()=>{class n{constructor(){this.modalService=K(Cn)}onFilterChange(t){console.log("Filter Change",t),this.modalService.open(this.templateRef)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-deposit",8,"page"]],viewQuery:function(l,c){if(l&1&&ot(uc,7),l&2){let y;Q(y=Z())&&(c.templateRef=y.first)}},attrs:mc,decls:44,vars:0,consts:[["filterRef",""],[3,"eventFilterChange"],["ngProjectAs","content",5,["content"]],[1,"container","my-4"],[1,"card"],[1,"card-body"],[1,"table"],["scope","col"],["scope","row"],["colspan","2"],[1,"card",2,"width","18rem"],[1,"card-title"],[1,"card-subtitle","mb-2","text-body-secondary"],[1,"card-text"],["href","#",1,"card-link"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",1),$("eventFilterChange",function(L){return M(y),R(c.onFilterChange(L))}),ce(1,2),p(2,"div",3)(3,"div",4)(4,"div",5)(5,"table",6)(6,"thead")(7,"tr")(8,"th",7),x(9,"#"),m(),p(10,"th",7),x(11,"First"),m(),p(12,"th",7),x(13,"Last"),m(),p(14,"th",7),x(15,"Handle"),m()()(),p(16,"tbody")(17,"tr")(18,"th",8),x(19,"1"),m(),p(20,"td"),x(21,"Mark"),m(),p(22,"td"),x(23,"Otto"),m(),p(24,"td"),x(25,"mdo"),m()(),p(26,"tr")(27,"th",8),x(28,"2"),m(),p(29,"td"),x(30,"Jacob"),m(),p(31,"td"),x(32,"Thornton"),m(),p(33,"td"),x(34,"fat"),m()(),p(35,"tr")(36,"th",8),x(37,"3"),m(),p(38,"td",9),x(39,"Larry the Bird"),m(),p(40,"td"),x(41,"twitter"),m()()()()()()(),ue(),m(),O(42,dc,12,0,"ng-template",null,0,me)}},dependencies:[Pt],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var mo=_i(On());var pc=["mask"],hc=["content"],gc=["footer"],fc=["titlebar"],vc=(n,h,t)=>({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex","justify-content":n,"align-items":h,"pointer-events":t}),yc=n=>({"p-dialog p-component":!0,"p-dialog-maximized":n}),_c=()=>({display:"flex","flex-direction":"column","pointer-events":"auto"}),bc=(n,h)=>({transform:n,transition:h}),Sc=n=>({value:"visible",params:n});function wc(n,h){if(n&1){let t=q();p(0,"div",14),$("mousedown",function(c){M(t);let y=P(2);return R(y.initResize(c))}),m()}n&2&&v("ngClass","p-resizable-handle")}function Cc(n,h){n&1&&Ue(0)}function xc(n,h){n&1&&D(0,"WindowMaximizeIcon")}function Ec(n,h){n&1&&D(0,"WindowMinimizeIcon")}function Pc(n,h){if(n&1&&(ce(0),O(1,xc,1,0,"WindowMaximizeIcon",11)(2,Ec,1,0,"WindowMinimizeIcon",11),ue()),n&2){let t=P(5);g(),v("ngIf",!t.maximized&&!t.maximizeIconTemplate),g(),v("ngIf",t.maximized&&!t.minimizeIconTemplate)}}function kc(n,h){}function Tc(n,h){n&1&&O(0,kc,0,0,"ng-template")}function Ic(n,h){if(n&1&&(ce(0),O(1,Tc,1,0,null,21),ue()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.maximizeIconTemplate)}}function Fc(n,h){}function Oc(n,h){n&1&&O(0,Fc,0,0,"ng-template")}function Nc(n,h){if(n&1&&(ce(0),O(1,Oc,1,0,null,21),ue()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.minimizeIconTemplate)}}function Dc(n,h){if(n&1){let t=q();p(0,"p-button",20),$("onClick",function(){M(t);let c=P(4);return R(c.maximize())})("keydown.enter",function(){M(t);let c=P(4);return R(c.maximize())}),O(1,Pc,3,2,"ng-container",11)(2,Ic,2,1,"ng-container",11)(3,Nc,2,1,"ng-container",11),m()}if(n&2){let t=P(4);v("styleClass","p-dialog-maximize-button")("tabindex",t.maximizable?"0":"-1"),g(),v("ngIf",!t.maximizeIcon),g(),v("ngIf",!t.maximized),g(),v("ngIf",t.maximized)}}function Vc(n,h){n&1&&(ce(0),D(1,"TimesIcon"),ue())}function Ac(n,h){}function Lc(n,h){n&1&&O(0,Ac,0,0,"ng-template")}function Mc(n,h){if(n&1&&(p(0,"span"),O(1,Lc,1,0,null,21),m()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.closeIconTemplate)}}function Rc(n,h){if(n&1){let t=q();p(0,"p-button",22),$("onClick",function(){M(t);let c=P(4);return R(c.hide())})("keydown.enter",function(){M(t);let c=P(4);return R(c.hide())}),O(1,Vc,2,0,"ng-container",11)(2,Mc,2,1,"span",11),m()}if(n&2){let t=P(4);v("styleClass","p-dialog-close-button")("ariaLabel",t.ddconfig.closeAriaLabel||t.defaultCloseAriaLabel),g(),v("ngIf",!t.closeIconTemplate),g(),v("ngIf",t.closeIconTemplate)}}function Bc(n,h){if(n&1&&(ce(0),p(1,"span",16),x(2),m(),p(3,"div",17),O(4,Dc,4,5,"p-button",18)(5,Rc,3,4,"p-button",19),m(),ue()),n&2){let t=P(3);g(),v("ngClass","p-dialog-title")("id",t.ariaLabelledBy),g(),re(t.ddconfig.header),g(),v("ngClass","p-dialog-header-actions"),g(),v("ngIf",t.ddconfig.maximizable),g(),v("ngIf",t.closable)}}function zc(n,h){if(n&1){let t=q();p(0,"div",15,3),$("mousedown",function(c){M(t);let y=P(2);return R(y.initDrag(c))}),O(2,Cc,1,0,"ng-container",12)(3,Bc,6,6,"ng-container",11),m()}if(n&2){let t=P(2);v("ngClass","p-dialog-header"),g(2),v("ngComponentOutlet",t.headerTemplate),g(),v("ngIf",!t.headerTemplate)}}function Uc(n,h){}function jc(n,h){n&1&&O(0,Uc,0,0,"ng-template",23)}function $c(n,h){n&1&&Ue(0)}function Jc(n,h){if(n&1&&(ce(0),x(1),ue()),n&2){let t=P(3);g(),ct(" ",t.ddconfig.footer," ")}}function Gc(n,h){n&1&&Ue(0)}function Kc(n,h){if(n&1&&(p(0,"div",17,4),O(2,Jc,2,1,"ng-container",11)(3,Gc,1,0,"ng-container",12),m()),n&2){let t=P(2);v("ngClass","p-dialog-footer"),g(2),v("ngIf",!t.footerTemplate),g(),v("ngComponentOutlet",t.footerTemplate)}}function Wc(n,h){if(n&1){let t=q();p(0,"div",7,1),$("@animation.start",function(c){M(t);let y=P();return R(y.onAnimationStart(c))})("@animation.done",function(c){M(t);let y=P();return R(y.onAnimationEnd(c))}),O(2,wc,1,1,"div",8)(3,zc,4,3,"div",9),p(4,"div",10,2),O(6,jc,1,0,null,11)(7,$c,1,0,"ng-container",12),m(),O(8,Kc,4,3,"div",13),m()}if(n&2){let t=P();xt(t.ddconfig.style),Qe(t.ddconfig.styleClass),ei("width",t.ddconfig.width)("height",t.ddconfig.height),v("ngClass",ge(22,yc,t.maximizable&&t.maximized))("ngStyle",De(24,_c))("@animation",ge(28,Sc,ii(25,bc,t.transformOptions,t.ddconfig.transitionOptions||"150ms cubic-bezier(0, 0, 0.2, 1)")))("pFocusTrapDisabled",t.ddconfig.focusTrap===!1),se("aria-labelledby",t.ariaLabelledBy)("aria-modal",!0)("id",t.dialogId),g(2),v("ngIf",t.ddconfig.resizable),g(),v("ngIf",t.ddconfig.showHeader!==!1),g(),v("ngClass","p-dialog-content")("ngStyle",t.ddconfig.contentStyle),g(2),v("ngIf",!t.contentTemplate),g(),v("ngComponentOutlet",t.contentTemplate),g(),v("ngIf",t.ddconfig.footer||t.footerTemplate)}}var Aa=(()=>{class n{viewContainerRef;constructor(t){this.viewContainerRef=t}static \u0275fac=function(l){return new(l||n)(Ht(Oo))};static \u0275dir=hn({type:n,selectors:[["","pDynamicDialogContent",""]]})}return n})(),La=(()=>{class n extends ua{name="dialog";static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var An=class{data;inputValues;header;ariaLabelledBy;footer;width;height;closeOnEscape=!1;focusOnShow=!0;focusTrap=!0;baseZIndex;autoZIndex=!1;dismissableMask=!1;rtl=!1;style;contentStyle;styleClass;transitionOptions;closable=!1;showHeader=!1;modal=!1;maskStyleClass;resizable=!1;draggable=!1;keepInViewport=!1;minX;minY;maximizable=!1;maximizeIcon;minimizeIcon;position;closeAriaLabel;appendTo;duplicate=!1;breakpoints;templates},on=class{constructor(){}close(h){this._onClose.next(h),setTimeout(()=>{this._onClose.complete()},1e3)}destroy(){this._onDestroy.next(null)}dragStart(h){this._onDragStart.next(h)}dragEnd(h){this._onDragEnd.next(h)}resizeInit(h){this._onResizeInit.next(h)}resizeEnd(h){this._onResizeEnd.next(h)}maximize(h){this._onMaximize.next(h)}_onClose=new Wt;onClose=this._onClose.asObservable();_onDestroy=new Wt;onDestroy=this._onDestroy.asObservable();_onDragStart=new Wt;onDragStart=this._onDragStart.asObservable();_onDragEnd=new Wt;onDragEnd=this._onDragEnd.asObservable();_onResizeInit=new Wt;onResizeInit=this._onResizeInit.asObservable();_onResizeEnd=new Wt;onResizeEnd=this._onResizeEnd.asObservable();_onMaximize=new Wt;onMaximize=this._onMaximize.asObservable();onChildComponentLoaded=new Wt},Hc=jn([Tt({transform:"{{transform}}",opacity:0}),Lt("{{transition}}",Tt({transform:"none",opacity:1}))]),qc=jn([Lt("{{transition}}",Tt({transform:"{{transform}}",opacity:0}))]),Ma=(()=>{class n extends Et{renderer;ddconfig;dialogRef;zone;parentDialog;visible=!0;componentRef;mask;resizing;dragging;maximized;_style={};originalStyle;lastPageX;lastPageY;ariaLabelledBy;id=bi("pn_id_");styleElement;insertionPoint;maskViewChild;contentViewChild;footerViewChild;headerViewChild;childComponentType;inputValues;container;wrapper;documentKeydownListener;documentEscapeListener;maskClickListener;transformOptions="scale(0.7)";documentResizeListener;documentResizeEndListener;documentDragListener;documentDragEndListener;_componentStyle=K(La);get minX(){return this.ddconfig.minX?this.ddconfig.minX:0}get minY(){return this.ddconfig.minY?this.ddconfig.minY:0}get keepInViewport(){return this.ddconfig.keepInViewport}get maximizable(){return this.ddconfig.maximizable}get maximizeIcon(){return this.ddconfig.maximizeIcon}get minimizeIcon(){return this.ddconfig.minimizeIcon}get closable(){return this.ddconfig.closable}get style(){return this._style}get position(){return this.ddconfig.position}get defaultCloseAriaLabel(){return this.config.getTranslation(Bt.ARIA).close}set style(t){t&&(this._style=ve({},t),this.originalStyle=t)}get parent(){let t=Array.from(this.document.getElementsByClassName("p-dialog"));if(t.length>1)return t.pop()}get parentContent(){let t=Array.from(this.document.getElementsByClassName("p-dialog"));if(t.length>0){let l=t[t.length-1].querySelector(".p-dialog-content");if(l)return Array.isArray(l)?l[0]:l}}get header(){return this.ddconfig.header}get data(){return this.ddconfig.data}get breakpoints(){return this.ddconfig.breakpoints}get footerTemplate(){return this.ddconfig?.templates?.footer}get headerTemplate(){return this.ddconfig?.templates?.header}get contentTemplate(){return this.ddconfig?.templates?.content}get minimizeIconTemplate(){return this.ddconfig?.templates?.minimizeicon}get maximizeIconTemplate(){return this.ddconfig?.templates?.maximizeicon}get closeIconTemplate(){return this.ddconfig?.templates?.closeicon}get maskClass(){let l=["left","right","top","topleft","topright","bottom","bottomleft","bottomright"].find(c=>c===this.position);return{"p-dialog-mask":!0,"p-overlay-mask p-overlay-mask-enter":this.ddconfig.modal||this.ddconfig.dismissableMask,[`p-dialog-${l}`]:l}}get dialogId(){return this.attrSelector}zIndexForLayering;constructor(t,l,c,y,F){super(),this.renderer=t,this.ddconfig=l,this.dialogRef=c,this.zone=y,this.parentDialog=F}ngOnInit(){super.ngOnInit(),this.breakpoints&&this.createStyle()}createStyle(){if(oi(this.platformId)&&!this.styleElement){this.styleElement=this.renderer.createElement("style"),this.styleElement.type="text/css",this.renderer.appendChild(this.document.head,this.styleElement);let t="";for(let l in this.breakpoints)t+=`
|
|
562
|
+
`,Zl={root:({instance:n})=>`p-fileupload p-fileupload-${n.mode} p-component`,header:"p-fileupload-header",pcChooseButton:"p-fileupload-choose-button",pcUploadButton:"p-fileupload-upload-button",pcCancelButton:"p-fileupload-cancel-button",content:"p-fileupload-content",fileList:"p-fileupload-file-list",file:"p-fileupload-file",fileThumbnail:"p-fileupload-file-thumbnail",fileInfo:"p-fileupload-file-info",fileName:"p-fileupload-file-name",fileSize:"p-fileupload-file-size",pcFileBadge:"p-fileupload-file-badge",fileActions:"p-fileupload-file-actions",pcFileRemoveButton:"p-fileupload-file-remove-button"},ka=(()=>{class n extends Rt{name="fileupload";theme=Ql;classes=Zl;static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var Si=(()=>{class n extends Et{name;url;method="post";multiple;accept;disabled;auto;withCredentials;maxFileSize;invalidFileSizeMessageSummary="{0}: Invalid file size, ";invalidFileSizeMessageDetail="maximum upload size is {0}.";invalidFileTypeMessageSummary="{0}: Invalid file type, ";invalidFileTypeMessageDetail="allowed file types: {0}.";invalidFileLimitMessageDetail="limit is {0} at most.";invalidFileLimitMessageSummary="Maximum number of files exceeded, ";style;styleClass;previewWidth=50;chooseLabel;uploadLabel;cancelLabel;chooseIcon;uploadIcon;cancelIcon;showUploadButton=!0;showCancelButton=!0;mode="advanced";headers;customUpload;fileLimit;uploadStyleClass;cancelStyleClass;removeStyleClass;chooseStyleClass;chooseButtonProps;uploadButtonProps={severity:"secondary"};cancelButtonProps={severity:"secondary"};onBeforeUpload=new qe;onSend=new qe;onUpload=new qe;onError=new qe;onClear=new qe;onRemove=new qe;onSelect=new qe;onProgress=new qe;uploadHandler=new qe;onImageError=new qe;onRemoveUploadedFile=new qe;fileTemplate;headerTemplate;contentTemplate;toolbarTemplate;chooseIconTemplate;fileLabelTemplate;uploadIconTemplate;cancelIconTemplate;emptyTemplate;advancedFileInput;basicFileInput;content;set files(t){this._files=[];for(let l=0;l<t.length;l++){let c=t[l];this.validate(c)&&(this.isImage(c)&&(c.objectURL=this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(t[l]))),this._files.push(t[l]))}}get files(){return this._files}get basicButtonLabel(){return this.auto||!this.hasFiles()?this.chooseLabel:this.uploadLabel??this.files[0].name}_files=[];progress=0;dragHighlight;msgs;uploadedFileCount=0;focus;uploading;duplicateIEEvent;translationSubscription;dragOverListener;uploadedFiles=[];sanitizer=K($o);zone=K(pn);http=K(jo);_componentStyle=K(ka);ngOnInit(){super.ngOnInit(),this.translationSubscription=this.config.translationObserver.subscribe(()=>{this.cd.markForCheck()})}ngAfterViewInit(){super.ngAfterViewInit(),oi(this.platformId)&&this.mode==="advanced"&&this.zone.runOutsideAngular(()=>{this.content&&(this.dragOverListener=this.renderer.listen(this.content.nativeElement,"dragover",this.onDragOver.bind(this)))})}_headerTemplate;_contentTemplate;_toolbarTemplate;_chooseIconTemplate;_uploadIconTemplate;_cancelIconTemplate;_emptyTemplate;_fileTemplate;_fileLabelTemplate;templates;ngAfterContentInit(){this.templates?.forEach(t=>{switch(t.getType()){case"header":this._headerTemplate=t.template;break;case"file":this._fileTemplate=t.template;break;case"content":this._contentTemplate=t.template;break;case"toolbar":this._toolbarTemplate=t.template;break;case"chooseicon":this._chooseIconTemplate=t.template;break;case"uploadicon":this._uploadIconTemplate=t.template;break;case"cancelicon":this._cancelIconTemplate=t.template;break;case"empty":this._emptyTemplate=t.template;break;case"filelabel":this._fileLabelTemplate=t.template;break;default:this._fileTemplate=t.template;break}})}basicFileChosenLabel(){return this.auto?this.chooseButtonLabel:this.hasFiles()?this.files&&this.files.length===1?this.files[0].name:this.config.getTranslation("fileChosenMessage")?.replace("{0}",this.files.length):this.config.getTranslation("noFileChosenMessage")||""}getTranslation(t){return this.config.getTranslation(t)}choose(){this.advancedFileInput?.nativeElement.click()}onFileSelect(t){if(t.type!=="drop"&&this.isIE11()&&this.duplicateIEEvent){this.duplicateIEEvent=!1;return}this.msgs=[],this.multiple||(this.files=[]);let l=t.dataTransfer?t.dataTransfer.files:t.target.files;for(let c=0;c<l.length;c++){let y=l[c];this.isFileSelected(y)||this.validate(y)&&(this.isImage(y)&&(y.objectURL=this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(l[c]))),this.files.push(l[c]))}this.onSelect.emit({originalEvent:t,files:l,currentFiles:this.files}),this.checkFileLimit(l),this.hasFiles()&&this.auto&&(this.mode!=="advanced"||!this.isFileLimitExceeded())&&this.upload(),t.type!=="drop"&&this.isIE11()?this.clearIEInput():this.clearInputElement()}isFileSelected(t){for(let l of this.files)if(l.name+l.type+l.size===t.name+t.type+t.size)return!0;return!1}isIE11(){if(oi(this.platformId))return!!this.document.defaultView.MSInputMethodContext&&!!this.document.documentMode}validate(t){if(this.msgs=this.msgs||[],this.accept&&!this.isFileTypeValid(t)){let l=`${this.invalidFileTypeMessageSummary.replace("{0}",t.name)} ${this.invalidFileTypeMessageDetail.replace("{0}",this.accept)}`;return this.msgs.push({severity:"error",text:l}),!1}if(this.maxFileSize&&t.size>this.maxFileSize){let l=`${this.invalidFileSizeMessageSummary.replace("{0}",t.name)} ${this.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.maxFileSize))}`;return this.msgs.push({severity:"error",text:l}),!1}return!0}isFileTypeValid(t){let l=this.accept?.split(",").map(c=>c.trim());for(let c of l)if(this.isWildcard(c)?this.getTypeClass(t.type)===this.getTypeClass(c):t.type==c||this.getFileExtension(t).toLowerCase()===c.toLowerCase())return!0;return!1}getTypeClass(t){return t.substring(0,t.indexOf("/"))}isWildcard(t){return t.indexOf("*")!==-1}getFileExtension(t){return"."+t.name.split(".").pop()}isImage(t){return/^image\//.test(t.type)}onImageLoad(t){window.URL.revokeObjectURL(t.src)}uploader(){if(this.customUpload)this.fileLimit&&(this.uploadedFileCount+=this.files.length),this.uploadHandler.emit({files:this.files}),this.cd.markForCheck();else{this.uploading=!0,this.msgs=[];let t=new FormData;this.onBeforeUpload.emit({formData:t});for(let l=0;l<this.files.length;l++)t.append(this.name,this.files[l],this.files[l].name);this.http.request(this.method,this.url,{body:t,headers:this.headers,reportProgress:!0,observe:"events",withCredentials:this.withCredentials}).subscribe(l=>{switch(l.type){case _n.Sent:this.onSend.emit({originalEvent:l,formData:t});break;case _n.Response:this.uploading=!1,this.progress=0,l.status>=200&&l.status<300?(this.fileLimit&&(this.uploadedFileCount+=this.files.length),this.onUpload.emit({originalEvent:l,files:this.files})):this.onError.emit({files:this.files}),this.uploadedFiles.push(...this.files),this.clear();break;case _n.UploadProgress:{l.loaded&&(this.progress=Math.round(l.loaded*100/l.total)),this.onProgress.emit({originalEvent:l,progress:this.progress});break}}this.cd.markForCheck()},l=>{this.uploading=!1,this.onError.emit({files:this.files,error:l})})}}clear(){this.files=[],this.uploadedFileCount=0,this.onClear.emit(),this.clearInputElement(),this.cd.markForCheck()}remove(t,l){this.clearInputElement(),this.onRemove.emit({originalEvent:t,file:this.files[l]}),this.files.splice(l,1),this.checkFileLimit(this.files)}removeUploadedFile(t){let l=this.uploadedFiles.splice(t,1)[0];this.uploadedFiles=[...this.uploadedFiles],this.onRemoveUploadedFile.emit({file:l,files:this.uploadedFiles})}isFileLimitExceeded(){let l=this.auto?this.files.length:this.files.length+this.uploadedFileCount;return this.fileLimit&&this.fileLimit<=l&&this.focus&&(this.focus=!1),this.fileLimit&&this.fileLimit<l}isChooseDisabled(){return this.auto?this.fileLimit&&this.fileLimit<=this.files.length:this.fileLimit&&this.fileLimit<=this.files.length+this.uploadedFileCount}checkFileLimit(t){this.msgs??=[];let l=this.msgs.length>0&&this.fileLimit&&this.fileLimit<t.length;if(this.isFileLimitExceeded()||l){let c=`${this.invalidFileLimitMessageSummary.replace("{0}",this.fileLimit.toString())} ${this.invalidFileLimitMessageDetail.replace("{0}",this.fileLimit.toString())}`;this.msgs.push({severity:"error",text:c})}}clearInputElement(){this.advancedFileInput&&this.advancedFileInput.nativeElement&&(this.advancedFileInput.nativeElement.value=""),this.basicFileInput&&this.basicFileInput.nativeElement&&(this.basicFileInput.nativeElement.value="")}clearIEInput(){this.advancedFileInput&&this.advancedFileInput.nativeElement&&(this.duplicateIEEvent=!0,this.advancedFileInput.nativeElement.value="")}hasFiles(){return this.files&&this.files.length>0}hasUploadedFiles(){return this.uploadedFiles&&this.uploadedFiles.length>0}onDragEnter(t){this.disabled||(t.stopPropagation(),t.preventDefault())}onDragOver(t){this.disabled||(ri(this.content?.nativeElement,"p-fileupload-highlight"),this.dragHighlight=!0,t.stopPropagation(),t.preventDefault())}onDragLeave(t){this.disabled||si(this.content?.nativeElement,"p-fileupload-highlight")}onDrop(t){if(!this.disabled){si(this.content?.nativeElement,"p-fileupload-highlight"),t.stopPropagation(),t.preventDefault();let l=t.dataTransfer?t.dataTransfer.files:t.target.files;(this.multiple||l&&l.length===1)&&this.onFileSelect(t)}}onFocus(){this.focus=!0}onBlur(){this.focus=!1}formatSize(t){let y=this.getTranslation(Bt.FILE_SIZE_TYPES);if(t===0)return`0 ${y[0]}`;let F=Math.floor(Math.log(t)/Math.log(1024));return`${(t/Math.pow(1024,F)).toFixed(3)} ${y[F]}`}upload(){this.hasFiles()&&this.uploader()}onBasicUploaderClick(){this.basicFileInput?.nativeElement.click()}onBasicKeydown(t){switch(t.code){case"Space":case"Enter":this.onBasicUploaderClick(),t.preventDefault();break}}imageError(t){this.onImageError.emit(t)}getBlockableElement(){return this.el.nativeElement.children[0]}get chooseButtonLabel(){return this.chooseLabel||this.config.getTranslation(Bt.CHOOSE)}get uploadButtonLabel(){return this.uploadLabel||this.config.getTranslation(Bt.UPLOAD)}get cancelButtonLabel(){return this.cancelLabel||this.config.getTranslation(Bt.CANCEL)}get browseFilesLabel(){return this.config.getTranslation(Bt.ARIA)[Bt.BROWSE_FILES]}get pendingLabel(){return this.config.getTranslation(Bt.PENDING)}ngOnDestroy(){this.content&&this.content.nativeElement&&this.dragOverListener&&(this.dragOverListener(),this.dragOverListener=null),this.translationSubscription&&this.translationSubscription.unsubscribe(),super.ngOnDestroy()}static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["p-fileupload"],["p-fileUpload"]],contentQueries:function(l,c,y){if(l&1&&(ke(y,Ns,4),ke(y,Ds,4),ke(y,Pa,4),ke(y,Vs,4),ke(y,As,4),ke(y,Ls,4),ke(y,Ms,4),ke(y,Rs,4),ke(y,Bs,4),ke(y,li,4)),l&2){let F;Q(F=Z())&&(c.fileTemplate=F.first),Q(F=Z())&&(c.headerTemplate=F.first),Q(F=Z())&&(c.contentTemplate=F.first),Q(F=Z())&&(c.toolbarTemplate=F.first),Q(F=Z())&&(c.chooseIconTemplate=F.first),Q(F=Z())&&(c.fileLabelTemplate=F.first),Q(F=Z())&&(c.uploadIconTemplate=F.first),Q(F=Z())&&(c.cancelIconTemplate=F.first),Q(F=Z())&&(c.emptyTemplate=F.first),Q(F=Z())&&(c.templates=F)}},viewQuery:function(l,c){if(l&1&&(ot(zs,5),ot(Us,5),ot(Pa,5)),l&2){let y;Q(y=Z())&&(c.advancedFileInput=y.first),Q(y=Z())&&(c.basicFileInput=y.first),Q(y=Z())&&(c.content=y.first)}},inputs:{name:"name",url:"url",method:"method",multiple:[2,"multiple","multiple",tt],accept:"accept",disabled:[2,"disabled","disabled",tt],auto:[2,"auto","auto",tt],withCredentials:[2,"withCredentials","withCredentials",tt],maxFileSize:[2,"maxFileSize","maxFileSize",ki],invalidFileSizeMessageSummary:"invalidFileSizeMessageSummary",invalidFileSizeMessageDetail:"invalidFileSizeMessageDetail",invalidFileTypeMessageSummary:"invalidFileTypeMessageSummary",invalidFileTypeMessageDetail:"invalidFileTypeMessageDetail",invalidFileLimitMessageDetail:"invalidFileLimitMessageDetail",invalidFileLimitMessageSummary:"invalidFileLimitMessageSummary",style:"style",styleClass:"styleClass",previewWidth:[2,"previewWidth","previewWidth",ki],chooseLabel:"chooseLabel",uploadLabel:"uploadLabel",cancelLabel:"cancelLabel",chooseIcon:"chooseIcon",uploadIcon:"uploadIcon",cancelIcon:"cancelIcon",showUploadButton:[2,"showUploadButton","showUploadButton",tt],showCancelButton:[2,"showCancelButton","showCancelButton",tt],mode:"mode",headers:"headers",customUpload:[2,"customUpload","customUpload",tt],fileLimit:[2,"fileLimit","fileLimit",t=>ki(t,null)],uploadStyleClass:"uploadStyleClass",cancelStyleClass:"cancelStyleClass",removeStyleClass:"removeStyleClass",chooseStyleClass:"chooseStyleClass",chooseButtonProps:"chooseButtonProps",uploadButtonProps:"uploadButtonProps",cancelButtonProps:"cancelButtonProps",files:"files"},outputs:{onBeforeUpload:"onBeforeUpload",onSend:"onSend",onUpload:"onUpload",onError:"onError",onClear:"onClear",onRemove:"onRemove",onSelect:"onSelect",onProgress:"onProgress",uploadHandler:"uploadHandler",onImageError:"onImageError",onRemoveUploadedFile:"onRemoveUploadedFile"},features:[je([ka]),Xt,ht],decls:2,vars:2,consts:[["advancedfileinput",""],["content",""],["icon",""],["basicfileinput",""],[3,"ngClass","ngStyle","class",4,"ngIf"],[3,"ngClass","class",4,"ngIf"],[3,"ngClass","ngStyle"],["type","file",3,"change","multiple","accept","disabled"],[1,"p-fileupload-header"],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngTemplateOutlet"],[1,"p-fileupload-content",3,"dragenter","dragleave","drop"],[3,"value","showValue",4,"ngIf"],[3,"severity","text"],["class","p-fileupload-file-list",4,"ngIf"],["tabindex","0",3,"focus","blur","onClick","keydown.enter","styleClass","disabled","label","buttonProps"],[3,"class",4,"ngIf"],[3,"label","disabled","styleClass","buttonProps","onClick",4,"ngIf"],[3,"onClick","label","disabled","styleClass","buttonProps"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],[3,"value","showValue"],[1,"p-fileupload-file-list"],[1,"p-fileupload-file"],["ngFor","",3,"ngForOf","ngForTemplate"],["class","p-fileupload-file",4,"ngFor","ngForOf"],["class","p-fileupload-file-thumbnail",3,"src","width","error",4,"ngIf"],[1,"p-fileupload-file-info"],[1,"p-fileupload-file-name"],[1,"p-fileupload-file-size"],[1,"p-fileupload-file-actions"],["text","","rounded","","severity","danger",3,"onClick","disabled","styleClass"],[1,"p-fileupload-file-thumbnail",3,"error","src","width"],["tabindex","0",3,"onClick","keydown","styleClass","disabled","label","buttonProps"],["type","file",3,"change","focus","blur","accept","multiple","disabled"],["class","p-button-icon p-button-icon-left",3,"ngClass",4,"ngIf"],[1,"p-button-icon","p-button-icon-left",3,"ngClass"],[3,"styleClass",4,"ngIf"],["class","p-button-icon p-button-icon-left",4,"ngIf"],[3,"styleClass"],[1,"p-button-icon","p-button-icon-left"],["class","p-button-icon p-button-icon-left pi",3,"ngClass",4,"ngIf"],[1,"p-button-icon","p-button-icon-left","pi",3,"ngClass"],[3,"class"]],template:function(l,c){l&1&&O(0,Il,15,39,"div",4)(1,ql,9,16,"div",5),l&2&&(v("ngIf",c.mode==="advanced"),g(),v("ngIf",c.mode==="basic"))},dependencies:[Le,gt,zo,Ye,Dt,ni,ft,Ea,Ca,Tn,fa,zi,$e],encapsulation:2,changeDetection:0})}return n})(),Qi=(()=>{class n{static \u0275fac=function(l){return new(l||n)};static \u0275mod=Ot({type:n});static \u0275inj=Ft({imports:[Si,$e,$e]})}return n})();var io=_i(On()),Ta=n=>(0,io.default)(n).isSame((0,io.default)("0001-01-01T00:00:00"));var Yl=["class","page"],Xl=()=>({width:"25rem"}),ec=()=>({width:"100%"}),tc=()=>({width:"50%"}),ic=()=>({});function nc(n,h){n&1&&(p(0,"tr")(1,"th"),x(2,"Account"),m(),p(3,"th",40),x(4,"Amount"),m(),p(5,"th",40),x(6,"Note"),m(),D(7,"th",41),m())}function oc(n,h){if(n&1&&(p(0,"div",49)(1,"div"),x(2),m()()),n&2){let t=P().$implicit;g(2),re(t.value)}}function ac(n,h){if(n&1&&O(0,oc,3,1,"div",48),n&2){let t=h.$implicit;v("ngIf",t)}}function rc(n,h){if(n&1&&(p(0,"div",49)(1,"div"),x(2),m()()),n&2){let t=h.$implicit;g(2),re(t.value)}}function sc(n,h){if(n&1){let t=q();p(0,"div",50)(1,"p-button",51),$("onClick",function(){M(t);let c=P(2);return R(c.addIitemVisible.set(!c.addIitemVisible()))}),m()()}}function lc(n,h){if(n&1){let t=q();p(0,"tr",42)(1,"td")(2,"p-select",43),O(3,ac,1,1,"ng-template",null,4,me)(5,rc,3,1,"ng-template",null,5,me)(7,sc,2,0,"ng-template",null,2,me),m()(),p(9,"td"),D(10,"input",44),m(),p(11,"td"),D(12,"textarea",45),m(),p(13,"td")(14,"button",46),$("click",function(){let c=M(t).rowIndex,y=P();return R(y.removeItem(c))}),D(15,"i",47),m()()()}if(n&2){let t=h.rowIndex,l=P();v("formGroupName",t),g(2),xt(De(7,tc)),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",l.journalRecordExpense().options.accounts),g(8),v("autoNumeric",De(8,ic))}}function cc(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",52)(3,"button",53),$("click",function(){M(t);let c=P();return R(c.addItem())}),x(4," Add "),m(),p(5,"span"),x(6,"Total :"),m()()(),p(7,"td"),x(8),Be(9,"async"),Be(10,"number"),m(),D(11,"td",54),m()}if(n&2){let t=P();g(8),re(Ze(10,3,Ze(9,1,t.totalDebitAmount$)))}}var Da=(()=>{class n{constructor(){this.fb=K(Go),this.journalRecordExpense=Ae(null),this.activatedRoute=K(ai),this.journalService=K(Xe),this.toasr=K(Mi),this.file=Ae(null),this.addIitemVisible=Ae(!1)}ngOnInit(){this.initForm(),this.loadJournalForm(),this.initFormAddItemCOA(),this.totalDebitAmount$=this.form.controls.items.valueChanges.pipe(kt(t=>t.reduce((l,c)=>l+c.debitAmount,0)),He("response"))}loadCategories(){this.categories$||(this.categories$=this.journalService.fetchCategoryOptions().pipe(wo(1)))}initFormAddItemCOA(){this.formAddItemCOA=this.fb.group({ID:this.fb.control(Ve.toString()),Name:this.fb.control(""),Code:this.fb.control(""),Note:this.fb.control(""),CategoryID:this.fb.control(""),OutletID:this.fb.control(Ve.toString()),Balance:this.fb.control(0)})}onaddItemCOA(){if(this.formAddItemCOA.invalid){this.formAddItemCOA.markAllAsTouched();return}let t=Object.entries(this.formAddItemCOA.getRawValue()).reduce((l,[c,y])=>(c==="CategoryID"?l[c]=y.key||y:l[c]=y,l),{});this.journalService.submitChartAccount(t).pipe(Fe(()=>{this.toasr.success("Add COA Success","Success"),this.loadJournalForm(),this.formAddItemCOA.reset(),this.addIitemVisible.update(l=>!l)})).subscribe()}loadJournalForm(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>{this.patchForm(t.form),this.journalRecordExpense.set(t)})).subscribe()}initForm(){this.form=this.fb.group({order:this.buildOrderGroup(this.fb),items:this.fb.array([]),additionalAccountID:this.fb.control(""),file:this.fb.control("")}),this.form.controls.order.controls.date.disable()}buildOrderGroup(t){return t.group({id:t.control(""),number:t.control(""),date:t.control(new Date),note:t.control(""),entryTypeID:t.control(0),referenceID:t.control(""),referenceTypeID:t.control(0),referenceText:t.control(""),contactID:t.control(""),detailReferenceID:t.control(""),creatorID:t.control(""),created:t.control(""),modifierID:t.control(""),modified:t.control(""),entityID:t.control(""),statusID:t.control(""),contactName:t.control("")})}buildItemGroup(t){return t.group({id:t.control(Ve.toString()),journalID:t.control(Ve.toString()),accountID:t.control(""),debitAmount:t.control(0),creditAmount:t.control(0),index:t.control(0),note:t.control("")})}patchForm(t){if(!t)return;this.form.controls.order.patchValue({id:t.order.id,number:t.order.number,date:Ta(t.order.date)?(0,no.default)().toDate():(0,no.default)(t.order.date).toDate(),note:t.order.note,entryTypeID:t.order.entryTypeID,referenceID:t.order.referenceID,referenceTypeID:t.order.referenceTypeID,referenceText:t.order.referenceText,contactID:t.order.contactID,detailReferenceID:t.order.detailReferenceID,creatorID:t.order.creatorID,created:t.order.created,modifierID:t.order.modifierID,modified:t.order.modified,entityID:t.order.entityID,statusID:t.order.statusID,contactName:t.order.contactName});let l=this.form.controls.items;l.clear(),t.items.forEach(c=>{let y=this.buildItemGroup(this.fb);y.patchValue(c),l.push(y)}),this.form.patchValue({items:void 0,order:void 0,additionalAccountID:t.additionalAccountID??"",file:t.file??""})}openDialogAddItemCOA(){this.addIitemVisible.update(t=>!t)}addItem(){let t=this.form.controls.items,l=this.buildItemGroup(this.fb);t.push(l)}removeItem(t){this.form.controls.items.removeAt(t)}search(t){let l=t.query;this.supplierSuggestions$=this.journalService.getJournalEntrySupplierSuggestions(l).pipe(He("response"))}onUpload(t){this.file.set(t.currentFiles[0])}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):y==="file"?c[y]=F.length>0?F:null:c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.file()),l}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-record-expense",8,"page"]],attrs:Yl,decls:81,vars:26,consts:[["header",""],["body",""],["footer",""],["fu",""],["selectedItem",""],["item",""],["pageTitle","Record Expense"],["ngProjectAs","action-button",5,["action-button"]],[1,"btn","btn-secondary","rounded"],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],[1,"row"],["formGroupName","order",1,"col"],[1,"d-flex","flex-column"],["for","outlet"],["inputId","outlet","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an outlet","filterBy","name",3,"virtualScroll","virtualScrollItemSize","options","filter"],["styleClass","w-100","formControlName","date"],["formControlName","number","type","text","pInputText",""],[1,"col"],["inputId","outlet","formControlName","additionalAccountID","optionLabel","value","optionValue","key","placeholder","",3,"virtualScroll","virtualScrollItemSize","options"],["formArrayName","items",3,"value"],["formGroupName","order",1,"row"],["for",""],["styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",3,"completeMethod","suggestions"],["rows","1","pTextarea","","formControlName","note","placeholder","e.g. Electricity & Phone Bill for Decemeber",3,"autoResize"],[1,"form-group","d-flex","flex-column"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["header","Add New Account",3,"modal","visible","closable"],[1,"row","row-gap-3",3,"formGroup"],["for","username",1,"font-semibold","w-24"],["formControlName","Name","pInputText","","id","username","autocomplete","off",1,"flex-auto"],["for","email",1,"font-semibold","w-24"],["formControlName","Code","pInputText","","id","email","autocomplete","off",1,"flex-auto"],[1,"col-12"],["for","password",1,"font-semibold","w-24"],["formControlName","CategoryID","containerStyleClass","w-100","appendTo","body","placeholder","Select Item",3,"onFocus","options"],[1,"d-flex","justify-content-end","gap-2"],["label","Cancel","severity","secondary",3,"click"],["label","Save",3,"click"],[2,"width","10%"],[2,"width","5%"],[3,"formGroupName"],["filter","","filterBy","value","styleClass","w-50","appendTo","body","formControlName","accountID","optionLabel","value","optionValue","key","placeholder","Select an account",3,"virtualScroll","virtualScrollItemSize","options"],["type","text","pInputText","","formControlName","debitAmount",3,"autoNumeric"],["autoResize","","rows","1","pTextarea","","formControlName","note"],[1,"btn","btn-link",3,"click"],[1,"fa-light","fa-trash","text-danger"],["class","flex items-center gap-2",4,"ngIf"],[1,"flex","items-center","gap-2"],[1,"p-3"],["label","Add New","fluid","","severity","secondary","text","","size","small","icon","pi pi-plus",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","rounded",3,"click"],["colspan","2"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",6),ce(1,7),p(2,"button",8),x(3,"Cancel"),m(),p(4,"button",9),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(5," Save "),m(),ue(),ce(6,10),p(7,"div",11)(8,"p-panel")(9,"div",12)(10,"div",13)(11,"div",14)(12,"label",15),x(13,"Outlet"),m(),D(14,"p-select",16),m()(),p(15,"div",13)(16,"div",14)(17,"label",15),x(18,"Date"),m(),D(19,"p-datepicker",17),m()(),p(20,"div",13)(21,"div",14)(22,"label",15),x(23,"Number"),m(),D(24,"input",18),m()(),p(25,"div",19)(26,"div",14)(27,"label",15),x(28,"Account"),m(),D(29,"p-select",20),m()()(),D(30,"hr"),p(31,"p-table",21),O(32,nc,8,0,"ng-template",null,0,me)(34,lc,16,9,"ng-template",null,1,me)(36,cc,12,5,"ng-template",null,2,me),m(),D(38,"hr"),p(39,"div",22)(40,"div",19)(41,"div",12)(42,"div",19)(43,"div",14)(44,"label",23),x(45,"Supplier"),m(),p(46,"p-autocomplete",24),Be(47,"async"),$("completeMethod",function(L){return M(y),R(c.search(L))}),m()()(),p(48,"div",19)(49,"div",14)(50,"label",23),x(51,"Note"),m(),D(52,"textarea",25),m()(),p(53,"div",19)(54,"div",26)(55,"label",23),x(56,"Upload"),m(),p(57,"p-fileupload",27,3),$("onSelect",function(L){return M(y),R(c.onUpload(L))}),m()()()()()()()(),ue(),m(),p(59,"p-dialog",28)(60,"div",29)(61,"div",19)(62,"div",14)(63,"label",30),x(64,"Name"),m(),D(65,"input",31),m()(),p(66,"div",19)(67,"div",14)(68,"label",32),x(69,"Code"),m(),D(70,"input",33),m()(),p(71,"div",34)(72,"div",14)(73,"label",35),x(74,"Category"),m(),p(75,"p-treeselect",36),Be(76,"async"),$("onFocus",function(){return M(y),R(c.loadCategories())}),m()()(),p(77,"div",19)(78,"div",37)(79,"p-button",38),$("click",function(){return M(y),R(c.addIitemVisible.set(!c.addIitemVisible()))}),m(),p(80,"p-button",39),$("click",function(){return M(y),R(c.onaddItemCOA())}),m()()()()()}l&2&&(g(7),v("formGroup",c.form),g(7),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",c.journalRecordExpense().options.entities)("filter",!0),g(15),v("virtualScroll",!0)("virtualScrollItemSize",50)("options",c.journalRecordExpense().options.paymentAccounts),g(2),v("value",c.form.controls.items.controls),g(15),v("suggestions",Ze(47,20,c.supplierSuggestions$)),g(6),v("autoResize",!0),g(7),xt(De(24,Xl)),v("modal",!0)("visible",c.addIitemVisible())("closable",!1),g(),v("formGroup",c.formAddItemCOA),g(15),xt(De(25,ec)),v("options",Ze(76,22,c.categories$)))},dependencies:[Pt,Le,Ye,Uo,Vt,_a,Yn,pi,di,Gi,Ji,ui,ci,Ut,$t,jt,Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,qi,gi,hi,Wi,Ki,Qi,Si,zt,ft,$i,ji,ga,ha],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var uc=["filterRef"],mc=["class","page"];function dc(n,h){n&1&&(p(0,"div",10)(1,"div",5)(2,"h5",11),x(3,"Card title"),m(),p(4,"h6",12),x(5,"Card subtitle"),m(),p(6,"p",13),x(7," Some quick example text to build on the card title and make up the bulk of the card's content. "),m(),p(8,"a",14),x(9,"Card link"),m(),p(10,"a",14),x(11,"Another link"),m()()())}var Va=(()=>{class n{constructor(){this.modalService=K(Cn)}onFilterChange(t){console.log("Filter Change",t),this.modalService.open(this.templateRef)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-deposit",8,"page"]],viewQuery:function(l,c){if(l&1&&ot(uc,7),l&2){let y;Q(y=Z())&&(c.templateRef=y.first)}},attrs:mc,decls:44,vars:0,consts:[["filterRef",""],[3,"eventFilterChange"],["ngProjectAs","content",5,["content"]],[1,"container","my-4"],[1,"card"],[1,"card-body"],[1,"table"],["scope","col"],["scope","row"],["colspan","2"],[1,"card",2,"width","18rem"],[1,"card-title"],[1,"card-subtitle","mb-2","text-body-secondary"],[1,"card-text"],["href","#",1,"card-link"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",1),$("eventFilterChange",function(L){return M(y),R(c.onFilterChange(L))}),ce(1,2),p(2,"div",3)(3,"div",4)(4,"div",5)(5,"table",6)(6,"thead")(7,"tr")(8,"th",7),x(9,"#"),m(),p(10,"th",7),x(11,"First"),m(),p(12,"th",7),x(13,"Last"),m(),p(14,"th",7),x(15,"Handle"),m()()(),p(16,"tbody")(17,"tr")(18,"th",8),x(19,"1"),m(),p(20,"td"),x(21,"Mark"),m(),p(22,"td"),x(23,"Otto"),m(),p(24,"td"),x(25,"mdo"),m()(),p(26,"tr")(27,"th",8),x(28,"2"),m(),p(29,"td"),x(30,"Jacob"),m(),p(31,"td"),x(32,"Thornton"),m(),p(33,"td"),x(34,"fat"),m()(),p(35,"tr")(36,"th",8),x(37,"3"),m(),p(38,"td",9),x(39,"Larry the Bird"),m(),p(40,"td"),x(41,"twitter"),m()()()()()()(),ue(),m(),O(42,dc,12,0,"ng-template",null,0,me)}},dependencies:[Pt],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var mo=_i(On());var pc=["mask"],hc=["content"],gc=["footer"],fc=["titlebar"],vc=(n,h,t)=>({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex","justify-content":n,"align-items":h,"pointer-events":t}),yc=n=>({"p-dialog p-component":!0,"p-dialog-maximized":n}),_c=()=>({display:"flex","flex-direction":"column","pointer-events":"auto"}),bc=(n,h)=>({transform:n,transition:h}),Sc=n=>({value:"visible",params:n});function wc(n,h){if(n&1){let t=q();p(0,"div",14),$("mousedown",function(c){M(t);let y=P(2);return R(y.initResize(c))}),m()}n&2&&v("ngClass","p-resizable-handle")}function Cc(n,h){n&1&&Ue(0)}function xc(n,h){n&1&&D(0,"WindowMaximizeIcon")}function Ec(n,h){n&1&&D(0,"WindowMinimizeIcon")}function Pc(n,h){if(n&1&&(ce(0),O(1,xc,1,0,"WindowMaximizeIcon",11)(2,Ec,1,0,"WindowMinimizeIcon",11),ue()),n&2){let t=P(5);g(),v("ngIf",!t.maximized&&!t.maximizeIconTemplate),g(),v("ngIf",t.maximized&&!t.minimizeIconTemplate)}}function kc(n,h){}function Tc(n,h){n&1&&O(0,kc,0,0,"ng-template")}function Ic(n,h){if(n&1&&(ce(0),O(1,Tc,1,0,null,21),ue()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.maximizeIconTemplate)}}function Fc(n,h){}function Oc(n,h){n&1&&O(0,Fc,0,0,"ng-template")}function Nc(n,h){if(n&1&&(ce(0),O(1,Oc,1,0,null,21),ue()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.minimizeIconTemplate)}}function Dc(n,h){if(n&1){let t=q();p(0,"p-button",20),$("onClick",function(){M(t);let c=P(4);return R(c.maximize())})("keydown.enter",function(){M(t);let c=P(4);return R(c.maximize())}),O(1,Pc,3,2,"ng-container",11)(2,Ic,2,1,"ng-container",11)(3,Nc,2,1,"ng-container",11),m()}if(n&2){let t=P(4);v("styleClass","p-dialog-maximize-button")("tabindex",t.maximizable?"0":"-1"),g(),v("ngIf",!t.maximizeIcon),g(),v("ngIf",!t.maximized),g(),v("ngIf",t.maximized)}}function Vc(n,h){n&1&&(ce(0),D(1,"TimesIcon"),ue())}function Ac(n,h){}function Lc(n,h){n&1&&O(0,Ac,0,0,"ng-template")}function Mc(n,h){if(n&1&&(p(0,"span"),O(1,Lc,1,0,null,21),m()),n&2){let t=P(5);g(),v("ngTemplateOutlet",t.closeIconTemplate)}}function Rc(n,h){if(n&1){let t=q();p(0,"p-button",22),$("onClick",function(){M(t);let c=P(4);return R(c.hide())})("keydown.enter",function(){M(t);let c=P(4);return R(c.hide())}),O(1,Vc,2,0,"ng-container",11)(2,Mc,2,1,"span",11),m()}if(n&2){let t=P(4);v("styleClass","p-dialog-close-button")("ariaLabel",t.ddconfig.closeAriaLabel||t.defaultCloseAriaLabel),g(),v("ngIf",!t.closeIconTemplate),g(),v("ngIf",t.closeIconTemplate)}}function Bc(n,h){if(n&1&&(ce(0),p(1,"span",16),x(2),m(),p(3,"div",17),O(4,Dc,4,5,"p-button",18)(5,Rc,3,4,"p-button",19),m(),ue()),n&2){let t=P(3);g(),v("ngClass","p-dialog-title")("id",t.ariaLabelledBy),g(),re(t.ddconfig.header),g(),v("ngClass","p-dialog-header-actions"),g(),v("ngIf",t.ddconfig.maximizable),g(),v("ngIf",t.closable)}}function zc(n,h){if(n&1){let t=q();p(0,"div",15,3),$("mousedown",function(c){M(t);let y=P(2);return R(y.initDrag(c))}),O(2,Cc,1,0,"ng-container",12)(3,Bc,6,6,"ng-container",11),m()}if(n&2){let t=P(2);v("ngClass","p-dialog-header"),g(2),v("ngComponentOutlet",t.headerTemplate),g(),v("ngIf",!t.headerTemplate)}}function Uc(n,h){}function jc(n,h){n&1&&O(0,Uc,0,0,"ng-template",23)}function $c(n,h){n&1&&Ue(0)}function Jc(n,h){if(n&1&&(ce(0),x(1),ue()),n&2){let t=P(3);g(),ct(" ",t.ddconfig.footer," ")}}function Gc(n,h){n&1&&Ue(0)}function Kc(n,h){if(n&1&&(p(0,"div",17,4),O(2,Jc,2,1,"ng-container",11)(3,Gc,1,0,"ng-container",12),m()),n&2){let t=P(2);v("ngClass","p-dialog-footer"),g(2),v("ngIf",!t.footerTemplate),g(),v("ngComponentOutlet",t.footerTemplate)}}function Wc(n,h){if(n&1){let t=q();p(0,"div",7,1),$("@animation.start",function(c){M(t);let y=P();return R(y.onAnimationStart(c))})("@animation.done",function(c){M(t);let y=P();return R(y.onAnimationEnd(c))}),O(2,wc,1,1,"div",8)(3,zc,4,3,"div",9),p(4,"div",10,2),O(6,jc,1,0,null,11)(7,$c,1,0,"ng-container",12),m(),O(8,Kc,4,3,"div",13),m()}if(n&2){let t=P();xt(t.ddconfig.style),Qe(t.ddconfig.styleClass),ei("width",t.ddconfig.width)("height",t.ddconfig.height),v("ngClass",ge(22,yc,t.maximizable&&t.maximized))("ngStyle",De(24,_c))("@animation",ge(28,Sc,ii(25,bc,t.transformOptions,t.ddconfig.transitionOptions||"150ms cubic-bezier(0, 0, 0.2, 1)")))("pFocusTrapDisabled",t.ddconfig.focusTrap===!1),se("aria-labelledby",t.ariaLabelledBy)("aria-modal",!0)("id",t.dialogId),g(2),v("ngIf",t.ddconfig.resizable),g(),v("ngIf",t.ddconfig.showHeader!==!1),g(),v("ngClass","p-dialog-content")("ngStyle",t.ddconfig.contentStyle),g(2),v("ngIf",!t.contentTemplate),g(),v("ngComponentOutlet",t.contentTemplate),g(),v("ngIf",t.ddconfig.footer||t.footerTemplate)}}var Aa=(()=>{class n{viewContainerRef;constructor(t){this.viewContainerRef=t}static \u0275fac=function(l){return new(l||n)(Ht(Oo))};static \u0275dir=hn({type:n,selectors:[["","pDynamicDialogContent",""]]})}return n})(),La=(()=>{class n extends ua{name="dialog";static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var An=class{data;inputValues;header;ariaLabelledBy;footer;width;height;closeOnEscape=!1;focusOnShow=!0;focusTrap=!0;baseZIndex;autoZIndex=!1;dismissableMask=!1;rtl=!1;style;contentStyle;styleClass;transitionOptions;closable=!1;showHeader=!1;modal=!1;maskStyleClass;resizable=!1;draggable=!1;keepInViewport=!1;minX;minY;maximizable=!1;maximizeIcon;minimizeIcon;position;closeAriaLabel;appendTo;duplicate=!1;breakpoints;templates},on=class{constructor(){}close(h){this._onClose.next(h),setTimeout(()=>{this._onClose.complete()},1e3)}destroy(){this._onDestroy.next(null)}dragStart(h){this._onDragStart.next(h)}dragEnd(h){this._onDragEnd.next(h)}resizeInit(h){this._onResizeInit.next(h)}resizeEnd(h){this._onResizeEnd.next(h)}maximize(h){this._onMaximize.next(h)}_onClose=new Wt;onClose=this._onClose.asObservable();_onDestroy=new Wt;onDestroy=this._onDestroy.asObservable();_onDragStart=new Wt;onDragStart=this._onDragStart.asObservable();_onDragEnd=new Wt;onDragEnd=this._onDragEnd.asObservable();_onResizeInit=new Wt;onResizeInit=this._onResizeInit.asObservable();_onResizeEnd=new Wt;onResizeEnd=this._onResizeEnd.asObservable();_onMaximize=new Wt;onMaximize=this._onMaximize.asObservable();onChildComponentLoaded=new Wt},Hc=jn([Tt({transform:"{{transform}}",opacity:0}),Lt("{{transition}}",Tt({transform:"none",opacity:1}))]),qc=jn([Lt("{{transition}}",Tt({transform:"{{transform}}",opacity:0}))]),Ma=(()=>{class n extends Et{renderer;ddconfig;dialogRef;zone;parentDialog;visible=!0;componentRef;mask;resizing;dragging;maximized;_style={};originalStyle;lastPageX;lastPageY;ariaLabelledBy;id=bi("pn_id_");styleElement;insertionPoint;maskViewChild;contentViewChild;footerViewChild;headerViewChild;childComponentType;inputValues;container;wrapper;documentKeydownListener;documentEscapeListener;maskClickListener;transformOptions="scale(0.7)";documentResizeListener;documentResizeEndListener;documentDragListener;documentDragEndListener;_componentStyle=K(La);get minX(){return this.ddconfig.minX?this.ddconfig.minX:0}get minY(){return this.ddconfig.minY?this.ddconfig.minY:0}get keepInViewport(){return this.ddconfig.keepInViewport}get maximizable(){return this.ddconfig.maximizable}get maximizeIcon(){return this.ddconfig.maximizeIcon}get minimizeIcon(){return this.ddconfig.minimizeIcon}get closable(){return this.ddconfig.closable}get style(){return this._style}get position(){return this.ddconfig.position}get defaultCloseAriaLabel(){return this.config.getTranslation(Bt.ARIA).close}set style(t){t&&(this._style=ve({},t),this.originalStyle=t)}get parent(){let t=Array.from(this.document.getElementsByClassName("p-dialog"));if(t.length>1)return t.pop()}get parentContent(){let t=Array.from(this.document.getElementsByClassName("p-dialog"));if(t.length>0){let l=t[t.length-1].querySelector(".p-dialog-content");if(l)return Array.isArray(l)?l[0]:l}}get header(){return this.ddconfig.header}get data(){return this.ddconfig.data}get breakpoints(){return this.ddconfig.breakpoints}get footerTemplate(){return this.ddconfig?.templates?.footer}get headerTemplate(){return this.ddconfig?.templates?.header}get contentTemplate(){return this.ddconfig?.templates?.content}get minimizeIconTemplate(){return this.ddconfig?.templates?.minimizeicon}get maximizeIconTemplate(){return this.ddconfig?.templates?.maximizeicon}get closeIconTemplate(){return this.ddconfig?.templates?.closeicon}get maskClass(){let l=["left","right","top","topleft","topright","bottom","bottomleft","bottomright"].find(c=>c===this.position);return{"p-dialog-mask":!0,"p-overlay-mask p-overlay-mask-enter":this.ddconfig.modal||this.ddconfig.dismissableMask,[`p-dialog-${l}`]:l}}get dialogId(){return this.attrSelector}zIndexForLayering;constructor(t,l,c,y,F){super(),this.renderer=t,this.ddconfig=l,this.dialogRef=c,this.zone=y,this.parentDialog=F}ngOnInit(){super.ngOnInit(),this.breakpoints&&this.createStyle()}createStyle(){if(oi(this.platformId)&&!this.styleElement){this.styleElement=this.renderer.createElement("style"),this.styleElement.type="text/css",this.renderer.appendChild(this.document.head,this.styleElement);let t="";for(let l in this.breakpoints)t+=`
|
|
563
563
|
@media screen and (max-width: ${l}) {
|
|
564
564
|
.p-dialog[id=${this.dialogId}]:not(.p-dialog-maximized) {
|
|
565
565
|
width: ${this.breakpoints[l]} !important;
|
|
@@ -657,6 +657,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
657
657
|
background: ${n("floatlabel.on.active.background")};
|
|
658
658
|
padding: ${n("floatlabel.on.active.padding")};
|
|
659
659
|
}
|
|
660
|
-
`,Yc={root:({instance:n,props:h})=>["p-floatlabel",{"p-floatlabel-over":h.variant==="over","p-floatlabel-on":h.variant==="on","p-floatlabel-in":h.variant==="in"}]},Ra=(()=>{class n extends Rt{name="floatlabel";theme=Zc;classes=Yc;static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var Xc=(()=>{class n extends Et{_componentStyle=K(Ra);variant="over";static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["p-floatlabel"],["p-floatLabel"],["p-float-label"]],hostVars:8,hostBindings:function(l,c){l&2&&Do("p-floatlabel",!0)("p-floatlabel-over",c.variant==="over")("p-floatlabel-on",c.variant==="on")("p-floatlabel-in",c.variant==="in")},inputs:{variant:"variant"},features:[je([Ra]),ht],ngContentSelectors:Qc,decls:1,vars:0,template:function(l,c){l&1&&(Pi(),ti(0))},dependencies:[Le,$e],encapsulation:2,changeDetection:0})}return n})(),Ba=(()=>{class n{static \u0275fac=function(l){return new(l||n)};static \u0275mod=Ot({type:n});static \u0275inj=Ft({imports:[Xc,$e,$e]})}return n})();var Mn=()=>[],Rn=(()=>{class n{static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-dialog-create-customer-supplier"]],decls:66,vars:8,consts:[[1,"row","row-gap-2"],[1,"col-12"],[1,"form-group","d-flex","flex-column"],["for",""],["appendTo","body","optionLabel","name","placeholder","Select a City",1,"w-full","md:w-56",3,"options"],[1,"col-12","col-lg-4"],["pInputText","","autocomplete","off",1,"w-100"],["rows","1","cols","30","pTextarea",""],[1,"col-12","col-lg-6"]],template:function(l,c){l&1&&(p(0,"div",0)(1,"div",1)(2,"div",2)(3,"label",3),x(4,"Customer / Supplier"),m(),D(5,"p-select",4),m()(),p(6,"div",5)(7,"div",2)(8,"label",3),x(9,"Title"),m(),D(10,"input",6),m()(),p(11,"div",5)(12,"div",2)(13,"label",3),x(14,"First Name"),m(),D(15,"input",6),m()(),p(16,"div",5)(17,"div",2)(18,"label",3),x(19,"Last Name"),m(),D(20,"input",6),m()(),p(21,"div",5)(22,"div",2)(23,"label",3),x(24,"Mobile"),m(),D(25,"input",6),m()(),p(26,"div",5)(27,"div",2)(28,"label",3),x(29,"Email"),m(),D(30,"input",6),m()(),p(31,"div",5)(32,"div",2)(33,"label",3),x(34,"Identification"),m(),D(35,"input",6),m()(),p(36,"div",1)(37,"div",2)(38,"label",3),x(39,"Birthday"),m(),D(40,"input",6),m()(),p(41,"div",1)(42,"div",2)(43,"label",3),x(44,"Title"),m(),D(45,"textarea",7),m()(),p(46,"div",8)(47,"div",2)(48,"label",3),x(49,"City"),m(),D(50,"p-select",4),m()(),p(51,"div",8)(52,"div",2)(53,"label",3),x(54,"Nationality"),m(),D(55,"p-select",4),m()(),p(56,"div",8)(57,"div",2)(58,"label",3),x(59,"Gender"),m(),D(60,"p-select",4),m()(),p(61,"div",8)(62,"div",2)(63,"label",3),x(64,"Member Code"),m(),D(65,"textarea",7),m()()()),l&2&&(g(5),v("options",De(4,Mn)),g(45),v("options",De(5,Mn)),g(5),v("options",De(6,Mn)),g(5),v("options",De(7,Mn)))},dependencies:[gi,hi,ui,ci,Ba,di,mi],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var ja=_i(uo());var tu=["class","page"],iu=()=>({width:"25rem"}),an=n=>({"ng-invalid ng-dirty":n}),nu=()=>({"min-width":"50rem"}),za=()=>({}),Ua=n=>({"text-danger":n});function ou(n,h){if(n&1&&(p(0,"div",23),D(1,"p-radiobutton",35),p(2,"label",36),x(3),m()()),n&2){let t=h.$implicit;g(),v("value",t.key),g(2),re(t.value)}}function au(n,h){n&1&&(p(0,"tr")(1,"th",37),x(2,"Account"),m(),p(3,"th",37),x(4,"Debit"),m(),p(5,"th",37),x(6,"Credit"),m(),p(7,"th",37),x(8,"Note"),m(),D(9,"th"),m())}function ru(n,h){if(n&1){let t=q();p(0,"tr",38)(1,"td"),D(2,"p-select",39),m(),p(3,"td"),D(4,"input",40),m(),p(5,"td"),D(6,"input",41),m(),p(7,"td"),D(8,"textarea",42),m(),p(9,"td")(10,"p-button",43),$("onClick",function(){let c=M(t).rowIndex,y=P(2);return R(y.removeItems(c))}),m()()()}if(n&2){let t=h.rowIndex,l=P(2);v("formGroupName",t),g(2),v("options",l.journalEntryForm().options.accounts)("virtualScrollItemSize",50),g(2),v("autoNumeric",De(6,za)),g(2),v("autoNumeric",De(7,za)),g(2),v("autoResize",!0)}}function su(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",44)(3,"div",45)(4,"p-button",46),$("onClick",function(){M(t);let c=P(2);return R(c.addItems())}),m(),p(5,"p-button",47),$("onClick",function(){M(t);let c=P(2);return R(c.onToggleUploadDialog())}),m(),p(6,"p-button",48),$("onClick",function(){M(t);let c=P(2);return R(c.onSwap())}),m()(),p(7,"span",49),x(8,"Total"),m()()(),p(9,"td",50),x(10),Be(11,"number"),m(),p(12,"td",50),x(13),Be(14,"number"),m(),D(15,"td",51),m()}if(n&2){let t=P(2);g(9),v("ngClass",ge(8,Ua,t.subTotalCredit()!==t.subTotalDebit())),g(),ct(" ",Ze(11,4,t.subTotalDebit())," "),g(2),v("ngClass",ge(10,Ua,t.subTotalCredit()!==t.subTotalDebit())),g(),ct(" ",Ze(14,6,t.subTotalCredit())," ")}}function lu(n,h){if(n&1){let t=q();p(0,"div",11)(1,"div",12)(2,"div",13)(3,"p-card")(4,"div",14)(5,"div",15)(6,"label",16),x(7,"Outlets"),m(),D(8,"p-select",17),m(),p(9,"div",15)(10,"label",16),x(11,"Date"),m(),D(12,"p-datepicker",18),m(),p(13,"div",15)(14,"label",16),x(15,"Number"),m(),D(16,"input",19),m(),p(17,"div",15)(18,"label",16),x(19),m(),p(20,"div",20)(21,"p-autocomplete",21),$("completeMethod",function(c){M(t);let y=P();return R(y.searchCustomer(c))}),m()()(),p(22,"div",15)(23,"label",16),x(24,"Contact"),m(),p(25,"div",22),St(26,ou,4,2,"div",23,Nt),m()()()()()(),p(28,"div",24)(29,"div",13)(30,"p-card")(31,"p-table",25),O(32,au,10,0,"ng-template",null,1,me)(34,ru,11,8,"ng-template",null,2,me)(36,su,16,12,"ng-template",null,0,me),m()()()(),p(38,"div",12)(39,"div",13)(40,"p-card")(41,"div",26)(42,"div",27)(43,"div",28)(44,"label",16),x(45,"Document"),m(),D(46,"p-select",29),m()(),p(47,"div",27)(48,"div",28)(49,"label",16),x(50,"Type"),m(),D(51,"p-select",30),m()(),p(52,"div",27)(53,"div",28)(54,"label",16),x(55,"Number"),m(),D(56,"input",31),m()(),p(57,"div",27)(58,"div",28)(59,"label",16),x(60,"ID"),m(),D(61,"input",32),m()(),p(62,"div",27)(63,"div",28)(64,"label",16),x(65,"Note"),m(),D(66,"textarea",33),m()(),p(67,"div",27)(68,"div",28)(69,"label",16),x(70,"Upload"),m(),p(71,"p-fileupload",34,3),$("onSelect",function(c){M(t);let y=P();return R(y.onUpload(c))}),m()()()()()()()()}if(n&2){let t=P();v("formGroup",t.form),g(8),v("options",t.outlets()),g(4),v("showIcon",!0)("ngClass",ge(16,an,t.form.controls.order.controls.date.invalid&&(t.form.controls.order.controls.date.dirty||t.form.controls.order.controls.date.touched))),g(4),v("ngClass",ge(18,an,t.form.controls.order.controls.number.invalid&&(t.form.controls.order.controls.number.dirty||t.form.controls.order.controls.number.touched))),g(3),re(+t.form.controls.order.controls.contactType.value==0?"Customer":"Supplier"),g(2),v("suggestions",t.customerSuggestions())("placeholder",+t.form.controls.order.controls.contactType.value==0?"Search Customer":"Search Supplier"),g(5),wt(t.contactType()),g(5),v("value",t.form.controls.items.controls)("tableStyle",De(20,nu)),g(15),v("ngClass",ge(21,an,t.form.controls.order.controls.entryTypeID.invalid&&(t.form.controls.order.controls.entryTypeID.dirty||t.form.controls.order.controls.entryTypeID.touched)))("options",t.journalEntryForm().options.entryTypes),g(5),v("ngClass",ge(23,an,t.form.controls.order.controls.referenceTypeID.invalid&&(t.form.controls.order.controls.referenceTypeID.dirty||t.form.controls.order.controls.referenceTypeID.touched)))("options",t.journalEntryForm().options.referenceTypes),g(15),v("autoResize",!0)("ngClass",ge(25,an,t.form.controls.order.controls.note.invalid&&(t.form.controls.order.controls.note.dirty||t.form.controls.order.controls.note.touched)))}}function cu(n,h){if(n&1){let t=q();p(0,"p-button",52),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m(),p(1,"p-button",53),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m()}n&2&&v("text",!0)}var po=(()=>{class n{constructor(){this.fileAttachment=Ae(new File([],"")),this.activatedRoute=K(ai),this.journalEntryService=K(Xe),this.journalEntryForm=Ae(null),this.customerSuggestions=Ae([]),this.itemsForm=Ae([]),this.subTotalDebit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.debitAmount,0)),this.subTotalCredit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.creditAmount,0)),this.contactType=Ae([{key:0,value:"Customer"},{key:1,value:"Supplier"}]),this.dialogService=K(Zi),this.uploadDialogVisible=Ae(!1),this.messageService=K(Bi),this.outlets=ut(()=>this.journalEntryForm()?.options?.outlets||[]),this.toasr=K(Mi),this.initializeFormEffect()}toggleDialog(){this.dialogService.open(Rn,{header:"Create Customer/Supplier",width:"40vw",footer:"submit",closable:!0,dismissableMask:!0,modal:!0,showHeader:!0})}ngOnInit(){this.initializeForm(),this.loadJournalEntryForm(),setInterval(()=>{this.subTotalCredit()!==this.subTotalDebit()&&this.messageService.add({severity:"warn",summary:"Mismatch Detected",detail:`The total Debit and Credit amounts are not balanced. Difference: ${this.subTotalCredit()-this.subTotalDebit()}`})},1e3)}onToggleUploadDialog(){this.uploadDialogVisible.update(t=>!t)}onUploadDialog(t){console.log(t),ja.default.parse(t.currentFiles[0],{complete:l=>{console.log("Parsed result:",l)},error:l=>{console.error("Parsing error:",l)}})}initializeForm(){this.form=new At({order:new At({id:new B("",[at.required]),number:new B("",[at.required]),date:new B({value:new Date,disabled:!0},[at.required]),note:new B(""),entryTypeID:new B(1,[at.required]),referenceID:new B(""),referenceTypeID:new B(0,[at.required]),referenceText:new B(""),contactID:new B(""),detailReferenceID:new B(""),creatorID:new B("",[at.required]),created:new B("",[at.required]),modifierID:new B(""),modified:new B(""),entityID:new B(""),statusID:new B(0),contactName:new B(""),contactType:new B(0)}),items:new bn([]),additionalAccountID:new B(""),file:new B(null)})}initializeFormEffect(){vn(()=>{let t=this.journalEntryForm();t&&(this.form.patchValue({order:Ie(ve({},t.form.order),{entryTypeID:Number(t.form.order.entryTypeID===0&&1),referenceID:String(t.form.order.referenceID||Ve),contactID:String(t.form.order.contactID||""),detailReferenceID:String(t.form.order.detailReferenceID||Ve),contactName:String(t.form.order.contactName),date:mo.default.isDayjs(t.form.order.date)?t.form.order.date.toDate():(0,mo.default)().toDate(),modifierID:String(t.form.order.modifierID||Ve),statusID:t.form.order.statusID,modified:String(t.form.order.modified),entityID:String(t.form.order.entityID||Ve)}),additionalAccountID:t.form.additionalAccountID}),this.updateFormItems(t.form.items),this.form.controls.items.touched||this.itemsForm.set(this.form.controls.items.value),this.form.controls.items.valueChanges.subscribe(l=>{this.itemsForm.set(l)}))})}updateFormItems(t){let l=this.form.controls.items;l.clear(),t.forEach(c=>{l.push(new At({id:new B(c.id),journalID:new B(c.journalID),accountID:new B(c.accountID),debitAmount:new B(c.debitAmount),creditAmount:new B(c.creditAmount),index:new B(c.index),note:new B(c.note)}))})}loadJournalEntryForm(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>this.journalEntryForm.set(t))).subscribe()}searchCustomer(t){switch(+this.form.controls.order.value.contactType){case 0:this.journalEntryService.getJournalEntryCustomerSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;case 1:this.journalEntryService.getJournalEntrySupplierSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;default:console.error("Invalid contact type");break}}addItems(){this.form.controls.items.push(new At({id:new B(Ve.toString()),journalID:new B(Ve.toString()),accountID:new B(Ve.toString()),debitAmount:new B(0),creditAmount:new B(0),index:new B(this.form.controls.items.length??0),note:new B("")}))}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalEntryService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.fileAttachment()),l}onUpload(t){console.log(t),this.fileAttachment.set(t.currentFiles[0])}removeItems(t){this.form.controls.items.removeAt(t)}onSwap(){let t=this.form.controls.items.value.map(l=>({id:l.id??"",journalID:l.journalID??"",accountID:l.accountID??"",debitAmount:l.creditAmount,creditAmount:l.debitAmount,index:l.index??0,note:l.note??""}));this.form.controls.items.setValue(t)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry-form",8,"page"]],features:[je([Zi,Bi])],attrs:tu,decls:11,vars:6,consts:[["footer",""],["header",""],["body",""],["fu",""],["pageTitle",`Manual Journal Form
|
|
661
|
-
`],["ngProjectAs","action-button",5,["action-button"]],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],["class","d-flex flex-column row-gap-4",3,"formGroup",4,"ngIf"],["header","Upload",3,"modal","visible"],["mode","basic","chooseLabel","Choose","chooseIcon","pi pi-upload",3,"onSelect"],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],["formGroupName","order",1,"row"],[1,"col"],[1,"row"],[1,"col","d-flex","flex-column"],["for",""],["size","small","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an Outlet",1,"w-full",3,"options"],["styleClass","w-100","dataType","string","dateFormat","mm-dd-yy","size","small","formControlName","date",3,"showIcon","ngClass"],["pSize","small","type","text","pInputText","","formControlName","number","placeholder","Enter Number",3,"ngClass"],[1,"d-flex","align-items-center","gap-2"],["size","small","styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",1,"w-100",3,"completeMethod","suggestions","placeholder"],[1,"d-flex","align-items-center","gap-2",2,"height","100%","min-height","43px"],[1,"d-flex","items-center","gap-2"],["formArrayName","items",1,"row"],["showGridlines","",3,"value","tableStyle"],[1,"row","gap-3"],[1,"col","col-lg-4"],[1,"form-group","d-flex","flex-column"],["formControlName","selectedCity","formControlName","entryTypeID","optionLabel","value","optionValue","key",3,"ngClass","options"],["formControlName","referenceTypeID","optionLabel","value","optionValue","key",3,"ngClass","options"],["pSize","small","type","text","formControlName","referenceText","pInputText","","placeholder","Enter Number"],["pSize","small","type","text","pInputText","","formControlName","referenceID"],["pTextarea","","formControlName","note","placeholder","Enter Note",1,"w-100",3,"autoResize","ngClass"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["formControlName","contactType","name","contactType","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[2,"width","25%"],[3,"formGroupName"],["appendTo","body","size","small","formControlName","accountID","virtualScroll","","optionLabel","name","optionValue","id","placeholder","Select an account","styleClass","w-100","showClear","",3,"options","virtualScrollItemSize"],["pSize","small","formControlName","debitAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","formControlName","creditAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","rows","1","cols","30","pTextarea","","formControlName","note",1,"w-100",3,"autoResize"],["size","small","icon","fa-solid fa-xmark","aria-label","Save","severity","danger",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"d-flex","gap-2"],["icon","fa-light fa-plus","size","small","label","Add",3,"onClick"],["icon","fa-light fa-upload","size","small","label","Upload",3,"onClick"],["icon","fa-light fa-arrows-rotate","size","small","label","Swap",3,"onClick"],[2,"vertical-align","middle"],[3,"ngClass"],["colspan","2"],["label","Cancel","severity","secondary",3,"click","text"],["label","OK(F2)","severity","primary",3,"click"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),ce(1,5),p(2,"button",6),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(3," Submit "),m(),ue(),ce(4,7),O(5,lu,73,27,"div",8),ue(),m(),p(6,"p-dialog",9)(7,"p-fileupload",10),$("onSelect",function(L){return M(y),R(c.onUploadDialog(L))}),m(),O(8,cu,2,1,"ng-template",null,0,me),m(),D(10,"p-toast")}l&2&&(g(5),v("ngIf",c.journalEntryForm()),g(),xt(De(5,iu)),v("modal",!0)("visible",c.uploadDialogVisible()))},dependencies:[Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,Pt,Le,gt,Ye,Vt,di,mi,Gi,Ji,ui,ci,Wi,Ki,Fn,In,jt,Ut,zt,ft,$t,pi,Pn,kn,gi,hi,Ln,Qi,Si,$i,ji,qi,Nn],encapsulation:2})}}return n})();var ho=n=>{let h=K(Xe),t=K(Hi);return t.show(),console.log("journalEntryResolver",n),h.getJournalEntryForm(n.paramMap.get("id")??"").pipe(He("response"),Fe(()=>t.hide()))};var uu=()=>["edit"],mu=()=>["/report/general-ledger"],du=n=>({id:n});function pu(n,h){n&1&&(p(0,"tr")(1,"th",15),x(2,"Code"),m(),p(3,"th"),x(4,"Account"),m(),p(5,"th",15),x(6,"Debit"),m(),p(7,"th",15),x(8,"Credit"),m()())}function hu(n,h){if(n&1&&(p(0,"tr")(1,"td")(2,"a",16),x(3),m()(),p(4,"td"),x(5),m(),p(6,"td"),x(7),Be(8,"number"),m(),p(9,"td"),x(10),Be(11,"number"),m()()),n&2){let t=h.$implicit;g(2),v("routerLink",De(10,mu))("queryParams",ge(11,du,t.accountID)),g(),re(t.accountCode),g(2),re(t.accountName),g(2),re(Ze(8,6,t.debitAmount)),g(3),re(Ze(11,8,t.creditAmount))}}function gu(n,h){if(n&1&&(p(0,"tr")(1,"td",17),x(2,"Total"),m(),p(3,"td"),x(4),Be(5,"number"),m(),p(6,"td"),x(7),Be(8,"number"),m()()),n&2){let t=P(2);g(4),re(Ze(5,2,t.totalDebitAmount())),g(3),re(Ze(8,4,t.totalCreditAmount()))}}function fu(n,h){if(n&1&&(p(0,"app-main-panel",3),ce(1,4),p(2,"a",5),x(3," Edit "),m(),p(4,"button",6),x(5,"Delete"),m(),ue(),ce(6,7),p(7,"div",8)(8,"div",9)(9,"p-card",10)(10,"div",11)(11,"div",12)(12,"div",11)(13,"div",13),x(14,"Date"),m(),p(15,"div",12),x(16),Be(17,"date"),m()(),D(18,"hr"),p(19,"div",11)(20,"div",13),x(21,"Number"),m(),p(22,"div",12),x(23),m()(),D(24,"hr"),p(25,"div",11)(26,"div",13),x(27,"Outlet"),m(),p(28,"div",12),x(29),m()()(),p(30,"div",12)(31,"div",11)(32,"div",13),x(33,"Date"),m(),p(34,"div",12),x(35),Be(36,"date"),m()(),D(37,"hr"),p(38,"div",11)(39,"div",13),x(40,"Number"),m(),p(41,"div",12),x(42),m()(),D(43,"hr"),p(44,"div",11)(45,"div",13),x(46,"Outlet"),m(),p(47,"div",12),x(48),m()()()()()(),p(49,"div",12)(50,"p-card")(51,"p-table",14),O(52,pu,9,0,"ng-template",null,0,me)(54,hu,12,13,"ng-template",null,1,me)(56,gu,9,6,"ng-template",null,2,me),m()()()(),ue(),m()),n&2){let t=P();v("pageTitle","Journal #"+t.journalEntryInfo().order.number),g(2),v("routerLink",De(15,uu)),g(14),ct(" ",en(17,9,t.journalEntryInfo().order.date,"dd mmm yy")," "),g(7),re(t.journalEntryInfo().order.number),g(6),re(t.journalEntryInfo().order.outletID),g(6),ct(" ",en(36,12,t.journalEntryInfo().order.date,"dd mmm yy")," "),g(7),re(t.journalEntryInfo().order.number),g(6),re(t.journalEntryInfo().order.outletID),g(3),v("value",t.journalEntryInfo().items)}}var $a=(()=>{class n{constructor(){this.journalEntryService=K(Xe),this.route=K(ai),this.journalEntryInfo=Ae(null),this.totalDebitAmount=ut(()=>this.journalEntryInfo()?.items?.reduce((l,c)=>l+c.debitAmount,0)||0),this.totalCreditAmount=ut(()=>this.journalEntryInfo()?.items?.reduce((l,c)=>l+c.creditAmount,0)||0)}ngOnInit(){this.route.paramMap.pipe(mn(t=>t.has("id")),kt(t=>t.get("id")),Xi(t=>this.journalEntryService.getJournalEntryInfo(t)),Fe(t=>this.journalEntryInfo.set(t)),He("response")).subscribe()}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry-info"]],decls:1,vars:1,consts:[["header",""],["body",""],["footer",""],[3,"pageTitle"],["ngProjectAs","action-button",5,["action-button"]],[1,"btn","btn-secondary","rounded",3,"routerLink"],[1,"btn","btn-danger","rounded"],["ngProjectAs","content",5,["content"]],[1,"row","row-gap-4"],[1,"col-12"],["header","Details"],[1,"row"],[1,"col"],[1,"col-2"],[3,"value"],[2,"width","10%"],[1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"text-end"]],template:function(l,c){l&1&&O(0,fu,58,16,"app-main-panel",3),l&2&&ze(c.journalEntryInfo()?0:-1)},dependencies:[Pt,Le,Vt,yn,$t,pi,jt,Ut,wn,Sn],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var Ja=n=>{let h=K(Xe),t=K(Hi);return t.show(),console.log("journalEntryResolver",n),h.getJournalRecordExpenseLoader().pipe(He("response"),Fe(()=>t.hide()))};var fo=_i(On());var Ga=_i(uo());var vu=()=>({width:"25rem"}),go=n=>({"ng-invalid ng-dirty":n}),yu=()=>({"min-width":"50rem"}),_u=()=>({});function bu(n,h){if(n&1&&(p(0,"div",23),D(1,"p-radiobutton",32),p(2,"label",33),x(3),m()()),n&2){let t=h.$implicit;g(),v("value",t.key),g(2),re(t.value)}}function Su(n,h){n&1&&(p(0,"tr")(1,"th",34),x(2,"Account"),m(),p(3,"th",34),x(4,"Amount"),m(),p(5,"th",34),x(6,"Note"),m(),D(7,"th"),m())}function wu(n,h){if(n&1){let t=q();p(0,"tr",35)(1,"td"),D(2,"p-select",36),m(),p(3,"td"),D(4,"input",37),m(),p(5,"td"),D(6,"textarea",38),m(),p(7,"td")(8,"p-button",39),$("onClick",function(){let c=M(t).rowIndex,y=P(2);return R(y.removeItems(c))}),m()()()}if(n&2){let t=h.rowIndex,l=P(2);v("formGroupName",t),g(2),v("options",l.JournalExpenseRecord().options.accounts)("virtualScrollItemSize",50),g(2),v("autoNumeric",De(5,_u)),g(2),v("autoResize",!0)}}function Cu(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",40)(3,"div",41)(4,"p-button",42),$("onClick",function(){M(t);let c=P(2);return R(c.addItems())}),m()(),p(5,"span",43),x(6,"Total"),m()()(),p(7,"td"),x(8),Be(9,"number"),m(),D(10,"td",44),m()}if(n&2){let t=P(2);g(8),ct(" ",Ze(9,1,t.subTotalDebit())," ")}}function xu(n,h){if(n&1){let t=q();p(0,"div",11)(1,"div",12)(2,"div",13)(3,"p-card")(4,"div",14)(5,"div",15)(6,"label",16),x(7,"Outlets"),m(),D(8,"p-select",17),m(),p(9,"div",15)(10,"label",16),x(11,"Date"),m(),D(12,"p-datepicker",18),m(),p(13,"div",15)(14,"label",16),x(15,"Number"),m(),D(16,"input",19),m(),p(17,"div",15)(18,"label",16),x(19),m(),p(20,"div",20)(21,"p-autocomplete",21),$("completeMethod",function(c){M(t);let y=P();return R(y.searchCustomer(c))}),m()()(),p(22,"div",15)(23,"label",16),x(24,"Contact"),m(),p(25,"div",22),St(26,bu,4,2,"div",23,Nt),m()(),p(28,"div",15)(29,"label",16),x(30,"Payments"),m(),D(31,"p-select",24),m()()()()(),p(32,"div",25)(33,"div",13)(34,"p-card")(35,"p-table",26),O(36,Su,8,0,"ng-template",null,1,me)(38,wu,9,6,"ng-template",null,2,me)(40,Cu,11,3,"ng-template",null,0,me),m()()()(),p(42,"div",12)(43,"div",13)(44,"p-card")(45,"div",27)(46,"div",28)(47,"div",29)(48,"label",16),x(49,"Note"),m(),D(50,"textarea",30),m()(),p(51,"div",28)(52,"div",29)(53,"label",16),x(54,"Upload"),m(),p(55,"p-fileupload",31,3),$("onSelect",function(c){M(t);let y=P();return R(y.onUpload(c))}),m()()()()()()()()}if(n&2){let t=P();v("formGroup",t.form),g(8),v("options",t.outlets()),g(4),v("showIcon",!0)("ngClass",ge(13,go,t.form.controls.order.controls.date.invalid&&(t.form.controls.order.controls.date.dirty||t.form.controls.order.controls.date.touched))),g(4),v("ngClass",ge(15,go,t.form.controls.order.controls.number.invalid&&(t.form.controls.order.controls.number.dirty||t.form.controls.order.controls.number.touched))),g(3),re(+t.form.controls.order.controls.contactType.value==0?"Customer":"Supplier"),g(2),v("suggestions",t.customerSuggestions())("placeholder",+t.form.controls.order.controls.contactType.value==0?"Search Customer":"Search Supplier"),g(5),wt(t.contactType()),g(5),v("options",t.JournalExpenseRecord().options.paymentAccounts),g(4),v("value",t.form.controls.items.controls)("tableStyle",De(17,yu)),g(15),v("autoResize",!0)("ngClass",ge(18,go,t.form.controls.order.controls.note.invalid&&(t.form.controls.order.controls.note.dirty||t.form.controls.order.controls.note.touched)))}}function Eu(n,h){if(n&1){let t=q();p(0,"p-button",45),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m(),p(1,"p-button",46),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m()}n&2&&v("text",!0)}var Ka=(()=>{class n{constructor(){this.fileAttachment=Ae(new File([],"")),this.activatedRoute=K(ai),this.journalEntryService=K(Xe),this.JournalExpenseRecord=Ae(null),this.customerSuggestions=Ae([]),this.itemsForm=Ae([]),this.subTotalDebit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.debitAmount,0)),this.subTotalCredit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.creditAmount,0)),this.contactType=Ae([{key:0,value:"Customer"},{key:1,value:"Supplier"}]),this.dialogService=K(Zi),this.uploadDialogVisible=Ae(!1),this.messageService=K(Bi),this.outlets=ut(()=>this.JournalExpenseRecord()?.options?.entities||[]),this.toasr=K(Mi),this.initializeFormEffect()}toggleDialog(){this.dialogService.open(Rn,{header:"Create Customer/Supplier",width:"40vw",footer:"submit",closable:!0,dismissableMask:!0,modal:!0,showHeader:!0})}ngOnInit(){this.initializeForm(),this.loadJournalExpenseRecord()}onToggleUploadDialog(){this.uploadDialogVisible.update(t=>!t)}onUploadDialog(t){console.log(t),Ga.default.parse(t.currentFiles[0],{complete:l=>{console.log("Parsed result:",l)},error:l=>{console.error("Parsing error:",l)}})}initializeForm(){this.form=new At({order:new At({id:new B("",[at.required]),number:new B("",[at.required]),date:new B({value:new Date,disabled:!0},[at.required]),note:new B(""),entryTypeID:new B(1,[at.required]),referenceID:new B(""),referenceTypeID:new B(0,[at.required]),referenceText:new B(""),contactID:new B(""),detailReferenceID:new B(""),creatorID:new B("",[at.required]),created:new B("",[at.required]),modifierID:new B(""),modified:new B(""),entityID:new B(""),statusID:new B(0),contactName:new B(""),contactType:new B(0)}),items:new bn([]),additionalAccountID:new B(""),file:new B(null)})}initializeFormEffect(){vn(()=>{let t=this.JournalExpenseRecord();t&&(this.form.patchValue({order:Ie(ve({},t.form.order),{entryTypeID:Number(t.form.order.entryTypeID===0&&1),referenceID:String(t.form.order.referenceID||Ve),contactID:String(t.form.order.contactID||""),detailReferenceID:String(t.form.order.detailReferenceID||Ve),contactName:String(t.form.order.contactName),date:fo.default.isDayjs(t.form.order.date)?t.form.order.date.toDate():(0,fo.default)().toDate(),modifierID:String(t.form.order.modifierID||Ve),statusID:+t.form.order.statusID,modified:String(t.form.order.modified),entityID:String(t.form.order.entityID||Ve)}),additionalAccountID:t.form.additionalAccountID}),this.updateFormItems(t.form.items),this.form.controls.items.touched||this.itemsForm.set(this.form.controls.items.value),this.form.controls.items.valueChanges.subscribe(l=>{this.itemsForm.set(l)}))})}updateFormItems(t){let l=this.form.controls.items;l.clear(),t.forEach(c=>{l.push(new At({id:new B(c.id),journalID:new B(c.journalID),accountID:new B(c.accountID),debitAmount:new B(c.debitAmount),creditAmount:new B(c.creditAmount),index:new B(c.index),note:new B(c.note)}))})}loadJournalExpenseRecord(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>this.JournalExpenseRecord.set(t))).subscribe()}searchCustomer(t){switch(+this.form.controls.order.value.contactType){case 0:this.journalEntryService.getJournalEntryCustomerSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;case 1:this.journalEntryService.getJournalEntrySupplierSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;default:console.error("Invalid contact type");break}}addItems(){this.form.controls.items.push(new At({id:new B(Ve.toString()),journalID:new B(Ve.toString()),accountID:new B(Ve.toString()),debitAmount:new B(0),creditAmount:new B(0),index:new B(this.form.controls.items.length??0),note:new B("")}))}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalEntryService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.fileAttachment()),l}onUpload(t){console.log(t),this.fileAttachment.set(t.currentFiles[0])}removeItems(t){this.form.controls.items.removeAt(t)}onSwap(){let t=this.form.controls.items.value.map(l=>({id:l.id??"",journalID:l.journalID??"",accountID:l.accountID??"",debitAmount:l.creditAmount,creditAmount:l.debitAmount,index:l.index??0,note:l.note??""}));this.form.controls.items.setValue(t)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-receive-money"]],features:[je([Zi,Bi])],decls:11,vars:6,consts:[["footer",""],["header",""],["body",""],["fu",""],["pageTitle",`Receive Money
|
|
662
|
-
`],["ngProjectAs","action-button",5,["action-button"]],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],["class","d-flex flex-column row-gap-4",3,"formGroup",4,"ngIf"],["header","Upload",3,"modal","visible"],["mode","basic","chooseLabel","Choose","chooseIcon","pi pi-upload",3,"onSelect"],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],["formGroupName","order",1,"row"],[1,"col"],[1,"row"],[1,"col","d-flex","flex-column"],["for",""],["size","small","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an Outlet",1,"w-full",3,"options"],["styleClass","w-100","dataType","string","dateFormat","mm-dd-yy","size","small","formControlName","date",3,"showIcon","ngClass"],["pSize","small","type","text","pInputText","","formControlName","number","placeholder","Enter Number",3,"ngClass"],[1,"d-flex","align-items-center","gap-2"],["size","small","styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",1,"w-100",3,"completeMethod","suggestions","placeholder"],[1,"d-flex","align-items-center","gap-2",2,"height","100%","min-height","43px"],[1,"d-flex","items-center","gap-2"],["size","small","formControlName","entityID","optionLabel","value","optionValue","key","placeholder","Select an Outlet",1,"w-full",3,"options"],["formArrayName","items",1,"row"],["showGridlines","",3,"value","tableStyle"],[1,"row","gap-3"],[1,"col","col-lg-4"],[1,"form-group","d-flex","flex-column"],["pTextarea","","formControlName","note","placeholder","Enter Note",1,"w-100",3,"autoResize","ngClass"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["formControlName","contactType","name","contactType","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[2,"width","25%"],[3,"formGroupName"],["appendTo","body","size","small","formControlName","accountID","virtualScroll","","optionLabel","value","optionValue","key","placeholder","Select an account","styleClass","w-100","showClear","",3,"options","virtualScrollItemSize"],["pSize","small","formControlName","debitAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","rows","1","cols","30","pTextarea","","formControlName","note",1,"w-100",3,"autoResize"],["size","small","icon","fa-solid fa-xmark","aria-label","Save","severity","danger",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"d-flex","gap-2"],["icon","fa-light fa-plus","size","small","label","Add",3,"onClick"],[2,"vertical-align","middle"],["colspan","2"],["label","Cancel","severity","secondary",3,"click","text"],["label","OK(F2)","severity","primary",3,"click"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),ce(1,5),p(2,"button",6),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(3," Submit "),m(),ue(),ce(4,7),O(5,xu,57,20,"div",8),ue(),m(),p(6,"p-dialog",9)(7,"p-fileupload",10),$("onSelect",function(L){return M(y),R(c.onUploadDialog(L))}),m(),O(8,Eu,2,1,"ng-template",null,0,me),m(),D(10,"p-toast")}l&2&&(g(5),v("ngIf",c.JournalExpenseRecord()),g(),xt(De(5,vu)),v("modal",!0)("visible",c.uploadDialogVisible()))},dependencies:[Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,Pt,Le,gt,Ye,Vt,di,
|
|
660
|
+
`,Yc={root:({instance:n,props:h})=>["p-floatlabel",{"p-floatlabel-over":h.variant==="over","p-floatlabel-on":h.variant==="on","p-floatlabel-in":h.variant==="in"}]},Ra=(()=>{class n extends Rt{name="floatlabel";theme=Zc;classes=Yc;static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275prov=lt({token:n,factory:n.\u0275fac})}return n})();var Xc=(()=>{class n extends Et{_componentStyle=K(Ra);variant="over";static \u0275fac=(()=>{let t;return function(c){return(t||(t=We(n)))(c||n)}})();static \u0275cmp=we({type:n,selectors:[["p-floatlabel"],["p-floatLabel"],["p-float-label"]],hostVars:8,hostBindings:function(l,c){l&2&&Do("p-floatlabel",!0)("p-floatlabel-over",c.variant==="over")("p-floatlabel-on",c.variant==="on")("p-floatlabel-in",c.variant==="in")},inputs:{variant:"variant"},features:[je([Ra]),ht],ngContentSelectors:Qc,decls:1,vars:0,template:function(l,c){l&1&&(Pi(),ti(0))},dependencies:[Le,$e],encapsulation:2,changeDetection:0})}return n})(),Ba=(()=>{class n{static \u0275fac=function(l){return new(l||n)};static \u0275mod=Ot({type:n});static \u0275inj=Ft({imports:[Xc,$e,$e]})}return n})();var Mn=()=>[],Rn=(()=>{class n{static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-dialog-create-customer-supplier"]],decls:66,vars:8,consts:[[1,"row","row-gap-2"],[1,"col-12"],[1,"form-group","d-flex","flex-column"],["for",""],["appendTo","body","optionLabel","name","placeholder","Select a City",1,"w-full","md:w-56",3,"options"],[1,"col-12","col-lg-4"],["pInputText","","autocomplete","off",1,"w-100"],["rows","1","cols","30","pTextarea",""],[1,"col-12","col-lg-6"]],template:function(l,c){l&1&&(p(0,"div",0)(1,"div",1)(2,"div",2)(3,"label",3),x(4,"Customer / Supplier"),m(),D(5,"p-select",4),m()(),p(6,"div",5)(7,"div",2)(8,"label",3),x(9,"Title"),m(),D(10,"input",6),m()(),p(11,"div",5)(12,"div",2)(13,"label",3),x(14,"First Name"),m(),D(15,"input",6),m()(),p(16,"div",5)(17,"div",2)(18,"label",3),x(19,"Last Name"),m(),D(20,"input",6),m()(),p(21,"div",5)(22,"div",2)(23,"label",3),x(24,"Mobile"),m(),D(25,"input",6),m()(),p(26,"div",5)(27,"div",2)(28,"label",3),x(29,"Email"),m(),D(30,"input",6),m()(),p(31,"div",5)(32,"div",2)(33,"label",3),x(34,"Identification"),m(),D(35,"input",6),m()(),p(36,"div",1)(37,"div",2)(38,"label",3),x(39,"Birthday"),m(),D(40,"input",6),m()(),p(41,"div",1)(42,"div",2)(43,"label",3),x(44,"Title"),m(),D(45,"textarea",7),m()(),p(46,"div",8)(47,"div",2)(48,"label",3),x(49,"City"),m(),D(50,"p-select",4),m()(),p(51,"div",8)(52,"div",2)(53,"label",3),x(54,"Nationality"),m(),D(55,"p-select",4),m()(),p(56,"div",8)(57,"div",2)(58,"label",3),x(59,"Gender"),m(),D(60,"p-select",4),m()(),p(61,"div",8)(62,"div",2)(63,"label",3),x(64,"Member Code"),m(),D(65,"textarea",7),m()()()),l&2&&(g(5),v("options",De(4,Mn)),g(45),v("options",De(5,Mn)),g(5),v("options",De(6,Mn)),g(5),v("options",De(7,Mn)))},dependencies:[gi,hi,ui,ci,Ba,pi,di],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var ja=_i(uo());var tu=["class","page"],iu=()=>({width:"25rem"}),an=n=>({"ng-invalid ng-dirty":n}),nu=()=>({"min-width":"50rem"}),za=()=>({}),Ua=n=>({"text-danger":n});function ou(n,h){if(n&1&&(p(0,"div",23),D(1,"p-radiobutton",35),p(2,"label",36),x(3),m()()),n&2){let t=h.$implicit;g(),v("value",t.key),g(2),re(t.value)}}function au(n,h){n&1&&(p(0,"tr")(1,"th",37),x(2,"Account"),m(),p(3,"th",37),x(4,"Debit"),m(),p(5,"th",37),x(6,"Credit"),m(),p(7,"th",37),x(8,"Note"),m(),D(9,"th"),m())}function ru(n,h){if(n&1){let t=q();p(0,"tr",38)(1,"td"),D(2,"p-select",39),m(),p(3,"td"),D(4,"input",40),m(),p(5,"td"),D(6,"input",41),m(),p(7,"td"),D(8,"textarea",42),m(),p(9,"td")(10,"p-button",43),$("onClick",function(){let c=M(t).rowIndex,y=P(2);return R(y.removeItems(c))}),m()()()}if(n&2){let t=h.rowIndex,l=P(2);v("formGroupName",t),g(2),v("options",l.journalEntryForm().options.accounts)("virtualScrollItemSize",50),g(2),v("autoNumeric",De(6,za)),g(2),v("autoNumeric",De(7,za)),g(2),v("autoResize",!0)}}function su(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",44)(3,"div",45)(4,"p-button",46),$("onClick",function(){M(t);let c=P(2);return R(c.addItems())}),m(),p(5,"p-button",47),$("onClick",function(){M(t);let c=P(2);return R(c.onToggleUploadDialog())}),m(),p(6,"p-button",48),$("onClick",function(){M(t);let c=P(2);return R(c.onSwap())}),m()(),p(7,"span",49),x(8,"Total"),m()()(),p(9,"td",50),x(10),Be(11,"number"),m(),p(12,"td",50),x(13),Be(14,"number"),m(),D(15,"td",51),m()}if(n&2){let t=P(2);g(9),v("ngClass",ge(8,Ua,t.subTotalCredit()!==t.subTotalDebit())),g(),ct(" ",Ze(11,4,t.subTotalDebit())," "),g(2),v("ngClass",ge(10,Ua,t.subTotalCredit()!==t.subTotalDebit())),g(),ct(" ",Ze(14,6,t.subTotalCredit())," ")}}function lu(n,h){if(n&1){let t=q();p(0,"div",11)(1,"div",12)(2,"div",13)(3,"p-card")(4,"div",14)(5,"div",15)(6,"label",16),x(7,"Outlets"),m(),D(8,"p-select",17),m(),p(9,"div",15)(10,"label",16),x(11,"Date"),m(),D(12,"p-datepicker",18),m(),p(13,"div",15)(14,"label",16),x(15,"Number"),m(),D(16,"input",19),m(),p(17,"div",15)(18,"label",16),x(19),m(),p(20,"div",20)(21,"p-autocomplete",21),$("completeMethod",function(c){M(t);let y=P();return R(y.searchCustomer(c))}),m()()(),p(22,"div",15)(23,"label",16),x(24,"Contact"),m(),p(25,"div",22),St(26,ou,4,2,"div",23,Nt),m()()()()()(),p(28,"div",24)(29,"div",13)(30,"p-card")(31,"p-table",25),O(32,au,10,0,"ng-template",null,1,me)(34,ru,11,8,"ng-template",null,2,me)(36,su,16,12,"ng-template",null,0,me),m()()()(),p(38,"div",12)(39,"div",13)(40,"p-card")(41,"div",26)(42,"div",27)(43,"div",28)(44,"label",16),x(45,"Document"),m(),D(46,"p-select",29),m()(),p(47,"div",27)(48,"div",28)(49,"label",16),x(50,"Type"),m(),D(51,"p-select",30),m()(),p(52,"div",27)(53,"div",28)(54,"label",16),x(55,"Number"),m(),D(56,"input",31),m()(),p(57,"div",27)(58,"div",28)(59,"label",16),x(60,"ID"),m(),D(61,"input",32),m()(),p(62,"div",27)(63,"div",28)(64,"label",16),x(65,"Note"),m(),D(66,"textarea",33),m()(),p(67,"div",27)(68,"div",28)(69,"label",16),x(70,"Upload"),m(),p(71,"p-fileupload",34,3),$("onSelect",function(c){M(t);let y=P();return R(y.onUpload(c))}),m()()()()()()()()}if(n&2){let t=P();v("formGroup",t.form),g(8),v("options",t.outlets()),g(4),v("showIcon",!0)("ngClass",ge(16,an,t.form.controls.order.controls.date.invalid&&(t.form.controls.order.controls.date.dirty||t.form.controls.order.controls.date.touched))),g(4),v("ngClass",ge(18,an,t.form.controls.order.controls.number.invalid&&(t.form.controls.order.controls.number.dirty||t.form.controls.order.controls.number.touched))),g(3),re(+t.form.controls.order.controls.contactType.value==0?"Customer":"Supplier"),g(2),v("suggestions",t.customerSuggestions())("placeholder",+t.form.controls.order.controls.contactType.value==0?"Search Customer":"Search Supplier"),g(5),wt(t.contactType()),g(5),v("value",t.form.controls.items.controls)("tableStyle",De(20,nu)),g(15),v("ngClass",ge(21,an,t.form.controls.order.controls.entryTypeID.invalid&&(t.form.controls.order.controls.entryTypeID.dirty||t.form.controls.order.controls.entryTypeID.touched)))("options",t.journalEntryForm().options.entryTypes),g(5),v("ngClass",ge(23,an,t.form.controls.order.controls.referenceTypeID.invalid&&(t.form.controls.order.controls.referenceTypeID.dirty||t.form.controls.order.controls.referenceTypeID.touched)))("options",t.journalEntryForm().options.referenceTypes),g(15),v("autoResize",!0)("ngClass",ge(25,an,t.form.controls.order.controls.note.invalid&&(t.form.controls.order.controls.note.dirty||t.form.controls.order.controls.note.touched)))}}function cu(n,h){if(n&1){let t=q();p(0,"p-button",52),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m(),p(1,"p-button",53),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m()}n&2&&v("text",!0)}var po=(()=>{class n{constructor(){this.fileAttachment=Ae(new File([],"")),this.activatedRoute=K(ai),this.journalEntryService=K(Xe),this.journalEntryForm=Ae(null),this.customerSuggestions=Ae([]),this.itemsForm=Ae([]),this.subTotalDebit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.debitAmount,0)),this.subTotalCredit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.creditAmount,0)),this.contactType=Ae([{key:0,value:"Customer"},{key:1,value:"Supplier"}]),this.dialogService=K(Zi),this.uploadDialogVisible=Ae(!1),this.messageService=K(Bi),this.outlets=ut(()=>this.journalEntryForm()?.options?.outlets||[]),this.toasr=K(Mi),this.initializeFormEffect()}toggleDialog(){this.dialogService.open(Rn,{header:"Create Customer/Supplier",width:"40vw",footer:"submit",closable:!0,dismissableMask:!0,modal:!0,showHeader:!0})}ngOnInit(){this.initializeForm(),this.loadJournalEntryForm(),setInterval(()=>{this.subTotalCredit()!==this.subTotalDebit()&&this.messageService.add({severity:"warn",summary:"Mismatch Detected",detail:`The total Debit and Credit amounts are not balanced. Difference: ${this.subTotalCredit()-this.subTotalDebit()}`})},1e3)}onToggleUploadDialog(){this.uploadDialogVisible.update(t=>!t)}onUploadDialog(t){console.log(t),ja.default.parse(t.currentFiles[0],{complete:l=>{console.log("Parsed result:",l)},error:l=>{console.error("Parsing error:",l)}})}initializeForm(){this.form=new At({order:new At({id:new B("",[at.required]),number:new B("",[at.required]),date:new B({value:new Date,disabled:!0},[at.required]),note:new B(""),entryTypeID:new B(1,[at.required]),referenceID:new B(""),referenceTypeID:new B(0,[at.required]),referenceText:new B(""),contactID:new B(""),detailReferenceID:new B(""),creatorID:new B("",[at.required]),created:new B("",[at.required]),modifierID:new B(""),modified:new B(""),entityID:new B(""),statusID:new B(0),contactName:new B(""),contactType:new B(0)}),items:new bn([]),additionalAccountID:new B(""),file:new B(null)})}initializeFormEffect(){vn(()=>{let t=this.journalEntryForm();t&&(this.form.patchValue({order:Ie(ve({},t.form.order),{entryTypeID:Number(t.form.order.entryTypeID===0&&1),referenceID:String(t.form.order.referenceID||Ve),contactID:String(t.form.order.contactID||""),detailReferenceID:String(t.form.order.detailReferenceID||Ve),contactName:String(t.form.order.contactName),date:mo.default.isDayjs(t.form.order.date)?t.form.order.date.toDate():(0,mo.default)().toDate(),modifierID:String(t.form.order.modifierID||Ve),statusID:t.form.order.statusID,modified:String(t.form.order.modified),entityID:String(t.form.order.entityID||Ve)}),additionalAccountID:t.form.additionalAccountID}),this.updateFormItems(t.form.items),this.form.controls.items.touched||this.itemsForm.set(this.form.controls.items.value),this.form.controls.items.valueChanges.subscribe(l=>{this.itemsForm.set(l)}))})}updateFormItems(t){let l=this.form.controls.items;l.clear(),t.forEach(c=>{l.push(new At({id:new B(c.id),journalID:new B(c.journalID),accountID:new B(c.accountID),debitAmount:new B(c.debitAmount),creditAmount:new B(c.creditAmount),index:new B(c.index),note:new B(c.note)}))})}loadJournalEntryForm(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>this.journalEntryForm.set(t))).subscribe()}searchCustomer(t){switch(+this.form.controls.order.value.contactType){case 0:this.journalEntryService.getJournalEntryCustomerSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;case 1:this.journalEntryService.getJournalEntrySupplierSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;default:console.error("Invalid contact type");break}}addItems(){this.form.controls.items.push(new At({id:new B(Ve.toString()),journalID:new B(Ve.toString()),accountID:new B(Ve.toString()),debitAmount:new B(0),creditAmount:new B(0),index:new B(this.form.controls.items.length??0),note:new B("")}))}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalEntryService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.fileAttachment()),l}onUpload(t){console.log(t),this.fileAttachment.set(t.currentFiles[0])}removeItems(t){this.form.controls.items.removeAt(t)}onSwap(){let t=this.form.controls.items.value.map(l=>({id:l.id??"",journalID:l.journalID??"",accountID:l.accountID??"",debitAmount:l.creditAmount,creditAmount:l.debitAmount,index:l.index??0,note:l.note??""}));this.form.controls.items.setValue(t)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry-form",8,"page"]],features:[je([Zi,Bi])],attrs:tu,decls:11,vars:6,consts:[["footer",""],["header",""],["body",""],["fu",""],["pageTitle",`Manual Journal Form
|
|
661
|
+
`],["ngProjectAs","action-button",5,["action-button"]],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],["class","d-flex flex-column row-gap-4",3,"formGroup",4,"ngIf"],["header","Upload",3,"modal","visible"],["mode","basic","chooseLabel","Choose","chooseIcon","pi pi-upload",3,"onSelect"],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],["formGroupName","order",1,"row"],[1,"col"],[1,"row"],[1,"col","d-flex","flex-column"],["for",""],["size","small","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an Outlet",1,"w-full",3,"options"],["styleClass","w-100","dataType","string","dateFormat","mm-dd-yy","size","small","formControlName","date",3,"showIcon","ngClass"],["pSize","small","type","text","pInputText","","formControlName","number","placeholder","Enter Number",3,"ngClass"],[1,"d-flex","align-items-center","gap-2"],["size","small","styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",1,"w-100",3,"completeMethod","suggestions","placeholder"],[1,"d-flex","align-items-center","gap-2",2,"height","100%","min-height","43px"],[1,"d-flex","items-center","gap-2"],["formArrayName","items",1,"row"],["showGridlines","",3,"value","tableStyle"],[1,"row","gap-3"],[1,"col","col-lg-4"],[1,"form-group","d-flex","flex-column"],["formControlName","selectedCity","formControlName","entryTypeID","optionLabel","value","optionValue","key",3,"ngClass","options"],["formControlName","referenceTypeID","optionLabel","value","optionValue","key",3,"ngClass","options"],["pSize","small","type","text","formControlName","referenceText","pInputText","","placeholder","Enter Number"],["pSize","small","type","text","pInputText","","formControlName","referenceID"],["pTextarea","","formControlName","note","placeholder","Enter Note",1,"w-100",3,"autoResize","ngClass"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["formControlName","contactType","name","contactType","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[2,"width","25%"],[3,"formGroupName"],["appendTo","body","size","small","formControlName","accountID","virtualScroll","","optionLabel","name","optionValue","id","placeholder","Select an account","styleClass","w-100","showClear","",3,"options","virtualScrollItemSize"],["pSize","small","formControlName","debitAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","formControlName","creditAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","rows","1","cols","30","pTextarea","","formControlName","note",1,"w-100",3,"autoResize"],["size","small","icon","fa-solid fa-xmark","aria-label","Save","severity","danger",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"d-flex","gap-2"],["icon","fa-light fa-plus","size","small","label","Add",3,"onClick"],["icon","fa-light fa-upload","size","small","label","Upload",3,"onClick"],["icon","fa-light fa-arrows-rotate","size","small","label","Swap",3,"onClick"],[2,"vertical-align","middle"],[3,"ngClass"],["colspan","2"],["label","Cancel","severity","secondary",3,"click","text"],["label","OK(F2)","severity","primary",3,"click"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),ce(1,5),p(2,"button",6),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(3," Submit "),m(),ue(),ce(4,7),O(5,lu,73,27,"div",8),ue(),m(),p(6,"p-dialog",9)(7,"p-fileupload",10),$("onSelect",function(L){return M(y),R(c.onUploadDialog(L))}),m(),O(8,cu,2,1,"ng-template",null,0,me),m(),D(10,"p-toast")}l&2&&(g(5),v("ngIf",c.journalEntryForm()),g(),xt(De(5,iu)),v("modal",!0)("visible",c.uploadDialogVisible()))},dependencies:[Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,Pt,Le,gt,Ye,Vt,pi,di,Gi,Ji,ui,ci,Wi,Ki,Fn,In,$t,jt,zt,ft,Ut,mi,Pn,kn,gi,hi,Ln,Qi,Si,$i,ji,qi,Nn],encapsulation:2})}}return n})();var ho=n=>{let h=K(Xe),t=K(Hi);return t.show(),console.log("journalEntryResolver",n),h.getJournalEntryForm(n.paramMap.get("id")??"").pipe(He("response"),Fe(()=>t.hide()))};var uu=()=>["edit"],mu=()=>["/report/general-ledger"],du=n=>({id:n});function pu(n,h){n&1&&(p(0,"tr")(1,"th",15),x(2,"Code"),m(),p(3,"th"),x(4,"Account"),m(),p(5,"th",15),x(6,"Debit"),m(),p(7,"th",15),x(8,"Credit"),m()())}function hu(n,h){if(n&1&&(p(0,"tr")(1,"td")(2,"a",16),x(3),m()(),p(4,"td"),x(5),m(),p(6,"td"),x(7),Be(8,"number"),m(),p(9,"td"),x(10),Be(11,"number"),m()()),n&2){let t=h.$implicit;g(2),v("routerLink",De(10,mu))("queryParams",ge(11,du,t.accountID)),g(),re(t.accountCode),g(2),re(t.accountName),g(2),re(Ze(8,6,t.debitAmount)),g(3),re(Ze(11,8,t.creditAmount))}}function gu(n,h){if(n&1&&(p(0,"tr")(1,"td",17),x(2,"Total"),m(),p(3,"td"),x(4),Be(5,"number"),m(),p(6,"td"),x(7),Be(8,"number"),m()()),n&2){let t=P(2);g(4),re(Ze(5,2,t.totalDebitAmount())),g(3),re(Ze(8,4,t.totalCreditAmount()))}}function fu(n,h){if(n&1&&(p(0,"app-main-panel",3),ce(1,4),p(2,"a",5),x(3," Edit "),m(),p(4,"button",6),x(5,"Delete"),m(),ue(),ce(6,7),p(7,"div",8)(8,"div",9)(9,"p-card",10)(10,"div",11)(11,"div",12)(12,"div",11)(13,"div",13),x(14,"Date"),m(),p(15,"div",12),x(16),Be(17,"date"),m()(),D(18,"hr"),p(19,"div",11)(20,"div",13),x(21,"Number"),m(),p(22,"div",12),x(23),m()(),D(24,"hr"),p(25,"div",11)(26,"div",13),x(27,"Outlet"),m(),p(28,"div",12),x(29),m()()(),p(30,"div",12)(31,"div",11)(32,"div",13),x(33,"Date"),m(),p(34,"div",12),x(35),Be(36,"date"),m()(),D(37,"hr"),p(38,"div",11)(39,"div",13),x(40,"Number"),m(),p(41,"div",12),x(42),m()(),D(43,"hr"),p(44,"div",11)(45,"div",13),x(46,"Outlet"),m(),p(47,"div",12),x(48),m()()()()()(),p(49,"div",12)(50,"p-card")(51,"p-table",14),O(52,pu,9,0,"ng-template",null,0,me)(54,hu,12,13,"ng-template",null,1,me)(56,gu,9,6,"ng-template",null,2,me),m()()()(),ue(),m()),n&2){let t=P();v("pageTitle","Journal #"+t.journalEntryInfo().order.number),g(2),v("routerLink",De(15,uu)),g(14),ct(" ",en(17,9,t.journalEntryInfo().order.date,"dd mmm yy")," "),g(7),re(t.journalEntryInfo().order.number),g(6),re(t.journalEntryInfo().order.outletID),g(6),ct(" ",en(36,12,t.journalEntryInfo().order.date,"dd mmm yy")," "),g(7),re(t.journalEntryInfo().order.number),g(6),re(t.journalEntryInfo().order.outletID),g(3),v("value",t.journalEntryInfo().items)}}var $a=(()=>{class n{constructor(){this.journalEntryService=K(Xe),this.route=K(ai),this.journalEntryInfo=Ae(null),this.totalDebitAmount=ut(()=>this.journalEntryInfo()?.items?.reduce((l,c)=>l+c.debitAmount,0)||0),this.totalCreditAmount=ut(()=>this.journalEntryInfo()?.items?.reduce((l,c)=>l+c.creditAmount,0)||0)}ngOnInit(){this.route.paramMap.pipe(mn(t=>t.has("id")),kt(t=>t.get("id")),Xi(t=>this.journalEntryService.getJournalEntryInfo(t)),Fe(t=>this.journalEntryInfo.set(t)),He("response")).subscribe()}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-entry-info"]],decls:1,vars:1,consts:[["header",""],["body",""],["footer",""],[3,"pageTitle"],["ngProjectAs","action-button",5,["action-button"]],[1,"btn","btn-secondary","rounded",3,"routerLink"],[1,"btn","btn-danger","rounded"],["ngProjectAs","content",5,["content"]],[1,"row","row-gap-4"],[1,"col-12"],["header","Details"],[1,"row"],[1,"col"],[1,"col-2"],[3,"value"],[2,"width","10%"],[1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"text-end"]],template:function(l,c){l&1&&O(0,fu,58,16,"app-main-panel",3),l&2&&ze(c.journalEntryInfo()?0:-1)},dependencies:[Pt,Le,Vt,yn,Ut,mi,$t,jt,wn,Sn],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var Ja=n=>{let h=K(Xe),t=K(Hi);return t.show(),console.log("journalEntryResolver",n),h.getJournalRecordExpenseLoader().pipe(He("response"),Fe(()=>t.hide()))};var fo=_i(On());var Ga=_i(uo());var vu=()=>({width:"25rem"}),go=n=>({"ng-invalid ng-dirty":n}),yu=()=>({"min-width":"50rem"}),_u=()=>({});function bu(n,h){if(n&1&&(p(0,"div",23),D(1,"p-radiobutton",32),p(2,"label",33),x(3),m()()),n&2){let t=h.$implicit;g(),v("value",t.key),g(2),re(t.value)}}function Su(n,h){n&1&&(p(0,"tr")(1,"th",34),x(2,"Account"),m(),p(3,"th",34),x(4,"Amount"),m(),p(5,"th",34),x(6,"Note"),m(),D(7,"th"),m())}function wu(n,h){if(n&1){let t=q();p(0,"tr",35)(1,"td"),D(2,"p-select",36),m(),p(3,"td"),D(4,"input",37),m(),p(5,"td"),D(6,"textarea",38),m(),p(7,"td")(8,"p-button",39),$("onClick",function(){let c=M(t).rowIndex,y=P(2);return R(y.removeItems(c))}),m()()()}if(n&2){let t=h.rowIndex,l=P(2);v("formGroupName",t),g(2),v("options",l.JournalExpenseRecord().options.accounts)("virtualScrollItemSize",50),g(2),v("autoNumeric",De(5,_u)),g(2),v("autoResize",!0)}}function Cu(n,h){if(n&1){let t=q();p(0,"tr")(1,"td")(2,"div",40)(3,"div",41)(4,"p-button",42),$("onClick",function(){M(t);let c=P(2);return R(c.addItems())}),m()(),p(5,"span",43),x(6,"Total"),m()()(),p(7,"td"),x(8),Be(9,"number"),m(),D(10,"td",44),m()}if(n&2){let t=P(2);g(8),ct(" ",Ze(9,1,t.subTotalDebit())," ")}}function xu(n,h){if(n&1){let t=q();p(0,"div",11)(1,"div",12)(2,"div",13)(3,"p-card")(4,"div",14)(5,"div",15)(6,"label",16),x(7,"Outlets"),m(),D(8,"p-select",17),m(),p(9,"div",15)(10,"label",16),x(11,"Date"),m(),D(12,"p-datepicker",18),m(),p(13,"div",15)(14,"label",16),x(15,"Number"),m(),D(16,"input",19),m(),p(17,"div",15)(18,"label",16),x(19),m(),p(20,"div",20)(21,"p-autocomplete",21),$("completeMethod",function(c){M(t);let y=P();return R(y.searchCustomer(c))}),m()()(),p(22,"div",15)(23,"label",16),x(24,"Contact"),m(),p(25,"div",22),St(26,bu,4,2,"div",23,Nt),m()(),p(28,"div",15)(29,"label",16),x(30,"Payments"),m(),D(31,"p-select",24),m()()()()(),p(32,"div",25)(33,"div",13)(34,"p-card")(35,"p-table",26),O(36,Su,8,0,"ng-template",null,1,me)(38,wu,9,6,"ng-template",null,2,me)(40,Cu,11,3,"ng-template",null,0,me),m()()()(),p(42,"div",12)(43,"div",13)(44,"p-card")(45,"div",27)(46,"div",28)(47,"div",29)(48,"label",16),x(49,"Note"),m(),D(50,"textarea",30),m()(),p(51,"div",28)(52,"div",29)(53,"label",16),x(54,"Upload"),m(),p(55,"p-fileupload",31,3),$("onSelect",function(c){M(t);let y=P();return R(y.onUpload(c))}),m()()()()()()()()}if(n&2){let t=P();v("formGroup",t.form),g(8),v("options",t.outlets()),g(4),v("showIcon",!0)("ngClass",ge(13,go,t.form.controls.order.controls.date.invalid&&(t.form.controls.order.controls.date.dirty||t.form.controls.order.controls.date.touched))),g(4),v("ngClass",ge(15,go,t.form.controls.order.controls.number.invalid&&(t.form.controls.order.controls.number.dirty||t.form.controls.order.controls.number.touched))),g(3),re(+t.form.controls.order.controls.contactType.value==0?"Customer":"Supplier"),g(2),v("suggestions",t.customerSuggestions())("placeholder",+t.form.controls.order.controls.contactType.value==0?"Search Customer":"Search Supplier"),g(5),wt(t.contactType()),g(5),v("options",t.JournalExpenseRecord().options.paymentAccounts),g(4),v("value",t.form.controls.items.controls)("tableStyle",De(17,yu)),g(15),v("autoResize",!0)("ngClass",ge(18,go,t.form.controls.order.controls.note.invalid&&(t.form.controls.order.controls.note.dirty||t.form.controls.order.controls.note.touched)))}}function Eu(n,h){if(n&1){let t=q();p(0,"p-button",45),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m(),p(1,"p-button",46),$("click",function(){M(t);let c=P();return R(c.uploadDialogVisible.set(!1))}),m()}n&2&&v("text",!0)}var Ka=(()=>{class n{constructor(){this.fileAttachment=Ae(new File([],"")),this.activatedRoute=K(ai),this.journalEntryService=K(Xe),this.JournalExpenseRecord=Ae(null),this.customerSuggestions=Ae([]),this.itemsForm=Ae([]),this.subTotalDebit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.debitAmount,0)),this.subTotalCredit=ut(()=>this.itemsForm().reduce((t,l)=>t+ +l.creditAmount,0)),this.contactType=Ae([{key:0,value:"Customer"},{key:1,value:"Supplier"}]),this.dialogService=K(Zi),this.uploadDialogVisible=Ae(!1),this.messageService=K(Bi),this.outlets=ut(()=>this.JournalExpenseRecord()?.options?.entities||[]),this.toasr=K(Mi),this.initializeFormEffect()}toggleDialog(){this.dialogService.open(Rn,{header:"Create Customer/Supplier",width:"40vw",footer:"submit",closable:!0,dismissableMask:!0,modal:!0,showHeader:!0})}ngOnInit(){this.initializeForm(),this.loadJournalExpenseRecord()}onToggleUploadDialog(){this.uploadDialogVisible.update(t=>!t)}onUploadDialog(t){console.log(t),Ga.default.parse(t.currentFiles[0],{complete:l=>{console.log("Parsed result:",l)},error:l=>{console.error("Parsing error:",l)}})}initializeForm(){this.form=new At({order:new At({id:new B("",[at.required]),number:new B("",[at.required]),date:new B({value:new Date,disabled:!0},[at.required]),note:new B(""),entryTypeID:new B(1,[at.required]),referenceID:new B(""),referenceTypeID:new B(0,[at.required]),referenceText:new B(""),contactID:new B(""),detailReferenceID:new B(""),creatorID:new B("",[at.required]),created:new B("",[at.required]),modifierID:new B(""),modified:new B(""),entityID:new B(""),statusID:new B(0),contactName:new B(""),contactType:new B(0)}),items:new bn([]),additionalAccountID:new B(""),file:new B(null)})}initializeFormEffect(){vn(()=>{let t=this.JournalExpenseRecord();t&&(this.form.patchValue({order:Ie(ve({},t.form.order),{entryTypeID:Number(t.form.order.entryTypeID===0&&1),referenceID:String(t.form.order.referenceID||Ve),contactID:String(t.form.order.contactID||""),detailReferenceID:String(t.form.order.detailReferenceID||Ve),contactName:String(t.form.order.contactName),date:fo.default.isDayjs(t.form.order.date)?t.form.order.date.toDate():(0,fo.default)().toDate(),modifierID:String(t.form.order.modifierID||Ve),statusID:+t.form.order.statusID,modified:String(t.form.order.modified),entityID:String(t.form.order.entityID||Ve)}),additionalAccountID:t.form.additionalAccountID}),this.updateFormItems(t.form.items),this.form.controls.items.touched||this.itemsForm.set(this.form.controls.items.value),this.form.controls.items.valueChanges.subscribe(l=>{this.itemsForm.set(l)}))})}updateFormItems(t){let l=this.form.controls.items;l.clear(),t.forEach(c=>{l.push(new At({id:new B(c.id),journalID:new B(c.journalID),accountID:new B(c.accountID),debitAmount:new B(c.debitAmount),creditAmount:new B(c.creditAmount),index:new B(c.index),note:new B(c.note)}))})}loadJournalExpenseRecord(){this.activatedRoute.data.pipe(kt(t=>t.form),Fe(t=>this.JournalExpenseRecord.set(t))).subscribe()}searchCustomer(t){switch(+this.form.controls.order.value.contactType){case 0:this.journalEntryService.getJournalEntryCustomerSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;case 1:this.journalEntryService.getJournalEntrySupplierSuggestions(t.query).pipe(Fe(l=>this.customerSuggestions.set(l))).subscribe();break;default:console.error("Invalid contact type");break}}addItems(){this.form.controls.items.push(new At({id:new B(Ve.toString()),journalID:new B(Ve.toString()),accountID:new B(Ve.toString()),debitAmount:new B(0),creditAmount:new B(0),index:new B(this.form.controls.items.length??0),note:new B("")}))}onSubmitJournalEntry(){if(console.log(this.form.value),this.form.invalid){this.markFormInvalidAndNotify();return}this.form.controls.order.controls.date.enable();let t=this.getCleanedFormValue();console.log("cleanedFormValue",t);let l=this.buildFormData(t);this.journalEntryService.submitJournalEntry(l).pipe(He("response"),Fe(()=>this.form.controls.order.controls.date.disable()),Ei(c=>xi(()=>c)),He("error")).subscribe()}markFormInvalidAndNotify(){this.form.markAllAsTouched(),this.toasr.warning("Please fill in all required fields","Warning")}getCleanedFormValue(){let t=this.form.getRawValue(),l=Object.entries(t).reduce((c,[y,F])=>(y==="items"?c[y]=F.map(L=>Ie(ve({},L),{debitAmount:+L.debitAmount,creditAmount:+L.creditAmount})):y==="order"?c[y]=Ie(ve({},F),{contactID:F.contactID||Ve}):c[y]=F,c),{});return JSON.parse(JSON.stringify(l,(c,y)=>y==="null"?null:y))}buildFormData(t){let l=new FormData;return l.append("Data",JSON.stringify(t)),l.append("File",this.fileAttachment()),l}onUpload(t){console.log(t),this.fileAttachment.set(t.currentFiles[0])}removeItems(t){this.form.controls.items.removeAt(t)}onSwap(){let t=this.form.controls.items.value.map(l=>({id:l.id??"",journalID:l.journalID??"",accountID:l.accountID??"",debitAmount:l.creditAmount,creditAmount:l.debitAmount,index:l.index??0,note:l.note??""}));this.form.controls.items.setValue(t)}static{this.\u0275fac=function(l){return new(l||n)}}static{this.\u0275cmp=we({type:n,selectors:[["app-journal-receive-money"]],features:[je([Zi,Bi])],decls:11,vars:6,consts:[["footer",""],["header",""],["body",""],["fu",""],["pageTitle",`Receive Money
|
|
662
|
+
`],["ngProjectAs","action-button",5,["action-button"]],["type","button",1,"btn","btn-primary","rounded",3,"click"],["ngProjectAs","content",5,["content"]],["class","d-flex flex-column row-gap-4",3,"formGroup",4,"ngIf"],["header","Upload",3,"modal","visible"],["mode","basic","chooseLabel","Choose","chooseIcon","pi pi-upload",3,"onSelect"],[1,"d-flex","flex-column","row-gap-4",3,"formGroup"],["formGroupName","order",1,"row"],[1,"col"],[1,"row"],[1,"col","d-flex","flex-column"],["for",""],["size","small","formControlName","entityID","optionLabel","name","optionValue","id","placeholder","Select an Outlet",1,"w-full",3,"options"],["styleClass","w-100","dataType","string","dateFormat","mm-dd-yy","size","small","formControlName","date",3,"showIcon","ngClass"],["pSize","small","type","text","pInputText","","formControlName","number","placeholder","Enter Number",3,"ngClass"],[1,"d-flex","align-items-center","gap-2"],["size","small","styleClass","w-100","inputStyleClass","w-100","formControlName","contactID","optionLabel","Value","optionValue","Key",1,"w-100",3,"completeMethod","suggestions","placeholder"],[1,"d-flex","align-items-center","gap-2",2,"height","100%","min-height","43px"],[1,"d-flex","items-center","gap-2"],["size","small","formControlName","entityID","optionLabel","value","optionValue","key","placeholder","Select an Outlet",1,"w-full",3,"options"],["formArrayName","items",1,"row"],["showGridlines","",3,"value","tableStyle"],[1,"row","gap-3"],[1,"col","col-lg-4"],[1,"form-group","d-flex","flex-column"],["pTextarea","","formControlName","note","placeholder","Enter Note",1,"w-100",3,"autoResize","ngClass"],["styleClass","justify-content-start","mode","basic","chooseLabel","Choose","chooseIcon","fa-solid fa-upload","maxFileSize","1000000",3,"onSelect"],["formControlName","contactType","name","contactType","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[2,"width","25%"],[3,"formGroupName"],["appendTo","body","size","small","formControlName","accountID","virtualScroll","","optionLabel","value","optionValue","key","placeholder","Select an account","styleClass","w-100","showClear","",3,"options","virtualScrollItemSize"],["pSize","small","formControlName","debitAmount","type","text","pInputText","",1,"w-100",3,"autoNumeric"],["pSize","small","rows","1","cols","30","pTextarea","","formControlName","note",1,"w-100",3,"autoResize"],["size","small","icon","fa-solid fa-xmark","aria-label","Save","severity","danger",3,"onClick"],[1,"d-flex","justify-content-between","align-items-center"],[1,"d-flex","gap-2"],["icon","fa-light fa-plus","size","small","label","Add",3,"onClick"],[2,"vertical-align","middle"],["colspan","2"],["label","Cancel","severity","secondary",3,"click","text"],["label","OK(F2)","severity","primary",3,"click"]],template:function(l,c){if(l&1){let y=q();p(0,"app-main-panel",4),ce(1,5),p(2,"button",6),$("click",function(){return M(y),R(c.onSubmitJournalEntry())}),x(3," Submit "),m(),ue(),ce(4,7),O(5,xu,57,20,"div",8),ue(),m(),p(6,"p-dialog",9)(7,"p-fileupload",10),$("onSelect",function(L){return M(y),R(c.onUploadDialog(L))}),m(),O(8,Eu,2,1,"ng-template",null,0,me),m(),D(10,"p-toast")}l&2&&(g(5),v("ngIf",c.JournalExpenseRecord()),g(),xt(De(5,vu)),v("modal",!0)("visible",c.uploadDialogVisible()))},dependencies:[Ai,Ti,Ii,Fi,Oi,Vi,Ni,Di,Pt,Le,gt,Ye,Vt,pi,di,Gi,Ji,ui,ci,Wi,Ki,Fn,In,$t,jt,zt,ft,Ut,mi,Pn,kn,gi,hi,Ln,Qi,Si,$i,ji,qi,Nn],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return n})();var Wa=n=>{let h=K(Xe),t=K(Hi);return t.show(),console.log("journalEntryResolver",n),h.getJournalReceiveMoney().pipe(He("response"),Fe(()=>t.hide()))};var Xg=[{path:"",redirectTo:"journal-entry",pathMatch:"full"},{path:"journal-entry",children:[{path:"",component:va},{path:"add",component:po,resolve:{form:ho}},{path:":id",component:$a},{path:":id/edit",component:po,resolve:{form:ho}}]},{path:"record-expense",component:Da,resolve:{form:Ja}},{path:"receive-money",component:Ka,resolve:{form:Wa}},{path:"journal-deposit",component:Va}];export{Xg as JOURNAL_ROUTES};
|