PageSourceSearch

https://dashboard.transax.com/_nuxt/_templateId_-aB9VQ4nH.js

js transax.com collected 2026-10-01 15:38:35 UTC 9,886 bytes, 1 lines download raw bytes

1import{_ as fe}from"./TextField-DTP5qN9N.js";import{d as ee,ax as te,W as ae,e as oe,c as n,a as s,x as D,t as le,a1 as se,k as T,E as k,y as E,aO as M,o as r,l as ne,b7 as _e,q as v,j as he,bo as we,g as J,A as B,a7 as z,X as ye,O as ge,M as be,bw as Y,aJ as Ee}from"./entry-BPpzu7Al.js";import{_ as Te}from"./Select-D_qikc3l.js";import"./Label-BUhFDx1h.js";import"./VTooltip-BFCN09Rf.js";import"./CheckBox.vue-CEb_bWPo.js";import"./VCheckbox-BNPmQQ_A.js";const ke={class:"section"},Re={key:0,class:"empty"},Ie=["title"],Ce=["title"],De=ee({__name:"DocumentTemplateMappingFields",props:{templateId:{},fields:{},catalog:{}},emits:["saved"],setup(q,{emit:N}){const P=q,m=N,{$repositories:x}=te(),_=ae(),h=oe(()=>P.catalog.map(i=>({title:`${i.group} — ${i.label}`,value:i.key})));async function R(i,u){i.mapped_field=u;try{const{hasError:l}=await x.v2.documentTemplates.updateField(P.templateId,i.id,{mapped_field:u});if(l){_.setToastDetail({type:M.Error,toastNotice:"Could not save field mapping."});return}m("saved",i)}catch{_.setToastDetail({type:M.Error,toastNotice:"Could not save field mapping."})}}return(i,u)=>{const l=Te;return r(),n("section",ke,[u[0]||(u[0]=s("h2",{class:"section-title"},"Field Mapping",-1)),u[1]||(u[1]=s("p",{class:"section-help"}," AI suggested these mappings. Change to a different Transax field if needed — saved automatically. ",-1)),i.fields.length===0?(r(),n("div",Re,"No fields detected yet.")):D("",!0),(r(!0),n(le,null,se(i.fields,f=>(r(),n("div",{key:`map-${f.id}`,class:"row"},[s("label",{class:"row-label",title:f.label},[k(E(f.label||"(unlabeled)")+" ",1),f.is_ai_suggested&&f.ai_confidence!==null?(r(),n("span",{key:0,class:"ai-chip",title:`AI confidence: ${(f.ai_confidence*100).toFixed(0)}%`}," AI ",8,Ce)):D("",!0)],8,Ie),T(l,{"model-value":f.mapped_field,items:h.value,"item-title":"title","item-value":"value",density:"compact","hide-details":"","hide-label":"",clearable:"",placeholder:"Unmapped","onUpdate:modelValue":w=>R(f,w)},null,8,["model-value","items","onUpdate:modelValue"])]))),128))])}}}),Le=ne(De,[["__scopeId","data-v-ee0aab12"]]),Se={class:"print-template-page"},Ne={class:"header"},Pe={class:"title"},xe={class:"subtitle"},Fe={key:0,class:"kind-chip"},Ue={class:"header-actions"},Ae={key:0,class:"error-banner"},Me={key:1,class:"loading"},Ve={key:2,class:"two-pane"},$e={class:"left-pane"},Oe={key:0,class:"preview-error"},Ge=["src"],Be={key:2,class:"preview-placeholder"},ze={key:3,class:"preview-placeholder"},je=["aria-valuenow"],He={class:"section"},Xe=["title"],j=280,H=700,Z=420,X="print-template-right-pane-width",qe=1500,We=12e4,Ke=ee({__name:"[templateId]",setup(q){const N=_e(),P=Ee(),{$repositories:m}=te(),x=ae(),_=Number(N.params.unitSaleId),h=Number(N.params.templateId),R=v(!0),i=v(null),u=v(!1),l=v(Z),f=v(!1),w=v(null),F=v([]),W=v([]),V=v({}),L=v({}),$=v(null),I=v(null),S=v(null),y=v(!1),O=v("Queued…");let G=null,g=!1;const U=oe(()=>!R.value&&F.value.length>0);function A(e){return Math.max(j,Math.min(H,e))}function re(e){const t=e.currentTarget;t.setPointerCapture(e.pointerId),f.value=!0;const o=e.clientX,d=l.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const c=p=>{const b=o-p.clientX;l.value=A(d+b)},a=()=>{f.value=!1,document.body.style.cursor="",document.body.style.userSelect="",t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",c),t.removeEventListener("pointerup",a),t.removeEventListener("pointercancel",a);try{localStorage.setItem(X,String(l.value))}catch{}};t.addEventListener("pointermove",c),t.addEventListener("pointerup",a),t.addEventListener("pointercancel",a)}function ie(e){const t=e.shiftKey?50:10;e.key==="ArrowLeft"?(e.preventDefault(),l.value=A(l.value+t)):e.key==="ArrowRight"?(e.preventDefault(),l.value=A(l.value-t)):e.key==="Home"?(e.preventDefault(),l.value=j):e.key==="End"?(e.preventDefault(),l.value=H):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),K())}function K(){l.value=Z;try{localStorage.removeItem(X)}catch{}}async function ue(){var e;R.value=!0,i.value=null;try{const[t,o,d,c,a]=await Promise.all([m.v2.documentTemplates.get(h),m.v2.documentTemplates.fields(h),m.v2.documentTemplates.fieldsCatalog(),m.v2.documentTemplates.resolveValues(h,_),m.unitSales.fetch(_)]);if(t.hasError)throw new Error("Failed to load template.");if(o.hasError)throw new Error("Failed to load fields.");if(d.hasError)throw new Error("Failed to load field catalog.");if(c.hasError)throw new Error("Failed to resolve deal values.");w.value=t.response,F.value=o.response||[],W.value=d.response||[],V.value=c.response||{};const p=a==null?void 0:a.response;$.value=((e=p==null?void 0:p.buyer)==null?void 0:e.id)??(p==null?void 0:p.buyerId)??null}catch(t){i.value=(t==null?void 0:t.message)??"Failed to load."}finally{R.value=!1}}async function Q(e,t){const o=await e();if(o.hasError||!o.response||typeof o.response.id!="number")throw new Error("Could not queue render.");const d=o.response.id,c=Date.now();for(;!g;){if(Date.now()-c>We)throw new Error("Render timed out. Please try again.");if(await new Promise(C=>{G=setTimeout(C,qe)}),g)return null;const a=await m.v2.documentTemplates.renderStatus(h,d);
1if(a.hasError||!a.response||typeof a.response.status!="string")throw new Error("Could not check render status.");const p=a.response.status,b=a.response.error;if(p==="ready"){t("Loading…");const C=await m.v2.documentTemplates.renderDownload(h,d);if(g)return null;if(C.hasError||!(C.response instanceof Blob))throw new Error("Could not download render.");return C.response}if(p==="failed")throw new Error(b||"Render failed.");t(p==="processing"?"Rendering…":"Queued…")}return null}async function de(){if(!(!U.value||y.value||u.value)){y.value=!0,O.value="Queued…",S.value=null;try{const e=await Q(()=>m.v2.documentTemplates.requestPreview(h,{unit_sale_id:_,overrides:L.value}),d=>O.value=d);if(!e||g)return;const t=URL.createObjectURL(e),o=I.value;I.value=t,o&&URL.revokeObjectURL(o)}catch(e){g||(S.value=(e==null?void 0:e.message)??"Could not render preview.")}finally{g||(y.value=!1)}}}async function ce(){try{const{response:e,hasError:t}=await m.v2.documentTemplates.resolveValues(h,_);t||(V.value=e||{})}catch{}}function pe(e,t){t===null||t===""?delete L.value[e]:L.value[e]=t}async function ve(){var e,t;if(!(!U.value||u.value||y.value)){u.value=!0;try{const o=await Q(()=>m.v2.documentTemplates.requestGenerate(h,{unit_sale_id:_,overrides:L.value}),()=>{});if(!o||g)return;const d=URL.createObjectURL(o);if(!window.open(d,"_blank")){const a=document.createElement("a");a.href=d,a.download=`${((e=w.value)==null?void 0:e.original_filename)??"document"}-${_}.pdf`,document.body.appendChild(a),a.click(),document.body.removeChild(a)}if($.value)try{const a=`${((t=w.value)==null?void 0:t.original_filename)??"document"}-${_}.pdf`,p=new File([o],a,{type:"application/pdf"}),b=new FormData;b.append("file",p),b.append("contactId",String($.value)),b.append("title",a),(await m.files.uploadDocument(b)).hasError||x.setToastDetail({type:M.Success,toastNotice:"Document saved to files.",capitalize:!0,isHtml:!1,closeTimeout:Y})}catch{}}catch(o){x.setToastDetail({type:M.Error,toastNotice:(o==null?void 0:o.message)??"Could not generate the document.",capitalize:!0,isHtml:!1,closeTimeout:Y})}finally{u.value=!1}}}function me(){window.opener?window.close():P.back()}return he(()=>{try{const e=Number(localStorage.getItem(X));Number.isFinite(e)&&e>0&&(l.value=A(e))}catch{}ue()}),we(()=>{g=!0,G!==null&&clearTimeout(G),I.value&&URL.revokeObjectURL(I.value)}),(e,t)=>{var d;const o=fe;return r(),n("div",Se,[s("header",Ne,[s("div",null,[s("h1",Pe,E(((d=w.value)==null?void 0:d.name)||"Print template"),1),s("p",xe,[k(" Deal #"+E(J(_))+" · ",1),w.value?(r(),n("span",Fe,E(w.value.kind),1)):D("",!0)])]),s("div",Ue,[T(z,{variant:"outlined",disabled:u.value||y.value,onClick:me},{default:B(()=>
1t[0]||(t[0]=[k(" Close ")])),_:1},8,["disabled"]),T(z,{variant:"tonal",loading:y.value,disabled:!U.value||u.value,onClick:de},{default:B(()=>t[1]||(t[1]=[k(" Generate Preview ")])),_:1},8,["loading","disabled"]),T(z,{color:"primary",loading:u.value,disabled:!U.value||y.value,onClick:ve},{default:B(()=>t[2]||(t[2]=[k(" Generate & Print ")])),_:1},8,["loading","disabled"])])]),i.value?(r(),n("div",Ae,E(i.value),1)):D("",!0),R.value?(r(),n("div",Me,"Loading template…")):(r(),n("div",Ve,[s("div",$e,[S.value?(r(),n("div",Oe,E(S.value),1)):D("",!0),I.value?(r(),n("iframe",{key:1,src:I.value,class:"preview-frame",title:"PDF preview"},null,8,Ge)):y.value?(r(),n("div",Be,[T(ye,{indeterminate:"",size:"20",width:"2"}),s("span",null,E(O.value),1)])):S.value?D("",!0):(r(),n("div",ze,t[3]||(t[3]=[k(" Click "),s("strong",null,"Generate Preview",-1),k(" to render the filled document. ")])))]),s("div",{class:ge(["splitter",{dragging:f.value}]),role:"separator","aria-orientation":"vertical","aria-valuenow":l.value,"aria-valuemin":j,"aria-valuemax":H,tabindex:"0",title:"Drag to resize. Double-click to reset.",onPointerdown:re,onDblclick:K,onKeydown:ie},null,42,je),s("aside",{class:"right-pane",style:be({flexBasis:l.value+"px"})},[T(Le,{"template-id":J(h),fields:F.value,catalog:W.value,onSaved:ce},null,8,["template-id","fields","catalog"]),s("section",He,[t[4]||(t[4]=s("h2",{class:"section-title"},"Value Overrides",-1)),t[5]||(t[5]=s("p",{class:"section-help"}," Type a value to replace what's filled from the deal. Leave blank to use the deal data. ",-1)),(r(!0),n(le,null,se(F.value,c=>(r(),n("div",{key:`val-${c.id}`,class:"row"},[s("label",{class:"row-label",title:c.label},E(c.label||"(unlabeled)"),9,Xe),T(o,{"model-value":L.value[c.id]??"",placeholder:V.value[c.id]??"",density:"compact","hide-details":"",clearable:"","onUpdate:modelValue":a=>pe(c.id,a)},null,8,["model-value","placeholder","onUpdate:modelValue"])]))),128))])],4)]))])}}}),ot=ne(Ke,[["__scopeId","data-v-dde4b35d"]]);export{ot 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.