<style>
    #config-division-users {
        width: 100%;
        padding-top: 0.7em;
    }
</style>

<table class="lmsbox lms-ui-background-cycle">
    <colgroup>
        <col style="width: 1%;">
        <col style="width: 98%;">
        <col style="width: 1%;">
        <col style="width: 1%;">
    </colgroup>
    <thead>
    <tr style="background-color: #B6A688;">
        <td class="bold" colspan="3">
            #2 {trans("Division configuration variable parameters")} ({trans('overwrite parameters from panel #1')})
        </td>
        <td>
            {button type="link-button" href="?m=configadd&refconfigid={$config.id}&reftype=division&action=init" icon="add" label="Add" tip="Add config for division"}
        </td>
    </tr>
    <tr>
        <td class="nobr bold">
            {trans("Division:")}
        </td>
        <td class="nobr bold">
            {trans("Comment:")} / {trans("Users:")}
        </td>
        <td class="nobr bold">
            {trans("Value:")}
        </td>
        <td class="nobr" align="right">
            &nbsp;
        </td>
    </tr>
    </thead>
    <tbody>
    {foreach $relatedoptions.divisions as $relatedoption}
        <tr class="highlight {if $relatedoption.disabled} blend{/if}" data-target-url="?m=configedit&id={$relatedoption.id}">
            <td class="valign-top" style="padding-top: 1em;">
                <strong>{$relatedoption.shortname|escape}</strong><br>
            </td>
            <td class="nobr valign-top" style="padding-top: 1em;">
                {$relatedoption.description} <br><br>
                <div>
                    {include file="config/configdivisionusers.html"}
                </div>
            </td>
            <td class="nobr valign-top" align="center" style="padding-top: 1em;">
                {$relatedoption.value}
            </td>
            <td class="lms-ui-buttons text-right nobr valign-top">
                {if $relatedoption.disabled}
                    {button type="link" icon="disconnected" tip="Enable" href="?m=configedit&id={$relatedoption.id}&statuschange=1"}
                {else}
                    {button type="link" icon="connected" tip="Disable" href="?m=configedit&id={$relatedoption.id}&statuschange=1"}
                {/if}
                {button type="link" icon="delete" class="delete-config" tip="Delete" href="?m=configdel&id={$relatedoption.id}"}
                {button type="link" icon="edit" tip="Edit" href="?m=configedit&id={$relatedoption.id}&action=init"}
            </td>
        </tr>
    {foreachelse}
        <tr>
            <td colspan="4" class="empty-table" align="center">
                <strong>{trans("No data")}</strong>
            </td>
        </tr>
    {/foreach}
    </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;
});

</script>
