 <section class="content-header">
    <h1>
        {{phrase.Polls}}
    </h1>
</section>


<section class="content" ng-show="views.list">
  <a ng-click="changeView('add')" class="floatRTL btn btn-success btn-flat pull-right marginBottom15">{{phrase.addPoll}}</a>  
  <div class="box col-xs-12">
      <div class="box-header">
          <h3 class="box-title">{{phrase.listPolls}}</h3>
          <div class="box-tools">
              <div class="input-group">
                  <input type="text" name="table_search" ng-model="searchText" class="form-control input-sm pull-right" style="width: 150px;" placeholder="{{phrase.Search}}">
                  <div class="input-group-btn">
                      <button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
                  </div>
              </div>
          </div>
      </div>
      <div class="box-body table-responsive">
          <table class="table table-hover">
              <tbody><tr>
                  <th>{{phrase.ID}}</th>
                  <th>{{phrase.pollTitle}}</th>
                  <th>{{phrase.pollTarget}}</th>
                  <th>{{phrase.pollStatus}}</th>
                  <th>{{phrase.Operations}}</th>
              </tr>
              <tr ng-repeat="poll in polls | filter:searchText">
                  <td>{{poll.id}}</td>
                  <td>{{poll.pollTitle}}</td>
                  <td>{{poll.pollTarget}}</td>
                  <td><span ng-show="poll.pollStatus == '1'">{{phrase.Active}}</span><span ng-show="poll.pollStatus == '0'">{{phrase.Inactive}}</span></td>
                  <td>
                    <a ng-show="poll.pollStatus == '0'" ng-click="makeActive(poll.id)" type="button" class="btn btn-info btn-flat" title="{{phrase.Active}}" tooltip><i class="fa  fa-check-square-o"></i></a>
                    <a ng-click="edit(poll.id)" type="button" class="btn btn-info btn-flat" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></a>
                    <a ng-click="remove(poll,$index)" type="button" class="btn btn-danger btn-flat" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></a>
                  </td>
              </tr>
              <tr ng-show="!polls.length"><td class="noTableData" colspan="4">{{phrase.noPolls}}</td></tr>
          </tbody></table>
      </div>
  </div>
</section>

<section class="content" ng-show="views.add">
  <a ng-click="changeView('list')" class="floatRTL btn btn-danger btn-flat pull-right marginBottom15">{{phrase.cancelAdd}}</a>  
  <div class="box col-xs-12">
    <div class="box-header">
        <h3 class="box-title">{{phrase.addPoll}}</h3>
    </div>
    <div class="box-body table-responsive">
      <form class="form-horizontal" name="addPoll" role="form" ng-submit="saveAdd()" novalidate>
        <div class="form-group" ng-class="{'has-error': addPoll.pollTitle.$invalid}">
          <label for="inputEmail3" class="col-sm-2 control-label">{{phrase.pollTitle}} * </label>
          <div class="col-sm-10">
            <input type="text" name="pollTitle" ng-model="form.pollTitle" class="form-control" required placeholder="{{phrase.pollTitle}}">
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword3" class="col-sm-2 control-label">{{phrase.pollOptions}}</label>
          <div class="col-sm-10">
            <a ng-click="addPollOption()" class="btn bg-olive marginBottom15 btn-flat">{{phrase.newOption}}</a>
            <ul>
              <li ng-repeat="option in form.pollOptions">{{option.title}} - <a ng-click="removePollOption(option,$index)">{{phrase.Remove}}</a></li>
            </ul>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': addPoll.pollTarget.$invalid}">
          <label for="inputPassword3" class="col-sm-2 control-label">{{phrase.pollTarget}}</label>
          <div class="col-sm-10">
            <select class="form-control" name="pollTarget" ng-model="form.pollTarget" required>
              <option value="all">{{phrase.all}}</option>
              <option value="teachers">{{phrase.teachers}}</option>
              <option value="students">{{phrase.students}}</option>
              <option value="parents">{{phrase.parents}}</option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" ng-disabled="addPoll.$invalid">{{phrase.addPoll}}</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</section>

<section class="content" ng-show="views.edit">
  <a ng-click="changeView('list')" class="floatRTL btn btn-danger btn-flat pull-right marginBottom15">{{phrase.cancelAdd}}</a>  
  <div class="box col-xs-12">
    <div class="box-header">
        <h3 class="box-title">{{phrase.editPoll}}</h3>
    </div>
    <div class="box-body table-responsive">
      <form class="form-horizontal" name="editPoll" role="form" ng-submit="saveEdit()" novalidate>
        <div class="form-group" ng-class="{'has-error': addPoll.pollTitle.$invalid}">
          <label for="inputEmail3" class="col-sm-2 control-label">{{phrase.pollTitle}} * </label>
          <div class="col-sm-10">
            <input type="text" name="pollTitle" ng-model="form.pollTitle" class="form-control" required placeholder="{{phrase.pollTitle}}">
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword3" class="col-sm-2 control-label">{{phrase.pollOptions}}</label>
          <div class="col-sm-10">
            <a ng-click="addPollOption()" class="btn bg-olive marginBottom15 btn-flat">{{phrase.newOption}}</a>
            <ul>
              <li ng-repeat="option in form.pollOptions">{{option.title}} - <a ng-click="removePollOption(option,$index)">{{phrase.Remove}}</a></li>
            </ul>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': addPoll.pollTarget.$invalid}">
          <label for="inputPassword3" class="col-sm-2 control-label">{{phrase.pollTarget}}</label>
          <div class="col-sm-10">
            <select class="form-control" name="pollTarget" ng-model="form.pollTarget" required>
              <option value="all">{{phrase.all}}</option>
              <option value="teachers">{{phrase.teachers}}</option>
              <option value="students">{{phrase.students}}</option>
              <option value="parents">{{phrase.parents}}</option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" ng-disabled="editPoll.$invalid">{{phrase.editPoll}}</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</section>