feat: implement apply bank address buttons

master
Katja Lutz 1 year ago
parent e0f5a05c3a
commit f501579644

@ -71,4 +71,12 @@ const Address: Component<{ address: PostalAddressData }> = (props) => (
</>
);
export const applyAddress = (target: AddressData, values: AddressData) => {
target.name = values.name;
target.line1 = values.line1;
target.line2 = values.line2;
target.zip = values.zip;
target.city = values.city;
};
export default Address;

@ -12,7 +12,7 @@ import {
onCleanup,
mergeProps,
} from "solid-js";
import { createStore, reconcile, unwrap } from "solid-js/store";
import { createStore, produce, reconcile, unwrap } from "solid-js/store";
import { format, fromUnixTime, getUnixTime } from "date-fns";
import z from "myzod";
import Big from "big.js";
@ -52,7 +52,11 @@ import {
storeSchema,
UiStoreContext,
} from "~/stores";
import { isStructuredAddress, PostalAddressData } from "../Address";
import {
applyAddress,
isStructuredAddress,
PostalAddressData,
} from "../Address";
import PositionsIcon from "~icons/carbon/show-data-cards";
import YouIcon from "~icons/carbon/face-wink";
import DesignIcon from "~icons/carbon/paint-brush";
@ -603,6 +607,23 @@ const SettingsOverlay: Component = () => {
}}
address={() => localState.customAddress}
/>
<div class="col-span-2">
<button
class="btn btn-xs btn-accent btn-block"
onClick={() => {
setLocalState(
produce((s) => {
applyAddress(
s.customAddress,
localState.creditor
);
})
);
}}
>
Von Bank Verbindung übernehmen
</button>
</div>
</AccordionItemGrid>
</Show>
</div>
@ -727,6 +748,23 @@ const SettingsOverlay: Component = () => {
setter={createCustomerAddressSetter(true)}
address={() => state.customer.alternativeAddress}
/>
<div class="col-span-2">
<button
class="btn btn-xs btn-accent btn-block"
onClick={() => {
setState(
produce((s) => {
applyAddress(
s.customer.alternativeAddress,
state.customer.debtorAddress
);
})
);
}}
>
Von Bank Verbindung übernehmen
</button>
</div>
</AccordionItemGrid>
</Show>
</div>

Loading…
Cancel
Save