<link rel="stylesheet" type="text/css" href="module/question/css/question.css" />
<section class="container inner-section user_page container ng-scope">
      <div class="sales_report">
            <div class="sales_report_in">
                  <div class="sales_card" ng-show="listFound">
                        <div class="container-fluid table_area">
                              <div class="col-md-12 clsrightcont sales_report" ng-show="listFound">
                                    <div class="panel">
                                          <div class="top_box">
                                                <div class="left_box select_tag_label">
                                                      <label>Select Tag</label>
                                                      <div class="input-group mb-3">

                                                      </div>
                                                </div>
                                                <div class="right_tag">
                                                      <div class="sear_tag">

                                                            <select name="clstime" class="select_tag form-control check" ng-model="formData.tag" ng-change="changeTag()" required select-option>
                                                                  <option value="" selected="">All</option>
                                                                  <option ng-repeat="tag in tagList" value={{tag.tag}}>{{tag.tag}}</option>
                                                            </select>
                                                      </div>
                                                </div>
                                                <div class="right_box">
                                                      <div class="sear">

                                                            <form class="row form_2">
                                                                  <div class="form-group col-sm-12 disable">
                                                                        <input type="search" ng-change="onSearchChange()" class="form-control" ng-model="formData.mymodel" name="Search" placeholder="Search"
                                                                              autocomplete="off" required>
                                                                  </div>
                                                            </form>
                                                      </div>
                                                      <div class="addbtn">
                                                            <button class="btn export" ng-click="addFun()">
                                                                  <p>Add</p>
                                                            </button>
                                                      </div>
                                                </div>
                                          </div>
                                          <table class="table table-fixed">
                                                <thead ng-if="sideselect.id == 1">
                                                      <tr>
                                                            <!-- <th class="col-xs-3" ng-repeat = "head in tblheading">{{head}}</th> -->
                                                            <th class="col-xs-1">S.no</th>
                                                            <th class="col-xs-2">Question Type</th>
                                                            <th class="col-xs-5">Question</th>
                                                            <th class="col-xs-2">Tag</th>
                                                            <th class="col-xs-2">Action</th>
                                                      </tr>
                                                </thead>
                                                <tbody>
                                                      <tr class="col-xs-12 pad-0" ng-repeat="question in  question_data " current-page="{{currentPage}}">
                                                            <td class="col-xs-1">{{pageSize * (currentPage-1)+$index+1}}</td>
                                                            <td class="col-xs-2">{{question.questiontype}}</td>
                                                            <td class="col-xs-5">{{question.questiontext}}</td>
                                                            <td class="col-xs-2">{{question.tag}}</td>
                                                            <td class="col-xs-2">
                                                                  <div ng-if="question.is_edit==1" class="clsicon deleteicon ion-edit" title="Edit" ng-click="editrow(question,$index)"></div>
                                                                  <div ng-if="question.is_edit!=1" class="clsicondis deleteicon ion-edit" title="Edit"></div>
                                                                  <div ng-if="question.is_edit==1" class="clsicon editicon ion-trash-a" title="Delete" ng-click="deleterow(question,$index)"></div>
                                                                  <div ng-if="question.is_edit!=1" class="clsicondis editicon ion-trash-a" title="Delete"></div>
                                                                  <div data-backdrop='static' data-toggle="modal" data-target="#myModal" ng-click="viewrow(question,$index)" class="editicon ion-eye ptr"
                                                                        title="View"></div>
                                                                  <!-- The Modal -->
                                                                  <div class="modal fade" id="myModal">
                                                                        <div class="modal-dialog">
                                                                              <div class="modal-content">
                                                                                    <!-- Modal Header -->

                                                                                    <div class="modal-header">
                                                                                          <h4 class="modal-title">
                                                                                                <b class="font_14">Question type: </b>{{view_question[0].questiontype}}</h4>
                                                                                          <button type="button" class="close" data-dismiss="modal">&times;</button>
                                                                                    </div>
                                                                                    <!-- Modal body -->
                                                                                    <!-- <div class="label_type">Question:</div> -->
                                                                                    <div class="modal-body model_left">
                                                                                          <b class="font_14">Question: </b>{{view_question[0].questiontext}}
                                                                                    </div>

                                                                                    <!-- <div class="check_box" ng-if="view_question[0].questiontypeid=='2' || view_question[0].questiontypeid=='6'"> -->
                                                                                    <div class="check_box">
                                                                                          <div class="label_type font_14">Answer:</div>
                                                                                          <div class="form-group-check-box" ng-repeat="questions in view_question[0].options">
                                                                                                <input type="checkbox" id="{{questions.optid}}" ng-checked='questions.iscorrect=="1"' disabled>
                                                                                                <label for="{{questions.optid}}">{{questions.opttext}}</label>
                                                                                          </div>
                                                                                          </form>
                                                                                    </div>
                                                                                    <!-- Modal footer -->
                                                                                    <div class="modal-footer">
                                                                                          <!-- <button type="button" class="btn_close btn btn-danger" data-dismiss="modal">Close</button> -->
                                                                                    </div>
                                                                              </div>
                                                                        </div>
                                                                  </div>
                                                            </td>
                                                      </tr>
                                                </tbody>
                                          </table>
                                    </div>
                                    <div class="container-fluid">
                                          <div class="row">
                                                <nav aria-label="Page navigation" id="div1">
                                                      <!-- <ul class="pager">
                              <li>
                                 <a href="#" aria-label="Previous">
                                 <span aria-hidden="true"><</span>
                                 </a>
                              </li>
                              <li><a href="#"  class="activeas">1</a></li>
                              <li><a href="#">2</a></li>
                              <li><a href="#">3</a></li>
                              <li><a href="#">4</a></li>
                              <li><a href="#">5</a></li>
                              <li>
                                 <a href="#" aria-label="Next">
                                 <span aria-hidden="true">></span>
                                 </a>
                              </li>
                              </ul> -->
                                                      <ul class="pagination pager" uib-pagination total-items="totalItems" ng-model="currentPage" ng-change="pageChanged()" max-size="maxSize"
                                                            boundary-links="true" rotate="false" num-pages="numPages" items-per-page="itemsPerPage"></ul>
                                                </nav>
                                          </div>
                                    </div>
                              </div>
                        </div>
                  </div>
                  <div ng-if="formLoad" class="profile_bg ng-scope">
                        <div ng-if="sideselect.id == 1" class="fix_height">
                              <div class="container-fluid pro_head ">
                                    <h3 class="box-title">{{formtitle}}</h3>
                                    <button type="button" class="close" ng-click="closeForm()">
                                          <span>×</span>
                                    </button>
                                    <!-- <span style="float:right; cursor:pointer">
                     <i style="color:#00AFD7; " class="icon ion-arrow-left-c"></i>
                     <a style="color:#00AFD7" ng-click="closeForm()">Back</a>
                     </span> -->
                              </div>
                              <div class="wrapper">
                                    <form name="categoryform" class="fix_height" ng-submit="questionSubmit()">
                                          <fieldset class="fix_height">
                                                <!-- <div class="box-header">
                           <span style="float:right; cursor:pointer">
                                 <i style="color:#00AFD7; " class="icon ion-arrow-left-c"></i>
                                 <a style="color:#00AFD7" ng-click="closeForm()">Back</a>
                           </span>
                           </div> -->
                                                <div class="col-md-12">
                                                      <label class='userlabel'> Type</label>
                                                      <div class="form-group  ">
                                                            <input type="radio" ng-model="formData.type" value="1" ng-change="changetype(1)"><span>Assessment</span>
                                                            <input type="radio" ng-model="formData.type" class="survey" value="2" ng-change="changetype(2)"><span>Survey</span>
                                                      </div>
                                                      <div class="color_error shake" ng-if="type_error!=''">
                                                            <a class="text-left shake">
                                                                  {{type_error}}</a>
                                                      </div>
                                                      <label class='userlabel'>Question Type</label>
                                                      <div class="input-group qtype">
                                                            <select name="clscategory" required ng-model="formData.questiontypeid" ng-change="changeQuestype()" class="form-control check" 
                                                            >
                                                                  <option value="" selected="" disabled="disabled">{{sideselect.formText[1]}}</option>
                                                                  <option value="{{qtype.id}}" ng-repeat="qtype in questype">{{qtype.questiontype}}</option>
                                                            </select>
                                                      </div>
                                                      <div class="color_error shake" ng-if="qtype_error!=''">
                                                            <a class="text-left shake">
                                                                  {{qtype_error}}</a>
                                                      </div>
                                                      <div ng-if="formData.type==1">
                                                            <label class='userlabel'>Category Type</label>
                                                            <select name="clstime" class="form-control check" required ng-model="formData.lvl_id" ng-change="selectedTrainingLevel()"
                                                            >
                                                                  <option value="" selected="" disabled="disabled">Select Category Type</option>
                                                                  <option ng-repeat="tlevel in traininglevels" value="{{tlevel.lvl_id}}">{{tlevel.lvl_name}}</option>
                                                            </select>
                                                      </div>
                                                      <div ng-if="formData.type==1" class="color_error shake" ng-if="ctype_error!=''">
                                                            <a class="text-left shake">
                                                                  {{ctype_error}}</a>
                                                      </div>

                                                </div>
                                                <div class="clearfix"></div>
                                                <div class="col-md-12">
                                                      <label for="tag" class="userlabel">Tag</label>
                                                      <input type="text" id="tag" class="form-control" required name="tag" ng-model="formData.tag" autocomplete="off" placeholder="Tag Name"
                                                            >
                                                      <div class="color_error shake" ng-if="tag_error!=''">
                                                            <a class="text-left shake">
                                                                  {{tag_error}}</a>
                                                      </div>
                                                </div>
                                                <div class="clearfix"></div>
                                                <div class="col-md-12">
                                                      <label class='userlabel'>{{sideselect.formText[2]}}</label>
                                                      <div class="input-group">
                                                            <textarea ng-model="formData.questiontext" required rows="10" cols="10" placeholder="Enter the Question"></textarea>
                                                      </div>
                                                      <div class="color_error shake" ng-if="qtxt_error!=''">
                                                            <a class="text-left shake">
                                                                  {{qtxt_error}}</a>
                                                      </div>
                                                </div>
                                                <!--                     
                           <div class="col-md-6">
                           <label class='userlabel'>{{sideselect.formText[6]}}</label>
                           <input class="form-control" type="file" name="qimage" img-upload-file  />
                           </div> -->
                                                <div class="clearfix"></div>
                                                <div class="col-md-12" ng-if="formData.questiontypeid==1 || formData.questiontypeid==2 || formData.questiontypeid==5 || formData.questiontypeid==6">
                                                      <div class="clschoicecontainer">
                                                            <div ng-repeat="item in optdetail track by $index" class="clschoicediv">
                                                                  <div class="clsiscorrect">
                                                                        <input type="checkbox" class="clsiscorrectbox form-control" ng-checked="formData.child[$index].iscorrect==1" value="1" ng-model="formData.child[$index].iscorrect"
                                                                              ng-true-value='1' ng-false-value='0' id="checkbox_{{$index}}"
                                                                        />
                                                                        <label for="checkbox_{{$index}}">
                                                                              <span></span>
                                                                        </label>
                                                                  </div>
                                                                  <div class="clsopttext">
                                                                        <input type="text" class="form-control" required name="anstext" placeholder="{{sideselect.ansFormText[1]}}" ng-model="formData.child[$index].opttext"
                                                                              autocomplete="off" />
                                                                  </div>
                                                                  <div class="clscoretext">
                                                                        <input type="text" class="form-control" required  special-key name="score"  placeholder="{{sideselect.ansFormText[2]}}"
                                                                              ng-model="formData.child[$index].score" autocomplete="off"
                                                                        />
                                                                  </div>
                                                                  <div class="clsdelete icon ion-trash-a" ng-click="deleteChioce(item,formData.child[$index])"></div>
                                                            </div>
                                                            <div class="clsbuttoncontainer">
                                                                  <input type="button" name="cancel" ng-click="addChoice()" value="{{sideselect.formText[3]}}" />
                                                            </div>
                                                            <div class="color_error shake" ng-if="ans_error!=''">
                                                                  <a class="text-left shake">
                                                                        {{ans_error}}</a>
                                                            </div>
                                                      </div>
                                                </div>
                                                <div class="clearfix"></div>
                                                <div class="col-sm-12 text-center ">
                                                      <button type="submit" class="btn primary fixed">Submit</button>
                                                      <button type="button" class="btn primary fixed" ng-click="closeForm()">Cancel</button>
                                                </div>
                                          </fieldset>
                                    </form>
                              </div>
                        </div>
                  </div>
            </div>
      </div>
</section>