Files
InvoiceShelf/public/build/assets/Index-Rihd2aA2.js
Darko Gjorgjijoski 7b3dd0288e Update build
2024-01-28 17:17:48 +01:00

2 lines
6.6 KiB
JavaScript

import{e as P,l as b,r,o as n,c as i,t as u,I as y,b as t,a as e,m as l,X as O,n as B,w as c,at as X,E as J,g as x,h as S,i as K,G as Q,k as W,L as Y,M as Z,s as ee,H as te,q as j}from"./main-vzIkKseS.js";const se={key:0,class:"absolute mt-5 px-6 w-full flex justify-end"},ae={key:0,class:"bg-white bg-opacity-75 text-xs px-3 py-1 font-semibold tracking-wide rounded"},ne={key:1,class:"ml-2 bg-white bg-opacity-75 text-xs px-3 py-1 font-semibold tracking-wide rounded"},oe={key:0},le={key:1},re=["src"],ie={class:"px-6 py-5 flex flex-col bg-gray-50 flex-1 justify-between"},de={class:"text-lg sm:text-2xl font-medium whitespace-nowrap truncate text-primary-500"},ce={key:0,class:"flex items-center mt-2"},ue=["src"],me=t("span",null,"by",-1),_e={class:"ml-2 text-base font-semibold truncate"},he={class:"flex justify-between mt-4 flex-col space-y-2 sm:space-y-0 sm:flex-row"},pe={class:"text-xl md:text-2xl font-semibold whitespace-nowrap text-primary-500"},fe={props:{data:{type:Object,default:null,required:!0}},setup(a){const o=a;P();let m=b(()=>parseInt(o.data.average_rating));return(d,_)=>{const h=r("base-text"),g=r("BaseRating");return n(),i("div",{class:"relative shadow-md border-2 border-gray-200 border-opacity-60 rounded-lg cursor-pointer overflow-hidden h-100",onClick:_[0]||(_[0]=w=>d.$router.push(`/admin/modules/${a.data.slug}`))},[a.data.purchased?(n(),i("div",se,[a.data.purchased?(n(),i("label",ae,u(d.$t("modules.purchased")),1)):y("",!0),a.data.installed?(n(),i("label",ne,[a.data.update_available?(n(),i("span",oe,u(d.$t("modules.update_available")),1)):(n(),i("span",le,u(d.$t("modules.installed")),1))])):y("",!0)])):y("",!0),t("img",{class:"lg:h-64 md:h-48 w-full object-cover object-center",src:a.data.cover,alt:"cover"},null,8,re),t("div",ie,[t("span",de,u(a.data.name),1),a.data.author_avatar?(n(),i("div",ce,[t("img",{class:"hidden h-10 w-10 rounded-full sm:inline-block mr-2",src:a.data.author_avatar?a.data.author_avatar:"http://localhost:3000$images/default-avatar.jpg",alt:""},null,8,ue),me,t("span",_e,u(a.data.author_name),1)])):y("",!0),e(h,{text:a.data.short_description,class:"pt-4 text-gray-500 h-16 line-clamp-2",length:110},null,8,["text"]),t("div",he,[t("div",null,[e(g,{rating:l(m)},null,8,["rating"])]),t("div",pe," $ "+u(a.data.monthly_price?a.data.monthly_price/100:a.data.yearly_price/100),1)])])])}}},ge={},be={class:"shadow-md border-2 border-gray-200 border-opacity-60 rounded-lg cursor-pointer overflow-hidden h-100"},ve={class:"px-6 py-5 flex flex-col bg-gray-50 flex-1 justify-between"},ye={class:"flex items-center mt-2"},$e={class:"flex justify-between mt-4 flex-col space-y-2 sm:space-y-0 sm:flex-row"};function xe(a,o){const m=r("BaseContentPlaceholdersBox"),d=r("BaseContentPlaceholdersText"),_=r("BaseContentPlaceholders");return n(),B(_,null,{default:c(()=>[t("div",be,[e(m,{class:"h-48 lg:h-64 md:h-48 w-full",rounded:""}),t("div",ve,[e(d,{class:"w-32 h-8",lines:1,rounded:""}),t("div",ye,[e(m,{class:"h-10 w-10 rounded-full sm:inline-block mr-2"}),t("div",null,[e(d,{class:"w-32 h-8 ml-2",lines:1,rounded:""})])]),e(d,{class:"pt-4 w-full h-16",lines:1,rounded:""}),t("div",$e,[e(d,{class:"w-32 h-8",lines:1,rounded:""}),e(d,{class:"w-32 h-8",lines:1,rounded:""})])])])]),_:1})}const k=O(ge,[["render",xe]]),ke={key:0},Be={key:0,class:"grid mt-6 w-full grid-cols-1 items-start gap-6 lg:grid-cols-2 xl:grid-cols-3"},we={key:1},Te={key:0,class:"grid mt-6 w-full grid-cols-1 items-start gap-6 lg:grid-cols-2 xl:grid-cols-3"},Ce={key:1,class:"mt-24"},Ie={class:"flex items-center justify-center text-gray-500"},Se={class:"text-gray-900 text-lg font-medium"},Pe={class:"mt-1 text-sm text-gray-500"},je={class:"grid lg:grid-cols-2 mt-6"},Me=["onSubmit"],Ge={class:"flex space-x-2"},Le=["href"],Ve=j(" Sign up & Get Token "),qe={setup(a){const o=X(),m=J(),d=x(""),{t:_}=P();let h=x(!1),g=x(!1);const w=b(()=>({api_token:{required:S.withMessage(_("validation.required"),K),minLength:S.withMessage(_("validation.name_min_length",{count:3}),Q(3))}})),M=b(()=>o.apiToken?(G(),!0):!1),p=W(w,b(()=>o.currentUser)),$=b(()=>d.value==="INSTALLED"?o.modules.filter(s=>s.installed):o.modules);async function G(){g.value=!0,await o.fetchModules().then(()=>{g.value=!1})}async function L(){if(p.value.$touch(),p.value.$invalid)return!0;h.value=!0,o.checkApiToken(o.currentUser.api_token).then(s=>{if(s.data.success){V();return}h.value=!1})}async function V(){try{await m.updateGlobalSettings({data:{settings:{api_token:o.currentUser.api_token}},message:"settings.preferences.updated_message"}).then(s=>{if(s.data.success){o.apiToken=o.currentUser.api_token;return}}),h.value=!1}catch(s){h.value=!1,console.error(s);return}}function U(s){d.value=s.filter}return(s,v)=>{const T=r("BaseBreadcrumbItem"),q=r("BaseBreadcrumb"),A=r("BasePageHeader"),C=r("BaseTab"),N=r("BaseTabGroup"),D=r("BaseInput"),E=r("BaseInputGroup"),F=r("BaseIcon"),I=r("BaseButton"),H=r("BaseCard"),R=r("BasePage");return n(),B(R,null,{default:c(()=>[e(A,{title:s.$t("modules.title")},{default:c(()=>[e(q,null,{default:c(()=>[e(T,{title:s.$t("general.home"),to:"dashboard"},null,8,["title"]),e(T,{title:s.$tc("modules.module",2),to:"#",active:""},null,8,["title"])]),_:1})]),_:1},8,["title"]),l(M)&&l(o).modules?(n(),i("div",ke,[e(N,{class:"-mb-5",onChange:U},{default:c(()=>[e(C,{title:s.$t("general.all"),filter:""},null,8,["title"]),e(C,{title:s.$t("modules.installed"),filter:"INSTALLED"},null,8,["title"])]),_:1}),l(g)?(n(),i("div",Be,[e(k),e(k),e(k)])):(n(),i("div",we,[l($)&&l($).length?(n(),i("div",Te,[(n(!0),i(Y,null,Z(l($),(f,z)=>(n(),i("div",{key:z},[e(fe,{data:f},null,8,["data"])]))),128))])):(n(),i("div",Ce,[t("label",Ie,u(s.$t("modules.no_modules_installed")),1)]))]))])):(n(),B(H,{key:1,class:"mt-6"},{default:c(()=>[t("h6",Se,u(s.$t("modules.connect_installation")),1),t("p",Pe,u(s.$t("modules.api_token_description",{url:l(m).config.base_url.replace(/^http:\/\//,"")})),1),t("div",je,[t("form",{action:"",class:"mt-6",onSubmit:ee(L,["prevent"])},[e(E,{label:s.$t("modules.api_token"),required:"",error:l(p).api_token.$error&&l(p).api_token.$errors[0].$message},{default:c(()=>[e(D,{modelValue:l(o).currentUser.api_token,"onUpdate:modelValue":v[0]||(v[0]=f=>l(o).currentUser.api_token=f),invalid:l(p).api_token.$error,onInput:v[1]||(v[1]=f=>l(p).api_token.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),t("div",Ge,[e(I,{class:"mt-6",loading:l(h),type:"submit"},{left:c(f=>[e(F,{name:"SaveIcon",class:te(f.class)},null,8,["class"])]),default:c(()=>[j(" "+u(s.$t("general.save")),1)]),_:1},8,["loading"]),t("a",{href:`${l(m).config.base_url}/auth/customer/register`,class:"mt-6 block",target:"_blank"},[e(I,{variant:"primary-outline",type:"button"},{default:c(()=>[Ve]),_:1})],8,Le)])],40,Me)])]),_:1}))]),_:1})}}};export{qe as default};