<vdr-action-bar>
    <vdr-ab-right>
        <vdr-action-bar-items locationId="seller-list"></vdr-action-bar-items>
        <a class="btn btn-primary" [routerLink]="['./create']" *vdrIfPermissions="['SuperAdmin', 'CreateSeller']">
            <clr-icon shape="plus"></clr-icon>
            {{ 'settings.create-new-seller' | translate }}
        </a>
    </vdr-ab-right>
</vdr-action-bar>

<vdr-data-table [items]="sellers$ | async">
    <vdr-dt-column></vdr-dt-column>
    <vdr-dt-column></vdr-dt-column>
    <vdr-dt-column></vdr-dt-column>
    <ng-template let-seller="item">
        <td class="left align-middle">
            {{ seller.name }}
        </td>
        <td class="right align-middle">
            <vdr-table-row-action
                iconShape="edit"
                [label]="'common.edit' | translate"
                [linkTo]="['./', seller.id]"
            ></vdr-table-row-action>
        </td>
        <td class="right align-middle">
            <vdr-dropdown>
                <button type="button" class="btn btn-link btn-sm" vdrDropdownTrigger>
                    {{ 'common.actions' | translate }}
                    <clr-icon shape="caret down"></clr-icon>
                </button>
                <vdr-dropdown-menu vdrPosition="bottom-right">
                    <button
                        type="button"
                        class="delete-button"
                        (click)="deleteSeller(seller.id)"
                        [disabled]="!(['SuperAdmin', 'DeleteSeller'] | hasPermission)"
                        vdrDropdownItem
                    >
                        <clr-icon shape="trash" class="is-danger"></clr-icon>
                        {{ 'common.delete' | translate }}
                    </button>
                </vdr-dropdown-menu>
            </vdr-dropdown>
        </td>
    </ng-template>
</vdr-data-table>
