<script lang="ts">
    import { _ } from "svelte-i18n"
    import { generalInfo } from "../../../store"
</script>

{#if $generalInfo && $generalInfo?.company?.companyAddresses}
    <div class="addresses">
        <div class="address-companyName">
            <strong>{$generalInfo?.company?.companyName}</strong>
        </div>
        <div class="address-list">
            {#each $generalInfo.company.companyAddresses as address}
                <div class="address">
                    {#if address.street && address.houseNumber}
                        <div class="address-item street">
                            <span>{address.street}</span>
                            <span>{address.houseNumber}</span>
                        </div>
                    {/if}
                    {#if address.postcode && address.city}
                        <div class="address-item city">
                            <span>{address.postcode}</span>
                            <span>{address.city}</span>
                        </div>
                    {/if}
                    {#if address.tel}
                        <div class="address-item tel">
                            <span>{$_("tel")}</span>
                            <span>{address.tel}</span>
                        </div>
                    {/if}
                    {#if address.fax}
                        <div class="address-item fax">
                            <span>{$_("fax")}</span>
                            <span>{address.fax}</span>
                        </div>
                    {/if}
                    {#if address.email}
                        <div class="address-item email">
                            <span>{$_("email")}</span>
                            <a href="mailto:{address.email}">{address.email}</a>
                        </div>
                    {/if}
                </div>
            {/each}
        </div>
    </div>
{/if}
