"use strict";(this.webpackChunk_tsmesolutions_cubes_initiatives=this.webpackChunk_tsmesolutions_cubes_initiatives||[]).push([[152],{10152:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var o=n(24590),l=n(16464),a=n(19244),i=n(90726);const r={isSingle:Boolean,showDetails:Boolean,createButtonDisabled:Boolean};var c=n(91123),s=n(78248),d=n(98618),u=n(34144);function p(e,t,n,o,l,a,i){try{var r=e[a](i),c=r.value}catch(e){return void n(e)}r.done?t(c):Promise.resolve(c).then(o,l)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(o,l){var a=e.apply(t,n);function i(e){p(a,o,l,i,r,"next",e)}function r(e){p(a,o,l,i,r,"throw",e)}i(void 0)})}}const v={class:"dropdown-header"},f={class:"dropdown-scroll"},k=["onClick"],h={key:0},B={class:"p-4"},w={class:"dropdown-header"},g={class:"dropdown-scroll"},y=["onClick"],b=(0,o.defineComponent)({__name:"initiatives-types-dropdown",props:r,emits:["onSelect"],setup(e,t){let{emit:n}=t;const r=n,p=i.IoC.DI().resolve(l.Ow.appContext),b=p.services[a.St.AppService.key],C=p.services[a.St.InitiativeSettingService.key],V=p.translation.global,N=(0,o.ref)(!1),D=(0,o.ref)({}),E=function(){var e=m(function*(){return new Promise(function(){var e=m(function*(e,t){try{const t=yield C.listInitiativeTypesAsync();t.data.length&&t.data.splice(0,0,new s.Y({id:"",name:{en:"New Project",ar:"مشروع جديد",id:"-1"}})),D.value=t.data,e(t)}catch(e){b.error(V.value.requestError,void 0,"settings@custom-fields-form::fetch"),t(e)}});return function(t,n){return e.apply(this,arguments)}}())});return function(){return e.apply(this,arguments)}}(),S=e=>{r("onSelect",e),N.value=!1};return(0,o.onMounted)(m(function*(){return yield E()})),(e,t)=>{const n=(0,o.resolveComponent)("v-button"),l=(0,o.resolveComponent)("v-dropdown"),a=(0,o.resolveComponent)("v-icon"),i=(0,o.resolveDirective)("fake-link");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[!e.isSingle&&D.value.length&&(0,o.unref)(d.p)((0,o.unref)(b),(0,o.unref)(u.h)["add-initiative"]).value?((0,o.openBlock)(),(0,o.createBlock)(l,{key:0,class:"btn-group",modelValue:N.value,"onUpdate:modelValue":t[0]||(t[0]=e=>N.value=e),placement:"bottom-end","offset-right":"",teleport:"",offset:"n2"},{trigger:(0,o.withCtx)(()=>[(0,o.createVNode)(n,{class:"dropdown-toggle",title:" "})]),default:(0,o.withCtx)(()=>[(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("h6",v,[(0,o.createTextVNode)((0,o.toDisplayString)((0,o.unref)(V).createNewProjectOfType),1)])),[[i]]),(0,o.createElementVNode)("div",f,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(D.value,(e,t)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,["-1"!=e?.name.id?(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("a",{key:`${e.id}-${t}`,class:"dropdown-item",onClick:t=>S(e.id)},[(0,o.createTextVNode)((0,o.toDisplayString)((0,o.unref)(c.useLocalize)((0,o.unref)(b),e.name,!0,"-")),1)],8,k)),[[i]]):(0,o.createCommentVNode)("v-if",!0)],64))),256))])]),_:1},8,["modelValue"])):(0,o.createCommentVNode)("v-if",!0),e.isSingle&&e.showDetails&&(0,o.unref)(d.p)((0,o.unref)(b),(0,o.unref)(u.h)["add-initiative"]).value?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},[D.value.length?((0,o.openBlock)(),(0,o.createElementBlock)("div",h,[(0,o.createVNode)(n,{accent:"primary",size:"md",class:"d-flex justify-content-center align-items-center overflow-hidden btn-floated position-absolute",disabled:e.createButtonDisabled},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(l,{modelValue:N.value,"onUpdate:modelValue":t[1]||(t[1]=e=>N.value=e),placement:"top",teleport:"",disabled:e.createButtonDisabled},{trigger:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",B,[(0,o.createVNode)(a,{name:"plus"})])]),default:(0,o.withCtx)(()=>[(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("h6",w,[(0,o.createTextVNode)((0,o.toDisplayString)((0,o.unref)(V).createNewProjectOfType),1)])),[[i]]),(0,o.createElementVNode)("div",g,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(D.value,(e,t)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,["-1"!=e?.name.id?(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("a",{key:`${e.id}-${t}`,class:"dropdown-item",onClick:t=>S(e.id)},[(0,o.createTextVNode)((0,o.toDisplayString)((0,o.unref)(c.useLocalize)((0,o.unref)(b),e.name,!0,"-")),1)],8,y)),[[i]]):(0,o.createCommentVNode)("v-if",!0)],64))),256))])]),_:1},8,["modelValue","disabled"])]),_:1},8,["disabled"])])):((0,o.openBlock)(),(0,o.createBlock)(n,{key:1,accent:"primary",size:"md",class:"btn-floated position-absolute",disabled:e.createButtonDisabled},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(a,{name:"plus"})]),_:1},8,["disabled"]))],64)):(0,o.createCommentVNode)("v-if",!0)],64)}}})}}]);
//# sourceMappingURL=ff3a8864b71df4e01663.js.map