<div class="content-wrapper">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-indigo">
                        <go-back/>
                        <i class="fas fa-envelope"></i> Contact List ({{contacts.length}})
                    </h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a ng-href="{{baseurl}}/dashboard">Home</a></li>
                        <li class="breadcrumb-item active">Contacts</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card card-indigo card-outline">
                        <div class="card-header border-transparent">
                            <h3 class="card-title">&nbsp;</h3>
                            <div class="card-tools">
                                <div class="btn-group">
                                    <button ng-click="goTo($event,'contactAdd')" type="button" class="btn bg-indigo"><i class="fas fa-plus"></i> <span class="d-none d-lg-inline-block">Create Contact</span></button>
                                    <!--<button ng-click="goTo($event,'projectAdd')" type="button" class="btn btn-success"><i class="fas fa-table"></i> <span class="d-none d-lg-inline-block">Create Project</span></button>-->
                                    <button type="button" title="Fullscreen Toggle" class="btn btn-dark toggle-fullscreen"><i class="fas fa-expand"></i></button>
                                    <button type="button" class="btn btn-dark" data-widget="collapse"><i class="fas fa-minus"></i></button>
                                </div>
                            </div>
                        </div>
                        <div class="card-body p-0">
                            <div class="table table-responsive">
                                <table id="contactList" class="table table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Email / Mobile</th>
                                        <th>Account</th>
                                        <th>Status</th>
                                        <th>Actions</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="contact in contacts">
                                        <td><span class="nowrap">{{contact.first_name}}</span></td>
                                        <td>
                                            <span class="nowrap"><a href="{{'mailto:'+contact.email}}" target="_blank">{{contact.email}}</a></span><br>
                                            <span class=""><a target="_blank" href="{{'tel:+91'+contact.phone}}">{{contact.phone}}</a></span>
                                        </td>
                                        <!--<td><span class="nowrap">{{contact.first_name}}</span></td>-->
                                        <td><span class="nowrap pointer text-blue" ng-click="goToSelf('accountView',{accountid:contact.acc_id})" ><small class="fas fa-external-link-alt"></small> {{contact.acc_company_name}}</span></td>
                                        <td><span class="badge badge-success">Active</span></td>
                                        <td>
                                            <div class="btn-group nowrap">
                                                <button type="button" class="btn bg-indigo" ng-click="goToSelf('contactView',{contactid:contact.contactid})"><i class="fas fa-eye"></i> View</button>
                                                <button type="button" class="btn bg-indigo dropdown-toggle" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                    <span class="sr-only">Toggle Dropdown</span>
                                                </button>
                                                <div class="dropdown-menu dropdown-menu-right" role="menu">
                                                    <a class="dropdown-item" ng-href="{{baseurl+'/contacts/edit/'+contact.contactid}}"><i class="fas fa-pen"></i> Edit</a>
                                                    <div class="dropdown-divider"></div>
                                                    <button class="dropdown-item" ng-click="deleteContactModel(contact)"><i class="fas fa-trash"></i> Delete</button>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <script type="text/ng-template" id="DeleteContact.html">
        <div class="">
            <div class="modal-header bg-danger">
                <h3 class="modal-title" id="modal-title">Delete Contact {{data.contact.first_name}}</h3>
            </div>
            <div class="modal-body" id="modal-body"><p>Are you sure to delete this contact</p></div>
            <div class="modal-footer bg-danger">
                <button class="btn btn-default" type="button" ng-click="ok()">Yes</button>
                <button class="btn btn-primary" type="button" ng-click="cancel()">No</button>
            </div>
        </div>
    </script>
</div>
