<!---
* Edited by:     Nermin Jukan, 63150367
* Date:          21. 05. 2018
* Modifications: Added a new attribute that is passed on to the delete function 'dialect.location_name' on line 43.

--->

<div class="container">
    <div class="row">
        <div class="col-xs-12">
            <div class="toolbar" style="left:0px;">
                <button type="button" ng-click="$ctrl.go('/login')" class="btn btn-warning">Odjava</button>
                <!--<img src="/resources/icons/logout.png" height="32" style="cursor:pointer;" ng-click="$ctrl.go('/login')" title="Odjava">-->
                <img src="../resources/icons/users.png" height="32" style="cursor:pointer;" ng-click="$ctrl.go('/users')" title="Uporabniki">
                <img src="../resources/icons/lock.png" height="32" style="cursor:pointer;" ng-click="$ctrl.go('/password')" title="Menjava gesla">
            </div>
            <h1>Urejevalnik narečnih besedil</h1>
            <div class="toolbar">
                <button type="button" ng-click="$ctrl.createNew()" class="btn btn-primary save">Dodaj nov vnos</button>
            </div>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <table class="table table-striped">
            <thead>
                <tr bgcolor='#CCCCCC'>
                    <th>#</th>
                    <th>Kratica</th>
                    <th>Kraj</th>
                    <th>Narečje</th>
                    <th>Urejanje</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="dialect in $ctrl.dialects | orderBy: 'location_name'">
                    <td>{{ $index + 1 }}</td>
                    <td>{{dialect.location_label}}</td>
                    <td>{{dialect.location_name}}</td>
                    <td ng-repeat="x in $ctrl.selectItems" ng-if="x.key === dialect.dialect_key">
                        {{x.name}}
                    </td>
                    <td>
                        <a href="#!/edit/{{dialect.id}}">Uredi</a> | <a href="" ng-click="$ctrl.delete(dialect.id, dialect.location_name)">Izbriši</a>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
