import{u as g,a as j,v as b,aB as f,aT as p,j as e,C as x,c2 as i,_ as c,dl as _,Q as h,i as v,c$ as d,c_ as C,c1 as y,d0 as m}from"./bundle.CHKSNOJF.js";function V(l){const[a]=g(),{handleChange:o}=l,u=j(),n=b(),[r]=f(p);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{className:"col-span-12 lg:col-span-6 xl:col-span-4 h-max shadow-sm",style:{borderColor:u.$24},children:[e.jsx(i,{leftSide:a("frequency"),children:e.jsx(c,{value:r?.frequency_id,onValueChange:s=>o("frequency_id",s),errorMessage:l.errors?.errors.frequency_id,customSelector:!0,dismissable:!1,children:Object.keys(_).map((s,t)=>e.jsx("option",{value:s,children:a(_[s])},t))})}),e.jsx(i,{leftSide:a("start_date"),children:e.jsx(h,{type:"date",onValueChange:s=>o("next_send_date",s),value:v(r?.next_send_date).format("YYYY-MM-DD"),min:v().format("YYYY-MM-DD"),errorMessage:l.errors?.errors.next_send_date})}),e.jsx(i,{leftSide:a("remaining_cycles"),children:e.jsxs(c,{value:r?.remaining_cycles?.toString(),onValueChange:s=>o("remaining_cycles",parseInt(s)),errorMessage:l.errors?.errors.remaining_cycles,customSelector:!0,dismissable:!1,children:[e.jsx("option",{value:"-1",children:a("endless")}),[...Array(37).keys()].map((s,t)=>e.jsx("option",{value:s.toString(),children:s},t))]})}),e.jsx(i,{leftSide:a("due_date"),children:e.jsxs(c,{value:r?.due_date_days?.toString(),onValueChange:s=>o("due_date_days",s),errorMessage:l.errors?.errors.due_date_days,customSelector:!0,dismissable:!1,children:[e.jsx("option",{value:"terms",children:a("use_payment_terms")}),[...Array(31).keys()].map((s,t)=>e.jsxs("option",{value:(s+1).toString(),children:[a("day")," ",s+1]},t))]})}),r&&n?.custom_fields?.invoice1&&e.jsx(d,{field:"invoice1",defaultValue:r?.custom_value1||"",value:n.custom_fields.invoice1,onValueChange:s=>o("custom_value1",String(s))}),r&&n?.custom_fields?.invoice2&&e.jsx(d,{field:"invoice2",defaultValue:r?.custom_value2||"",value:n.custom_fields.invoice2,onValueChange:s=>o("custom_value2",String(s))})]}),e.jsxs(x,{className:"col-span-12 lg:col-span-6 xl:col-span-4 h-max shadow-sm",style:{borderColor:u.$24},children:[e.jsx(i,{leftSide:a("invoice_number_short"),children:e.jsx(h,{id:"number",placeholder:a("auto_generate"),onValueChange:s=>o("number",s),value:r?.number||"",errorMessage:l.errors?.errors.number})}),e.jsx(i,{leftSide:a("po_number_short"),children:e.jsx(h,{id:"po_number",onValueChange:s=>o("po_number",s),value:r?.po_number||"",errorMessage:l.errors?.errors.po_number})}),e.jsx(i,{leftSide:a("discount"),children:e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("div",{className:"w-full lg:w-1/2",children:e.jsxs(c,{dropdownIndicatorClassName:"pr-3",onValueChange:s=>o("is_amount_discount",JSON.parse(s)),value:r?.is_amount_discount.toString(),errorMessage:l.errors?.errors.is_amount_discount,customSelector:!0,dismissable:!1,searchable:!1,withoutControlPadding:!0,withoutDropdownIndicatorPadding:!0,children:[e.jsx("option",{value:"false",children:a("percent")}),e.jsx("option",{value:"true",children:a("amount")})]})}),e.jsx("div",{className:"w-full lg:w-1/2",children:e.jsx(C,{value:r?.discount||"",onValueChange:s=>o("discount",parseFloat(s)),errorMessage:l.errors?.errors.discount})})]})}),e.jsx(i,{leftSide:a("auto_bill"),children:e.jsxs(c,{value:r?.auto_bill||"always",onValueChange:s=>o("auto_bill",s),errorMessage:l.errors?.errors.auto_bill,customSelector:!0,dismissable:!1,children:[e.jsx("option",{value:"always",children:a("enabled")}),e.jsx("option",{value:"optout",children:a("optout")}),e.jsx("option",{value:"optin",children:a("optin")}),e.jsx("option",{value:"off",children:a("disabled")})]})}),r&&n?.custom_fields?.invoice3&&e.jsx(d,{field:"invoice3",defaultValue:r?.custom_value3||"",value:n.custom_fields.invoice3,onValueChange:s=>o("custom_value3",String(s))}),r&&n?.custom_fields?.invoice4&&e.jsx(d,{field:"invoice4",defaultValue:r?.custom_value4||"",value:n.custom_fields.invoice4,onValueChange:s=>o("custom_value4",String(s))})]})]})}function w(l){const[a]=g(),{handleChange:o}=l,u=j(),[n]=f(p),r=[a("public_notes"),a("private_notes"),a("terms"),a("footer")];return e.jsx(x,{className:"col-span-12 xl:col-span-8 shadow-sm h-max",style:{borderColor:u.$24},children:e.jsxs(y,{tabs:r,withoutVerticalMargin:!0,withHorizontalPadding:!0,horizontalPaddingWidth:"1.5rem",fullRightPadding:!0,children:[e.jsx("div",{className:"mb-4 px-6",children:e.jsx(m,{value:n?.public_notes,onChange:s=>o("public_notes",s)})}),e.jsx("div",{className:"mb-4 px-6",children:e.jsx(m,{value:n?.private_notes,onChange:s=>o("private_notes",s)})}),e.jsx("div",{className:"mb-4 px-6",children:e.jsx(m,{value:n?.terms,onChange:s=>o("terms",s)})}),e.jsx("div",{className:"mb-4 px-6",children:e.jsx(m,{value:n?.footer,onChange:s=>o("footer",s)})})]})})}export{V as I,w as a};
