Skip to content

Commit

Permalink
Merge pull request #2158 from invoiceninja/INV2-1651-2
Browse files Browse the repository at this point in the history
(EU) Expose threshold setting
  • Loading branch information
beganovich authored Nov 4, 2024
2 parents 5699015 + 7fa82c2 commit a24fc87
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ export function AURegions() {
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.AU.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.AU.subregions.${value[0]}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useHandleCurrentCompanyChangeProperty } from '$app/pages/settings/commo
import { ChangeEvent, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EditSubRegionModal } from './EditSubRegionModal';
import Toggle from '$app/components/forms/Toggle';

export function EURegions() {
const [t] = useTranslation();
Expand Down Expand Up @@ -47,6 +48,8 @@ export function EURegions() {
};

const divClickIntercept = (id: string) => {
console.log(id);

const checkbox = document.getElementById(id.replace('.apply_tax', ''));
checkbox?.click();
};
Expand Down Expand Up @@ -94,15 +97,19 @@ export function EURegions() {
regions?.map((value: [string, TaxSetting], index) => (
<div
key={index}
className="border py-4 sm:py-3 sm:grid sm:grid-cols-3 sm:gap-10 flex flex-col lg:flex-row undefined px-5 sm:px-6 lg:items-center"
className="border py-4 sm:py-3 sm:grid sm:grid-cols-3 sm:gap-10 flex flex-col lg:flex-row undefined px-5 sm:px-6 lg:items-center text-sm"
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.EU.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.EU.subregions.${value[0]}`}
Expand Down Expand Up @@ -155,6 +162,20 @@ export function EURegions() {
subregion={subRegion}
taxSetting={taxSetting}
/>

<Element
leftSide={<p className="lg:pl-5">(EU) {t('sales_above_threshold')}</p>}
>
<Toggle
id="tax_data.regions.EU.has_sales_above_threshold"
checked={
companyChanges?.tax_data?.regions?.EU?.has_sales_above_threshold
}
onValueChange={(v) =>
handleChange('tax_data.regions.EU.has_sales_above_threshold', v)
}
/>
</Element>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,15 @@ export function USRegions() {
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.US.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.US.subregions.${value[0]}`}
Expand Down

0 comments on commit a24fc87

Please sign in to comment.