2 lines
29 KiB
JavaScript
2 lines
29 KiB
JavaScript
"use strict";(self["webpackChunkmiriamgemeinde"]=self["webpackChunkmiriamgemeinde"]||[]).push([[119],{116:function(e,t,a){var i=a(6518),o=a(9565),s=a(2652),l=a(9306),n=a(8551),r=a(1767),d=a(9539),p=a(4549),c=p("find",TypeError);i({target:"Iterator",proto:!0,real:!0,forced:c},{find:function(e){n(this);try{l(e)}catch(i){d(this,"throw",i)}if(c)return o(c,this,e);var t=r(this),a=0;return s(t,function(t,i){if(e(t,a++))return i(t)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},2812:function(e){var t=TypeError;e.exports=function(e,a){if(e<a)throw new t("Not enough arguments");return e}},4603:function(e,t,a){var i=a(6840),o=a(9504),s=a(655),l=a(2812),n=URLSearchParams,r=n.prototype,d=o(r.append),p=o(r["delete"]),c=o(r.forEach),h=o([].push),u=new n("a=1&a=2&b=3");u["delete"]("a",1),u["delete"]("b",void 0),u+""!=="a=2"&&i(r,"delete",function(e){var t=arguments.length,a=t<2?void 0:arguments[1];if(t&&void 0===a)return p(this,e);var i=[];c(this,function(e,t){h(i,{key:t,value:e})}),l(t,1);var o,n=s(e),r=s(a),u=0,m=0,g=!1,b=i.length;while(u<b)o=i[u++],g||o.key===n?(g=!0,p(this,o.key)):m++;while(m<b)o=i[m++],o.key===n&&o.value===r||d(this,o.key,o.value)},{enumerable:!0,unsafe:!0})},7566:function(e,t,a){var i=a(6840),o=a(9504),s=a(655),l=a(2812),n=URLSearchParams,r=n.prototype,d=o(r.getAll),p=o(r.has),c=new n("a=1");!c.has("a",2)&&c.has("a",void 0)||i(r,"has",function(e){var t=arguments.length,a=t<2?void 0:arguments[1];if(t&&void 0===a)return p(this,e);var i=d(this,e);l(t,1);var o=s(a),n=0;while(n<i.length)if(i[n++]===o)return!0;return!1},{enumerable:!0,unsafe:!0})},8119:function(e,t,a){a.r(t),a.d(t,{default:function(){return re}});var i=a(641),o=a(33),s=a(3751);const l={class:"worship-management"},n={class:"action-buttons"},r={key:0,class:"import-section"},d={class:"import-content"},p={key:0,class:"selected-file"},c=["disabled"],h={key:1,class:"export-section"},u={class:"export-content"},m=["disabled"],g={class:"import-dialog-content"},b={class:"import-dialog-header"},v={class:"import-dialog-body"},f={key:0,class:"import-errors"},y={class:"imported-worships-list"},k={key:0,class:"new-badge"},D={key:1,class:"update-badge"},w={class:"worship-edit-fields"},L={key:0,class:"old-value"},F=["onUpdate:modelValue"],I={class:"field-group"},x=["onUpdate:modelValue"],C={key:0,class:"old-value"},E=["onUpdate:modelValue"],S={key:0,class:"old-value"},V={key:0,class:"old-value"},N=["onUpdate:modelValue"],U={key:0,class:"old-value"},W=["onUpdate:modelValue"],P={key:0,class:"old-value"},T=["onUpdate:modelValue"],_={key:0,class:"old-value"},O=["onUpdate:modelValue"],z={key:0,class:"old-value"},A=["onUpdate:modelValue"],X={class:"field-group"},$=["onUpdate:modelValue"],G=["onClick"],J={class:"import-dialog-footer"},Q=["disabled"],Y={class:"liturgical-loader"},K=["value"],H=["disabled"],R={class:"liturgical-day-section"},B={class:"filter-section"},j={class:"checkbox-label"},M=["onClick"],q=["onClick"],Z=["onClick"],ee={class:"tooltip"};function te(e,t,a,te,ae,ie){const oe=(0,i.g2)("multiselect");return(0,i.uX)(),(0,i.CE)("div",l,[t[69]||(t[69]=(0,i.Lk)("h2",null,"Gottesdienst Verwaltung",-1)),(0,i.Lk)("div",n,[(0,i.Lk)("button",{type:"button",onClick:t[0]||(t[0]=(...e)=>ie.toggleImportSection&&ie.toggleImportSection(...e)),class:"import-button"},(0,o.v_)(ae.showImportSection?"Import ausblenden":"Import"),1),(0,i.Lk)("button",{type:"button",onClick:t[1]||(t[1]=(...e)=>ie.toggleExportSection&&ie.toggleExportSection(...e)),class:"export-button"},(0,o.v_)(ae.showExportSection?"Export ausblenden":"Export"),1)]),ae.showImportSection?((0,i.uX)(),(0,i.CE)("div",r,[t[35]||(t[35]=(0,i.Lk)("h3",null,"Gottesdienste importieren",-1)),(0,i.Lk)("div",d,[t[34]||(t[34]=(0,i.Lk)("label",{for:"import-file"},"Datei auswählen (.doc, .docx):",-1)),(0,i.Lk)("input",{type:"file",id:"import-file",ref:"fileInput",onChange:t[2]||(t[2]=(...e)=>ie.handleFileSelect&&ie.handleFileSelect(...e)),accept:".doc,.docx"},null,544),ae.selectedFile?((0,i.uX)(),(0,i.CE)("div",p," Ausgewählte Datei: "+(0,o.v_)(ae.selectedFile.name),1)):(0,i.Q3)("",!0),(0,i.Lk)("button",{type:"button",onClick:t[3]||(t[3]=(...e)=>ie.importWorships&&ie.importWorships(...e)),disabled:!ae.selectedFile||ae.isImporting,class:"submit-import-button"},(0,o.v_)(ae.isImporting?"Importiere...":"Importieren"),9,c)])])):(0,i.Q3)("",!0),ae.showExportSection?((0,i.uX)(),(0,i.CE)("div",h,[t[40]||(t[40]=(0,i.Lk)("h3",null,"Gottesdienste exportieren",-1)),(0,i.Lk)("div",u,[t[37]||(t[37]=(0,i.Lk)("label",{for:"export-date-from"},"Von Datum:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"date",id:"export-date-from","onUpdate:modelValue":t[4]||(t[4]=e=>ae.exportDateFrom=e)},null,512),[[s.Jo,ae.exportDateFrom]]),t[38]||(t[38]=(0,i.Lk)("label",{for:"export-date-to"},"Bis Datum:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"date",id:"export-date-to","onUpdate:modelValue":t[5]||(t[5]=e=>ae.exportDateTo=e)},null,512),[[s.Jo,ae.exportDateTo]]),t[39]||(t[39]=(0,i.Lk)("label",{for:"export-format"},"Export-Format:",-1)),(0,i.bo)((0,i.Lk)("select",{id:"export-format","onUpdate:modelValue":t[6]||(t[6]=e=>ae.exportFormat=e)},[...t[36]||(t[36]=[(0,i.Lk)("option",{value:"editing"},"Für Bearbeitung",-1),(0,i.Lk)("option",{value:"newsletter"},"Für Gemeindebrief",-1)])],512),[[s.u1,ae.exportFormat]]),(0,i.Lk)("button",{type:"button",onClick:t[7]||(t[7]=(...e)=>ie.exportWorships&&ie.exportWorships(...e)),disabled:!ae.exportDateFrom||!ae.exportDateTo||ae.isExporting,class:"submit-export-button"},(0,o.v_)(ae.isExporting?"Exportiere...":"Exportieren"),9,m)])])):(0,i.Q3)("",!0),ae.showImportDialog?((0,i.uX)(),(0,i.CE)("div",{key:2,class:"import-dialog-overlay",onClick:t[11]||(t[11]=(0,s.D$)((...e)=>ie.closeImportDialog&&ie.closeImportDialog(...e),["self"]))},[(0,i.Lk)("div",g,[(0,i.Lk)("div",b,[t[41]||(t[41]=(0,i.Lk)("h3",null,"Importierte Gottesdienste bearbeiten",-1)),(0,i.Lk)("button",{class:"close-button",onClick:t[8]||(t[8]=(...e)=>ie.closeImportDialog&&ie.closeImportDialog(...e))},"×")]),(0,i.Lk)("div",v,[ae.importErrors&&ae.importErrors.length>0?((0,i.uX)(),(0,i.CE)("div",f,[t[42]||(t[42]=(0,i.Lk)("h4",null,"Fehler beim Parsen:",-1)),(0,i.Lk)("ul",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ae.importErrors,(e,t)=>((0,i.uX)(),(0,i.CE)("li",{key:t},(0,o.v_)(e),1))),128))])])):(0,i.Q3)("",!0),(0,i.Lk)("div",y,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ae.importedWorships,(e,a)=>((0,i.uX)(),(0,i.CE)("div",{key:a,class:"imported-worship-item"},[(0,i.Lk)("h4",null,[(0,i.eW)(" Gottesdienst "+(0,o.v_)(a+1)+" ",1),e._isNew?((0,i.uX)(),(0,i.CE)("span",k,"NEU")):e._isUpdate?((0,i.uX)(),(0,i.CE)("span",D,"ÄNDERUNG")):(0,i.Q3)("",!0)]),(0,i.Lk)("div",w,[(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"date")}])},[(0,i.Lk)("label",null,[t[43]||(t[43]=(0,i.eW)(" Datum: ",-1)),ie.isFieldChanged(e,"date")?((0,i.uX)(),(0,i.CE)("span",L,"(alt: "+(0,o.v_)(ie.getOldValue(e,"date"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"date","onUpdate:modelValue":t=>e.date=t},null,8,F),[[s.Jo,e.date]])],2),(0,i.Lk)("div",I,[t[44]||(t[44]=(0,i.Lk)("label",null,"Tag-Name:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.dayName=t},null,8,x),[[s.Jo,e.dayName]])]),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"time")}])},[(0,i.Lk)("label",null,[t[45]||(t[45]=(0,i.eW)(" Uhrzeit: ",-1)),ie.isFieldChanged(e,"time")?((0,i.uX)(),(0,i.CE)("span",C,"(alt: "+(0,o.v_)(ie.getOldValue(e,"time"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"time","onUpdate:modelValue":t=>e.time=t,step:"60"},null,8,E),[[s.Jo,e.time]])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"eventPlaceId")}])},[(0,i.Lk)("label",null,[t[46]||(t[46]=(0,i.eW)(" Ort: ",-1)),ie.isFieldChanged(e,"eventPlaceId")?((0,i.uX)(),(0,i.CE)("span",S,"(alt: "+(0,o.v_)(ie.getOldValue(e,"eventPlaceName")||ie.getOldValue(e,"eventPlaceId"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bF)(oe,{modelValue:e.eventPlace,"onUpdate:modelValue":[t=>e.eventPlace=t,t=>{t&&(e.eventPlaceId=t.id)}],options:ae.eventPlaces,label:"name","track-by":"id",placeholder:"Veranstaltungsort wählen"},null,8,["modelValue","onUpdate:modelValue","options"])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"title")}])},[(0,i.Lk)("label",null,[t[47]||(t[47]=(0,i.eW)(" Titel: ",-1)),ie.isFieldChanged(e,"title")?((0,i.uX)(),(0,i.CE)("span",V,"(alt: "+(0,o.v_)(ie.getOldValue(e,"title"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.title=t},null,8,N),[[s.Jo,e.title]])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"organizer")}])},[(0,i.Lk)("label",null,[t[48]||(t[48]=(0,i.eW)(" Gestalter: ",-1)),ie.isFieldChanged(e,"organizer")?((0,i.uX)(),(0,i.CE)("span",U,"(alt: "+(0,o.v_)(ie.getOldValue(e,"organizer"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.organizer=t},null,8,W),[[s.Jo,e.organizer]])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"collection")}])},[(0,i.Lk)("label",null,[t[49]||(t[49]=(0,i.eW)(" Kollekte: ",-1)),ie.isFieldChanged(e,"collection")?((0,i.uX)(),(0,i.CE)("span",P,"(alt: "+(0,o.v_)(ie.getOldValue(e,"collection"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.collection=t},null,8,T),[[s.Jo,e.collection]])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"sacristanService")}])},[(0,i.Lk)("label",null,[t[50]||(t[50]=(0,i.eW)(" Dienst: ",-1)),ie.isFieldChanged(e,"sacristanService")?((0,i.uX)(),(0,i.CE)("span",_,"(alt: "+(0,o.v_)(ie.getOldValue(e,"sacristanService"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.sacristanService=t},null,8,O),[[s.Jo,e.sacristanService]])],2),(0,i.Lk)("div",{class:(0,o.C4)(["field-group",{"field-changed":ie.isFieldChanged(e,"organPlaying")}])},[(0,i.Lk)("label",null,[t[51]||(t[51]=(0,i.eW)(" Orgelspiel: ",-1)),ie.isFieldChanged(e,"organPlaying")?((0,i.uX)(),(0,i.CE)("span",z,"(alt: "+(0,o.v_)(ie.getOldValue(e,"organPlaying"))+")",1)):(0,i.Q3)("",!0)]),(0,i.bo)((0,i.Lk)("input",{type:"text","onUpdate:modelValue":t=>e.organPlaying=t},null,8,A),[[s.Jo,e.organPlaying]])],2),(0,i.Lk)("div",X,[(0,i.Lk)("label",null,[(0,i.bo)((0,i.Lk)("input",{type:"checkbox","onUpdate:modelValue":t=>e.approved=t},null,8,$),[[s.lH,e.approved]]),t[52]||(t[52]=(0,i.eW)(" Freigegeben ",-1))])]),(0,i.Lk)("button",{type:"button",onClick:e=>ie.removeWorship(a),class:"remove-button"},"Entfernen",8,G)])]))),128))])]),(0,i.Lk)("div",J,[(0,i.Lk)("button",{type:"button",onClick:t[9]||(t[9]=(...e)=>ie.closeImportDialog&&ie.closeImportDialog(...e)),class:"cancel-button"},"Abbrechen"),(0,i.Lk)("button",{type:"button",onClick:t[10]||(t[10]=(...e)=>ie.saveImportedWorships&&ie.saveImportedWorships(...e)),disabled:0===ae.importedWorships.length||ae.isImporting,class:"save-button"},(0,o.v_)(ae.isImporting?"Speichere...":"Speichern"),9,Q)])])])):(0,i.Q3)("",!0),(0,i.Lk)("div",Y,[(0,i.bo)((0,i.Lk)("select",{"onUpdate:modelValue":t[12]||(t[12]=e=>ae.selectedYear=e),class:"year-select"},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ae.availableYears,e=>((0,i.uX)(),(0,i.CE)("option",{key:e,value:e},(0,o.v_)(e),9,K))),128))],512),[[s.u1,ae.selectedYear]]),(0,i.Lk)("button",{type:"button",onClick:t[13]||(t[13]=(...e)=>ie.loadLiturgicalYear&&ie.loadLiturgicalYear(...e)),class:"load-year-button",disabled:ae.isLoading},(0,o.v_)(ae.isLoading?"Lade...":"Kirchenjahr laden"),9,H)]),(0,i.Lk)("form",{onSubmit:t[30]||(t[30]=(0,s.D$)((...e)=>ie.saveWorship&&ie.saveWorship(...e),["prevent"]))},[t[53]||(t[53]=(0,i.Lk)("label",{for:"eventPlaceId"},"Veranstaltungsort:",-1)),(0,i.bF)(oe,{modelValue:ae.selectedEventPlace,"onUpdate:modelValue":t[14]||(t[14]=e=>ae.selectedEventPlace=e),options:ae.eventPlaces,label:"name","track-by":"id",placeholder:"Veranstaltungsort wählen"},null,8,["modelValue","options"]),t[54]||(t[54]=(0,i.Lk)("label",{for:"dayName"},"Name des Tags:",-1)),(0,i.Lk)("div",R,[(0,i.bF)(oe,{modelValue:ae.selectedDayName,"onUpdate:modelValue":t[15]||(t[15]=e=>ae.selectedDayName=e),options:ae.dayNameOptions,multiple:!1,taggable:!0,onTag:ie.addDayNameTag,placeholder:"Tag-Name wählen oder eingeben",label:"name","track-by":"name"},null,8,["modelValue","options","onTag"])]),t[55]||(t[55]=(0,i.Lk)("label",{for:"date"},"Datum:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"date",id:"date","onUpdate:modelValue":t[16]||(t[16]=e=>ae.worshipData.date=e),required:"",onChange:t[17]||(t[17]=(...e)=>ie.updateDayNameFromDate&&ie.updateDayNameFromDate(...e))},null,544),[[s.Jo,ae.worshipData.date]]),t[56]||(t[56]=(0,i.Lk)("label",{for:"time"},"Uhrzeit:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"time",id:"time","onUpdate:modelValue":t[18]||(t[18]=e=>ae.worshipData.time=e),required:""},null,512),[[s.Jo,ae.worshipData.time]]),t[57]||(t[57]=(0,i.Lk)("label",{for:"title"},"Titel:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"text",id:"title","onUpdate:modelValue":t[19]||(t[19]=e=>ae.worshipData.title=e),required:""},null,512),[[s.Jo,ae.worshipData.title]]),t[58]||(t[58]=(0,i.Lk)("label",{for:"organizer"},"Gestalter:",-1)),(0,i.bF)(oe,{modelValue:ae.selectedOrganizers,"onUpdate:modelValue":t[20]||(t[20]=e=>ae.selectedOrganizers=e),options:ae.organizerOptions,multiple:!0,taggable:!0,onTag:ie.addOrganizerTag,placeholder:"Gestalter wählen oder neu eingeben",label:"name","track-by":"name"},null,8,["modelValue","options","onTag"]),t[59]||(t[59]=(0,i.Lk)("label",{for:"sacristanService"},"Küsterdienst:",-1)),(0,i.bF)(oe,{modelValue:ae.selectedSacristans,"onUpdate:modelValue":t[21]||(t[21]=e=>ae.selectedSacristans=e),options:ae.sacristanOptions,multiple:!0,taggable:!0,onTag:ie.addSacristanTag,placeholder:"Küsterdienst wählen oder neu eingeben",label:"name","track-by":"name"},null,8,["modelValue","options","onTag"]),t[60]||(t[60]=(0,i.Lk)("label",{for:"collection"},"Kollekte:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"text",id:"collection","onUpdate:modelValue":t[22]||(t[22]=e=>ae.worshipData.collection=e)},null,512),[[s.Jo,ae.worshipData.collection]]),t[61]||(t[61]=(0,i.Lk)("label",{for:"address"},"Adresse:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"text",id:"address","onUpdate:modelValue":t[23]||(t[23]=e=>ae.worshipData.address=e)},null,512),[[s.Jo,ae.worshipData.address]]),t[62]||(t[62]=(0,i.Lk)("label",{for:"selfInformation"},"Selbstinformation:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"checkbox",id:"selfInformation","onUpdate:modelValue":t[24]||(t[24]=e=>ae.worshipData.selfInformation=e)},null,512),[[s.lH,ae.worshipData.selfInformation]]),t[63]||(t[63]=(0,i.Lk)("label",{for:"highlightTime"},"Uhrzeit hervorheben:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"checkbox",id:"highlightTime","onUpdate:modelValue":t[25]||(t[25]=e=>ae.worshipData.highlightTime=e)},null,512),[[s.lH,ae.worshipData.highlightTime]]),t[64]||(t[64]=(0,i.Lk)("label",{for:"neighborInvitation"},"Einladung zum Nachbarschaftsraum:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"checkbox",id:"neighborInvitation","onUpdate:modelValue":t[26]||(t[26]=e=>ae.worshipData.neighborInvitation=e)},null,512),[[s.lH,ae.worshipData.neighborInvitation]]),t[65]||(t[65]=(0,i.Lk)("label",{for:"approved"},"Freigegeben:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"checkbox",id:"approved","onUpdate:modelValue":t[27]||(t[27]=e=>ae.worshipData.approved=e)},null,512),[[s.lH,ae.worshipData.approved]]),t[66]||(t[66]=(0,i.Lk)("label",{for:"introLine"},"Einleitungszeile:",-1)),(0,i.bo)((0,i.Lk)("input",{type:"text",id:"introLine","onUpdate:modelValue":t[28]||(t[28]=e=>ae.worshipData.introLine=e)},null,512),[[s.Jo,ae.worshipData.introLine]]),t[67]||(t[67]=(0,i.Lk)("button",{type:"submit"},"Speichern",-1)),(0,i.Lk)("button",{type:"button",onClick:t[29]||(t[29]=(...e)=>ie.resetForm&&ie.resetForm(...e))},"Neuer Gottesdienst")],32),(0,i.Lk)("div",B,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":t[31]||(t[31]=e=>ae.searchDate=e),type:"date",class:"search-input",placeholder:"Nach Datum suchen..."},null,512),[[s.Jo,ae.searchDate]]),(0,i.Lk)("label",j,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":t[32]||(t[32]=e=>ae.showPastWorships=e),type:"checkbox"},null,512),[[s.lH,ae.showPastWorships]]),t[68]||(t[68]=(0,i.eW)(" Vergangene Gottesdienste anzeigen ",-1))]),ae.searchDate?((0,i.uX)(),(0,i.CE)("button",{key:0,onClick:t[33]||(t[33]=(...e)=>ie.clearSearch&&ie.clearSearch(...e)),type:"button",class:"clear-button"}," Suche zurücksetzen ")):(0,i.Q3)("",!0)]),(0,i.Lk)("ul",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ie.filteredWorships,e=>((0,i.uX)(),(0,i.CE)("li",{key:e.id,class:(0,o.C4)(["worship-list-item",{"old-items":ie.dateIsLowerCurrentDate(e.date)},{"not-approved":!e.approved}])},[(0,i.Lk)("span",null,(0,o.v_)(e.title)+" - "+(0,o.v_)(ie.formatDate(e.date))+", "+(0,o.v_)(ie.formatTime(e.time)),1),(0,i.Lk)("button",{type:"button",class:"approve-toggle-button",onClick:t=>ie.toggleApproved(e)},(0,o.v_)(e.approved?"Freigabe zurücknehmen":"Freigeben"),9,M),(0,i.Lk)("button",{type:"button",onClick:t=>ie.editWorship(e)},"Bearbeiten",8,q),(0,i.Lk)("button",{type:"button",onClick:t=>ie.deleteWorship(e.id)},"Löschen",8,Z),(0,i.Lk)("div",ee,(0,o.v_)(ie.getEventPlaceName(e.eventPlaceId)),1)],2))),128))])])}a(4114),a(8111),a(2489),a(116),a(1701),a(4603),a(7566),a(8721);var ae=a(4335),ie=a(5877),oe=a(9654),se={name:"WorshipManagement",components:{Multiselect:ie.Ay},data(){const e=(new Date).getFullYear();return{worships:[],eventPlaces:[],organizerOptions:[],sacristanOptions:[],selectedOrganizers:[],selectedSacristans:[],dayNameOptions:[],liturgicalDays:[],selectedDayName:null,selectedYear:e,availableYears:[e,e+1,e+2],isLoading:!1,isUpdatingFromDate:!1,worshipData:{eventPlaceId:null,date:"",time:"",title:"",organizer:"",collection:"",address:"",selfInformation:!1,highlightTime:!1,neighborInvitation:!1,introLine:"",sacristanService:"",website:"",dayName:"",approved:!1},selectedEventPlace:null,editMode:!1,editId:null,searchDate:"",showPastWorships:!1,showImportSection:!1,selectedFile:null,isImporting:!1,showExportSection:!1,exportDateFrom:"",exportDateTo:"",exportFormat:"editing",isExporting:!1,showImportDialog:!1,importedWorships:[],importErrors:[]}},computed:{filteredWorships(){let e=this.worships;if(!this.showPastWorships){const t=new Date;t.setHours(0,0,0,0),e=e.filter(e=>{if(e.date){const a=new Date(e.date);return a.setHours(0,0,0,0),a>=t}return!0})}if(this.searchDate){const t=new Date(this.searchDate);t.setHours(0,0,0,0),e=e.filter(e=>{if(e.date){const a=new Date(e.date);return a.setHours(0,0,0,0),a.getTime()===t.getTime()}return!1})}return e}},watch:{selectedDayName(e,t){e&&e!==t&&!this.isUpdatingFromDate&&this.updateDateFromDayName()}},async created(){await this.fetchEventPlaces(),await this.fetchWorships(),await this.fetchWorshipOptions(),await this.fetchLiturgicalDays()},methods:{isFieldChanged(e,t){return e._changedFields&&e._changedFields.includes(t)},getOldValue(e,t){return e._oldValues&&e._oldValues[t]?e._oldValues[t]:""},formatTime:oe.fU,formatDate:oe.Yq,async fetchWorships(){try{const e=await ae.A.get("/worships");this.worships=e.data}catch(e){console.error("Fehler beim Abrufen der Gottesdienste:",e)}},async fetchEventPlaces(){try{const e=await ae.A.get("/event-places");this.eventPlaces=e.data}catch(e){console.error("Fehler beim Abrufen der Veranstaltungsorte:",e)}},async fetchWorshipOptions(){try{const e=await ae.A.get("/worships/options");this.organizerOptions=e.data.organizers.map(e=>({name:e})),this.sacristanOptions=e.data.sacristanServices.map(e=>({name:e}))}catch(e){console.error("Fehler beim Abrufen der Worship-Optionen:",e)}},async fetchLiturgicalDays(){try{const e=await ae.A.get("/liturgical-days");this.liturgicalDays=e.data;const t=new Date;t.setHours(0,0,0,0);const a=e.data.filter(e=>{const a=new Date(e.date);return a.setHours(0,0,0,0),a>=t});a.sort((e,t)=>new Date(e.date)-new Date(t.date)),this.dayNameOptions=a.map(e=>{const t=new Date(e.date),a=t.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"});return{name:`${a} - ${e.dayName}`,dayName:e.dayName,date:e.date}})}catch(e){console.error("Fehler beim Abrufen der liturgischen Tage:",e)}},async loadLiturgicalYear(){if(this.selectedYear){this.isLoading=!0;try{const e=await ae.A.post("/liturgical-days/load-year",{year:this.selectedYear});alert(e.data.message),await this.fetchLiturgicalDays()}catch(e){console.error("Fehler beim Laden des Kirchenjahres:",e),e.response&&e.response.data&&e.response.data.message?alert("Fehler: "+e.response.data.message):alert("Fehler beim Laden des Kirchenjahres")}finally{this.isLoading=!1}}else alert("Bitte wählen Sie ein Jahr aus")},updateDayNameFromDate(){if(!this.worshipData.date)return;this.isUpdatingFromDate=!0;const e=this.worshipData.date,t=this.liturgicalDays.find(t=>{const a="string"===typeof t.date?t.date:t.date.split("T")[0];return a===e});if(t){const a=this.dayNameOptions.find(t=>t.date===e);a&&(this.selectedDayName=a),this.worshipData.dayName=t.dayName,console.log("Liturgischer Tag gefunden:",t.dayName)}else console.log("Kein liturgischer Tag gefunden für:",e);this.$nextTick(()=>{this.isUpdatingFromDate=!1})},updateDateFromDayName(){this.selectedDayName&&this.selectedDayName.date&&(this.worshipData.date=this.selectedDayName.date,this.worshipData.dayName=this.selectedDayName.dayName,console.log("Datum gesetzt auf:",this.selectedDayName.date,"für",this.selectedDayName.dayName))},async saveWorship(){try{const e={...this.worshipData,eventPlaceId:this.selectedEventPlace?this.selectedEventPlace.id:null,organizer:this.selectedOrganizers.map(e=>e.name).join(", "),sacristanService:this.selectedSacristans.map(e=>e.name).join(", "),dayName:this.selectedDayName?this.selectedDayName.dayName:"",approved:!!this.worshipData.approved};this.editMode?await ae.A.put(`/worships/${this.editId}`,e):await ae.A.post("/worships",e),this.resetForm(),await this.fetchWorships(),await this.fetchWorshipOptions()}catch(e){console.error("Fehler beim Speichern des Gottesdienstes:",e)}},async toggleApproved(e){try{const t=!e.approved;await ae.A.put(`/worships/${e.id}`,{approved:t}),e.approved=t}catch(t){console.error("Fehler beim Aktualisieren des Freigabe-Status:",t),alert("Fehler beim Aktualisieren des Freigabe-Status.")}},editWorship(e){if(this.worshipData={...e},this.worshipData.date=(0,oe.Yq)(e.date).split(".").reverse().join("-"),this.worshipData.time=(0,oe.fU)(e.time),console.log(this.worshipData),this.selectedEventPlace=this.eventPlaces.find(t=>t.id===e.eventPlaceId),this.selectedOrganizers=e.organizer?e.organizer.split(",").map(e=>({name:e.trim()})):[],this.selectedSacristans=e.sacristanService?e.sacristanService.split(",").map(e=>({name:e.trim()})):[],e.dayName){const t=this.dayNameOptions.find(t=>t.dayName===e.dayName&&t.date===this.worshipData.date);this.selectedDayName=t||null}else this.selectedDayName=null;this.editMode=!0,this.editId=e.id},async deleteWorship(e){try{await ae.A.delete(`/worships/${e}`),await this.fetchWorships()}catch(t){console.error("Fehler beim Löschen des Gottesdienstes:",t)}},resetForm(){this.worshipData={eventPlaceId:null,date:"",time:"",title:"",organizer:"",collection:"",address:"",selfInformation:!1,highlightTime:!1,neighborInvitation:!1,introLine:"",dayName:"",approved:!1},this.selectedEventPlace=null,this.selectedOrganizers=[],this.selectedSacristans=[],this.selectedDayName=null,this.editMode=!1,this.editId=null},getEventPlaceName(e){const t=this.eventPlaces.find(t=>t.id===e);return t?t.name:"Unbekannter Ort"},dateIsLowerCurrentDate(e){const t=new Date,a=new Date(e);return a<t},clearSearch(){this.searchDate=""},addOrganizerTag(e){const t={name:e};this.organizerOptions.push(t),this.selectedOrganizers.push(t)},addSacristanTag(e){const t={name:e};this.sacristanOptions.push(t),this.selectedSacristans.push(t)},addDayNameTag(e){const t={name:e,dayName:e,date:this.worshipData.date||null};this.dayNameOptions.push(t),this.selectedDayName=t,this.worshipData.dayName=e},toggleImportSection(){this.showImportSection=!this.showImportSection,this.showImportSection||(this.selectedFile=null,this.$refs.fileInput&&(this.$refs.fileInput.value=""))},handleFileSelect(e){const t=e.target.files[0];if(t){const a=[".doc",".docx"],i=t.name.toLowerCase(),o=a.some(e=>i.endsWith(e));if(!o)return alert("Bitte wählen Sie nur .doc oder .docx Dateien aus."),e.target.value="",void(this.selectedFile=null);this.selectedFile=t}else this.selectedFile=null},async importWorships(){if(!this.selectedFile)return void alert("Bitte wählen Sie eine Datei aus.");this.isImporting=!0;const e=new FormData;e.append("file",this.selectedFile);try{const t=await ae.A.post("/worships/import",e,{headers:{"Content-Type":"multipart/form-data"}});t.data.worships&&t.data.worships.length>0?(this.importedWorships=t.data.worships.map(e=>{const t=this.eventPlaces.find(t=>t.id===e.eventPlaceId);let a=e.time;return a&&"string"===typeof a&&a.length>5&&(a=a.substring(0,5)),{...e,date:"string"===typeof e.date?e.date.split("T")[0]:e.date,time:a,eventPlace:t||null,approved:!1,_changedFields:e._changedFields||[],_oldValues:e._oldValues||{},_isUpdate:e._isUpdate||!1,_isNew:e._isNew||!1,_existingId:e._existingId||null}}),this.importErrors=t.data.errors||[],this.showImportDialog=!0):alert("Keine Gottesdienste in der Datei gefunden.")}catch(t){console.error("Fehler beim Importieren der Gottesdienste:",t);const e=t.response?.data?.message||"Fehler beim Importieren der Datei.";alert("Fehler: "+e)}finally{this.isImporting=!1}},closeImportDialog(){this.showImportDialog=!1,this.importedWorships=[],this.importErrors=[],this.selectedFile=null,this.$refs.fileInput&&(this.$refs.fileInput.value="")},removeWorship(e){this.importedWorships.splice(e,1)},async saveImportedWorships(){if(0===this.importedWorships.length)return void alert("Keine Gottesdienste zum Speichern vorhanden.");this.isImporting=!0;const e=this.importedWorships.map(e=>{let t=e.date;if(e.date instanceof Date){const a=e.date.getFullYear(),i=String(e.date.getMonth()+1).padStart(2,"0"),o=String(e.date.getDate()).padStart(2,"0");t=`${a}-${i}-${o}`}else"string"===typeof e.date&&(t=e.date.split("T")[0]);let a=e.time;a&&"string"===typeof a&&5===a.length&&(a+=":00");const i={date:t,dayName:e.dayName,time:a,title:e.title,organizer:e.organizer,collection:e.collection,sacristanService:e.sacristanService,organPlaying:e.organPlaying,approved:e.approved||!1,eventPlaceId:e.eventPlace?e.eventPlace.id:e.eventPlaceId||null};return i});try{const t=await ae.A.post("/worships/import/save",{worships:e});let a=t.data.message||"Import erfolgreich abgeschlossen!";void 0===t.data.imported&&void 0===t.data.updated||(a="Import abgeschlossen!\n",void 0!==t.data.imported&&(a+=`- ${t.data.imported} neue Gottesdienste erstellt\n`),void 0!==t.data.updated&&(a+=`- ${t.data.updated} Gottesdienste aktualisiert\n`),void 0!==t.data.skipped&&t.data.skipped>0&&(a+=`- ${t.data.skipped} übersprungen (vergangene Daten)\n`)),t.data.errors&&t.data.errors.length>0&&(a+=`\nFehler: ${t.data.errors.length}`),alert(a),this.closeImportDialog(),await this.fetchWorships(),await this.fetchWorshipOptions(),await this.fetchLiturgicalDays()}catch(t){console.error("Fehler beim Speichern der Gottesdienste:",t);const e=t.response?.data?.message||"Fehler beim Speichern der Gottesdienste.";alert("Fehler: "+e)}finally{this.isImporting=!1}},toggleExportSection(){this.showExportSection=!this.showExportSection,this.showExportSection||(this.exportDateFrom="",this.exportDateTo="",this.exportFormat="editing")},async exportWorships(){if(this.exportDateFrom&&this.exportDateTo)if(new Date(this.exportDateFrom)>new Date(this.exportDateTo))alert('Das "Von Datum" muss vor dem "Bis Datum" liegen.');else{this.isExporting=!0;try{const e=await ae.A.get("/worships/export",{params:{from:this.exportDateFrom,to:this.exportDateTo,format:this.exportFormat},responseType:"blob"}),t=new Blob([e.data],{type:e.headers["content-type"]||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),a=window.URL.createObjectURL(t),i=document.createElement("a");i.href=a;const o=e.headers["content-disposition"];let s=`gottesdienste_${this.exportDateFrom}_${this.exportDateTo}.docx`;if(o){const e=o.match(/filename="?(.+)"?/i);e&&(s=e[1])}i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(a)}catch(e){console.error("Fehler beim Exportieren der Gottesdienste:",e);const t=e.response?.data?.message||"Fehler beim Exportieren der Datei.";alert("Fehler: "+t)}finally{this.isExporting=!1}}else alert("Bitte wählen Sie einen Datumsbereich aus.")}}},le=a(6262);const ne=(0,le.A)(se,[["render",te],["__scopeId","data-v-115fb63a"]]);var re=ne},8721:function(e,t,a){var i=a(3724),o=a(9504),s=a(2106),l=URLSearchParams.prototype,n=o(l.forEach);i&&!("size"in l)&&s(l,"size",{get:function(){var e=0;return n(this,function(){e++}),e},configurable:!0,enumerable:!0})},9654:function(e,t,a){function i(e){const[t,a]=e.split(":");return`${t}:${a}`}function o(e){const t={year:"numeric",month:"2-digit",day:"2-digit"};return new Date(e).toLocaleDateString("de-DE",t)}function s(e){const t=new Date(e),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${a}:${i}`}a.d(t,{Yq:function(){return o},fU:function(){return i},ry:function(){return s}})}}]);
|
||
//# sourceMappingURL=119.04d5ce1d.js.map
|