<script lang="ts">
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';

export let hide: boolean = true;
</script>


<div
    class="ae_comp__pres_mgmt_menu_opts w-full border-t border-gray-300 mt-1"
    class:hidden={hide}
    >
    <h2 class="text-sm font-semibold text-center pb-1">
        <button
            type="button"
            on:click={() => {
                $events_loc.pres_mgmt.hide__menu_opts = !$events_loc.pres_mgmt.hide__menu_opts;
            }}
            class="btn btn-sm variant-ghost-info"
            >
            {#if $events_loc.pres_mgmt.hide__menu_opts}
                <span class="fas fa-chevron-up m-1"></span>
            {:else}
                <span class="fas fa-chevron-down m-1"></span>
            {/if}
            &AElig; Pres Mgmt Menu Options
            {#if $events_loc.pres_mgmt.hide__menu_opts}
                <span class="fas fa-chevron-up m-1"></span>
            {:else}
                <span class="fas fa-chevron-down m-1"></span>
            {/if}
        </button>
    </h2>

    <div
        class="flex flex-row gap-1 items-center justify-between"
        class:hidden={$events_loc.pres_mgmt.hide__menu_opts}
        >

        <div class="flex flex-row flex-wrap gap-1 items-center justify-evenly">

            {#if $ae_loc.authenticated_access}
                {#if !$events_loc.pres_mgmt.hide__session_msg}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.hide__session_msg = true;
                        }}
                        class="btn btn-sm variant-ghost-success"
                        >
                        <span class="fas fa-toggle-on m-1"></span>
                        Showing Session Message
                    </button>
                {:else}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.hide__session_msg = false;
                        }}
                        class="btn btn-sm variant-ringed-warning"
                        >
                        <span class="fas fa-toggle-off m-1"></span>
                        Show Session Message?
                    </button>
                {/if}
            {/if}

            {#if $ae_loc.authenticated_access}
                {#if !$events_loc.pres_mgmt.hide__session_code}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.hide__session_code = true;
                        }}
                        class="btn btn-sm variant-ghost-success"
                        >
                        <span class="fas fa-toggle-on m-1"></span>
                        Showing Session Code
                    </button>
                {:else}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.hide__session_code = false;
                        }}
                        class="btn btn-sm variant-ringed-warning"
                        >
                        <span class="fas fa-toggle-off m-1"></span>
                        Show Session Code?
                    </button>
                {/if}
            {/if}

            {#if $ae_loc.trusted_access}
                {#if $events_loc.pres_mgmt.show__copy_access_link}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show__copy_access_link = false;
                        }}
                        class="btn btn-sm variant-ghost-success"
                        >
                        <span class="fas fa-toggle-on m-1"></span>
                        Showing Copy Access Link
                    </button>
                {:else}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show__copy_access_link = true;
                        }}
                        class="btn btn-sm variant-ringed-warning"
                        >
                        <span class="fas fa-toggle-off m-1"></span>
                        Show Copy Access Link?
                    </button>
                {/if}
            {/if}

            {#if $ae_loc.trusted_access}
                {#if $events_loc.pres_mgmt.show__email_access_link}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show__email_access_link = false;
                        }}
                        class="btn btn-sm variant-ghost-success"
                        >
                        <span class="fas fa-toggle-on m-1"></span>
                        Showing Email Access Link
                    </button>
                {:else}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show__email_access_link = true;
                        }}
                        class="btn btn-sm variant-ringed-warning"
                        >
                        <span class="fas fa-toggle-off m-1"></span>
                        Show Email Access Link?
                    </button>
                {/if}
            {/if}


            {#if $ae_loc.authenticated_access}
                {#if $events_loc.pres_mgmt.show_content__session_qr}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show_content__session_qr = false;
                        }}
                        class="btn btn-sm variant-ghost-success"
                        >
                        <span class="fas fa-toggle-on m-1"></span>
                        Showing Session QR Code
                    </button>
                {:else}
                    <button
                        type="button"
                        on:click={() => {
                            $events_loc.pres_mgmt.show_content__session_qr = true;
                        }}
                        class="btn btn-sm variant-ringed-warning"
                        >
                        <span class="fas fa-toggle-off m-1"></span>
                        Show Session QR Code?
                    </button>
                {/if}
            {/if}

        </div>

        <div class="flex flex-row gap-1 items-center justify-evenly">
        {#if $ae_loc.trusted_access}
            {#if $ae_loc.edit_mode}
                <button
                    type="button"
                    on:click={() => {
                        $ae_loc.edit_mode = false;
                    }}
                    class="btn btn-sm variant-ghost-success"
                    >
                    <!-- <span class="fas fa-toggle-on m-1"></span> -->
                    <span class="fas fa-edit m-1"></span>
                    Edit Mode On
                </button>
            {:else}
                <button
                    type="button"
                    on:click={() => {
                        $ae_loc.edit_mode = true;
                    }}
                    class="btn btn-sm variant-ringed-warning"
                    >
                    <span class="fas fa-toggle-off m-1"></span>
                    <!-- <span class="fas fa-edit m-1"></span> -->
                    Edit Mode?
                </button>
            {/if}
        {/if}
        </div>

    </div>

</div>