<div class="content-wrapper" ng-if="!myAccess.tipList">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6 offset-sm-1 offset-md-2 offset-lg-3 mt-5">
                <div class="alert alert-warning alert-dismissible">
                    <h5><i class="icon fas fa-ban"></i> 	!</h5>
                    Unauthorised Access.
                </div>
            </div>
        </div>
    </div>
</div>
<div class="content-wrapper" ng-if="myAccess.tipList">
    <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> Tip List ({{tips.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">Tip</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,'tipAdd')" type="button" class="btn bg-indigo"><i class="fas fa-plus"></i> <span class="d-none d-lg-inline-block">Create Tip</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="tipList" class="table table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <th>Title</th>
                                        <th>Body</th>
                                        <th>Valid till</th>
                                        <th>Status</th>
										<th>View Image</th>
                                        <th>Actions</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="tip in tips">
                                        <td><span class="nowrap">{{tip.title | capitalize}}</span></td>
                                        <td>
                                            <span class="nowrap">{{tip.body | capitalize}}</span><br>
                                        </td>
                                        <td><span class="nowrap">{{tip.valid_till | datetz:'ll'}}</span></td>
                                        <td><span class="badge badge-{{tip.status == 'active' ? 'success' : 'danger'}}">{{tip.status | capitalize}}</span></td>
										<td>
                                           <div><a href="#" ng-click="viewImgModel(tip)">View Image</a></div>
                                        </td>
                                        <td>
                                            <div class="btn-group nowrap">
                                                <a ng-href="{{baseurl+'/tips/edit/'+tip.id}}">
                                                    <button type="button" class="btn bg-indigo">
                                                        <i class="fas fa-pen"></i> Edit
                                                    </button>
                                                </a>
                                            </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 Tip {{data.tip.title}}</h3>
            </div>
            <div class="modal-body" id="modal-body"><p>Are you sure to delete this tip</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>
    <script type="text/ng-template" id="Viewimg.html">
      <div class="">    
		 <div class="modal-body" id="modal-body" ng-repeat="a in tip">
			<a href="#" ng-if="a.uploadimage">   
			<img alt="{{a.uploadimage}}" ng-src="{{baseurl}}/app/uploads/{{a.uploadimage}}" style="width:770px;height:480px;" />
			</a>
			<span ng-if="a.uploadimage==''">No Image<span>
         </div>
         <div class="modal-footer">
            <button class="btn btn-default" type="button" ng-click="cancel()">Close</button>
         </div>
      </div>
    </script>