import{aa as d,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as e}from"./main-tangy-colts-beg.js";import{s as l}from"./machine.-tangy-colts-beg-869.js";import{h as o,a as m,c as E}from"./commonut-tangy-colts-beg-867.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,a){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,a),a)}};const s=d(({helpers:t})=>({states:{components:[E(t),{componentName:t.componentName.mixInput,helperText:e("Enter the customer ID for creating invoice"),id:"customer-id",label:e("Customer ID"),onChange:"HANDLE_CUSTOMER",path:"customer",render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{componentName:t.componentName.mixInput,helperText:e("Enter the description of the invoice"),id:"description",label:e("Description"),onChange:"HANDLE_DESCRIPTION",path:"description",render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:t.componentName.select,helperText:e("Select the auto advance option for the invoice"),id:"autoAdvance",label:e("Auto advance"),onChange:"SELECT_AUTO_ADVANCE",options:[{label:e("Yes"),value:"true"},{label:e("No"),value:"false"}],path:"auto_advance",render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:t.componentName.select,helperText:e("Select the collection method of the invoice"),id:"collection-method",label:e("Collection Method"),onChange:"SELECT_COLLECTION_METHOD",options:[{label:e("Charge automatically"),value:"charge_automatically"},{label:e("Send invoice"),value:"send_invoice"}],path:"collection_method",render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:t.componentName.mixInput,helperText:e("Either Days Until Due or Due Date must be supplied. The date on which payment for this invoice is due. Enter the time (as a Unix timestamp)"),id:"due-date",label:e("Due Date"),onChange:"HANDLE_DUE_DATE",path:"due_date",render:"IF_SEND_INVOICE_SELECTED",value:[]},{componentName:t.componentName.mixInput,helperText:e("Either Days Until Due or Due Date must be supplied. The date on which payment for this invoice is due. "),id:"days-until-due",label:e("Days Until Due"),onChange:"HANDLE_DAYS_UNTIL_DUE",path:"days_until_due",render:"IF_SEND_INVOICE_SELECTED",value:[]},{addItemButtonLabel:"Metadata",componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.mixInput,label:e("Key"),name:"key",value:[],wrapperClassName:"w-100"},{componentName:t.componentName.mixInput,label:e("Value"),name:"value",value:[],wrapperClassName:"w-100"}],id:"metaData-field-properties",label:e("Meta Data"),onChange:"HANDLE_META_DATA",path:"metaDataFieldProperties",render:"IF_CONNECTION_SELECTED",value:[]}]},actions:{IF_CONNECTION_SELECTED:({$:a})=>{var n;return c((n=a.getComponent("connection-id"))==null?void 0:n.value)},IF_SEND_INVOICE_SELECTED:({$:a})=>{var n,i;return c((n=a.getComponent("connection-id"))==null?void 0:n.value)&&((i=a.getComponent("collection-method"))==null?void 0:i.value)==="send_invoice"},CONNECTION_ADD_CHANGE:m,HANDLE_CUSTOMER:o("customerId"),HANDLE_DAYS_UNTIL_DUE:o("daysUntilDue"),HANDLE_DESCRIPTION:o("descriptionDb"),HANDLE_DUE_DATE:o("dueDate"),HANDLE_META_DATA:o("metaDataFieldProperties"),SELECT_AUTO_ADVANCE:o("autoAdvanceDb"),SELECT_COLLECTION_METHOD:o("collection-methodDb"),SET_CONNECTION:o("connectionId"),ON_MACHINE_LOAD:async({$:a})=>{l(a,[{db:"connectionId",id:"connection-id"},{db:"customerId",id:"customer-id"},{db:"autoAdvanceDb",id:"autoAdvance"},{db:"collection-methodDb",id:"collection-method"},{db:"metaDataFieldProperties",id:"metaData-field-properties"},{db:"descriptionDb",id:"description"},{db:"dueDate",id:"due-date"},{db:"daysUntilDue",id:"days-until-due"}])}}}));export{s as default};
