<div class="row page-titles">
    <div class="col-md-6 col-8 align-self-center">
        <h3 class="text-themecolor m-b-0 m-t-0">{{phrase.Meetings}}</h3>
    </div>
    <div class="col-md-6 col-4 align-self-center">

    </div>
</div>

<div class="row" ng-show="views.list">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-show="$root.can('Meetings.addMeeting')"  ng-click="changeView('add')" class="btn pull-right btn-success card-block-input-item">{{phrase.addMeeting}}</button>
                <div class="pull-right card-block-input-group card-block-input-item">
                    <div class="input-group input-group-sm">
                        <input type="text" name="table_search" ng-model="searchText" placeholder="{{phrase.Search}}" class="form-control input-sm">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
                <h4 class="card-title">{{phrase.listMeetings}}</h4>
                <div class="table-responsive">

                    <table class="table table-bordered table-hover">
                        <tbody>
                            <tr>
                                <th>{{phrase.meetTitle}}</th>
                                <th>{{phrase.meetSchTime}}</th>
                                <th>{{phrase.meetPresenter}}</th>
                                <th style="width:160px;">{{phrase.Operations}}</th>
                            </tr>
                            <tr ng-repeat="meeting in meetings | filter:searchText">
                                <td>
                                    {{meeting.conference_title}}
                                    <a ng-show="meeting.conference_status == 0" class="btn btn-sm btn-info float-right" style="color:white;"><i class="mdi mdi-timer"></i> {{phrase.Scheduled}} </a>
                                    <a ng-show="meeting.conference_status == 1" target="-BLANK" ng-href="{{'meetings/join/' + meeting.id}}" class="btn btn-sm btn-danger float-right" style="color:white;"><i class="mdi mdi-play"></i> {{phrase.live}} </a>
                                    <a ng-show="meeting.conference_status == 2" class="btn btn-sm btn-success float-right" style="color:white;"><i class="mdi mdi-check"></i> {{phrase.Completed}} </a>
                    
                                    <br /> <small>{{meeting.conference_desc}}</small>
                                </td>
                                <td>{{meeting.scheduled_date}} <br /> {{phrase.confDuration}} : {{meeting.conference_duration}}</td>
                                <td>
                                    {{meeting.conference_host.name}}
                                </td>
                                <td ng-show="$root.can('Meetings.editMeeting') || $root.can('Meetings.delMeet')">
                                    <button ng-show="$root.can('Meetings.editMeeting')" ng-click="edit(meeting.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></button>
                                    <button ng-show="$root.can('Meetings.delMeet')" ng-click="remove(meeting,$index)" type="button" class="btn btn-danger btn-circle" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></button>
                                </td>
                            </tr>
                            <tr ng-show="!meetings.length">
                                <td class="noTableData" colspan="4">{{phrase.noDataAvailable}}</td>
                            </tr>
                        </tbody>
                    </table>

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

<div class="row" ng-show="views.add">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-click="changeView('list')" class="btn btn-danger btn-flat pull-right card-block-input-item">{{phrase.cancelAdd}}</button>
                <h4 class="card-title">{{phrase.addMeeting}}</h4>
                <div class="table-responsive">

                    <form class="form-horizontal" name="addConference" role="form" ng-submit="saveAdd()" novalidate>
                        
                        <div class="form-group row" ng-class="{'has-error': addConference.conference_title.$invalid}">
                            <label for="inputEmail3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetTitle}} * </label>
                            <div class="col-sm-10">
                                <input type="text" name="conference_title" ng-model="form.conference_title" class="form-control" required placeholder="{{phrase.meetTitle}}">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetDesc}}</label>
                            <div class="col-sm-10">
                                <textarea name="conference_desc" class="form-control" ng-model="form.conference_desc" placeholder="{{phrase.meetDesc}}"></textarea>
                            </div>
                        </div>

                        <div class="form-group row" ng-class="{'has-error': addConference.conference_host.$invalid}">
                            <label for="inputEmail3" class="col-sm-2 text-right control-label col-form-label">Meeting Host * </label>
                            <div class="col-sm-10">
                                <button type="button" ng-click="linkHost()" class="btn btn-danger btn-flat">{{phrase.searchUsers}}</button>
                                
                                <table class="table table-bordered">
                                    <tr ng-show="form.conference_host">
                                        <td>{{form.conference_host.name}}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div class="form-group row" ng-class="{'has-error': addConference.conference_target_type.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.typeUsers}} *</label>
                            <div class="col-sm-10">
                                <div class="radio-list" ng-show="$root.dashboardData.role == 'admin'">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="admins" ng-model="form.conference_target_type" required >
                                        {{phrase.Administrators}}
                                    </label>
                                </div>
                                <div class="radio-list" ng-show="$root.dashboardData.role == 'admin'">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="teachers" ng-model="form.conference_target_type" required >
                                        {{phrase.teachers}}
                                    </label>
                                </div>
                                <div class="radio-list">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="students" ng-model="form.conference_target_type" required >
                                        {{phrase.students}}
                                    </label>
                                </div>
                                <div class="radio-list">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="parents" ng-model="form.conference_target_type" required >
                                        {{phrase.parents}}
                                    </label>
                                </div>
                                <div class="radio-list">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="users" ng-model="form.conference_target_type" required >
                                        {{phrase.specificUsers}}
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="form.conference_target_type == 'students' || form.conference_target_type == 'parents'" ng-class="{'has-error': addConference.classId.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.class}} *</label>
                            <div class="col-sm-10">
                                <select class="form-control" ng-model="form.conference_target_details_ac.class" name="classId" multiple ng-required="form.conference_target_type == 'students' || form.conference_target_type == 'parents'" ng-change="searchSubjectList()">
                                    <option ng-repeat="class in classes" value="c{{class.id}}">{{class.className}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="(form.conference_target_type == 'students' || form.conference_target_type == 'parents') && $root.dashboardData.enableSections == '1'" ng-class="{'has-error': addConference.sectionId.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.section}} *</label>
                            <div class="col-sm-10">
                                <select class="form-control" ng-model="form.conference_target_details_ac.section" name="sectionId" multiple ng-required="(form.conference_target_type == 'students' || form.conference_target_type == 'parents') && $root.dashboardData.enableSections == '1'">
                                    <option ng-repeat="section in sections" value="s{{section.id}}">{{section.sectionName}} - {{section.sectionTitle}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="form.conference_target_type == 'users'">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.selUsers}} *</label>
                            <div class="col-sm-10">

                                <button type="button" ng-click="linkTarget()" class="btn btn-danger btn-flat">{{phrase.selUsers}}</button>
                                <div class="row" ng-repeat="userOne in form.conference_target_details track by $index">
                                    <div class="col-xs-8"><input type="text" class="form-control" disabled="disabled" ng-model="userOne.student"></div>
                                    <button type="button" ng-click="removeUserFromTarget($index)" class="btn btn-danger btn-circle"><i class="fa fa-trash-o"></i></button></li>
                                </div>

                            </div>
                        </div>

                        <div class="form-group row" ng-class="{'has-error': addConference.scheduled_now.$invalid || addConference.scheduled_date.$invalid || addConference.scheduled_hour.$invalid || addConference.scheduled_min.$invalid || addConference.scheduled_ampm.$invalid}">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetSchTime}} *</label>
                            <div class="col-sm-10">

                                <div class="form-group row">
                                    <div class="col-sm-12">
                                        <div class="radio-list">
                                            <label class="ng-binding">
                                                <input type="radio" name="scheduled_now" value="now" ng-model="form.scheduled_now" required> {{phrase.startMeetNow}}
                                            </label>
                                        </div>
                                        <div class="radio-list">
                                            <label class="ng-binding">
                                                <input type="radio" name="scheduled_now" value="later" ng-model="form.scheduled_now" required=""> {{phrase.schMeeting}}
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group row" ng-show="form.scheduled_now == 'later'">
                                    <div class="col-sm-6">
                                        <input type="text" date-picker name="scheduled_date" ng-model="form.scheduled_date" ng-required="form.scheduled_now == 'later'" class="form-control datemask">
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_hour" ng-model="form.scheduled_hour" ng-required="form.scheduled_now == 'later'" ng-options="value as value for value in ['01','02','03','04','05','06','07','08','09','10','11','12']">
                                        </select>
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_min" ng-model="form.scheduled_min" ng-required="form.scheduled_now == 'later'" ng-options="value as value for value in ['00','05','10','15','20','25','30','35','40','45','50','55']">
                                        </select>
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_ampm" ng-required="form.scheduled_now == 'later'" ng-model="form.scheduled_ampm">
                                            <option value="AM">AM</option>
                                            <option value="PM">PM</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row" ng-class="{'has-error': addConference.conference_duration.$invalid}">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetDuration}} *</label>
                            <div class="col-sm-10">
                                <input type="text" name="conference_duration" ng-model="form.conference_duration" required class="form-control">
                            </div>
                        </div>
                        <div class="form-group m-b-0 row">
                            <div class="offset-sm-2 col-sm-10">
                                <button type="submit" class="btn btn-info waves-effect waves-light" ng-disabled="addConference.$invalid">{{phrase.addMeeting}}</button>
                            </div>
                        </div>
                    </form>

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

<div class="row" ng-show="views.edit">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-click="changeView('list')" class="btn btn-danger btn-flat pull-right card-block-input-item">{{phrase.cancelEdit}}</button>
                <h4 class="card-title">{{phrase.editMeeting}}</h4>
                <div class="table-responsive">

                    <form class="form-horizontal" name="editConference" role="form" ng-submit="saveEdit()" novalidate>
                        <div class="form-group row" ng-class="{'has-error': editConference.conference_title.$invalid}">
                            <label for="inputEmail3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetTitle}} * </label>
                            <div class="col-sm-10">
                                <input type="text" name="conference_title" ng-model="form.conference_title" class="form-control" required placeholder="{{phrase.meetTitle}}">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetDesc}}</label>
                            <div class="col-sm-10">
                                <textarea name="conference_desc" class="form-control" ng-model="form.conference_desc" placeholder="{{phrase.meetDesc}}"></textarea>
                            </div>
                        </div>
                        
                        <div class="form-group row" ng-class="{'has-error': editConference.conference_host.$invalid}">
                            <label for="inputEmail3" class="col-sm-2 text-right control-label col-form-label">Meeting Host * </label>
                            <div class="col-sm-10">
                                <button type="button" ng-click="linkHost()" class="btn btn-danger btn-flat">{{phrase.searchUsers}}</button>
                        
                                <table class="table table-bordered">
                                    <tr ng-show="form.conference_host">
                                        <td>{{form.conference_host.name}}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        
                        <div class="form-group row" ng-class="{'has-error': editConference.conference_target_type.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.typeUsers}} *</label>
                            <div class="col-sm-10">
                                <div class="radio-list" ng-show="$root.dashboardData.role == 'admin'">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="admins" ng-model="form.conference_target_type" required>
                                        {{phrase.Administrators}}
                                    </label>
                                </div>
                                <div class="radio-list" ng-show="$root.dashboardData.role == 'admin'">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="teachers" ng-model="form.conference_target_type" required>
                                        {{phrase.teachers}}
                                    </label>
                                </div>
                                <div class="radio-list">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="students" ng-model="form.conference_target_type" required>
                                        {{phrase.students}}
                                    </label>
                                </div>
                                <div class="radio-list">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="parents" ng-model="form.conference_target_type" required>
                                        {{phrase.parents}}
                                    </label>
                                </div>
                                <div class="radio-list" ng-show="$root.dashboardData.role == 'admin' || $root.dashboardData.role == 'teacher'">
                                    <label>
                                        <input type="radio" name="conference_target_type" value="users" ng-model="form.conference_target_type" required>
                                        {{phrase.specificUsers}}
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="form.conference_target_type == 'students' || form.conference_target_type == 'parents'" ng-class="{'has-error': editConference.classId.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.class}} *</label>
                            <div class="col-sm-10">
                                <select class="form-control" ng-model="form.conference_target_details_ac.class" name="classId" multiple ng-required="form.conference_target_type == 'students' || form.conference_target_type == 'parents'" ng-change="searchSubjectList()">
                                    <option ng-repeat="class in classes" value="c{{class.id}}">{{class.className}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="(form.conference_target_type == 'students' || form.conference_target_type == 'parents') && $root.dashboardData.enableSections == '1'" ng-class="{'has-error': editConference.sectionId.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.section}} *</label>
                            <div class="col-sm-10">
                                <select class="form-control" ng-model="form.conference_target_details_ac.section" name="sectionId[]" multiple ng-required="(form.conference_target_type == 'students' || form.conference_target_type == 'parents') && $root.dashboardData.enableSections == '1'">
                                    <option ng-repeat="section in sections" value="s{{section.id}}">{{section.sectionName}} - {{section.sectionTitle}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row" ng-show="form.conference_target_type == 'users'">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.selUsers}} *</label>
                            <div class="col-sm-10">
                        
                                <button type="button" ng-click="linkTarget()" class="btn btn-danger btn-flat">{{phrase.selUsers}}</button>
                                <div class="row" ng-repeat="userOne in form.conference_target_details track by $index">
                                    <div class="col-xs-8"><input type="text" class="form-control" disabled="disabled" ng-model="userOne.student"></div>
                                    <button type="button" ng-click="removeUserFromTarget($index)" class="btn btn-danger btn-circle"><i class="fa fa-trash-o"></i></button></li>
                                </div>
                        
                            </div>
                        </div>
                        
                        <div class="form-group row" ng-class="{'has-error': editConference.scheduled_now.$invalid || editConference.scheduled_date.$invalid || editConference.scheduled_hour.$invalid || editConference.scheduled_min.$invalid || editConference.scheduled_ampm.$invalid}">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetSchTime}} *</label>
                            <div class="col-sm-10">
                        
                                <div class="form-group row">
                                    <div class="col-sm-12">
                                        <div class="radio-list">
                                            <label class="ng-binding">
                                                <input type="radio" name="scheduled_now" value="now" ng-model="form.scheduled_now" required> {{phrase.startMeetNow}}
                                            </label>
                                        </div>
                                        <div class="radio-list">
                                            <label class="ng-binding">
                                                <input type="radio" name="scheduled_now" value="later" ng-model="form.scheduled_now" required=""> {{phrase.schMeeting}}
                                            </label>
                                        </div>
                                    </div>
                                </div>
                        
                                <div class="form-group row" ng-show="form.scheduled_now == 'later'">
                                    <div class="col-sm-6">
                                        <input type="text" date-picker name="scheduled_date" ng-model="form.scheduled_date" ng-required="form.scheduled_now == 'later'" class="form-control datemask">
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_hour" ng-model="form.scheduled_hour" ng-required="form.scheduled_now == 'later'" ng-options="value as value for value in ['01','02','03','04','05','06','07','08','09','10','11','12']">
                                        </select>
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_min" ng-model="form.scheduled_min" ng-required="form.scheduled_now == 'later'" ng-options="value as value for value in ['00','05','10','15','20','25','30','35','40','45','50','55']">
                                        </select>
                                    </div>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="scheduled_ampm" ng-required="form.scheduled_now == 'later'" ng-model="form.scheduled_ampm">
                                            <option value="AM">AM</option>
                                            <option value="PM">PM</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row" ng-class="{'has-error': editConference.conference_duration.$invalid}">
                            <label for="inputPassword3" class="col-sm-2 text-right control-label col-form-label">{{phrase.meetDuration}} *</label>
                            <div class="col-sm-10">
                                <input type="text" name="conference_duration" ng-model="form.conference_duration" required class="form-control">
                            </div>
                        </div>
                        <div class="form-group m-b-0">
                            <div class="offset-sm-2 col-sm-10">
                                <button type="submit" class="btn btn-info waves-effect waves-light" ng-disabled="editConference.$invalid">{{phrase.editMeeting}}</button>
                            </div>
                        </div>
                    </form>

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

<modal visible="show_join_meeting">
    <div class="form-group row">
        <div class="col-sm-12 text-center">
            <h4>{{meeting_title}} {{phrase.live}}. {{phrase.canJoinClick}}</h4>
            <br />
            <a target="-BLANK" ng-href="{{'meetings/join/' + meeting_id}}" class="btn btn-md btn-danger" style="color:white;"><i class="mdi mdi-play"></i> {{phrase.live}} </a>
        </div>
    </div>
</modal>
<modal visible="showModalLink">
    <div class="row">
        <div class="col-md-9">
            <input type="text" class="form-control" id="searchLink" placeholder="{{phrase.typeNameUserMail}}">
        </div>
        <div class="col-md-2">
            <button type="button" ng-click="linkHostButton()" class="btn btn-danger btn-flat">{{phrase.Search}}</button>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12" style="padding-top:10px;">
            <div class="box-body table-responsive">
                <table class="table table-bordered">
                    <tbody>
                        <tr ng-repeat="studentOne in searchResults">
                            <td>{{studentOne.name}}</td>
                            <td>{{studentOne.email}}</td>
                            <td class="no-print">
                                <button type="button" ng-click="linkHostFinish(studentOne)" class="btn btn-success btn-flat">{{phrase.select}}</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</modal>
<modal visible="showTargetModalLink">
    <div class="row">
        <div class="col-md-9">
            <input type="text" class="form-control" id="searchTargetLink" placeholder="{{phrase.typeNameUserMail}}">
        </div>
        <div class="col-md-2">
            <button type="button" ng-click="linkTargetButton()" class="btn btn-danger btn-flat">{{phrase.Search}}</button>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12" style="padding-top:10px;">
            <div class="box-body table-responsive">
                <table class="table table-bordered">
                    <tbody>
                        <tr ng-repeat="studentOne in searchTargetResults">
                            <td>{{studentOne.name}}</td>
                            <td>{{studentOne.email}}</td>
                            <td class="no-print">
                                <button type="button" ng-click="linkTargetFinish(studentOne)" class="btn btn-success btn-flat">{{phrase.select}}</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</modal>