1"use strict";(self.webpackChunkota=self.webpackChunkota||[]).push([[6547],{41292(T,S,t){t.d(S,{PagesUserAssignmentsModule:()=>X});var g=t(62552),l=t(56872),A=t(35747);const n=[{path:"**",component:(()=>{var o;class a{static#t=o=()=>(this.\u0275fac=function(i){return new(i||a)},this.\u0275cmp=g.VBU({type:a,selectors:[["ng-component"]],standalone:!1,decls:0,vars:0,template:function(i,m){},encapsulation:2}))}return o(),a})()}];let r=(()=>{var o;class a{static#t=o=()=>(this.\u0275fac=function(i){return new(i||a)},this.\u0275mod=g.$C({type:a}),this.\u0275inj=g.G2t({imports:[A.iI.forChild(n),A.iI]}))}return o(),a})();var c=t(10127);const d={controller:(()=>{class o{constructor(s,e,i){this._AssignmentStatisticsResource=s,this._AssignmentTableRowsService=e,this._StatsTable=i}$onChanges(){this._setData()}_setData(){this._AssignmentStatisticsResource.getCompanyAssignmentStats(this.startDay,this.endDay,this.companyId).then(s=>this._AssignmentTableRowsService.getAssignmentStatTableRows(s.map(e=>({isNew:e.isCreated,...e}))).then(e=>{this.tableRows=e,this.tableColumns=this._AssignmentTableRowsService.getColumns(this.tableRows,["assignment","visits","contacts","isNew"]),this.sumRow=this._StatsTable.getSumRow(this.tableColumns,this.tableRows)})).catch(()=>{})}}return o.$inject=["AssignmentStatisticsResource","AssignmentTableRowsService","StatsTable"],o})(),bindings:{startDay:"<",endDay:"<",companyId:"<",name:"@"},template:'<stats-table ng-if="$ctrl.tableRows.length" [rows]="$ctrl.tableRows" [sum-row]="$ctrl.sumRow" [columns]="$ctrl.tableColumns" name="{{::$ctrl.name}}" [centered-values]="true"></stats-table>'},_={controller:(()=>{class o{constructor(s){this._AssignmentStatisticsResource=s}$onInit(){this.selectedCompanyId=this.companyId,this.submit(new Date(this.start),new Date(this.end))}switchCompany(s){this.selectedCompanyId=s,this.submit(this.selectedStart,this.selectedEnd)}_convertDateToYmd(s){return[s.getFullYear(),("0"+(s.getMonth()+1)).slice(-2),("0"+s.getDate()).slice(-2)].join("-")}getDownloadStatsLink(s){return"/ostotoimeksiannot/tilastot/export/"+this.selectedCompanyId+"/"+s+"?start="+this._convertDateToYmd(this.selectedStart)+"&end="+this._convertDateToYmd(this.selectedEnd)}submit(s,e){this.loading||(this.loading=!0,this.error=!1,this.selectedStart=s,this.selectedEnd=e,this._AssignmentStatisticsResource.getDailyCompanyAssignments(s,e,this.selectedCompanyId).then(i=>{this.sumStats=i.reduce((m,u,Z)=>(m.active=0===Z?u.active:m.active+u.created,m.contacts+=u.contacts,m.new+=u.created,m.closed+=u.deleted,m.visits+=u.visits,m),{active:0,new:0,closed:0,visits:0,contacts:0}),this.initialized=!0,this.graphContacts=i.map(({date:m,contacts:u})=>({t:m,y:u})),this.graphVisits=i.map(({date:m,visits:u})=>({t:m,y:u}))}).catch(()=>{this.error=!0}).finally(()=>{this.loading=!1}))}}return o.$inject=["AssignmentStatisticsResource"],o})(),templateUrl:"/template/assignment/components/assignment-stats",bindings:{companyId:"<",start:"@?",end:"@?"}},f=(()=>{class o{constructor(s,e,i,m){this._AssignmentResource=s,this._StatsTableRowsBase=e,this._$q=i,this._$log=m}getRows(s){return this._StatsTableRowsBase.getRows(s)}getColumns(s,e){return this._StatsTableRowsBase.getColumns(s,e)}getAssignmentStatTableRows(s){return this._$q.all(this._StatsTableRowsBase.getRows(s).map(e=>this._AssignmentResource.getAssignment(e.assignmentId.value).then(i=>(e.assignment={value:i.assignmentNumber,type:"double",extra:i.locations.map(m=>m.name).join(", ")},e)).catch(i=>(this._$log.error(i),e.assignment=e.assignmentId,e))))}}return o.$inject=["AssignmentResource","StatsTableRowsBase","$q","$log"],o})();var C=t(32142),R=t(3794),M=t(49878),E=t(51739),$=t(90545);const O="otAsunnot:assignments:stats";c.module(O,[E.A,$.A,R.A,M.A,C.A]).service("AssignmentTableRowsService",f).component("assignmentStats",_).component("assignmentStatTable",d);const P=O;var Y=t(34618),B=t(61758),w=t(61439),j=t(92740),L=t.n(j);const W={controller:(()=>{class o{constructor(s,e){this._AssignmentResource=s,this._ModalService=e,this.name=L()("assignmentDeleteModal")}delete(){this.loading=!0,this._AssignmentResource.deleteAssignment(this.assignment.assignmentId).then(()=>{this.onDelete(this.assignment),this._ModalService.close(this.name)}).catch(()=>{this.onError()}).finally(()=>{this.loading=!1})}}return o.$inject=["AssignmentResource","ModalService"],o})(),bindings:{assignment:"<",onDelete:"&",onError:"&"},templateUrl:"/template/assignment/components/delete-assignment"};var x=t(73235);const N={controller:(()=>{class o extends x.A{constructor(s,e){super(s),this._AssignmentStatisticsResource=e}toggle(){this._AssignmentStatisticsResource.getSummedStats(this.assignment.assignmentId).then(s=>{this.stats=s})}}return o.$inject=["$translate","AssignmentStatisticsResource"],o})(),bindings:{assignment:"<",last:"<",onDelete:"&",onError:"&"},templateUrl:"/template/assignment/components/user-assignments/user-assignment"},F={controller:t(24168).A,templateUrl:"/template/assignment/components/user-assignments/user-assignments",bindings:{companyId:"<",companyName:"@"}},y="otAsunnot:assignments:userAssignments";c.module(y,[Y.A,B.A,w.A]).component("deleteAssignment",W).component("userAssignments",F).component("userAssignment",N);const G=y;var Q=t(53010);const I="otAsunnot:page:userAssignments";c.module(I,[Q.A,P,G]);const V=I;var J=t(27095),z=t(45954),U=t(21668),H=t(279);let X=(()=>{var o;class a{constructor(){(0,g.WQX)(l.be).bootstrap(document.documentElement,[...H.m,...U.m,V],{strictDi:!0})}static#t=o=()=>(this.\u0275fac=function(i){return new(i||a)},this.\u0275mod=g.$C({type:a}),this.\u0275inj=g.G2t({imports:[r,l.be,J.o,z.y,U.d]}))}return o(),a})()},2556(T,S,t){t.d(S,{O:()=>r});var g=t(77060),l=t.n(g),A=t(79466),v=t.n(A),n=t(62552);let r=(()=>{var c;class h{transform(d,p=2,b=null,_=!1){if(null==d||""===d)return b||d;const D=d.toString().replace(/\s/g,"").replace(",","."),f=v()(D);if(f.toString()!==D)return d;const C=_?l()(f,p).toFixed(p).replace(".",","):l()(f,p).toString().replace(".",","),R=C.indexOf(",");return C.replace(/\d(?=(?:\d{3})+(?:[.,]|$))/g,(M,E)=>R<0||E<R?M+"\xa0":M)}static#t=c=()=>(this.\u0275fac=function(p){return new(p||h)},this.\u0275pipe=n.EJ8({name:"price",type:h,pure:!0}),this.\u0275prov=n.jDH({token:h,factory:h.\u0275fac,providedIn:"root"}))}return c(),h})()},30189(T,S,t){var g=t(21401),l=t.n(g),A=t(90652);const v={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};A.ij._date.override("function"==typeof l()?{_id:"moment",formats:function(){return v},parse:function(n,r){return"string"==typeof n&&"string"==typeof r?n=l()(n,r):n instanceof l()||(n=l()(n)),n.isValid()?n.valueOf():null},format:function(n,r){return l()(n).format(r)},add:function(n,r,c){return l()(n).add(r,c).valueOf()},diff:function(n,r,c){return l()(n).diff(l()(r),c)},startOf:function(n,r,c){return n=l()(n),"isoWeek"===r?(c=Math.trunc(Math.min(Math.max(0,c),6)),n.isoWeekday(c).startOf("day").valueOf()):n.startOf(r).valueOf()},endOf:function(n,r){return l()(n).endOf(r).valueOf()}}:{})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.