<link rel="stylesheet" type="text/css" href="module/training/css/training.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-3">Trainer Name</th>
                                            <th class="col-xs-2">Training Type</th>
                                            <th class="col-xs-2">Evaluation Type</th>
                                            <th class="col-xs-2">Assessment Time</th>
                                            <th class="col-xs-1">Start Date</th>
                                            <th class="col-xs-1">End Date</th>
                                            <!-- <th class="col-xs-1">Training Status</th> -->
                                            <th class="col-xs-1">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody ng-if="itemdetail.length>0">
                                        <tr ng-repeat="item in itemdetail">
                                            <td class="col-xs-3">{{item.schedule_name}}</td>
                                            <td class="col-xs-2">{{item.lvl_name}}</td>
                                            <td class="col-xs-2">{{item.assessment_type_str}}</td>
                                            <td class="col-xs-2">{{item.assessmenttime}}</td>
                                            <td class="col-xs-1">{{item.startdate}}</td>
                                            <td class="col-xs-1">{{item.enddate}}</td>
                                            <!-- <td class="col-xs-1">{{item.status}}</td> -->
                                            <td class="col-xs-1">
                                                <div  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 class="clsicon deleteicon ion-edit" title="Edits" ng-click="editrow(item,$index)"></div>
                                            <!-- <div ng-if="item.is_edit!=1" class="clsicondis ion-edit" title="Edit"></div> -->
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="text-center" ng-if="itemdetail.length==0">
                                    No Records Found
                                </div>
                            </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 form-scroll" ng-if="sideselect.id == 1">
                    <form class="row form_2" ng-submit="trainingSubmit()" novalidate>
                        <div class="form-group col-sm-6 phone">
                            <input id="schedule_name" type="text" class="form-control" name="clsasstotquest"  ng-model="formData.schedule_name" required>
                            <label for="schedule_name" class="control-label form-control-placeholder">{{sideselect.formText[39]}}</label>
                            <div class="color_error shake" ng-if="schedule_name_error!=''">
                                <a class="text-left shake">{{schedule_name_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <select name="clstime" class="form-control check" ng-model="formData.lvl_id" ng-change="selectedTrainingLevel()" required select-option>
                                <option value=""  selected="" disabled="disabled">{{sideselect.formText[1]}}</option>
                                 <option ng-repeat="tlevel in traininglevels" value="{{tlevel.lvl_id}}">{{tlevel.lvl_name}}</option>
                              </select>
                            <div class="color_error shake" ng-if="lvl_id_error!=''">
                                <a class="text-left shake">{{lvl_id_error}}</a>
                            </div>
                        </div>
                        <div class="form-group col-sm-6 phone">
                            <select name="clstime" class="form-control check" ng-model="formData.trainer_id" ng-change="loadtrainerregion()" required select-option>
                                <option value=""  selected="" disabled="disabled">{{sideselect.formText[5]}}</option>
                                <option ng-repeat="tlevel in trainerlists" value="{{tlevel.userid}}">{{tlevel.name}}</option>
                                <!-- <option value="1" >Timer Assessment</option> -->
                             </select>
                            <div class="color_error shake" ng-if="trainer_id_error!=''">
                                <a class="text-left shake">{{trainer_id_error}}</a>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <!-- <div class="col-md-12">
                            <label class='userlabel'>{{sideselect.formText[6]}}</label>
                        </div> -->
                        <div class="col-md-12">
                            <div class="region" ng-show="filterAvailable">
                                <label class='userlabel'>{{sideselect.formText[7]}}</label>
                                <div class="clearfix"></div>
                                <div class="col-md-12 selectedcitypan scroll_bar">
                                    <div class="checkbox" ng-repeat="tcity in selectedtrainercity">
                                        <div class="col-md-4">
                                            <label class="checkbox-inline " data-toggle="collapse" data-target="#collapse{{$index+1}}">
                                                <input type="checkbox" class="checkcls"  ng-model="formData.filter_regions[tcity.city]" value="city" ng-change="trainerCityChange(tcity,$index,$event)">{{tcity.city}}
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="col-md-12">
                            <div class="region second_section" ng-show="dealerAvailable">
                                <div class="col-md-5 user_label">
                                    <div class="col-md-12 user_label">
                                        <label class='userlabel'>{{sideselect.formText[8]}}</label>
                                    </div>
                                    <div class="clearfix"></div>
                                    <div class="col-md-12 selectedcitypan">
                                        <div class="checkbox" ng-repeat="city_new in selectedCityDealer">
                                            <div class="col-md-12 user_label second_label">
                                                <label class='userlabel selected'>{{city_new.city}}</label>
                                            </div>
                                            <div class="checkbox" ng-repeat="tdealer in city_new.dealer">
                                                <div class="col-md-12">
                                                    <label class="checkbox-inline " data-toggle="collapse" data-target="#collapse{{$index+1}}">
                                                        <input type="checkbox" class="checkcls"  ng-model="formData.filter_dealers[tdealer.dealer_code]" value="dealer" ng-change="trainerDealerChange(tdealer,$index)">{{tdealer.dealer_name}}
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- <div class="col-md-12 no_participate" ng-show="participantAvailable1">
                            <p>No participant for schedule the training</p>
                        </div> -->
                        <div class="col-md-12">
                            <div class="region second_section" ng-show="participantAvailable">
                                <div class="col-md-5 user_label">
                                    <!-- <div class="col-md-12">
                                        <label class='userlabel'>{{sideselect.formText[6]}}</label>
                                    </div> -->
                                    <div class="col-md-12 user_label">
                                        <label class='userlabel selected'>{{sideselect.formText[41]}}</label>
                                    </div>
                                    <div class="clearfix"></div>
                                    <div class="col-md-12 selectedcitypan">
                                        <div class="checkbox" ng-repeat="sdealer in dealerParticipant">
                                            <div class="col-md-12 user_label second_label">
                                                <label class='userlabel selected'>{{sdealer.dealer_name}}</label>
                                            </div>
                                            <div class="checkbox" ng-repeat="dpart in sdealer.user">
                                                <div class="col-md-12">
                                                    <label class="checkbox-inline " data-toggle="collapse" data-target="#collapse{{$index+1}}">
                                                        <!-- <input type="checkbox" class="checkcls"  ng-model="formData.trainerParticipantList[sdealer.dealer_code+'-'+dpart.userid]" value="participant">{{dpart.name}} -->
                                                        <input type="checkbox"  class="checkcls" id="dpart{{dpart.userid}}" ng-model="formData.trainerParticipantList[dpart.userid]" ng-change="readytoAddParticipants(sdealer, dpart,$index)" value="participant">{{dpart.name}}
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-sm-6 phone">
                                <input class="form-control datepick" id="trainingscal" name="clsstartdate" type="text" data-isblockdate="true"  ng-model="formData.startdate" required="required" ng-datepickermin autocomplete="off" />
                                <label for="start_date" class="control-label form-control-placeholder">{{sideselect.formText[13]}}</label>
                                <div class="color_error shake" ng-if="startdate_error!=''">
                                    <a class="text-left shake">{{startdate_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <input class="form-control datepick" id="trainingecal" name="clsenddate" type="text" data-isblockdate="true" ng-model="formData.enddate" required="required" min-date="minDate" ng-datepickermax autocomplete="off" />
                                <label for="end_date" class="control-label form-control-placeholder">{{sideselect.formText[15]}}</label>
                                <div class="color_error shake" ng-if="enddate_error!=''">
                                    <a class="text-left shake">{{enddate_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <select name="clsstarttime" class="form-control check" ng-model="formData.starttime" ng-change="selectedstartTime()" required select-option>
                                    <option value="" selected="" disabled="disabled">{{sideselect.formText[18]}}</option>
                                    <option ng-repeat="stime in tstart_time" value={{stime.value}}>{{stime.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="clsendtime" class="form-control endtime" ng-model="formData.endtime" required select-option disabled>
                                    <option value=""  selected="" disabled="disabled">{{sideselect.formText[20]}}</option>
                                    <option ng-repeat="etime in tstart_time" value={{etime.value}}>{{etime.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 phone">
                                <select name="clstime" class="form-control check" ng-model="formData.notificationdays" required select-option>
                                    <option value=""  selected="" disabled="disabled">{{sideselect.formText[22]}}</option>
                                    <option ng-repeat="ndays in notificationdate" value="{{ndays}}">{{ndays}}</option>
                                </select>
                                <div class="color_error shake" ng-if="notificationdays_error!=''">
                                    <a class="text-left shake">{{notificationdays_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <select name="clstime" class="form-control check" ng-model="formData.buffer_day" required select-option>
                                    <option value=""  selected="" disabled="disabled">{{sideselect.formText[24]}}</option>
                                    <option ng-repeat="bdays in bufferdate" value="{{bdays}}">{{bdays}}</option>
                                </select>
                                <div class="color_error shake" ng-if="buffer_day_error!=''">
                                    <a class="text-left shake">{{buffer_day_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <textarea rows="4" class="form-control" name="clstravelinfo"  ng-model="formData.travel_desc" required></textarea>
                                <label for="end_date" class="control-label form-control-placeholder">{{sideselect.formText[25]}}</label>
                                <div class="color_error shake" ng-if="travel_desc_error!=''">
                                    <a class="text-left shake">{{travel_desc_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <textarea rows="4" class="form-control" name="clshotelinfo"   ng-model="formData.hotel_desc" required></textarea>
                                <label for="end_date" class="control-label form-control-placeholder">{{sideselect.formText[27]}}</label>
                                <div class="color_error shake" ng-if="hotel_desc_error!=''">
                                    <a class="text-left shake">{{hotel_desc_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                               <input type="radio"  ng-model="formData.assessment_type" value="0"> Pre Assessment
                               <input type="radio"  ng-model="formData.assessment_type" value="1"> Post Assessment
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <input type="text" class="form-control" name="clsassname"   ng-model="formData.assessmentname" required>
                                <label for="start_date" class="control-label form-control-placeholder">{{sideselect.formText[30]}}</label>
                                <div class="color_error shake" ng-if="assessmentname_error!=''">
                                    <a class="text-left shake">{{assessmentname_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <select name="clstime" class="form-control check" ng-model="formData.assessmenttime" required select-option>
                                    <option value=""  selected="" disabled="disabled">{{sideselect.formText[33]}}</option>
                                    <option ng-repeat="duration in ass_duration" value="{{duration.value}}">{{duration.title}}</option>
                                </select>
                                <div class="color_error shake" ng-if="assessmenttime_error!=''">
                                    <a class="text-left shake">{{assessmenttime_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <input type="number" min="0" class="form-control" name="clsasstotquest"  ng-model="formData.ques_count" required>
                                <label for="start_date" class="control-label form-control-placeholder">{{sideselect.formText[34]}}</label>
                                <div class="color_error shake" ng-if="ques_count_error!=''">
                                    <a class="text-left shake">{{ques_count_error}}</a>
                                </div>
                            </div>
                            <div class="form-group col-sm-6 phone">
                                <select name="clstime" class="form-control check" ng-model="formData.randomcond" required select-option>
                                    <option value=""  selected="" disabled="disabled">{{sideselect.formText[37]}}</option>
                                    <option ng-repeat="atype in ass_type" value="{{atype.val}}">{{atype.txt}}</option>
                                </select>
                                <div class="color_error shake" ng-if="randomcond_error!=''">
                                    <a class="text-left shake">{{randomcond_error}}</a>
                                </div>
                            </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>