<table class="lmsbox lms-ui-background-cycle">
    <colgroup>
        <col style="width: 1%;">
        <col style="width: 1%;">
        <col style="width: 98%;">
        <col style="width: 1%;">
        <col style="width: 1%;">
    </colgroup>
    <thead>
        <tr style="background-color: #B6A688;" class="configdivisionusers_header">
            <td class="bold" colspan="4">
                {if $reftype == division}
                    #2 {trans("User in division configuration variable parameters")} ({trans('overwrite parameters from panel #1')})
                {else}
                    #3 {trans("User in division configuration variable parameters")} ({trans('overwrite parameters from panel #2 and panel #1')})
                {/if}
            </td>
            <td>
                {if $reftype == division}
                    {button type="link-button" href="?m=configadd&refconfigid={$config.id}&divisionid={$divisioninfo.id}&reftype=divisionuser&action=init" icon="add" label="Add" tip="Add config for user in division"}
                {else}
                    {button type="link-button" href="?m=configadd&refconfigid={$relatedoption.id}&divisionid={$relatedoption.divisionid}&reftype=divisionuser&action=init" icon="add" label="Add" tip="Add config for user in division"}
                {/if}
            </td>
        </tr>
        <tr class="configdivisionusers_header">
            <td class="nobr bold">
                <strong>{trans("Login:")}</strong>
            </td>
            <td class="nobr bold">
                {trans("First/last name:")}
            </td>
            <td class="nobr bold">
                {trans("Comment:")}
            </td>
            <td class="nobr bold">
                {trans("Value:")}
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </thead>
    <tbody>
        {if $reftype == division}
            {foreach $relatedoptions.divisions[0].users as $relatedoptionuser}
                <tr class="highlight {if $relatedoptionuser.disabled} blend{/if}" data-target-url="?m=configedit&id={$relatedoptionuser.id}">
                    <td class="nobr">
                        <strong>{$relatedoptionuser.login}</strong><br>
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.name|escape}
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.description}
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.value}
                    </td>
                    <td class="lms-ui-buttons text-right nobr">
                        {if $relatedoptionuser.disabled}
                            {button type="link" icon="disconnected" tip="Enable" href="?m=configedit&id={$relatedoptionuser.id}&statuschange=1"}
                        {else}
                            {button type="link" icon="connected" tip="Disable" href="?m=configedit&id={$relatedoptionuser.id}&statuschange=1"}
                        {/if}
                        {button type="link" icon="delete" class="delete-config" tip="Delete" href="?m=configdel&id={$relatedoptionuser.id}"}
                        {button type="link" icon="edit" tip="Edit" href="?m=configedit&id={$relatedoptionuser.id}&action=init"}
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td colspan="5" class="fall" align="center">
                        <p><strong>{t}No data{/t}</strong></p>
                    </td>
                </tr>
            {/foreach}
        {else}
            {foreach $relatedoption.users as $relatedoptionuser}
                <tr class="highlight {if $relatedoptionuser.disabled} blend{/if}" data-target-url="?m=configedit&id={$relatedoptionuser.id}">
                    <td class="nobr">
                        <strong>{$relatedoptionuser.login}</strong><br>
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.name|escape}
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.description}
                    </td>
                    <td class="nobr">
                        {$relatedoptionuser.value}
                    </td>
                    <td class="lms-ui-buttons text-right nobr">
                        {if $relatedoptionuser.disabled}
                            {button type="link" icon="disconnected" tip="Enable" href="?m=configedit&id={$relatedoptionuser.id}&statuschange=1"}
                        {else}
                            {button type="link" icon="connected" tip="Disable" href="?m=configedit&id={$relatedoptionuser.id}&statuschange=1"}
                        {/if}
                        {button type="link" icon="delete" class="delete-config" tip="Delete" href="?m=configdel&id={$relatedoptionuser.id}"}
                        {button type="link" icon="edit" tip="Edit" href="?m=configedit&id={$relatedoptionuser.id}&action=init"}
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td colspan="5" class="empty-table" align="center">
                        <strong>{trans("No data")}</strong>
                    </td>
                </tr>
            {/foreach}
        {/if}
    </tbody>
</table>

<script>

$('.delete-config').click(function() {
    confirmDialog($t("Are you sure, you want to delete?"), this).done(function() {
        location.href = $(this).attr('href');
    });
    return false;
});

$(function () {
    $('.configdivisionusers_header').css('color', 'black');
});

</script>
