<link rel="stylesheet" type="text/css" href="module/ilearning/css/ilearning.css" />
<section class="user_page container">
    <div class="sales_report">
        <div class="sales_report_in">
            <div class="sales_card" ng-show="!newschedule">
                <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" class="form-control" name="Search" placeholder="Search" autocomplete="off" required="">
                                    </div> -->
                                </form>
                            </div>
                            <div class="addbtn">
                                <button class="btn export">
                                    <p ng-click="view_function('hide')">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-2">Channel Name</th>
                                            <th class="col-xs-1">Title</th>
                                            <th class="col-xs-3">Description</th>
                                            <th class="col-xs-1">Organizer Role</th>
                                            <th class="col-xs-1">Organizer Name</th>
                                            <th class="col-xs-2">Timings</th>
                                            <!-- <th class="col-xs-1">Status</th> -->
                                            <th class="col-xs-1">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="row-content" ng-repeat="itemlist in itemtraininglist track by $index">
                                            <td class="col-xs-2">{{itemlist.channel}} </td>
                                            <td class="col-xs-1">{{itemlist.title}}</td>
                                            <td class="col-xs-3">{{itemlist.description}}</td>

                                            <td class="col-xs-1" ng-if="itemlist.organiser_role==4">Zone Manager</td>
                                            <td class="col-xs-1" ng-if="itemlist.organiser_role==6">Regional Manager</td>
                                            <td class="col-xs-1" ng-if="itemlist.organiser_role==7">Area Manager</td>
                                            <td class="col-xs-1" ng-if="itemlist.organiser_role==14">Dealer</td>



                                            <td class="col-xs-1">{{itemlist.organisername}}</td>
                                            <td class="col-xs-2">{{itemlist.fromdate}} 
                                                <br> {{itemlist.todate}}</td>
                                            <!-- <td class="col-xs-1">{{itemlist.status}}</td> -->
                                            <td class="col-xs-1">
                                                <!-- <div class="clsicon deleteicon ion-edit" ng-click="editFun(itemlist,$index)" title="Edit"></div> -->
                                                <div class="team" ng-click="getuserlistedit(itemlist,$index)">
                                                    <img src="images/team.png" data-toggle="modal"  data-target="#exampleModal">
                                                </div>
                                                <div ng-if="timevaluecurrent > itemlist.fromdate">
                                                    <div class="clsicon editicon ion-trash-a" title="Delete" ></div>
                                                </div>
                                                <div ng-if="timevaluecurrent < itemlist.fromdate">
                                                    <div class="clsicon editicon ion-trash-a" title="Delete" ng-click="deleteRow(itemlist,$index)" ></div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </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>
                </div>
            </div>


            <div class="salescard_schedule" ng-show="newschedule">
                <div class="tile">
                    <h4>Schedule New Training</h4>
                    <p class="close_btn" ng-click="newschedule=false">x</p>
                </div>
                <div class="sales_card pt0">

                    <div class="container-fluid table_area">
                        <div class="row bottom_box">
                            <div class="col-sm-12">

                                <div class="col-sm-12 col-xs-12">
                                    <form class="form_2" ng-submit="addSchedule()" novalidate>

                                        <!--   <div class="btn-group dropdown todos" id="todos">
                                                            <button class="btn btn-default dropdown-toggle botn-todos" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Todos
                                                            <span class="caret caret-posicion"></span>
                                                            </button>
                                                            <ul class="dropdown-menu ancho-todos" aria-labelledby="dropdownMenu1">
                                                              <li><a href="#" ><input value="1" name="busqueda1" type="radio" class="todoss"><span> Todos</span></a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="enc"> En camino</a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="enca"> En camino - 2do intento</a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="entre"> Entregado</a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="entre2"> Entregado al 2do intento</a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="nose"> No se puede entregar</a></li>
                                                              <li><a href="#"><input value="1" name="busqueda1" type="radio" class="cancelado"> Cancelado</a></li>
                                                            </ul>
                                                          </div> -->

                                        <div class="form-group col-sm-12">
                                            <select class="form-control" ng-model="formData.typeselected">
                                                <option value="" disabled>Select Training Title</option>
                                                <option ng-repeat="typelist in typelists" value="{{typelist.id}}">{{typelist.title}}</option>
                                            </select>
                                            <div class="color_error shake" ng-if="role_error==true">
                                                <a class="text-left shake">
                                                    Please Select Training Title</a>
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-12">
                                            <textarea placeholder="Enter Training Title Description" ng-model="formData.description" class="form-control"></textarea>
                                            <div class="color_error shake top58" ng-if="desc_error==true">
                                                <a class="text-left shake">
                                                    Please Enter Training Description</a>
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-6">

                                            <input type="text" class="form-control" placeholder="Start Date" datetime-picker date-format="yyyy-MM-dd" date-only size="30" ng-model="formData.sdate"
                                                id="startdate" />
                                            <!-- <input type="text"   ng-model="formData.startdate"  id="startdate" class="form-control datepicker" name="clspublishdate" autocomplete="off" data-isblockdate="true" data-disable-touch-keyboard ng-datepickermax
                                                            required> -->
                                            <!-- <label for="clspublishdate" class="control-label form-control-placeholder">
                                                <i class="icon-calendar"></i>Start Date </label> -->
                                            <div class="color_error shake" ng-if="sdate_error==true">
                                                <a class="text-left shake">
                                                    Please Select From Date
                                                </a>
                                            </div>
                                        </div>

                                        <div class="form-group col-sm-6">
                                            <div class="form-group col-sm-6" >
                                                <select class="form-control" ng-model="formData.starttimeselected" ng-change="changestarttime()">
                                                    <option value="" disabled>Select Start Time</option>
                                                    <option ng-repeat="timeval in starttimes" value="{{timeval}}">{{timeval}}</option>
                                                </select>
                                                <div class="color_error shake" ng-if="starttime_error==true">
                                                    <a class="text-left shake">
                                                        Please Select Start Time
                                                    </a>
                                                </div>
                                            </div>
                                            <div class="form-group col-sm-6" >
                                                <select class="form-control" ng-model="formData.endtimeselected" ng-change="changezmfirst()">
                                                    <option value="" disabled>Select End Time</option>
                                                    <option ng-repeat="timeval in endtimes" value="{{timeval}}">{{timeval}}</option>
                                                </select>
                                                <div class="color_error shake" ng-if="endtime_error==true">
                                                    <a class="text-left shake">
                                                        Please Select End Time
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="wid100">
                                            <h4>Presenter Selection</h4>
                                            <div class="inside">
                                                <div class="form-group col-sm-6">
                                                    <select class="form-control" ng-model="formData.roleselected" ng-change="changeRole()">
                                                        <option value=""disabled >Select Role</option>
                                                        <option ng-repeat="roleuser in roleuserlist" value="{{roleuser.id}}">{{roleuser.rolename}}</option>
                                                    </select>
                                                    <div class="color_error shake" ng-if="select_role_error==true">
                                                        <a class="text-left shake">
                                                            Please Select Role
                                                        </a>
                                                    </div>
                                                </div>


                                                <div class="form-group col-sm-6" ng-if="formData.roleselected == '4'">
                                                    <select class="form-control" ng-model="formData.zmselected" ng-change="changezmfirst()">
                                                        <option value="" disabled>Select Zone Manager</option>
                                                        <option ng-repeat="zmuser in zmuserlist" value="{{zmuser.userid}}-{{zmuser.value}}">{{zmuser.emp_code}}-{{zmuser.fname}}</option>
                                                    </select>

                                                </div>
                                                <div class="form-group col-sm-6" ng-if="formData.roleselected == '5'">
                                                    <select class="form-control" ng-model="formData.trainerselected" ng-change="changetrainerfirst()">
                                                        <option value="" disabled>Select Trainer</option>
                                                        <option ng-repeat="trainer in traineruserlist" value="{{trainer.userid}}">{{trainer.emp_code}}-{{trainer.fname}}</option>
                                                    </select>

                                                </div>

                                                <div class="form-group col-sm-6" ng-if="formData.roleselected == '6' || formData.roleselected == '7' ||  formData.roleselected == '14'">
                                                    <select class="form-control" ng-model="formData.zmsecondselected" ng-change="changeZmtogetRM()">
                                                        <option value="" disabled>Select Zone Manager</option>
                                                        <option ng-repeat="zmuser in zmuserlist" value="{{zmuser.userid}}">{{zmuser.emp_code}}-{{zmuser.fname}}</option>
                                                    </select>

                                                </div>

                                                <div class="form-group col-sm-6" ng-if="showrmdiv == 'view'">
                                                    <select class="form-control" ng-model="formData.rmsecondselected" ng-change="changeRMtoGetAM()">
                                                        <option value="" disabled>Region Manager</option>
                                                        <option ng-repeat="rmuser in rmseconduserlist" value="{{rmuser.userid}}-{{rmuser.value}}">{{rmuser.emp_code}}-{{rmuser.fname}}</option>
                                                    </select>
                                                </div>

                                                <div class="form-group col-sm-6" ng-if="showamdiv == 'view'">
                                                    <select class="form-control" ng-model="formData.amsecondselected" ng-change="changeAMtoGetDealer()">
                                                        <option value="" disabled >Select Area Manager</option>
                                                        <option ng-repeat="amuser in amseconduserlist" value="{{amuser.userid}}-{{amuser.value}}">{{amuser.emp_code}}-{{amuser.fname}}</option>
                                                    </select>
                                                </div>

                                                <div class="form-group col-sm-6" ng-if="showdealerdiv == 'view'">
                                                    <select class="form-control" ng-model="formData.dealersecondselected" ng-change="changeDealertogetDSC()">
                                                        <option value="" disabled >Select Dealer</option>
                                                        <option ng-repeat="dealer in dealerseconduserlist" value="{{dealer.userid}}-{{dealer.value}}">{{dealer.emp_code}}-{{dealer.fname}}</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>



                                        <div class="wid100">
                                            <h4 ng-if="showparticipantzonediv == 'view'">Participant Selection</h4>

                                            <div ng-if="showparticipantzonediv == 'view'">
                                                <div class="inside">
                                                    <h3>Zone</h3>
                                                    <div class="row">
                                                        <div class="col-md-3" ng-repeat="zmuser in zmlistcheckbox">
                                                            <label class="checkbox-inline">
                                                                <input type="checkbox" class="checkcls" id="{{zmuser}}" value="{{zmuser.value}}" ng-model="selectedzmlist" ng-change="changezmcheckbox(zmuser)">
                                                                <span>{{zmuser.fname}}</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-if="showparticipantregiondiv == 'view'">
                                                <div class="inside">
                                                    <h3>Region</h3>
                                                    <div class="row">
                                                        <div class="col-md-3" ng-repeat="rmuser in rmlistcheckbox">
                                                            <label class="checkbox-inline">
                                                                <input type="checkbox" class="checkcls" id="{{rmuser}}" value="{{rmuser.value}}" ng-model="selectedrmlist" ng-change="changermcheckbox(rmuser)">
                                                                <span>{{rmuser.name}}</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-if="showparticipantareadiv == 'view'">
                                                <div class="inside">
                                                    <h3>Area</h3>
                                                    <div class="row">
                                                        <div class="col-md-3" ng-repeat="amuser in amlistcheckbox">
                                                            <label class="checkbox-inline">
                                                                <input type="checkbox" class="checkcls" id="{{amuser}}" value="{{amuser.value}}" ng-model="selectedamlist" ng-change="changeamcheckbox(amuser)">
                                                                <span>{{amuser.name}}</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-if="showparticipantdealerdiv == 'view'">
                                                <div class="inside">
                                                    <h3>Dealer</h3>
                                                    <div class="row">
                                                        <div class="col-md-3" ng-repeat="dealeruser in dealerlistcheckbox">
                                                            <label class="checkbox-inline">
                                                                <input type="checkbox" class="checkcls" id="{{dealeruser}}" value="{{dealeruser.value}}" ng-model="selecteddealerlist" ng-change="changedealercheckbox(dealeruser)">
                                                                <span>{{dealeruser.name}}</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-if="showparticipantdscdiv == 'view'">
                                                <div class="inside">
                                                    <h3>Dsc</h3>
                                                    <div class="row">
                                                        <div class="col-md-3" ng-repeat="dsclist in dsclistcheckbox">
                                                            <label class="checkbox-inline">
                                                                <input type="checkbox" class="checkcls" id="{{dsclist}}" value="{{dsclist.value}}" ng-model="selectedzmlist" ng-change="changedscheckbox(dsclist)">
                                                                <span>{{dsclist.dealer_code}}-{{dsclist.fname}}/{{dsclist.lname}}</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="color_error shake" style="position: relative !important; float:left;top:0;" ng-if="dse_error==true">
                                                    <a class="text-left shake">
                                                        Please Select DSE
                                                    </a>
                                                </div>
                                            </div>


                                        </div>
                                        <div class="col-sm-12 text-center ">
                                            <button type="button" class="btn primary fixed" ng-click="newschedule=false">Cancel</button>
                                            <button type="submit" class="btn primary fixed">Submit</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!---ADD / EDIT FORM -------->
            <!-- ngIf: formLoad -->
        </div>
    </div>
</section>



  <!-- participant -->
  <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Participants</h5>
                    <button data-toggle="modal" data-target="#addexampleModal" class="add_btn">Add</button>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="participant_list">
                    <img class="img_class" src="https://hyper-m.cygnusa.in/images/no_user.png">
                    <p class="title_head">29338 - ANKIT KUMAR</p>
                    <p class="red_cmd">Not Attended</p>
                    <div class="clsicon editicon ion-trash-a icon_delete" title="Delete"></div>
                </div>
                <div class="participant_list">
                    <img class="img_class" src="https://hyper-m.cygnusa.in/images/no_user.png">
                    <p class="title_head">29338 - ANKIT KUMAR</p>
                    <p class="red_cmd">Not Attended</p>
                    <div class="clsicon editicon ion-trash-a icon_delete" title="Delete"></div>
                </div>
                <div class="participant_list">
                    <img class="img_class" src="https://hyper-m.cygnusa.in/images/no_user.png">
                    <p class="title_head">29338 - ANKIT KUMAR</p>
                    <p class="red_cmd">Not Attended</p>
                    <div class="clsicon editicon ion-trash-a icon_delete" title="Delete"></div>
                </div>

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




      <!-- Add participant -->
      <div class="modal fade" id="addexampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">ADD</h5>
                        
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                  

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