Files
dockerStuff/config/tandoor/staticfiles/vue3/assets/BookViewPage-B02kp2SW.a29aa348b402.js
2025-11-16 21:46:46 +00:00

2 lines
5.1 KiB
JavaScript

import{d as U,u as W,r as o,o as A,A as y,Q as b,R as $,h as V,f as r,M as H,w as e,g as a,j as d,t as u,N as q,b6 as j,X as G,O as F,z as O,aP as K,a as Q,c as X,K as J,V as R,e as T,l as h,b5 as Y,b as P,ae as Z,p as I,F as L,x as ee,k as E,aU as ae,m as le,s as te,ai as ne,y as se,q as oe,i as x}from"./main-BhFWIRV_.js";import{_ as ue}from"./IngredientsTable.vue_vue_type_script_setup_true_lang-ClY6kQB1.js";import{g as ie}from"./model_utils-CVQgSPL_.js";import{_ as re}from"./KeywordsBar.vue_vue_type_script_setup_true_lang-9vWdzSaj.js";import{V as de,a as ve,c as pe,b as ce}from"./number_utils-1sJWKMUK.js";import"./VTooltip-CP00KBBq.js";const S=U({__name:"BookEntryCard",props:{recipeOverview:{type:{},required:!0}},setup(B){const v=B,{t:p}=W(),w=o(!1),c=o({}),g=o([]);A(()=>{n()});function n(){let k=new y;w.value=!0,k.apiRecipeRetrieve({id:v.recipeOverview.id}).then(f=>{c.value=f,g.value=ie(c.value,p,{showStepHeaders:!0})}).catch(f=>{b().addError($.FETCH_ERROR,f)}).finally(()=>{w.value=!1})}return(k,f)=>(r(),V(H,{loading:w.value},{default:e(()=>[a(q,null,{default:e(()=>[d(u(v.recipeOverview.name),1)]),_:1}),a(j,{height:"25vh",recipe:v.recipeOverview},null,8,["recipe"]),a(G,null,{default:e(()=>[d(u(v.recipeOverview.description),1)]),_:1}),a(F,null,{default:e(()=>[a(re,{keywords:v.recipeOverview.keywords},null,8,["keywords"])]),_:1}),a(ue,{"ingredient-factor":1,modelValue:g.value,"onUpdate:modelValue":f[0]||(f[0]=C=>g.value=C),"show-checkbox":!1},null,8,["modelValue"]),a(K,null,{default:e(()=>[a(O,{to:{name:"RecipeViewPage",params:{id:v.recipeOverview.id}}},{default:e(()=>[d(u(k.$t("Open")),1)]),_:1},8,["to"])]),_:1})]),_:1},8,["loading"]))}}),fe={class:"text-center mt-1"},me={class:"text-disabled"},_e={class:"text-center mt-1"},Ve={class:"text-disabled"},xe=U({__name:"BookViewPage",props:{bookId:{type:String,required:!0}},setup(B){const v=B,{mdAndUp:p}=Q();te();const w=o(!1),c=o(!1),g=o(!1),n=o(0),k=o(0),f=o(0),C=X(()=>k.value+f.value),m=o({}),z=o([]),_=o([]);A(()=>{D()});function D(){const i=new y;w.value=!0,i.apiRecipeBookRetrieve({id:v.bookId}).then(l=>{m.value=l,z.value=[],M(1)}).catch(l=>{b().addError($.FETCH_ERROR,l)}).finally(()=>{w.value=!1})}function M(i){const l=new y;c.value=!0,l.apiRecipeBookEntryList({book:v.bookId,page:i,pageSize:50}).then(t=>{t.results.forEach(s=>{_.value.push(s.recipeContent)}),k.value=t.count,t.next?M(i+1):m.value.filter?N(m.value.filter.id,1):c.value=!1}).catch(t=>{b().addError($.FETCH_ERROR,t),c.value=!1})}function N(i,l){new y().apiRecipeList({filter:i,page:l,pageSize:50}).then(s=>{_.value=_.value.concat(s.results),k.value=s.count,s.next?N(i,l+1):c.value=!1}).catch(s=>{b().addError($.FETCH_ERROR,s),c.value=!1})}return(i,l)=>(r(),V(J,null,{default:e(()=>[a(E,null,{default:e(()=>[a(R,null,{default:e(()=>[a(H,null,{default:e(()=>[a(q,null,{default:e(()=>[d(u(m.value.name)+" ",1),h(p)?(r(),V(O,{key:0,class:"float-right",variant:"flat",to:{name:"BooksPage"},"prepend-icon":"$books"},{default:e(()=>[d(u(i.$t("Books")),1)]),_:1})):T("",!0)]),_:1}),m.value.shared&&m.value.shared.length>0?(r(),V(F,{key:0},{default:e(()=>[a(Y,null,{default:e(()=>[a(Z,{class:"me-2"},{default:e(()=>[d(u(i.$t("shared_with")),1)]),_:1}),(r(!0),P(L,null,I(m.value.shared,t=>(r(),V(ne,null,{default:e(()=>[d(u(t.displayName),1)]),_:2},1024))),256))]),_:1})]),_:1})):T("",!0),a(F,{class:"text-disabled"},{default:e(()=>[d(u(m.value.description),1)]),_:1}),a(de,{modelValue:g.value,"onUpdate:modelValue":l[0]||(l[0]=t=>g.value=t)},{default:e(()=>[a(ve,null,{default:e(()=>[a(pe,null,{default:e(()=>[d(u(i.$t("Table_of_Contents")),1)]),_:1}),a(ce,null,{default:e(()=>[a(ee,null,{default:e(()=>[(r(!0),P(L,null,I(_.value,(t,s)=>(r(),V(se,{key:t.id,onClick:ge=>{n.value=s,g.value=!1}},{default:e(()=>[d(u(t.name),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),a(E,null,{default:e(()=>[a(R,{class:"text-center"},{default:e(()=>[a(ae,{"model-value":n.value+1,"onUpdate:modelValue":l[1]||(l[1]=t=>n.value=Math.max(t-1,0)),length:C.value,onNext:l[2]||(l[2]=t=>n.value=Math.min(n.value+(h(p)?1:0),C.value-1)),onPrev:l[3]||(l[3]=t=>n.value=Math.max(n.value-(h(p)?1:0),0))},null,8,["model-value","length"])]),_:1})]),_:1}),a(E,null,{default:e(()=>[a(R,{cols:"12"},{default:e(()=>[a(le,{modelValue:n.value,"onUpdate:modelValue":l[6]||(l[6]=t=>n.value=t),"show-arrows":""},{next:e(()=>[a(O,{icon:"fa-solid fa-chevron-right",variant:"plain",onClick:l[4]||(l[4]=t=>n.value=n.value+(h(p)?2:1))})]),prev:e(()=>[a(O,{icon:"fa-solid fa-chevron-left",variant:"plain",onClick:l[5]||(l[5]=t=>n.value=n.value-(h(p)?2:1))})]),default:e(()=>[(r(!0),P(L,null,I(_.value,(t,s)=>(r(),V(oe,{key:t.id},{default:e(()=>[a(E,null,{default:e(()=>[a(R,{cols:"12",md:"6"},{default:e(()=>[a(S,{"recipe-overview":_.value[s]},null,8,["recipe-overview"]),x("div",fe,[x("span",me,u(s+1),1)])]),_:2},1024),h(p)&&_.value.length>s+1?(r(),V(R,{key:0,cols:"6"},{default:e(()=>[a(S,{"recipe-overview":_.value[s+1]},null,8,["recipe-overview"]),x("div",_e,[x("span",Ve,u(s+2),1)])]),_:2},1024)):T("",!0)]),_:2},1024)]),_:2},1024))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}))}});export{xe as default};