"use strict";(self.webpackChunk_esome_dev_ppms=self.webpackChunk_esome_dev_ppms||[]).push([[6962],{86962:(e,t,i)=>{i.r(t),i.d(t,{ActivityInstanceListPage:()=>z});var r,n,o,s,a,d=i(50493),c=i(68784),l=i(16682),p=i(94430),m=i(56765),u=i(28120),g=i(27805),h=i(53421),f=i(77675),y=i(15633),v=i(36179);function w(e,t,i,r,n,o,s){try{var a=e[o](s),d=a.value}catch(e){return void i(e)}a.done?t(d):Promise.resolve(d).then(r,n)}function b(e){return function(){var t=this,i=arguments;return new Promise((function(r,n){var o=e.apply(t,i);function s(e){w(o,r,n,s,a,"next",e)}function a(e){w(o,r,n,s,a,"throw",e)}s(void 0)}))}}function x(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var z=class extends((0,u.$)(f.h)((0,h.NC)(h.z2)(f.B4))){constructor(){super(...arguments),this.mode=(0,v.s2)()?"CARD":"GRID"}get context(){return{search:{handler:e=>{this.grist.searchText=e},placeholder:h.z2.t("title.activity instance list"),value:this.grist.searchText},filter:{handler:()=>{this.grist.toggleHeadroom()}},help:"worklist/activity-instance-list",actions:[]}}render(){var e=this.mode;return(0,p.dy)(r||(r=x(["\n      <ox-grist .mode="," .config="," .fetchHandler=",'>\n        <div slot="headroom">\n          <div id="filters">\n            <ox-filters-form autofocus without-search></ox-filters-form>\n          </div>\n\n          <div id="sorters">\n            Sort\n            <mwc-icon\n              @click=','\n              >expand_more</mwc-icon\n            >\n            <ox-popup id="sorter-control">\n              <ox-sorters-control> </ox-sorters-control>\n            </ox-popup>\n          </div>\n\n          <div id="modes">\n            <mwc-icon @click='," ?active=",">grid_on</mwc-icon>\n            <mwc-icon @click="," ?active=",">format_list_bulleted</mwc-icon>\n            <mwc-icon @click="," ?active=",">apps</mwc-icon>\n          </div>\n        </div>\n      </ox-grist>\n    "])),e,this.gristConfig,this.fetchHandler.bind(this),(e=>{var t=e.currentTarget;this.sorterControl.open({right:0,top:t.offsetTop+t.offsetHeight})}),(()=>this.mode="GRID"),"GRID"==e,(()=>this.mode="LIST"),"LIST"==e,(()=>this.mode="CARD"),"CARD"==e)}pageInitialized(e){var t=this;return b((function*(){t.gristConfig={list:{thumbnail:"thumbnail",fields:["name","description"],details:["updatedAt"]},columns:[{type:"gutter",gutterName:"sequence"},{type:"gutter",gutterName:"row-selector",multiple:!0},{type:"string",name:"name",header:h.z2.t("field.name"),record:{editable:!1},filter:"search",sortable:!0,width:150},{type:"string",name:"description",header:h.z2.t("field.description"),record:{editable:!1},filter:"search",width:200},{type:"number",name:"priority",header:h.z2.t("field.priority"),record:{editable:!1,renderer:function(e,t,i,r,s){var a=["","gray","yellow","orange","red"][e||0],d=new Array(e>4?4:e||0).fill("");return(0,p.dy)(n||(n=x(["",""])),d.map((()=>(0,p.dy)(o||(o=x(['<mwc-icon style="color:',';">star</mwc-icon>'])),a))))}},width:60},{type:"string",name:"state",header:h.z2.t("field.status"),record:{editable:!1},width:80},{type:"resource-object",name:"updater",header:h.z2.t("field.updater"),record:{editable:!1},sortable:!0,width:120},{type:"datetime",name:"updatedAt",header:h.z2.t("field.updated_at"),record:{editable:!1},sortable:!0,width:180},{type:"image",name:"thumbnail",header:h.z2.t("field.thumbnail"),record:{editable:!1},hidden:!0}],rows:{selectable:{multiple:!0}},sorters:[{name:"name"}]}}))()}fetchHandler(e){return b((function*(){var{page:t,limit:i,sortings:r=[],filters:n=[]}=e,o=yield g.Lp.query({query:(0,l.ZP)(s||(s=x(["\n        query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n          responses: activityInstances(filters: $filters, pagination: $pagination, sortings: $sortings) {\n            items {\n              id\n              name\n              description\n              priority\n              state\n              thumbnail\n              updater {\n                id\n                name\n              }\n              updatedAt\n            }\n            total\n          }\n        }\n      "]))),variables:{filters:n,pagination:{page:t,limit:i},sortings:r}});return{total:o.data.responses.total||0,records:o.data.responses.items||[]}}))()}};z.styles=[y.Ix,y.Pn,(0,p.iv)(a||(a=x(["\n      :host {\n        display: flex;\n\n        width: 100%;\n\n        --grid-record-emphasized-background-color: red;\n        --grid-record-emphasized-color: yellow;\n      }\n    "])))],(0,d.gn)([(0,m.Cb)({type:Object}),(0,d.w6)("design:type",Object)],z.prototype,"gristConfig",void 0),(0,d.gn)([(0,m.Cb)({type:String}),(0,d.w6)("design:type",String)],z.prototype,"mode",void 0),(0,d.gn)([(0,m.IO)("#sorter-control"),(0,d.w6)("design:type",Object)],z.prototype,"sorterControl",void 0),(0,d.gn)([(0,m.IO)("ox-grist"),(0,d.w6)("design:type",c.Nw)],z.prototype,"grist",void 0),z=(0,d.gn)([(0,m.Mo)("activity-instance-list-page")],z)}}]);