import{_ as b}from"./BForm.vue_vue_type_script_setup_true_lang-u44ElAm9-BpNSPhCc.js";import{_ as $,d as o,o as d,a as r,b as t,g as y,t as n,w as s,j as V,e as m}from"./index-D02r7Zsc.js";import{_ as v}from"./BButton.vue_vue_type_script_setup_true_lang-D5Eg7-Zv-DDRCX2AG.js";import{_ as w}from"./BFormCheckboxGroup.vue_vue_type_script_setup_true_lang-CZ2qJTp0-lrA37oyN.js";import{_ as k}from"./BFormGroup.vue_vue_type_script_setup_true_lang-BmZN8qcE-Cpaz2jd5.js";import{_ as L}from"./BFormInput.vue_vue_type_script_setup_true_lang-B9E5yJEs-DBdCBfsp.js";import"./useDefaults-DESCdb0p-CFLjYrdG.js";import"./BSpinner.vue_vue_type_script_setup_true_lang-H1MzHypA-D8AXjJB0.js";import"./dom-DVb-f0ZG-Crdf0-mU.js";import"./useColorVariantClasses-ZDE19TZw-Cvu7SygP.js";import"./BLink.vue_vue_type_script_setup_true_lang-Ct47WhzE-DDPYis_D.js";import"./object-0ALvRU0O-3BORTTD-.js";import"./stringUtils-gJJ6T6UC-g5BZrMym.js";import"./index-C0p9vHHI-DoOEDIMw.js";import"./useStateClass-BGbSLWFN-BcKQ8Z3i.js";import"./ConditionalWrapper.vue_vue_type_script_lang-IX_NpHH--DrWkD0m2.js";import"./useId-t29UARy6-BH5d2231.js";import"./BCol.vue_vue_type_script_setup_true_lang-D0xTJQ30-C8E8teuV.js";import"./getClasses-CsgNQabU-zDOdZIGY.js";import"./BFormValidFeedback.vue_vue_type_script_setup_true_lang-D5WYd1j7-BqGw1a2-.js";const R={data:function(){return{readinglist:{reading_list_id:0,reading_list_name:"",reading_list_caption:"",reading_list_readonly:"1",reading_list_public:"0",reading_list_confidential:"1"}}},created:function(){this.$route.params.id&&(this.readinglist=this.get("readinglists").find(i=>i.reading_list_id==this.$route.params.id))},methods:{addReadingList:async function(){this.publish("showOverlay",!0);let i=await this.get("ws").saveReadingList(this.get("sessionId"),this.readinglist);if(this.publish("showOverlay",!1),i)if(this.$route.params.id){let e=this.get("readinglists").findIndex(u=>u.reading_list_id==this.$route.params.id);this.set("readinglists",[...this.get("readinglists").slice(0,e),i,...this.get("readinglists").slice(e+1)])}else this.set("readinglists",[...this.get("readinglists"),i]);this.$router.push({name:"readinglistslist"})}}},B={class:"d-flex align-items-center m-1"},U={key:0,class:"h3 title text-secondary text-center mb-0 flex-grow-1 me-5"},N={key:1,class:"h3 title text-secondary text-center mb-0 flex-grow-1 me-5"},S={class:"d-flex justify-content-end"};function j(i,e,u,C,I,p){const f=y("backbutton"),_=L,l=k,g=w,c=v,h=b;return d(),o("div",null,[r("div",B,[t(f),i.$route.params.id?(d(),o("h1",U,n(i.$t("readinglists.editReadingList")),1)):(d(),o("h1",N,n(i.$t("readinglists.newReadingList")),1))]),t(h,{class:"m-3",onSubmit:V(p.addReadingList,["prevent"])},{default:s(()=>[t(l,{label:i.$t("readinglists.name")},{default:s(()=>[t(_,{required:"",modelValue:i.readinglist.reading_list_name,"onUpdate:modelValue":e[0]||(e[0]=a=>i.readinglist.reading_list_name=a)},null,8,["modelValue"])]),_:1},8,["label"]),t(l,{label:i.$t("readinglists.caption")},{default:s(()=>[t(_,{modelValue:i.readinglist.reading_list_caption,"onUpdate:modelValue":e[1]||(e[1]=a=>i.readinglist.reading_list_caption=a)},null,8,["modelValue"])]),_:1},8,["label"]),t(l,null,{default:s(()=>[t(g,{switch:"",modelValue:i.readinglist.reading_list_public,"onUpdate:modelValue":e[2]||(e[2]=a=>i.readinglist.reading_list_public=a),value:"1","unchecked-value":"0"},{default:s(()=>[m(n(i.$t("readinglists.public")),1)]),_:1},8,["modelValue"])]),_:1}),t(l,null,{default:s(()=>[t(g,{switch:"",modelValue:i.readinglist.reading_list_readonly,"onUpdate:modelValue":e[3]||(e[3]=a=>i.readinglist.reading_list_readonly=a),value:"1","unchecked-value":"0"},{default:s(()=>[m(n(i.$t("readinglists.readonly")),1)]),_:1},8,["modelValue"])]),_:1}),r("div",S,[t(c,{type:"submit",variant:"outline-primary"},{default:s(()=>[e[4]||(e[4]=r("i",{class:"bi bi-plus"},null,-1)),m(n(i.$t("readinglists.save")),1)]),_:1})])]),_:1},8,["onSubmit"])])}const ii=$(R,[["render",j]]);export{ii as default};
