1import{j as z,u as y}from"./invoiceUtils.0d13f92.js";import{c as f,o as a,a as r,b as m,d as u,e as l,O as E,h as S,x as _,$ as W,t as J,_ as Q,M as X,f as Z,g as j,a0 as C,w as M,b7 as x,i as ee,l as oe,bF as te,bf as b,c0 as se,ba as ie,q as ne}from"./client.0d13f92.js";import{V as re}from"./vue-scrollto.0d13f92.js";import{_ as le,b as ae,a as de}from"./sidebar.0d13f92.js";import{_ as me,a as ce,c as ue,b as fe,d as pe}from"./invoice-export-button.0d13f92.js";import{_ as he}from"./fileLockedDialog.0d13f92.js";import ve from"./doc-note-panel.0d13f92.js";import{_ as ge}from"./belegketteCard.0d13f92.js";import{_ as _e}from"./history.0d13f92.js";import{_ as ye}from"./doc-emails.0d13f92.js";import{_ as Ce}from"./commentsAndArchive.0d13f92.js";import{_ as Ae}from"./discount_margin.0d13f92.js";import{_ as Ee}from"./invoice_positionsv2.0d13f92.js";import Me from"./editor.0d13f92.js";import{_ as be,a as De}from"./factorChangesPanel.0d13f92.js";import{_ as Le}from"./datepicker.0d13f92.js";import{_ as Se}from"./textarea.0d13f92.js";import{_ as Oe}from"./segmented-pill.0d13f92.js";import{i as Re,a as ke}from"./isNull.0d13f92.js";import"./getProductProp.0d13f92.js";import"./useSaveDialog.0d13f92.js";import"./assignIn.0d13f92.js";import"./keysIn.0d13f92.js";import"./invoiceValidation.0d13f92.js";import"./duration.0d13f92.js";import"./weekday.0d13f92.js";import"./utc.0d13f92.js";import"./tabs.0d13f92.js";import"./table.0d13f92.js";import"./onlinebulb.0d13f92.js";import"./email-reader.0d13f92.js";import"./email-composer.0d13f92.js";import"./browser.0d13f923.js";import"./image-webp.0d13f92.js";import"./difference.0d13f92.js";const we={class:"cms-admincenter-invoice offer"},Te={class:"cms-modern-card-page-header"},Ne={class:"cms-modern-card-page-header-content"},Ve={key:0},Ue={key:1},Pe={key:0,class:"cms-modern-card-page-header-toggle"},$e={key:0,class:"cms-modern-card",ref:"cardmain"},Ie={class:"cms-modern-card-title-wrapper"},Ye={key:0,class:"cms-draft-badge"},Be={key:0},He={class:"cms-modern-card-actions-inline"},Fe={class:"cms-modern-card-content"},Ge={class:"cms-modern-card-inner"},Ke={class:"cms-form-form"},qe={class:"cms-form-group"},ze={class:"cms-form-group horizontal"},We={class:"cms-form-group"},Je={class:"cms-form-group horizontal"},Qe={key:0,class:"cms-form-group"},Xe={class:"cms-card-subsection"},Ze={class:"cms-form-group horizontal"},je={class:"cms-card-subsection"},xe={key:1,class:"row cards-main"},eo={class:"col-xs-12 col-md-12"},oo={key:0,class:"confirm-content"},to={class:"cms-form-form"},so={key:1,class:"confirm-content"},io={class:"confirm-controls"};function no(e,o,n,i,d,t){const v=Oe,h=me,p=Q,c=X,R=Se,D=Le,L=Z,k=j,w=be,T=De,N=Me,V=Ee,U=Ae,P=Ce,$=ce,I=ye,Y=_e,B=ge,H=x,F=ve,G=he,K=le,q=W("tippy");return a(),f("div",we,[r("div",Te,[r("div",{class:"cms-modern-card-page-header-icon",style:E(t.getIconStyle("offer_background"))},o[27]||(o[27]=[r("i",{class:"material-icons"},"description",-1)]),4),r("div",Ne,[e.myModel._id?(a(),f("h1",Ve,"Angebot bearbeiten")):(a(),f("h1",Ue,"Angebot erstellen")),o[28]||(o[28]=r("p",null,"Angebotsdetails und Positionen",-1))]),e.myModel._id?(a(),f("div",Pe,[l(v,{modelValue:e.viewMode,"onUpdate:modelValue":o[0]||(o[0]=s=>e.viewMode=s),options:t.viewModeOptions},null,8,["modelValue","options"])])):m("",!0)]),e.viewMode==="detail"?(a(),f("div",$e,[r("div",{class:"cms-modern-card-header",style:E(t.getHeaderStyle("offer_background"))},[o[31]||(o[31]=r("div",{class:"cms-modern-card-icon primary"},[r("i",{class:"material-icons"},"description")],-1)),r("div",Ie,[r("h2",null,[o[30]||(o[30]=S("Angebotsdaten",-1)),e.myModel.isDraft||!e.myModel._id?_((a(),f("span",Ye,o[29]||(o[29]=[S("Entwurf",-1)]))),[[q,{text:(e.myModel.completenessErrors||[]).length?"<strong>Fehlende Felder:</strong><br>"+e.myModel.completenessErrors.map(s=>"⢠"+s.label).join("<br>"):"Neues Dokument - noch nicht gespeichert"}]]):m("",!0)]),e.myModel.offer_id?(a(),f("p",Be,J(e.myModel.offer_id),1)):m("",!0)]),r("div",He,[l(h,{model:e.myModel},null,8,["model"]),l(p,{icon:"close",round:!0,tooltip:"SchlieÃen",onClick:t.closeDoc},null,8,["onClick"])])],4),r("div",Fe,[r("div",Ge,[r("div",Ke,[r("div",qe,[l(c,{modelValue:e.myModel.receiver,"onUpdate:modelValue":o[1]||(o[1]=s=>
1e.myModel.receiver=s),options:t.availableCustomers.map(s=>s==null?void 0:s._id),placeholder:"Rechnungsempfänger auswählen",customLabel:t.customLabel,loading:e.isLoadingUsers,onSearchChange:e.debouncedAsyncFindCustomer,onSelect:t.onSelectCustomer,disabled:e.READ_ONLY,label:"Rechnungsempfänger",searchable:!0,error:e.hasCompletenessError("receiver"),errorText:e.getCompletenessLabel("receiver")},null,8,["modelValue","options","customLabel","loading","onSearchChange","onSelect","disabled","error","errorText"]),t.itemsContact.length?(a(),u(c,{key:0,modelValue:e.myModel.contact,"onUpdate:modelValue":o[2]||(o[2]=s=>e.myModel.contact=s),options:t.itemsContact.map(s=>s==null?void 0:s._id),placeholder:"Kontaktperson auswählen",customLabel:t.customLabelContact,disabled:e.READ_ONLY,label:"Kontaktperson",searchable:!0},null,8,["modelValue","options","customLabel","disabled"])):m("",!0),t.availableAddresses.length?(a(),u(c,{key:1,modelValue:e.myModel.address,"onUpdate:modelValue":o[3]||(o[3]=s=>e.myModel.address=s),options:t.availableAddresses.map(s=>s._id),placeholder:"Lieferadresse auswählen",customLabel:t.customLabelAddressWithStar,allowEmpty:!0,disabled:e.READ_ONLY,label:"Lieferadresse",searchable:!0},null,8,["modelValue","options","customLabel","disabled"])):m("",!0),l(R,{modelValue:e.myModel.desc,"onUpdate:modelValue":o[4]||(o[4]=s=>
1e.myModel.desc=s),label:"Betreff",disabled:e.READ_ONLY,"pin-id":"offer-betreff"},null,8,["modelValue","disabled"])]),r("div",ze,[l(D,{modelValue:e.myModel.date,"onUpdate:modelValue":o[5]||(o[5]=s=>e.myModel.date=s),label:"Datum",onlyDate:!0,disabled:e.READ_ONLY||!!e.myModel.offer_id,errorText:e.getCompletenessLabel("date"),"pin-id":"offer-datum"},null,8,["modelValue","disabled","errorText"]),l(L,{modelValue:e.myModel.offer_id,"onUpdate:modelValue":o[6]||(o[6]=s=>e.myModel.offer_id=s),label:"Angebotsnummer",disabled:"disabled"},null,8,["modelValue"])]),r("div",We,[l(c,{modelValue:t.offertype,"onUpdate:modelValue":o[7]||(o[7]=s=>t.offertype=s),options:e.offerTypeDropdown,placeholder:"Angebotstyp auswählen",customLabel:s=>s.value,trackBy:"key",disabled:e.READ_ONLY,label:"Angebotstyp"},null,8,["modelValue","options","customLabel","disabled"])]),r("div",Je,[l(k,{modelValue:e.myModel.isSpecimen,"onUpdate:modelValue":o[8]||(o[8]=s=>e.myModel.isSpecimen=s),label:"Muster"},null,8,["modelValue"]),l(L,{modelValue:e.myModel.vatrate,"onUpdate:modelValue":o[9]||(o[9]=s=>e.myModel.vatrate=s),modelModifiers:{number:!0},label:"Steuersatz ( in % )",disabled:e.READ_ONLY},null,8,["modelValue","disabled"])]),e.myModel._id?(a(),f("div",Qe,[l(c,{modelValue:e.myModel.status,"onUpdate:modelValue":o[10]||(o[10]=s=>e.myModel.status=s),options:e.statusDropdown.map(s=>s.key),placeholder:"Status auswählen",customLabel:s=>{var g;return(g=e.statusDropdown.find(A=>A.key===s))==null?void 0:g.value},disabled:e.READ_ONLY,label:"Status"},null,8,["modelValue","options","customLabel","disabled"])])):m("",!0),r("div",Xe,[o[32]||(o[32]=r("div",{class:"cms-card-subsection-title"},[r("i",{class:"material-icons"},"local_shipping"),r("span",null,"Versand")],-1)),r("div",Ze,[l(c,{modelValue:e.myModel.shipping_method,"onUpdate:modelValue":o[11]||(o[11]=s=>e.myModel.shipping_method=s),options:t.shippingMethods.map(s=>s.key),customLabel:s=>{var g;return((g=t.shippingMethods.find(A=>A.key===s))==null?void 0:g.title)||s},placeholder:"Versandart auswählen",label:"Versandart",allowEmpty:!0,disabled:e.READ_ONLY},null,8,["modelValue","options","customLabel","disabled"]),l(D,{modelValue:e.myModel.versand_date,"onUpdate:modelValue":o[12]||(o[12]=s=>e.myModel.versand_date=s),label:"Versandtermin",format:"dd/MM/yyyy HH:mm",minuteInterval:15,timePickerInline:!0,"pin-id":"angebot-versandtermin",disabled:e.READ_ONLY},null,8,["modelValue","disabled"])])])]),e.myModel._factorChanges&&e.myModel._factorChanges.length?(a(),u(w,{key:0,model:e.myModel,type:"offer",beforeApply:t.beforeApplyFactorChanges,onApplied:t.onFactorChangesApplied}
1,null,8,["model","beforeApply","onApplied"])):m("",!0),e.myModel._articleChanges&&e.myModel._articleChanges.length?(a(),u(T,{key:1,model:e.myModel,type:"offer",beforeApply:t.beforeApplyArticleChanges,onApplied:t.onArticleChangesApplied},null,8,["model","beforeApply","onApplied"])):m("",!0),r("div",je,[l(N,{modelValue:e.myModel.intro_text,"onUpdate:modelValue":o[13]||(o[13]=s=>e.myModel.intro_text=s),label:"Einleitungstext","pin-id":"angebot-einleitungstext"},null,8,["modelValue"])]),(a(),u(V,{model:e.myModel,"onChange::mask":t.onChangePositions,"onChange::dirty":t.onDirtyPositions,key:e.myModel._id,withGroups:!1,disabled:e.READ_ONLY,doShowPartsList:e.showPartsList,saving:e.isSaving,ref:"invoicePos"},null,8,["model","onChange::mask","onChange::dirty","disabled","doShowPartsList","saving"]))])]),r("div",{class:"cms-modern-card-actions",style:E(t.getFooterStyle("offer_background"))},[o[33]||(o[33]=r("div",{class:"cms-spacer"},null,-1)),_(l(p,{icon:"save",label:"speichern",variant:"primary",onClick:o[14]||(o[14]=s=>t.save())},null,512),[[C,!e.READ_ONLY]]),_(l(p,{icon:"save",label:"speichern & schlieÃen",variant:"primary",onClick:o[15]||(o[15]=s=>t.save(null,!0))},null,512),[[C,!e.READ_ONLY]])],4)],512)):m("",!0),e.viewMode==="detail"?(a(),f("div",xe,[r("div",eo,[l(U,{model:e.myModel,color:t.BACKGROUND_COLOR,onScrollToTop:t.scrollToTop,disabled:e.READ_ONLY},null,8,["model","color","onScrollToTop","disabled"]),l(P,{files:e.myModel.files,comment:e.myModel.comment,quicknote:e.myModel.quicknote,"onInput::text":o[18]||(o[18]=s=>e.myModel.comment=s),"onInput::quicknote":o[19]||(o[19]=s=>e.myModel.quicknote=s),"onInput::files":o[20]||(o[20]=s=>{e.myModel.files=s}),onScrollToTop:t.scrollToTop,color:t.BACKGROUND_COLOR,disabled:e.READ_ONLY},{actions:M(()=>[o[34]||(o[34]=r("div",{class:"cms-spacer"},null,-1)),_(l(p,{icon:"save",label:"speichern",variant:"primary",onClick:o[16]||(o[16]=s=>t.save())},null,512),[[C,!e.READ_ONLY]]),_(l(p,{icon:"save",label:"speichern & schlieÃen",variant:"primary",onClick:o[17]||(o[17]=s=>t.save(null,!0))},null,512),[[C,!e.READ_ONLY]])]),_:1},8,["files","comment","quicknote","onScrollToTop","color","disabled"]),l($,{model:e.myModel,color:t.BACKGROUND_COLOR,type:"offer",onScrollToTop:t.scrollToTop,disabled:e.READ_ONLY},null,8,["model","color","onScrollToTop","disabled"]),e.myModel._id?(a(),u(I,{key:0,docType:"offer",docId:e.myModel._id.toString()},null,8,["docId"])):m("",!0),e.auth_isAdmin&&e.myModel._id?(a(),u(Y,{key:1,collection:"invoice","doc-id":e.myModel._id.toString(),color:t.BACKGROUND_COLOR,onScrollToTop:t.scrollToTop},null,8,["doc-id","color","onScrollToTop"])):m("",!0)])])):m("",!0),e.viewMode==="overview"?(a(),u(B,{key:2,chain:t.documentChain,"can-edit":!e.READ_ONLY,color:t.BACKGROUND_COLOR,onAction:t.handleBelegketteAction},null,8,["chain","can-edit","color","onAction"])):m("",!0),e.showDialog?(a(),u(H,{key:3,modal:!0,showHeader:!0,controls:!1,onClose:o[23]||(o[23]=s=>e.showDialog=!1),ref:"dialog",fitContent:!0,icon:"swap_horiz",wrapperClass:{"cms-confirm-dialog":!0,"type-info":!0}},{header:M(()=>o[35]||(o[35]=[r("div",{class:"confirm-title"},"Beleg konvertieren",-1)])),body:M(()=>[t.priceFail?(a(),f("div",so,"Beleg ist unvollständig und kann nicht konvertiert werden.")):(a(),f("div",oo,[r("div",to,[l(c,{modelValue:e.convertTo,"onUpdate:modelValue":o[21]||(o[21]=s=>e.convertTo=s),options:e.availableConvertTo,placeholder:"Belegtyp auswählen",customLabel:s=>s.value,allowEmpty:!1,label:"Beleg konvertieren in",trackBy:"key"},null,8,["modelValue","options","customLabel"])])])),r("div",io,[l(p,{label:"Abbrechen",icon:"close","icon-position":"left","label-visibility":"visible-xs",variant:"outline",onClick:o[22]||(o[22]=s=>e.showDialog=!1)}),t.priceFail?m("",!0):(a(),u(p,{key:0,label:"Konvertieren",icon:"check","icon-position":"right","label-visibility":"visible-xs",variant:"primary",onClick:t.convert},null,8,["onClick"]))])]),_:1}
1,512)):m("",!0),e.myModel._id?(a(),u(F,{key:4,room:"accounting/offer/edit/"+e.myModel._id,"doc-id":e.myModel._id,"doc-type":"offer"},null,8,["room","doc-id"])):m("",!0),e.showFileLockDialog?(a(),u(G,{key:5,model:t.model,onOpen:o[24]||(o[24]=s=>e.showFileLockDialog=!1),onClose:t.closeDoc},null,8,["model","onClose"])):m("",!0),l(K,{onPrint:t.print,onSave:t.save,onCopy:o[25]||(o[25]=s=>e.showDialog=!0),onClose:t.closeDoc,"onToggle::partlist":o[26]||(o[26]=s=>e.showPartsList=!e.showPartsList),showPartsList:!0,ref:"sidebar",hasChanged:t.hasChanged>0,showSave:!e.READ_ONLY,showCopy:!e.READ_ONLY,showClose:!0,showPrint:!!e.myModel._id,isDraft:!!e.myModel.isDraft},null,8,["onPrint","onSave","onClose","hasChanged","showSave","showCopy","showPrint","isDraft"])])}const ro={props:{type:{type:String,default:"offer"}},beforeRouteLeave:de,beforeRouteUpdate:ae,provide(){return{pinScope:ne(()=>this.myModel._id?`offer::${this.myModel._id}`:null)}},data(){var e={viewMode:this.$route.query.view==="overview"?"overview":"detail",myModel:{title:"",items:[],type:"offer",status:"open",offertype:"offer",images:[],showFileLockDialog:!1,children:[],receiver:!1,date:new Date().toISOString(),contact:!1,vatrate:20,discountrate:0,checklist:[],ressources:[],notifications:[],version:3,files:[],netto:0,_v2:!0},isSaving:!1,showPartsList:!1,READ_ONLY:!1,selectedGallery:{images:[]},isLoadingUsers:!1,no_single_price_mode:!1,statusDropdown:[{key:"open",value:"offen"},{key:"canceled",value:"storniert"},{key:"closed",value:"geschlossen"}],offerTypeDropdown:[{key:"offer",value:"Angebot"},{key:"request",value:"Anfrage"},{key:"draft",value:"Entwurf"}],availableConvertTo:[{key:"template",value:"Vorlage"},{key:"offer",value:"Angebot"},{key:"order",value:"Auftrag"}],convertTo:{key:"order",value:"Auftrag"},galleryBrowserOpen:!1,discount:{docalcdiscount:!1,discounted_netto:"",discounted_brutto:"",tmp_netto:0,tmp_brutto:0,discount_brutto_focused:!1},baseModel:{title:"",items:[],type:"offer",status:"open",offertype:"offer",images:[],children:[],receiver:!1,date:new Date().toISOString(),contact:!1,vatrate:20,discountrate:0,checklist:[],ressources:[],notifications:[],version:3,files:[],currPos:{showAddNewPos:!1,currPos:!1,selectedGroup:!1,editCurrPos:!1}},showDialog:!1,showFileLockDialog:!1};return e},methods:{handleBelegketteAction(e){this.viewMode="detail",e==="convert-order"&&(this.convertTo=this.availableConvertTo.find(o=>o.key==="order")||this.convertTo,this.showDialog=!0)},getHeaderStyle(e){return{"border-bottom":"3px solid "+(this.$store.getters["invoice/COLORS"](e)||"#41b883")}},getIconStyle(e){const o=this.$store.getters["invoice/COLORS"](e);return{color:o&&o.length>3&&o!=="#000000"&&o!=="#000"?o:"#41b883"}},getFooterStyle(e){return{"border-top":"3px solid "+(this.$store.getters["invoice/COLORS"](e)||"#41b883")}},asyncFindCustomer(e){this.isLoadingCustomer=!0,this.$store.dispatch("invoice/SEARCH_CUSTOMER",{text:e}).then(o=>{this.isLoadingCustomer=!1},o=>{console.log("ERR!!",o)})},getDifferences(e,o){const n={};for(const i in e)if(e.hasOwnProperty(i))if(!o.hasOwnProperty(i))n[i]={old:void 0,new:e[i]};else if(this.isObject(e[i])&&this.isObject(o[i])){const d=this.getDifferences(e[i],o[i]);Object.keys(d).length>0&&(n[i]=d)}else e[i]!==o[i]&&(n[i]={old:o[i],new:e[i]});for(const i in o)o.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&(n[i]={old:o[i],new:void 0});return n},isObject(e){return e&&typeof e=="object"&&!Array.isArray(e)},closeDoc(){this.$router.replace({path:this.ADMINCENTER_URL+"/accounting/offer/browse"})},onSelectCustomer(){this.myModel.address=!1,this.myModel.contact=!1},onChangePositions(e){console.log("ON CHANGE POSITIONS",e),this.myModel.items=e.model.items,this.myModel.groups=e.model.groups,this.save()},onDirtyPositions(){this.isSaving||this.$store.commit("invoice/INCREMENT_MODEL_VALUE_CHANGED_COUNT","offer")},beforeApplyFactorChanges(){return this.$refs.invoicePos&&(this.$refs.invoicePos.editCurrPos||this.$refs.invoicePos.showAddNewPos)?(this.$notify({content:"Bitte schlieÃen Sie zuerst die Positionsmaske",type:"error"}),!1):!0},async onFactorChangesApplied(){this.isSaving=!0,await this.$store.dispatch("invoice/getPageDataOfferEdit",{id:this.$route.params.id}),this.$nextTick(()=>{this.isSaving=!1,this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer")})},beforeApplyArticleChanges(){return this.$refs.invoicePos&&(this.$refs.invoicePos.editCurrPos||this.$refs.invoicePos.showAddNewPos)?(this.$notify({content:"Bitte schlieÃen Sie zuerst die Positionsmaske",type:"error"}),!1):!0},async onArticleChangesApplied(){this.isSaving=!0,await this.$store.dispatch("invoice/getPageDataOfferEdit",{id:this.$route.params.id}),this.$nextTick(()=>{this.isSaving=!1,this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer")})},print(){var e="/api/v0/invoice/print/"+this.myModel._id+"?filename="+this.myModel.desc+"&mode="+this.SELECTED_MODE+"target=_blank";window.open(e,"_blank")},scrollToTop(){re.scrollTo(this.$refs.cardmain)},formatDate(e){return ie(e).format("DD/MM/YYYY HH:mm")},...pe,convert:fe,save(e,o){var n,i,d;if((n=this.$refs.invoicePos)!=null&&n.editCurrPos||(i=this.$refs.invoicePos)!=null&&i.showAddNewPos)return this.$n
1otify({content:"Bitte schlieÃen Sie zuerst die Positionsmaske",type:"error"});if(this.isSaving)return this.$notify({content:"wird gespeichert, bitte warten",type:"warning"});if(this.$refs.invoicePos){const t=this.$refs.invoicePos.getSnapshot();this.myModel.items=t.items,this.myModel.groups=t.groups}else if(this.myModel._id&&(!this.myModel.items||!this.myModel.items.length)){const t=this.$store.getters["invoice/byId"](this.myModel._id);(d=t==null?void 0:t.items)!=null&&d.length&&(this.myModel.items=t.items,this.myModel.groups=t.groups||this.myModel.groups,console.warn("[save] restored items from store - invoicePos ref missing"))}this.isSaving=!0,this.myModel._id?this.$store.dispatch("invoice/update",this.myModel).then(t=>{this.$notify({content:"gespeichert"}),this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer"),this.isSaving=!1,o&&this.$router.push(this.ADMINCENTER_URL+"/accounting/offer/browse/"),e&&e()},t=>{this.isSaving=!1,this.$notify({content:t.message||t,type:"error"})}):this.$store.dispatch("invoice/create",this.myModel).then(t=>{this.$notify({content:"gespeichert"}),this.$nextTick(()=>{this.isSaving=!1,this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer"),e||this.$router.replace({path:this.ADMINCENTER_URL+"/accounting/offer/edit/"+t._id}),e&&e(null,t)})},t=>{this.isSaving=!1,this.$notify({content:t.message||t,type:"error"})})},getImageSrc(e){return this.$store.getters["file/src2"](e)},customLabel(e){let o=this.availableCustomers.find(i=>i._id===e);o||(o=this.availableAddresses.find(i=>i._id===e)),o||(o=this.availableContacts.find(i=>i._id===e));let n=y(o);return o&&o.account_locked&&(n="ð "+n),n},customLabelAddress(e){if(e==="__same_as_receiver__")return"â wie Rechnungsempfänger";let o=this.availableAddresses.find(n=>n._id===e);return y(o)},isDefaultContact(e){var n;const o=this.availableCustomers.find(i=>i._id===this.myModel.receiver);return o&&((n=o.userData)==null?void 0:n.default_contact)===e},isDefaultAddress(e){var n;const o=this.availableCustomers.find(i=>i._id===this.myModel.receiver);return o&&((n=o.userData)==null?void 0:n.default_address)===e},customLabelContact(e){let o=this.availableContacts.find(i=>i._id===e);o||(o=this.itemsContact.find(i=>i._id===e));let n=y(o);return o&&o.account_locked&&(n="ð "+n),this.isDefaultContact(e)&&(n="â "+n),n},customLabelAddressWithStar(e){if(e==="__same_as_receiver__")return"â wie Rechnungsempfänger";let o=this.availableAddresses.find(i=>i._id===e),n=y(o);return this.isDefaultAddress(e)&&(n="â "+n),n}},beforeMount(){},async mounted(){var e;(this.FILE_IS_READONLY_BY_CURR_USER||this.$store.getters["admincenter/FILE_IS_READONLY_BY_CURR_USER_AND_TAB"](this.model))&&(this.showFileLockDialog=!0,this.READ_ONLY=!0),(e=this.model)!=null&&e.fileLock&&!this.READ_ONLY&&(await this.$store.dispatch("admincenter/CLAIM_FILE_LOCK",{_id:this.model.fileLock})||(this.showFileLockDialog=!0,this.READ_ONLY=!0))},created(){var o,n,i;this._modelSyncing=!0,this.model&&(this.myModel=this.model),!this.model&&((i=(n=(o=this.$store.state.config)==null?void 0:o.components)==null?void 0:n.invoice)!=null&&i.kleinunternehmer)&&(this.myModel.vatrate=0),this.debouncedAsyncFindCustomer=b(this.asyncFindCustomer,1e3),this.debouncedSave=b(this.save,1e3),this.debouncedCalcDiscount=b(z,1e3),this.myModel.files||(this.myModel.files=[]),this.myModel.comment||(this.myModel.comment="");for(var e=0;e<this.myModel.items.length;e++)this.myModel.items[e].item.uuid||(this.myModel.items[e].item.uuid=se(),console.log("CREATED UIID FOR ",this.myModel.items[e].item));this.$nextTick(()=>{this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer"),this._modelSyncing=!1})},computed:{...ue,shippingMethods(){var e,o,n;return((n=(o=(e=this.$store.state.config)==null?void 0:e.components)==null?void 0:o.invoice)==null?void 0:n.shipping_methods)||[]},hasChanged(){return this.$store.getters["invoice/GET_MODEL_VALUE_CHANGED_COUNT"]("offer")},viewModeOptions(){return[{value:"detail",label:"Detail",icon:"edit"},{value:"overview",label:"Belegkette",icon:"account_tree",disabled:this.hasChanged>0}]},documentChain(){return this.$store.state.invoice.documentChain},FILE_IS_READONLY_BY_CURR_USER(){return this.$store.getters["admincenter/FILE_IS_READONLY_BY_CURR_USER"](this.myModel)},availableCustomers(){let e=this.$store.state.invoice.items.customer.concat(this.SEARCH_CACHE_CUSTOMER);e=e.filter(n=>!n.account_locked||n._id===this.myModel.receiver);const o=new Map;return e.forEach(n=>{o.set(n._id,n)}),Array.from(o.values())},availableContacts(){let e=this.$store.state.invoice.items.contact.concat(this.SEARCH_CACHE_CONTACT);const o=new Map;return e.forEach(n=>{o.set(n._id,n)}),Array.from(o.values())},SEARCH_CACHE_CUSTOMER(){return this.$store.getters["invoice/SEARCH_CACHE_CUSTOMER"]},SEARCH_CACHE_ADDRESS(){return this.$store.getters["invoice/SEARCH_CACHE_ADDRESS"]},SEARCH_CACHE_CONTACT(){return this.$store.getters["invoice/SEARCH_CACHE_CONTACT"]},itemsContact(){var d,t,v;if(!this.myModel.receiver)return[];var e=this.availableCustomers.find(h=>h._id===this.myModel.receiver);if(!e||!((d=e.userData)!=null&&d.contacts))return[];for(var o=[],n=0;n<((v=(t=e.userData)==null?void 0:t.contacts)==null?void 0:v.length);n++){var i=this.$store.getters["invoice/CONTACT_BY_ID"](e.userData.contacts[n]);i?o.push(i):console.log("nox")}return o=o.filter(h=>!h.account_locked||h._id===this.myModel.contact),o},availableAddresses(){var p;if(!this.myModel.receiver)return[];var e=this.availableCustomers.find(c=>c._id===this.myModel.receiver);if(!e)return[];for(var o=[],n=0;n<e.userData.addresses.length;n++){var i=this.$store.getters["invoice/ADDRESS_BY_ID"](e.userData.addresses[n]);i?o.push(i):console.log("nox")}o=o.filter(c=>!c.account_locked||c._id===this.myModel.address);var d=[],t=(p=e.userData)==null?void 0:p.default_address,v={_id:"__same_as_receiver__",_isSameAsReceiver:!0,userData:e.userData};if(t){var h=o.find(c=>c._id===t);h&&(d.push(h),o=o.filter(c=>c._id!==t))}return d.push(v),d.push(...o),d},MODULE_TEMPLATES_ENABLED(){return this.$store.getters["invoice/MODULE_TEMPLATES_ENABLED"]},SELECTED_MODE(){return this.myModel.pdf_no_single_price_mode?"nga":!1},GET_COLORS(e){return{"background-color":this.$store.getters["invoice/COLORS"]("offer_background"),color:this.$store.getters["invoice/COLORS"]("offer_foreground")}},GET_COLORS2(){return{"border-bottom":"4px solid "+this.$store.getters["invoice/COLORS"]("offer_background")}},GET_COLORS3(){return{"border-top":"4px solid "+this.$store.getters["invoice/COLORS"]("offer_background")}},BACKGROUND_COLOR(){return this.$store.getters["invoice/COLORS"]("offer_background")},model(){return this.$store.getters["invoice/byId"](this.$route.params.id)},offertype:{get(){return this.myModel.offertype?{key:this.myModel.offertype,value:te(this.offerTypeDropdown,e=>e.key===this.myModel.offertype)[0].value}:!1},set(e){e?this.myModel.offertype=e.key:this.myModel.offertype=!1}},priceFail(){for(var e=!1,o=0;o<this.myModel.items.length;o++)(Re(this.myModel.items[o].item.price)||ke(parseFloat(this.myModel.items[o].item.price,10)))&&(e=!0);return e}},watch:{viewMode(e){e==="detail"&&this.$nextTick(()=>{this.$store.commit("invoice/RESET_MODEL_VALUE_CHANGED_COUNT","offer")})},discount(){this.debouncedCalcDiscount()},model(e,o){this._modelSyncing=!0,this.model?this.myModel=this.model:this.myModel=oe(this.baseModel),this.$nextTick(()=>{this._modelSyncing=!1})},"myModel.receiver"(){console.log("RFECEICVER")},myModel:{deep:!0,handler(e,o){const n=O(e,o);
1console.log("Changed values:",n),!(!(o!=null&&o._id)&&(e!=null&&e._id))&&!this.isSaving&&!this._modelSyncing&&this.$store.commit("invoice/INCREMENT_MODEL_VALUE_CHANGED_COUNT","offer")}}},asyncData({store:e,route:{params:{id:o}}}){var n={qry:{type:"offer"}};return o&&(n.id=o),Promise.all([e.dispatch("invoice/getPageDataOfferEdit",n)])}};function O(e,o){const n={};return Object.keys(e).forEach(i=>{if(!o.hasOwnProperty(i))n[i]={old:e[i],new:void 0};else if(e[i]!==null&&o[i]!==null&&typeof e[i]=="object"&&typeof o[i]=="object"){const d=O(e[i],o[i]);Object.keys(d).length>0&&(n[i]=d)}else e[i]!==o[i]&&(n[i]={old:e[i],new:o[i]})}),Object.keys(o).forEach(i=>{e.hasOwnProperty(i)||(n[i]={old:void 0,new:o[i]})}),n}const Go=ee(ro,[["render",no],["__scopeId","data-v-0f9ef5a8"]]);export{Go as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.