You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
13 KiB

var L=Object.defineProperty;var W=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var n=(e,t,r)=>W(e,typeof t!="symbol"?t+"":t,r);import{V as K,f as z,e as X,C as Z,_,g as b,h as g,i as f,j as s,l as F,t as v,m,s as C,o as G,p as Y,w as ee,k as Q,F as te,x as h}from"./index-BLqts8WY.js";import{Q as re}from"./QuickNav-DgCyvgDx.js";import{T as ie}from"./TopMessage-BE0GBIgW.js";import{l as oe,e as se,h as ne,ap as ae,aK as de,aL as le,aM as pe,at as ue}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var ce=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,he=(e,t,r,i)=>{for(var a=i>1?void 0:i?fe(t,r):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(a=(i?d(t,r,a):d(a))||a);return i&&a&&ce(t,r,a),a};let T=class extends K{constructor(){super(...arguments);n(this,"$notify");n(this,"activeDid","");n(this,"apiServer","");n(this,"amountInput","0");n(this,"descriptionOfCondition","");n(this,"descriptionOfItem","");n(this,"destinationPathAfter","");n(this,"hideBackButton",!1);n(this,"message","");n(this,"offeredToProject",!1);n(this,"offeredToRecipient",!1);n(this,"offererDid");n(this,"offerId","");n(this,"prevCredToEdit");n(this,"projectId","");n(this,"projectName","a project");n(this,"recipientDid","");n(this,"recipientName","");n(this,"showGeneralAdvanced",!1);n(this,"unitCode","HUR");n(this,"validThroughDateInput","");n(this,"libsUtil",oe)}async mounted(){var a,l,d,p,c,y,o,I,w,O,x,D,$,j,E,k,N,P,S,A,U,q,R,V,M,B;try{this.prevCredToEdit=this.$route.query.prevCredToEdit?JSON.parse(this.$route.query.prevCredToEdit):void 0}catch{this.$notify({group:"alert",type:"danger",title:"Retrieval Error",text:"The previous record isn't available for editing. If you submit, you'll create a new record."},6e3)}const r=(d=(l=(a=this.prevCredToEdit)==null?void 0:a.claim)==null?void 0:l.includesObject)==null?void 0:d.amountOfThisGood;this.amountInput=this.$route.query.amountInput||(r?String(r):"")||this.amountInput,this.unitCode=this.$route.query.unitCode||((y=(c=(p=this.prevCredToEdit)==null?void 0:p.claim)==null?void 0:c.includesObject)==null?void 0:y.unitCode)||this.unitCode,this.descriptionOfCondition=((I=(o=this.prevCredToEdit)==null?void 0:o.claim)==null?void 0:I.description)||this.descriptionOfCondition,this.descriptionOfItem=this.$route.query.description||((x=(O=(w=this.prevCredToEdit)==null?void 0:w.claim)==null?void 0:O.itemOffered)==null?void 0:x.description)||this.descriptionOfItem,this.destinationPathAfter=this.$route.query.destinationPathAfter,this.offererDid=this.$route.query.offererDid||((j=($=(D=this.prevCredToEdit)==null?void 0:D.claim)==null?void 0:$.agent)==null?void 0:j.identifier)||this.offererDid,this.hideBackButton=this.$route.query.hideBackButton==="true",this.message=this.$route.query.message||"";let i;((P=(N=(k=(E=this.prevCredToEdit)==null?void 0:E.claim)==null?void 0:k.itemOffered)==null?void 0:N.isPartOf)==null?void 0:P["@type"])==="PlanAction"&&(i=(U=(A=(S=this.prevCredToEdit)==null?void 0:S.claim)==null?void 0:A.itemOffered)==null?void 0:U.isPartOf),this.projectId=this.$route.query.projectId||(i==null?void 0:i.identifier)||this.projectId,this.projectName=this.$route.query.projectName||(i==null?void 0:i.name)||this.projectName,this.recipientDid=this.$route.query.recipientDid||((V=(R=(q=this.prevCredToEdit)==null?void 0:q.claim)==null?void 0:R.recipient)==null?void 0:V.identifier),this.recipientName=this.$route.query.recipientName||"",this.validThroughDateInput=((B=(M=this.prevCredToEdit)==null?void 0:M.claim)==null?void 0:B.validThrough)||this.validThroughDateInput;try{const u=await z();if(this.apiServer=u.apiServer??"",this.activeDid=u.activeDid??"",this.showGeneralAdvanced=u.showGeneralAdvanced??!1,this.recipientDid&&!this.recipientName){const H=await X.contacts.toArray(),J=await se();this.recipientName=ne(this.recipientDid,this.activeDid,J,H)}this.offeredToProject=!!this.projectId,this.offeredToRecipient=!this.offeredToProject&&!!this.recipientDid}catch(u){console.error("Error retrieving settings from database:",u),this.$notify({group:"alert",type:"danger",title:"Error",text:u.messa