1import { j as S, l as F, z as N, A as T, o as p, c, e as n, u as e, n as z, f as d, a as s, B as w, t as a, C as u, b as y, i as D, s as W, d as E, F as M, g as O, y as V } from "./app-BQglH-tG.js"; 2import { _ as P } from "./AddOnMultiplePrices-CTspyy0-.js"; 3import { _ as R, r as j } from "./BaseInput-1l26qd8j.js"; 4import { _ as f } from "./BaseListbox-CWI9LspK.js"; 5import { _ as I } from "./LiveChat-Cv9P2dP9.js"; 6import { _ as G } from "./CurrencyInput-DDy5H46y.js"; 7import { _ as H } from "./FormFooter-cMftLzxe.js"; 8import { _ as g } from "./InputError-BlVrgZq_.js"; 9import { _ as J } from "./TipTapEditor-Bog43iYj.js"; 10import { _ as K } from "./DashboardLayout-SjMKBVdQ.js"; 11import { r as L } from "./QuestionMarkCircleIcon-C-DsZbEB.js"; 12import { r as Q } from "./CheckIcon-pbR60zuN.js"; 13import "./modelWrapper-BuMWMt6a.js"; 14import "./TrashIcon-Jdvm91L_.js"; 15import "./ModalConfirmation-DER2JDFV.js"; 16import "./LoaderIcon-BOkmnW5w.js"; 17import "./_plugin-vue_export-helper-DlAUqK2U.js"; 18import "./functions-DNMBuN0o.js"; 19import "./UserAvatar-Boyff1w9.js"; 20import "./vue-tabler-icons.es-_MpZvCnK.js"; 21import "./index-B6o3v9Fz.js"; 22import "./listbox--4vAmvqx.js"; 23import "./form-BicfoI4A.js"; 24import "./use-text-value-CY-cTGmG.js"; 25import "./ChevronDownIcon-CtpQP63k.js"; 26import "./consts-CUuEXtFB.js"; 27import "./XMarkIcon-JhKzQL4a.js"; 28import "./ApplicationLogo-BE-OKeyv.js"; 29import "./popover-Blq397Xu.js"; 30import "./index-CQ6xcn9I.js"; 31import "./BaseButton-BF1tDvcc.js"; 32import "./BaseModal-BE4aZshQ.js"; 33import "./EyeIcon-CRkgYch_.js"; 34import "./HomeIcon-CD_D5QXU.js"; 35import "./MinusIcon-CxLG0C3a.js"; 36import "./menu-DtABgxi1.js"; 37import "./use-tree-walker-BR_K-2Kt.js"; 38import "./vue-transitions-CEGBwb15.js"; 39import "./ClockIcon-cut-dFbY.js"; 40const X = { class: "p-6" }, Y = { class: "h5 text-lg font-bold text-gray-900 sm:text-lg" }, Z = { class: "text-sm text-gray-500" }, ee = { class: "py-6" }, te = { for: "title", class: "block text-base font-medium leading-5 text-gray-900" }, se = { class: "relative mt-1 md:max-w-[50%]" }, oe = { class: "py-6" }, le = { for: "description", class: "block text-base font-medium leading-5 text-gray-900" }, ie = { class: "relative mt-1 md:max-w-[50%]" }, re = { key: 0, class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" }, ne = { class: "py-6" }, ae = { for: "type", class: "block text-base font-medium leading-5 text-gray-900" }, de = { key: 0, class: "py-6" }, pe = { for: "price", class: "block text-base font-medium leading-5 text-gray-900" }, me = { class: "relative mt-1 md:max-w-[50%]" }, ce = { class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" }, ue = { id: "price-currency", class: "text-gray-500 sm:text-sm" }, _e = { class: "py-6" }, fe = { class: "block text-base font-medium leading-5 text-gray-900" }, ge = { key: 2, class: "py-6" }, ye = { class: "block text-base font-medium leading-5 text-gray-900" }, be = { class: "py-6" }, he = { class: "flex items-center" }, ve = { class: "py-6" }, xe = { class: "h5 mb-6 text-lg font-bold text-gray-900 sm:text-lg" }, we = { class: "relative mt-1 flex md:max-w-[50%]" }, Ve = { for: "applies_to_services", class: "block text-sm font-medium text-gray-500" }, ke = { class: "block" }, mt = { __name: "AddOnCreate", props: { periods: { type: Array, required: true }, services: { type: Array, required: true }, currency: { type: String, required: true } }, setup(b) { 41 const m = b, { t: i } = S(), k = [{ label: i("Add-ons"), url: route("add-ons.index") }, { label: i("Create") }], t = F({ title: null, description: null, type: "single", billing_type: "one-off", price: null, applies_to_services: [], options: [{ label: "", price: null }], currency: m.currency, billing_period: m.periods[0].id, allow_quantity_selection: true }), C = [{ label: i("Single"), value: "single" }, { label: i("Multiple"), value: "multiple" }], $ = [{ label: i("One-off"), value: "one-off" }, { label: i("Recurring"), value: "recurring" }], h = O(() => m.services.filter((l) => t.billing_type === "one-off" || l.pricing_variations.some((o) => o.billing_period_id === t.billing_period)).map((l) => ({ ...l, value: l.id, label: l.name }))); 42 N(h, () => t.applies_to_services = t.applies_to_services.filter((l) => m.services.find((o) => o.id === l).pricing_variations.some((o) => o.billing_period_id === t.billing_period))); 43 const q = m.periods.map((l) => ({ value: l.id, label: _.capitalize(l.name) })), B = () => {
44 t.transform((l) => V.omitBy({ billing_type: l.billing_type, type: l.type, title: l.title, price: l.type !== "multiple" ? l.price : null, description: l.description, options: l.type === "multiple" ? l.options : null, applies_to_services: l.applies_to_services, billing_period_id: l.billing_type === "recurring" ? l.billing_period : null, allow_quantity_selection: l.allow_quantity_selection }, V.isNil)).post(route("add-ons.store")); 45 }, U = () => window.history.back(); 46 return (l, o) => { 47 const A = T("VTooltip"); 48 return p(), c(M, null, [n(e(z), { title: e(i)("Create add-on") }, null, 8, ["title"]), n(K, { breadcrumbs: k, "show-footer": false }, { header: d(() => [E(a(e(i)("Create add-on")), 1)]), default: d(() => [s("form", { onSubmit: w(B, ["prevent"]) }, [s("div", X, [s("div", Y, a(e(i)("Add-on details")), 1), s("div", Z, a(e(i)("Set up add-ons for one or more services.")), 1), s("div", ee, [s("label", te, a(e(i)("Title")), 1), s("div", se, [n(R, { id: "title", modelValue: e(t).title, "onUpdate:modelValue": o[0] || (o[0] = (r) => e(t).title = r), "has-errors": e(t).errors.title, class: "w-full" }, null, 8, ["modelValue", "has-errors"])]), n(g, { message: e(t).errors.title }, null, 8, ["message"])]), s("div", oe, [s("label", le, a(e(i)("Description")), 1), s("div", ie, [n(J, { modelValue: e(t).description, "onUpdate:modelValue": o[1] || (o[1] = (r) => e(t).description = r), class: u([e(t).errors.description ? "border-red-300 text-red-900 placeholder-red-300 ring-red-500 focus:border-red-500 focus:outline-none" : "border border-gray-300 focus:border-primary-500 focus:ring-primary-500", "overflow-hidden bg-white"]), "show-buttons": "" }, null, 8, ["modelValue", "class"]), e(t).errors.description ? (p(), c("div", re, [n(e(j), { class: "h-5 w-5 text-red-500", "aria-hidden": "true" })])) : y("", true)]), n(g, { message: e(t).errors.description }, null, 8, ["message"])]), s("div", ne, [s("label", ae, a(e(i)("Field type")), 1), n(f, { modelValue: e(t).type, "onUpdate:modelValue": o[2] || (o[2] = (r) => e(t).type = r), options: C, "same-width-dropdown": "", class: "h-full md:max-w-[50%]" }, null, 8, ["modelValue"])]), e(t).type === "single" ? (p(), c("div", de, [s("label", pe, a(e(i)("Price")), 1), s("div", me, [n(G, { id: "price", modelValue: e(t).price, "onUpdate:modelValue": o[3] || (o[3] = (r) => e(t).price = r), name: "price", class: u([e(t).errors.price ? "border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500" : "border border-gray-300 focus:border-primary-500 focus:ring-primary-500", "block w-full rounded-md border-gray-300 pr-12 shadow-sm sm:text-sm"]) }, null, 8, ["modelValue", "class"]), s("div", ce, [s("span", ue, a(b.currency), 1)])]), n(g, { message: e(t).errors.price }, null, 8, ["message"])])) : (p(), D(P, { key: 1, modelValue: e(t), "onUpdate:modelValue": o[4] || (o[4] = (r) => W(t) ? t.value = r : null) }, null, 8, ["modelValue"])), s("div", _e, [s("label", fe, a(e(i)("Billing type")), 1), n(f, { modelValue: e(t).billing_type, "onUpdate:modelValue": o[5] || (o[5] = (r) => e(t).billing_type = r), options: $, "same-width-dropdown": "", class: "h-full md:max-w-[50%]" }, null, 8, ["modelValue"])]), e(t).billing_type === "recurring" ? (p(), c("div", ge, [s("label", ye, a(e(i)("Billing period")), 1), n(f, { modelValue: e(t).billing_period, "onUpdate:modelValue": o[6] || (o[6] = (r) => e(t).billing_period = r), options: e(q), "same-width-dropdown": "", class: "h-full md:max-w-[50%]" }, null, 8, ["modelValue", "options"])])) : y("", true), s("div", be, [s("div", he, [n(I, { modelValue: e(t).allow_quantity_selection, "onUpdate:modelValue": o[7] || (o[7] = (r) => e(t).allow_quantity_selection = r) }, null, 8, ["modelValue"]), s("span", { class: "my-auto ml-4 block cursor-pointer select-none text-sm font-medium text-gray-600", onClick: o[8] || (o[8] = (r) => e(t).allow_quantity_selection = !e(t).allow_quantity_selection) }, a(e(i)("Allow quantity selection")), 1), n(A, null, { popper: d(() => [s("p", null, a(e(i)("When enabled, clients can choose how many units to purchase during checkout. When disabled, only one unit can be purchased at a time.")), 1)]), default: d(() => [n(e(L), { class: "ml-2 h-5 w-5 cursor-help text-gray-400" })]), _: 1 })])]), s("div", ve, [s("div", xe, a(e(i)("Where add-ons appear")), 1), s("div", we, [n(f, { id: "applies_to_services", modelValue: e(t).applies_to_services, "onUpdate:modelValue": o[9] || (
48o[9] = (r) => e(t).applies_to_services = r), "has-errors": e(t).errors.applies_to_services, options: h.value, placeholder: e(i)("Select services"), class: "w-full", "dropdown-classes": "bottom-10", multiple: "", searchable: "", "same-width-dropdown": "" }, { label: d(() => [s("label", Ve, a(e(i)("Add-ons will appear in the intake form for the following services")), 1)]), option: d(({ option: r, active: v, selected: x }) => [s("li", { class: u([v ? "bg-gray-50" : "text-gray-900", "relative cursor-default select-none py-2 pl-3 pr-9"]) }, [s("div", { class: u([x ? "font-semibold" : "font-normal", "relative block truncate"]) }, [s("span", ke, a(r.name), 1)], 2), x ? (p(), c("span", { key: 0, class: u([v ? "text-gray-600" : "text-gray-500", "absolute inset-y-0 right-0 flex items-center pr-4"]) }, [n(e(Q), { class: "h-5 w-5", "aria-hidden": "true" })], 2)) : y("", true)], 2)]), _: 1 }, 8, ["modelValue", "has-errors", "options", "placeholder"])]), n(g, { message: e(t).errors.applies_to_services }, null, 8, ["message"])])]), n(H, { "is-dirty": e(t).isDirty, processing: e(t).processing, "submit-text": e(i)("Create") }, { left: d(() => [s("button", { class: "inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2", onClick: w(U, ["prevent"]) }, a(l.$t("Cancel")), 1)]), _: 1 }, 8, ["is-dirty", "processing", "submit-text"])], 32)]), _: 1 })], 64); 49 }; 50} }; 51export { 52 mt as default 53};
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.