PageSourceSearch

https://portal.godesignguru.com/build/assets/BillingTaxSettingIndex-BvbN2om7.js

js godesignguru.com collected 2026-10-04 05:50:32 UTC 18,824 bytes, 102 lines download raw bytes

1import { _ as re } from "./FilterDropdown-Bc7H-WkN.js";
2import { _ as P } from "./FullScreenDialog-C1EmHZW_.js";
3import { r as ne, _ as O } from "./ModalConfirmation-BptK8hn4.js";
4import { u as le } from "./LoaderIcon-BfI_LFZK.js";
5import { r as ie } from "./menu-DpWDC0YJ.js";
6import { r as ue } from "./PencilIcon-DF7D2KxS.js";
7import { r as me } from "./TrashIcon-7IRzqwUc.js";
8import { o as d, i as q, f as x, e as m, u as t, a as e, t as s, d as h, G as B, c as v, b as M, F as S, r as z, g as D, aa as de, h as ce, j as Z, z as pe, w as U, D as G, C as R, v as xe, m as ve, l as W, n as fe, H, s as L, q as J } from "./app-yg_pP4S4.js";
9import { G as ge, j as ye, y as be } from "./popover-DTQdCRwt.js";
10import { _ as Y } from "./InputError-c3Vl2Z79.js";
11import { s as ee, M as K } from "./LiveChat-BEmWJs6j.js";
12import { _ as he } from "./Table-D1P44re1.js";
13import { _ as _e } from "./DashboardLayout-CXf_hhYT.js";
14import { a as Q } from "./functions-DLrKIvnr.js";
15import { b as we, d as Ce } from "./index-CDyB1Hog.js";
16import { aW as ke } from "./XMarkIcon-C7ztHuKP.js";
17import "./MinusIcon-C5ZUuSoW.js";
18import "./BaseButton-DP1PFEmO.js";
19import "./_plugin-vue_export-helper-DlAUqK2U.js";
20import "./use-text-value-9Z6g_4jd.js";
21import "./use-tree-walker-DC0osvAV.js";
22import "./ApplicationLogo-D4QkytOJ.js";
23import "./UserAvatar-B3-R1wxh.js";
24import "./consts-7Qk9bpse.js";
25import "./form-BcDj1t5Y.js";
26import "./BaseInput-DrEncIoW.js";
27import "./index-BF2h0ubX.js";
28import "./CheckIcon-Bb6ppPFl.js";
29import "./modelWrapper-D0DowOi8.js";
30import "./TablePagination-CoQin-sh.js";
31import "./listbox-BVei8WBz.js";
32import "./ChevronUpDownIcon-D7fhXTZr.js";
33import "./CheckIcon-CfE0icDF.js";
34import "./ChevronRightIcon-f6ucdGu7.js";
35import "./ArrowUpIcon-c4MStV6E.js";
36import "./BaseModal-lnT_D81c.js";
37import "./EyeIcon-C30yl1ND.js";
38import "./HomeIcon-B7IW8yDA.js";
39import "./vue-transitions-DxcThSkT.js";
40import "./ClockIcon-DWc8x_ii.js";
41const $e = { class: "sr-only" }, Be = { __name: "BillingTaxActionsDropdown", props: { tax: { type: Object, required: true } }, emits: ["delete", "edit"], setup(g, { emit: C }) {
42  const o = C, _ = B(false), { trigger: a, popper: c } = le({ placement: "bottom-end", strategy: "fixed" });
43  return (b, y) => (d(), q(t(be), { as: "div", class: "relative mr-6 max-lg:mr-2" }, { default: x(() => [m(t(ge), { ref_key: "popoverButton", ref: a, as: "template" }, { default: x(() => [e("button", { type: "button", class: "relative inline-flex items-center rounded-md p-1 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-10 max-lg:p-2.5", onClick: y[0] || (y[0] = (p) => _.value = !_.value) }, [e("span", $e, s(b.$t("Sales tax actions")), 1), m(t(ie), { class: "h-6 w-6" })])]), _: 1 }, 512), m(t(ye), { ref_key: "popoverPanel", ref: c, class: "z-20 rounded border bg-white shadow-lg" }, { default: x(() => [e("button", { type: "button", class: "group flex w-48 cursor-pointer items-center rounded-md px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-700", onClick: y[
431] || (y[1] = (p) => o("edit", g.tax)) }, [m(t(ue), { class: "mr-2 h-5 w-5 text-gray-400 hover:text-gray-500" }), h(" " + s(b.$t("Edit")), 1)]), e("button", { type: "button", class: "group flex w-48 cursor-pointer items-center rounded-md px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-700", onClick: y[2] || (y[2] = (p) => o("delete", g.tax)) }, [m(t(me), { class: "mr-2 h-5 w-5 text-gray-400 hover:text-gray-500" }), h(" " + s(b.$t("Delete")), 1)])]), _: 1 }, 512)]), _: 1 }));
44} }, Me = { key: 0, class: "text-sm font-normal text-gray-900" }, Se = { key: 1 }, De = { __name: "BillingTaxCountries", props: { countries: { required: true, type: Array } }, setup(g) {
45  const C = g, o = B(false), _ = D(() => C.countries.slice(1));
46  return (a, c) => (d(), v(S, null, [g.countries.length > 0 ? (d(), v("div", Me, [h(s(g.countries.at(0).name) + " ", 1), g.countries.length - 1 >= 1 ? (d(), v("span", { key: 0, class: "cursor-pointer text-sm font-normal text-blue-600", onClick: c[0] || (c[0] = (b) => o.value = !o.value) }, " +" + s(g.countries.length - 1), 1)) : M("", true)])) : M("", true), o.value ? (d(), v("div", Se, [(d(true), v(S, null, z(_.value, (b) => (d(), v("div", { key: b.id, class: "text-sm font-normal text-gray-900" }, s(b.name), 1))), 128))])) : M("", true)], 64));
47} }, Ve = { class: "text-left" }, Te = { for: "name", class: "block text-sm font-medium text-gray-700" }, Ae = { class: "text-xs font-normal text-gray-500" }, Ee = { class: "mt-1" }, je = { class: "mt-4" }, Fe = { for: "rate", class: "block text-sm font-medium text-gray-700" }, Oe = { class: "text-xs font-normal text-gray-500" }, Ue = { class: "relative mt-1" }, Ye = { class: "mt-4" }, qe = { for: "countries", class: "block text-sm font-medium text-gray-700" }, ze = { class: "text-xs font-normal text-gray-500" }, Ie = { class: "mt-1" }, Ne = { key: 0, class: "mt-4" }, Pe = { class: "flex items-center justify-between" }, Ge = { for: "divisions", class: "block text-sm font-medium text-gray-700" }, Re = { class: "flex items-center gap-2" }, We = { class: "text-xs font-normal text-gray-500" }, He = { key: 0, class: "text-xs font-normal text-amber-600" }, Le = { class: "mt-1 max-h-64 overflow-y-auto rounded-md border border-gray-300 bg-white p-3" }, Je = { class: "space-y-4" }, Ke = { class: "text-xs font-medium text-gray-500" }, Qe = ["onUpdate:modelValue", "value"], Xe = { class: "text-sm text-gray-700" }, X = { __name: "BillingTaxFormFields", props: ve({ countriesOptions: { type: Array, required: true }, multiSelectClasses: { type: Object, required: true } }, { modelValue: { type: Object, required: true }, modelModifiers: {} }), emits: ["update:modelValue"], setup(g) {
48  const C = g, { countriesOptions: o, multiSelectClasses: _ } = de(C), a = ce(g, "modelValue"), { t: c } = Z(), b = D(() => ({ ..._.value, container: "multiselect relative mx-auto w-full flex items-center justify-end box-border cursor-pointer border border-red-300 rounded-md bg-white text-base leading-snug outline-none", containerActive: "multiselect relative mx-auto w-full flex items-center justify-end box-border cursor-pointer border border-red-500 rounded-md bg-white text-base leading-snug outline-none ring-1 ring-red-500" })), y = D(() => (a.value.countries ?? []).map((u) => o.value.find((r) => r.value === u)).filter(Boolean)), p = D(() => y.value.map((u) => ({ name: u.value, label: u.label, divisions: (u.divisions ?? []).slice().sort((r, i) => r.localeCompare(i)) }))), k = D(() => p.value.some((u) => {
49    var _a;
50    const r = ((_a = a.value.divisionsByCountry) == null ? void 0 : _a[u.name]) ?? [];
51    return Array.isArray(r) && r.length === 0;
52  }));
53  pe(p, (u) => {
54    (!a.value.divisionsByCountry || typeof a.value.divisionsByCountry != "object") && (a.value.divisionsByCountry = {});
55    const r = {};
56    u.forEach((i) => {
57      const w = a.value.divisionsByCountry[i.name];
58      if (!Array.isArray(w)) {
59        r[i.name] = [...i.divisions];
60        return;
61      }
62      r[i.name] = w.filter((E) => i.divisions.includes(E));
63    }), a.value.divisionsByCountry = r;
64  }, { immediate: true });
65  const V = () => {
66    a.value.divisionsByCountry = p.value.reduce((u, r) => (u[r.name] = [...r.divisions], u), {});
67  }, T = () => {
68    a.value.divisionsByCountry = p.value.reduce((u, r) => (u[r.name] = [], u), {});
69  };
70  return (u, r) => {
71    var _a, _b, _c, _d, _e2, _f;
72    return d(), v("div", Ve, [e("div", null, [e("label", Te, s(t(c)("Tax name")), 1), e("p", Ae, s(t(c)("This tax name will be displayed in your invoices")), 1), e("div", Ee, [U(e("input", { id: "name", "onUpdate:modelValue": r[0] || (r[0] = (i) => a.value.name = i), type: "text", name: "name", autocomplete: "off", class: R(["block w-full rounded-md shadow-sm focus:border-primary-500 focus:ring-primary-500 sm:text-sm", ((_a = a.value.errors) == null ? void 0 : _a.name) ? "border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500" : "border-gray-300"]) }, null, 2), [[G, a.value.name]])]), m(Y, { message: (_b = a.value.errors) == null ? void 0 : _b.name }, null, 8, ["message"])]), e("div", je, [e("label", Fe, s(t(c)("Tax rate")), 1
72), e("p", Oe, s(t(c)("The tax rate is applied to the total price in your invoices")), 1), e("div", Ue, [U(e("input", { id: "rate", "onUpdate:modelValue": r[1] || (r[1] = (i) => a.value.rate = i), type: "number", name: "rate", step: "0.1", autocomplete: "off", class: R(["block w-full rounded-md pr-7 focus:border-primary-500 focus:ring-primary-500 sm:text-sm", ((_c = a.value.errors) == null ? void 0 : _c.rate) ? "border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500" : "border-gray-300"]), "aria-describedby": "rate-percent" }, null, 2), [[G, a.value.rate]]), r[3] || (r[3] = e("div", { class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" }, [e("span", { id: "rate-percent", class: "text-gray-500 sm:text-sm" }, " % ")], -1))]), m(Y, { message: (_d = a.value.errors) == null ? void 0 : _d.rate }, null, 8, ["message"])]), e("div", Ye, [e("label", qe, s(t(c)("Countries")), 1), e("p", ze, s(t(c)("Select the countries or region the sales tax will apply to")), 1), e("div", Ie, [m(t(ee), { id: "countries", modelValue: a.value.countries, "onUpdate:modelValue": r[2] || (r[2] = (i) => a.value.countries = i), name: "countries", options: t(o), searchable: true, classes: ((_e2 = a.value.errors) == null ? void 0 : _e2.countries) ? b.value : t(_), mode: "tags", autocomplete: "off" }, null, 8, ["modelValue", "options", "classes"])]), m(Y, { message: (_f = a.value.errors) == null ? void 0 : _f.countries }, null, 8, ["message"])]), p.value.length ? (d(), v("div", Ne, [e("div", Pe, [e("label", Ge, s(t(c)("States/Provinces")), 1), e("div", Re, [e("button", { type: "button", class: "text-xs font-medium text-primary-600 hover:text-primary-500", onClick: V }, s(t(c)("Select all")), 1), e("button", { type: "button", class: "text-xs font-medium text-red-600 hover:text-red-500", onClick: T }, s(t(c)("Deselect all")), 1)])]), e("p", We, s(t(c)("Select the states or provinces where this tax applies")), 1), k.value ? (d(), v("p", He, s(t(c)("If no state or province is selected, the tax applies to the whole country.")), 1)) : M("", true), e("div", Le, [e("div", Je, [(d(true), v(S, null, z(p.value, (i) => (d(), v("div", { key: i.name, class: "space-y-2" }, [e("p", Ke, s(i.label), 1), (d(true), v(S, null, z(i.divisions, (w) => (d(), v("label", { key: w, class: "flex cursor-pointer items-center gap-3 rounded-md p-2 hover:bg-gray-50" }, [U(e("input", { "onUpdate:modelValue": (A) => a.value.divisionsByCountry[i.name] = A, type: "checkbox", value: w, class: "h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500" }, null, 8, Qe), [[xe, a.value.divisionsByCountry[i.name]]]), e("span", Xe, s(w), 1)]))), 128))]))), 128))])])])) : M("", true)]);
73  };
74} }, Ze = { class: "p-6 sm:flex" }, et = { class: "table-cell w-full truncate py-4 pl-6 pr-8 text-sm text-gray-900 max-lg:relative max-lg:max-w-0 max-lg:py-3 max-lg:pl-4 max-lg:pr-2 sm:max-lg:pl-6 lg:w-3/12" }, tt = { class: "lg:hidden" }, st = ["onClick"], ot = { class: "mt-0.5 truncate text-xs leading-5 text-gray-500" }, at = { class: "text-sm max-lg:hidden" }, rt = ["onClick"], nt = { class: "hidden w-4/12 py-4 pr-8 text-sm text-gray-700 lg:table-cell" }, lt = { class: "hidden w-2/12 py-4 pr-8 text-sm text-gray-700 lg:table-cell" }, it = { class: "hidden w-2/12 py-4 pr-8 text-sm text-gray-700 lg:table-cell" }, ut = { class: "w-1/12 text-right" }, mt = { class: "mb-3 text-xl font-semibold text-gray-900" }, dt = { class: "mb-5 text-gray-500" }, ct = { class: "max-sm:min-h-0 max-sm:flex-1 max-sm:overflow-y-auto max-sm:p-4 max-lg:[&_button[aria-haspopup=listbox]]:min-h-11 max-lg:[&_input]:text-base max-lg:[&_select]:text-base max-lg:[&_textarea]:text-base" }, pt = { class: "max-sm:min-h-0 max-sm:flex-1 max-sm:overflow-y-auto max-sm:p-4 max-lg:[&_button[aria-haspopup=listbox]]:min-h-11 max-lg:[&_input]:text-base max-lg:[&_select]:text-base max-lg:[&_textarea]:text-base" }, ss = { __name: "BillingTaxSettingIndex", props: { taxes: { type: Object }, countries: { type: Array } }, setup(g) {
75  const C = g, { t: o } = Z(), _ = we(Ce).smaller("sm"), a = [{ label: o("Settings"), url: route("settings.modules.index") }, { label: o("Modules and extensions"), url: route("settings.modules.index") }, { label: o("Billing"), url: route("settings.modules.billing.index") }, { label: o("Taxes") }], c = B([{ key: "name", label: o("Tax name"), headerClasses: "pl-6 w-full lg:w-3/12", showing: true, position: 1 }, { key: "countries", label: o("Applied to"), headerClasses: "w-4/12", showing: true, position: 2 }, { key: "rate", label: o("Tax rate"), headerClasses: "w-2/12", showing: true, position: 3 }, { key: "created_at", label: o("Created at"), headerClasses: "w-2/12", showing: true, position: 4 }]), b = [{ key: "countries", label: o("Applied to"), type: "tags", options: C.c
75ountries.map((l) => ({ value: l.name, label: l.name })), placeholder: o("Select"), component: ee }], y = W({ name: null, rate: null, countries: [], divisionsByCountry: {} }), p = W({ name: null, rate: null, countries: [], divisionsByCountry: {} }), k = B(false), V = B(false), T = B(false), u = B(null), r = B(null), i = D(() => C.countries.map((l) => ({ value: l.name, label: l.name, divisions: l.divisions ?? [] }))), w = (l, f) => {
76    const n = f.countries.reduce(($, F) => ((F == null ? void 0 : F.name) && ($[F.name] = F.divisions ?? []), $), {});
77    l.defaults({ name: f.name, rate: f.rate, countries: f.countries.map(($) => ($ == null ? void 0 : $.name) ?? $), divisionsByCountry: n }), l.reset();
78  }, A = (l) => {
79    const f = Object.assign(route().params, l);
80    return J.visit(route(route().current(), f), { preserveScroll: true, preserveState: true });
81  }, E = () => {
82    y.reset(), k.value = false;
83  }, te = () => {
84    y.transform((l) => ({ name: l.name, rate: l.rate, countries: l.divisionsByCountry })).post(route("settings.modules.billing.tax.store"), { preserveScroll: true, onSuccess: E });
85  }, j = (l) => {
86    u.value = l, w(p, l), V.value = true;
87  }, I = () => {
88    u.value = null, w(p, { name: null, rate: null, countries: [] }), V.value = false;
89  }, se = () => {
90    p.transform((l) => ({ name: l.name, rate: l.rate, countries: l.divisionsByCountry })).put(route("settings.modules.billing.tax.update", { tax: u.value.id }), { preserveScroll: true, onSuccess: I });
91  }, oe = (l) => {
92    r.value = l, T.value = true;
93  }, N = () => {
94    r.value = null, T.value = false;
95  }, ae = () => {
96    J.delete(route("settings.modules.billing.tax.destroy", { tax: r.value.id }), { onSuccess: N });
97  };
98  return (l, f) => (d(), v(S, null, [m(t(fe), { title: t(o)("Billing settings") }, null, 8, ["title"]), m(_e, { breadcrumbs: a, "show-footer": false, "wrapper-class": "max-lg:[&_input]:text-base max-lg:[&_textarea]:text-base max-lg:[&_select]:text-base max-lg:[&_button[aria-haspopup=listbox]]:min-h-11" }, { header: x(() => [h(s(t(o)("Taxes")), 1)]), actions: x(() => [e("button", { type: "button", class: "ml-3 inline-flex items-center rounded-md border border-transparent bg-primary-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2", onClick: f[0] || (f[0] = (n) => k.value = !k.value) }, s(t(o)("Create tax")), 1)]), default: x(() => [e("div", Ze, [m(re, { inputs: b, onFiltersChanged: A })]), m(he, { class: "sm:max-lg:[&_.normal-row:first-child]:border-t-0 max-sm:[&_.normal-row~.normal-row>td]:border-t max-lg:[&_thead]:hidden", data: g.taxes, columns: c.value, "sortable-columns": ["created_at"], paginated: "", expandable: "", onSort
98Updated: A }, { name: x(({ item: n }) => [e("td", et, [e("div", tt, [e("button", { type: "button", class: "block w-full truncate text-left font-medium leading-5 text-gray-900 after:absolute after:inset-0 after:content-['']", onClick: ($) => j(n) }, s(n.name), 9, st), e("div", ot, [h(s(n.rate) + " % ", 1), n.countries.length > 0 ? (d(), v(S, { key: 0 }, [h(" \xB7 " + s(n.countries[0].name) + " ", 1), n.countries.length > 1 ? (d(), v(S, { key: 0 }, [h(" +" + s(n.countries.length - 1), 1)], 64)) : M("", true)], 64)) : M("", true), h(" \xB7 " + s(t(Q)(n.created_at, "MMM D, YYYY")), 1)])]), e("div", at, [e("div", { class: "cursor-pointer truncate font-medium leading-5 text-gray-900 hover:text-primary-600", onClick: ($) => j(n) }, s(n.name), 9, rt)])])]), countries: x(({ item: n }) => [e("td", nt, [m(De, { countries: n.countries }, null, 8, ["countries"])])]), rate: x(({ item: n }) => [e("td", lt, s(n.rate) + " % ", 1)]), created_at: x(({ item: n }) => [e("td", it, s(t(Q)(n.created_at, "MMM D, YYYY")), 1)]), expandable: x(({ item: n }) => [e("td", ut, [m(Be, { tax: n, onDelete: oe, onEdit: j }, null, 8, ["tax"])])]), "empty-state": x(() => [m(t(ke), { class: "mx-auto mb-5 h-12 w-12 stroke-1 text-gray-400" }), e("h3", mt, s(t(o)("No tax yet")), 1), e("p", dt, s(t(o)("Get started by creating a new tax.")), 1
98), e("button", { type: "button", class: "ml-3 inline-flex items-center rounded-md border border-transparent bg-primary-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2", onClick: f[1] || (f[1] = (n) => k.value = !k.value) }, [m(t(ne), { class: "mr-3 h-5 w-5" }), h(" " + s(t(o)("Create tax")), 1)])]), _: 1 }, 8, ["data", "columns"]), (d(), q(H(t(_) ? P : O), { open: k.value, title: t(o)("Create tax"), "confirm-text": t(o)("Save changes"), size: "md", onConfirmed: te, onClosed: E }, { content: x(() => [e("div", ct, [m(X, { modelValue: t(y), "onUpdate:modelValue": f[2] || (f[2] = (n) => L(y) ? y.value = n : null), "countries-options": i.value, "multi-select-classes": t(K) }, null, 8, ["modelValue", "countries-options", "multi-select-classes"])])]), _: 1 }, 40, ["open", "title", "confirm-text"])), (d(), q(H(t(_) ? P : O), { open: V.value, title: t(o)("Edit tax"), "confirm-text": t(o)("Save changes"), size: "md", onConfirmed: se, onClosed: I }, { content: x(() => [e("div", pt, [m(X, { modelValue: t(p), "onUpdate:modelValue": f[3] || (f[3] = (n) => L(p) ? p.value = n : null), "countries-options": i.value, "multi-select-classes": t(K) }, null, 8, ["modelValue", "countries-options", "multi-select-classes"])])]), _: 1 }, 40, ["open", "title", "confirm-text"])), m(O, { color: "red", open: T.value, "confirm-text": t(o)("Delete tax"), onConfirmed: ae, onClosed: N }, { title: x(() => [h(s(t(o)("Delete tax?")), 1)]), content: x(() => [h(s(t(o)("Are you sure you want to delete this tax?")), 1)]), _: 1 }, 8, ["open", "confirm-text"])]), _: 1 })], 64));
99} };
100export {
101  ss as default
102};

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.