<link rel="stylesheet" type="text/css" href="module/assessment/css/assessment.css" />
<section class="user_page container">
    <div class="sales_report">
        <div class="sales_report_in">
            <div class="sales_card" ng-show="listFound">
                <div class="container-fluid table_area">
                    <div class="row top_box">
                        <div class="left_box">
                            <div class="input-group mb-3">
                            </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>
                    <div class="row bottom_box">
                        <div class="col-sm-12 table_box">
                            <div class="table-fixed">
                                <table class="table table-fixed">
                                    <thead>
                                        <tr class="row-name">
                                            <th class="col-xs-4">Assessment Name</th>
                                            <th class="col-xs-2">Assessment Time</th>
                                            <th class="col-xs-2">Published Date</th>
                                            <th class="col-xs-2">End Date</th>
                                            <th class="col-xs-2">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="item in itemdetail">
                                            <td class="col-xs-4">{{item.assessmentname}}</td>
                                            <td class="col-xs-2">{{item.assessmenttime}}</td>
                                            <td class="col-xs-2">{{item.publisheddate}}</td>
                                            <td class="col-xs-2">{{item.enddate}}</td>
                                            <td class="col-xs-2">
                                                <div ng-if="item.is_edit==1" class="clsicon deleteicon ion-edit" title="Edit" ng-click="editrow(item,$index,0)"></div>
                                                <div ng-if="item.is_edit!=1" class="clsicondis ion-edit" title="Edit"></div>
                                                <div ng-if="item.is_edit==1" class="clsicon editicon ion-trash-a" title="Delete" ng-click="deleterow(item,$index)"></div>
                                                <div ng-if="item.is_edit!=1" class="clsicondis ion-trash-a" title="Delete"></div>
                                                <div ng-if="item.is_edit==1"title="copy"  class="clsicon editicon" ng-click="editrow(item,$index,1)">
                                                <svg version="1.1" id="Capa_1" x="0px" y="0px"
                                                    viewBox="0 0 488.3 488.3" style="enable-background:new 0 0 488.3 488.3;"
                                                    xml:space="preserve">
                                                    <g>
                                                        <g>
                                                            <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124
			C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124
			c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z" />
                                                            <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227
			c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6
			V38.6C439.65,17.3,422.35,0,401.05,0z" />
                                                        </g>
                                                    </g>
                                                </svg>
                                            </div>
                                            <div ng-if="item.is_edit!=1"title="copy" class="clsicon editicon" ng-click="editrow(item,$index,1)">
                                                    <svg version="1.1" id="Capa_1" x="0px" y="0px"
                                                        viewBox="0 0 488.3 488.3" style="enable-background:new 0 0 488.3 488.3;"
                                                        xml:space="preserve">
                                                        <g>
                                                            <g>
                                                                <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124
                C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124
                c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z" />
                                                                <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227
                c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6
                V38.6C439.65,17.3,422.35,0,401.05,0z" />
                                                            </g>
                                                        </g>
                                                    </svg>
                                                </div>
                                                <!-- <div ng-if="item.is_edit==1" class="clsicon copyicon ion-trash-a" title="copy" ng-click="editrow(item,$index,1)"></div>
                                                <div ng-if="item.is_edit!=1" class="clsicondis ion-trash-a" title="Copy"></div> -->
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="container">
                    <div class="row">
                        <nav aria-label="Page navigation" id="div1">
                            <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>
            <!---ADD / EDIT FORM -------->
            <div class="profile_bg" ng-if="formLoad">
                <div class="container-fluid pro_head">
                    <h4 class="text4">{{formtitle}}</h4>
                    <button type="button" class="close ass-close" ng-click="closeForm()">
                        <span>×</span>
                    </button>
                </div>
                <div class="container-fluid form_bg" ng-if="sideselect.id == 1">
                    <div class="left-part">
                        <h4 class="title">Questions</h4>
                        <select class="pull-right" ng-model="formData.tag" ng-change="changeTag()">
                            <option value="" selected="">Tag</option>
                            <option ng-repeat="tag in tagList" value="{{tag.tag}}">{{tag.tag}}</option>
                        </select>
                        <!-- <div class="form-group col-sm-6 pull-right">
                            <input id="total_ques" type="text" class="form-control" ng-model="formData.total_question" required="required" />
                            <label for="total_ques" class="control-label form-control-placeholder">Total Questions</label>
                        </div> -->
                        <div class="w100 left-inn">
                            <div class="w100" ng-repeat="ques in assessment_question">
                                <div class="panel-body form-group">
                                    <input type="hidden" class="checkcls" ng-model="ques.selected" value="{{ques.id}}" >
                                    <input type="checkbox" class="checkcls checkbox" id="{{ques.id}}" ng-model="ques.selected" ng-change="quesChange(ques,$index)" required >
                                    <label class="checkbox" for="{{ques.id}}">{{ques.questiontext}}</label>
                                </div>
                                <div class="col-sm-5" ng-if="formData.questionList[ques.id]">
                                    <input type="radio" class="radio" name="quesradio{{ques.id}}" ng-model="formData.is_mandatory[ques.id]" id="radio_{{ques.id}}"
                                        value="1" />
                                    <label class="radio" for="radio_{{ques.id}}">Yes, mandatory</label>

                                    <input type="radio" class="radio" name="quesradio{{ques.id}}" ng-model="formData.is_mandatory[ques.id]" id="{{ques.id}}"
                                        value="0" />
                                    <label class="radio" for="{{ques.id}}">No, mandatory</label>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12 text-center fixed_add">
                                <div class="color_error shake">
                                        <a class="text-left shake">
                                            {{question_tag_error}}</a>
                                    </div>
                            <!-- <button type="button" class="btn primary fixed" ng-click="closeForm()">Cancel</button> -->
                            <button type="submit" class="btn primary fixed" ng-click="addQuestions()">Add</button>
                           
                        </div>
                    </div>


                    <form class="form_2 right-part form-scroll" ng-submit="assessmentSubmit()" novalidate>
                        <div class="form-group col-sm-6 phone">
                            <input id="topic" type="text" class="form-control" autocomplete="off" ng-model="formData.assessmentname" required="required"
                            />
                            <label for="topic" class="control-label form-control-placeholder">{{sideselect.formText[0]}}</label>
                            <div class="color_error shake" ng-if="assessment_error!=''">
                                <a class="text-left shake">
                                    {{assessment_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <select name="clstime" class="form-control check" ng-model="formData.assessmenttimetype" required select-option>
                                <option value="" selected="" disabled="disabled">--Select Assessment Type--</option>
                                <!-- <option value="0">No Timer</option> -->
                                <option value="1">Timer Assessment</option>
                            </select>
                            <div class="color_error shake" ng-if="type_error!=''">
                                <a class="text-left shake">
                                    {{type_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-12 phone">
                            <select name="clstime" class="pull-left form-control check role" ng-model="formData.roleList" required select-option>
                                <option value="" selected="">Select Role</option>
                                <option ng-repeat="tag in UserType" value="{{tag.id}}">{{tag.title}}</option>
                            </select>
                            <!-- <multiple-autocomplete ng-model="formData.roleList" object-property="rolename" suggestions-arr="role">
                            </multiple-autocomplete> -->
                            <div class="color_error shake" ng-if="role_error!=''">
                                <a class="text-left shake">
                                    {{role_error}}</a>
                            </div>
                        </div>
                          <div class="form-group col-sm-12 phone">
                    <label for="segment" class="control-label ">Segment</label>  
                  <select id='segment' name="clscategory" ng-model="formData.segment"   class="form-control selectbox"
                     required select-option>
                    <option value="" selected="" disabled="disabled">{{sideselect.formText[20]}}</option>
                    <option value="0"  >Student Learner</option>
                    <option value="1"  >Parents/Guardian</option>
                    <option value="2"  >Instructor</option>
                  </select>
                  <div class="color_error shake" ng-if="segment_error!=''">
                     <a class="text-left shake">
                     {{segment_error}}</a>
                  </div>
               </div>   
                        <div class="form-group col-sm-6 phone">
                            <input type="text" id="start_date" class="form-control datepicker" name="start_date" ng-model="formData.publisheddate" autocomplete="off"
                                data-isblockdate="true" ng-datepickermin required>
                            <label for="start_date" class="control-label form-control-placeholder">Start Date</label>
                            <div class="color_error shake" ng-if="publisheddate_error!=''">
                                <a class="text-left shake">
                                    {{publisheddate_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <input type="text" id="end_date" class="form-control datepicker" name="clsenddate" ng-model="formData.enddate" autocomplete="off"
                                data-isblockdate="true" ng-datepickermax required>
                            <label for="end_date" class="control-label form-control-placeholder">End Date</label>
                            <div class="color_error shake" ng-if="enddate_error!=''">
                                <a class="text-left shake">
                                    {{enddate_error}}</a>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="form-group col-sm-6 phone">

                            <!-- <input ng-model="formData.publishedtime" type="time" placeholder="HH:mm" min="00:00" max="24:00" required > -->
                            <select name="clstime" class="form-control check" ng-model="formData.publishedtime" required select-option>
                                <option value="" selected="" disabled="disabled">Start Time</option>
                                <option ng-repeat="assessmenttime in start_time" value={{assessmenttime.value}}>{{assessmenttime.title}}</option>
                            </select>
                            <div class="color_error shake" ng-if="starttime_error!=''">
                                <a class="text-left shake">
                                    {{starttime_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <select name="clstime" class="form-control check" ng-model="formData.endtime" required select-option>
                                <option value="" selected="" disabled="disabled">End Time</option>
                                <option ng-repeat="endtime in end_time" value={{endtime.value}}>{{endtime.title}}</option>
                            </select>
                            <div class="color_error shake" ng-if="endtime_error!=''">
                                <a class="text-left shake">
                                    {{endtime_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6" ng-if="formData.assessmenttimetype==1">
                            <input id="assessmenttime" class="form-control" ng-model="formData.assessmenttime" autocomplete="off" required="required">
                            <label for="assessmenttime" class="control-label form-control-placeholder">{{sideselect.formText[1]}}</label>
                            <div class="color_error shake" ng-if="assessmenttime_error!=''">
                                <a class="text-left shake">
                                    {{assessmenttime_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-md-6">
                            <select name="clstime" class="form-control check" ng-model="formData.randomcond" required select-option>
                                <option value="" selected="" disabled="disabled">--Select Question Type--</option>
                                <option value="0">No random question</option>
                                <option value="1">Random question</option>
                            </select>
                            <div class="color_error shake" ng-if="ques_error!=''">
                                <a class="text-left shake">
                                    {{ques_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <input id="attempts" type="text" class="form-control" ng-model="formData.attemptslimit"
                            />
                            <label for="attempts" class="control-label form-control-placeholder">Attempts Limit</label>
                            <div class="color_error shake" ng-if="limit_error!=''">
                                <a class="text-left shake">
                                    {{limit_error}}</a>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="form-group col-md-6">
                            <select name="clstime" class="form-control check" ng-model="formData.pass_score" required select-option>
                                <option value="" selected="" disabled="disabled">{{sideselect.formText[17]}}</option>
                                <option ng-repeat="score in scoreList">{{score}}</option>
                            </select>
                            <label class="control-label form-control-placeholder">Pass Percentage</label>
                            <div class="color_error shake" ng-if="ques_error!=''">
                                <a class="text-left shake">
                                    {{ques_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-12 phone">
                            <input type="checkbox" class="checkbox" id="notify" ng-disabled="true" ng-change="zoneChanged(obj,$index)" ng-model="formData.assessmentnotification"
                                value="1" ng-checked="true">
                            <label class="checkbox" for="notify">{{sideselect.formText[16]}}</label>
                            <!-- <input id="notify" type="text" class="form-control" ng-model="formData.assessmentnotification" required="required" />
                            <label for="notify" class="control-label form-control-placeholder">{{sideselect.formText[16]}}</label> -->
                            <div class="color_error shake" ng-if="notify_error!=''">
                                <a class="text-left shake">
                                    {{notify_error}}</a>
                            </div>
                        </div>


                        <!-- <div class="w100 region">
                            <div>
                                <label>Filters</label>
                            </div>
                            <div class="form-group col-sm-4 pt0">
                                <label>Zone</label>
                                <div class="region_box scroll">
                                    <div ng-repeat="obj in zoneList track by $index">
                                        <input type="checkbox" class="checkbox" id="{{obj.zone}}" ng-change="zoneChanged(obj,$index)" ng-model="formData.zoneList[obj.zone]"
                                            value="{{obj.zone}}">
                                        <label class="checkbox" for="{{obj.zone}}">{{obj.zone}}</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group col-sm-4 pt0" ng-show="stateVisible">
                                <label>City</label>
                                <div class="col-sm-12 region_box scroll_bar">
                                    <div ng-repeat="obj in regionList">
                                        <div ng-repeat="child in obj.child">
                                            <input type="checkbox" class="checkbox" id="{{child}}" ng-change="regionChanged(child,$index)" ng-model="formData.regionList[child]"
                                                value="{{child}}">
                                            <label class="checkbox" for="{{child}}">{{child}}</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group col-sm-4 pt0" ng-show="dealerVisible">
                                <label>Dealer</label>
                                <div class="col-sm-12 region_box scroll_bar">
                                    <div ng-repeat="obj in dealerList">
                                        <div ng-repeat="child in obj.child">
                                            <input type="checkbox" class="checkbox" id="{{child.dealer_code}}" ng-model="formData.dealerList[child.dealer_code]" value="{{child.dealer_code}}">
                                            <label class="checkbox" for="{{child.dealer_code}}">{{child.dealer_name}}</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="color_error shake" ng-if="zone_error!=''">
                            <a class="text-left shake">
                                {{zone_error}}</a>
                        </div> -->
                        <div class="clearfix"></div>
                        <h4 class="sub-tit" ng-if="questionTempList.length>0">Question List</h4>

                        <div class="w100 question" ng-if="questionTempList.length>0">
                            <!-- <label>Question list</label> -->
                            <!-- <table class="table table-fixed ques-table">
                                <tbody>
                                    <tr class="table-row remove" ng-repeat="item in random_question track by $index"> 
                                        <td>{{$index+1}}. {{item}} </td>
                                        <td class='remove' ng-click="onremoveQuestion()">Remove</td>
                                    </tr>
                                </tbody>
                            </table> -->

                            <div class="qlist">
                                <div class="w100 prel qlist-inn" ng-repeat="list in questionTempList track by $index">
                                    <!-- <input type="checkbox" class="checkbox" id="formData.quesTempList[list.id]" ng-model="formData.quesTempList[list.id]"  value="formData.quesTempList[list.id]"> -->
                                    <label class="checkbox" for="formData.questionTempList[list.id]">{{$index+1}}. {{list.questiontext}}</label>
                                    <div class="ion-trash-a question_delete" title="Delete" ng-click='deleteQuestion(list)'></div>
                                </div>

                            </div>
                        </div>
                        <div class="color_error shake" ng-if="addquestion_error!=''">
                            <a class="text-left shake">
                                {{addquestion_error}}</a>
                        </div>
                        <div class="col-sm-12 text-center ">
                            <button type="button" class="btn primary fixed" ng-click="closeForm()">Cancel</button>
                            <button type="submit" class="btn primary fixed">Submit</button>
                        </div>
                        
                    </form>
                </div>

            </div>
        </div>
    </div>
</section>