<app-main-header></app-main-header>
<app-confirm-popup (sendCount)='sendtolist($event)'></app-confirm-popup>
<div class="col-sm-12">

  <div class="manager-row row">

    <div class="col-sm-3" *ngIf="setrmselectednameobj !=''">
      <div class="form-group dse-list">
        <label>RM: {{setrmselectednameobj}}</label>
      </div>
    </div>

    <div class="col-sm-3" *ngIf="setamselectednameobj !=''">
      <div class="form-group dse-list">
        <label>AM: {{setamselectednameobj}}</label>
      </div>
    </div>

    <div class="col-sm-3" *ngIf="setdealerselectednameobj !=''">
      <div class="form-group dse-list">
        <label>Dealer: {{setdealerselectednameobj}}</label>
      </div>
    </div>

    <div class="col-sm-3" *ngIf="setdseselectednameobj !=''">
      <div class="form-group dse-list">
        <label>DSE: {{setdseselectednameobj}}</label>
      </div>
    </div>
  </div>

</div>


<div class="section task-section">
  <div class="top-section row" *ngIf="!is_edit">

    <div class="col-sm-12 col-12">



      <div class="w100">
        <div class="row">
          <div class="col-sm-9">
            <p class="back" routerLink="/manager-activity-planner">
              <img src="assets/img/arrow_blue_left.png "> BACK
            </p>
          </div>
        </div>
      </div>

      <div class="box-type task-left">

        <div class="row">

          <div class="col-sm-12">
            <h5>Activity List</h5>
            <div class="table_training table-responsive scroll_x">
              <table class="table table-fixed">
                <thead>
                  <tr>
                    <th>Plan Title</th>
                    <th>Plan Date</th>
                    <th>From Time</th>
                    <th>To Time</th>
                    <th>Description</th>
                    <th>Created On</th>
                    <!-- <th>Edit</th>
                    <th>Delete</th> -->
                  </tr>
                </thead>
                <tbody *ngIf="todaylist.length != 0">
                  <tr *ngFor="let item of todaylist;">
                    <td>{{item.plan_title}}</td>
                    <td>{{item.plandate}}</td>
                    <td>{{item.fromtime}}</td>
                    <td>{{item.totime}}</td>
                    <td *ngIf="item.plan_description !=''">{{item.plan_description}}</td>
                    <td *ngIf="item.plan_description ==''">-</td>
                    <td>{{item.created_on}}</td>
                    <!-- <td>
                       <div class="edit" (click)="edittoday(item)"><img src="assets/img/edit.png " alt="Edit" title="Edit" ></div> 
                      
                    </td>
                    <td *ngIf="item.is_deleted =='0'">
                    
                      <div class="delete" (click)="deletetoday(item)"><img src="assets/img/delete.png "   alt="Delete" title="Delete" ></div> 
                      
                    </td>
                    <td *ngIf="item.is_deleted =='1'">
                        <div class="delete disabled" ><img src="assets/img/delete.png " ></div> 
                    </td> -->
                  </tr>
                </tbody>
                <tbody *ngIf="todaylist.length == 0">
                  <tr>
                    <td colspan="8">No Record Found</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>

        </div>

      </div>
    </div>


    <!-- <div class="col-sm-4 col-12 task-right">
      <app-taskstatus-manager></app-taskstatus-manager>
    </div> -->
  </div>

  <div class="top-section row" *ngIf="is_edit">
    <div class="col-sm-12 col-12">

      <div class="row">
        <div class="col-sm-12">
          <!-- <h4 class="head">My Activity Planner</h4> -->
          <p class="back" (click)='back()'>
            <img src="assets/img/arrow_blue_left.png "> BACK
          </p>
        </div>
      </div>
      
      <div class="box-type task-left">
        <form [formGroup]="addplanform" class="enquiry_form">

          <div class="row">
            <div class="col-sm-6">
              <div class="form-group">
                <label>Activity
                </label>
                <input class="form-control" type="text" [(ngModel)]="activity_edit" formControlName="activity" placeholder="Title">
              </div>
              <div class="color_error shake" *ngIf="addplanform.controls['activity'].invalid && submittedvalue ">
                <a class="text-left shake">
                  <img src="assets/img/error.png" />Please enter a title</a>
              </div>
            </div>
            <div class="col-sm-6">
              <div class="form-group">
                <label>Description
                </label>
                <input class="form-control" type="text" [(ngModel)]="description_edit" formControlName="description" placeholder="Description">
              </div>
              <div class="color_error shake" *ngIf="addplanform.controls['description'].invalid && submittedvalue ">
                <a class="text-left shake">
                  <img src="assets/img/error.png" />Please enter Description</a>
              </div>
            </div>
            <div class="col-sm-6">
              <div class="form-group training-date">
                <label>Date</label>
                <ng-datepicker [(ngModel)]="followupdate" formControlName="dateval" class="followupdate" [options]="options" name="followupdate"
                  class="form-control custom-date"></ng-datepicker>
              </div>
              <div class="color_error shake" *ngIf="addplanform.controls['dateval'].invalid && submittedvalue ">
                <a class="text-left shake">
                  <img src="assets/img/error.png" />Please select a date</a>
              </div>
            </div>
            <div class="col-sm-6">
              <div class="row">
                <div class="col-sm-6">
                  <div class="form-group">
                    <label>From Time</label>
                    <select class="form-control" [(ngModel)]="fromtime_edit" formControlName="fromtime" (change)="selectfromtime($event.target.value)"
                      required>
                      <option selected="selected" disabled="disabled" value="">--Select--</option>
                      <option *ngFor="let zm of timearr" [value]="zm.title_code">{{zm.title}}</option>
                    </select>
                    <div class="color_error shake" *ngIf="addplanform.controls['fromtime'].invalid && submittedvalue ">
                      <a class="text-left shake">
                        <img src="assets/img/error.png" />Please select from time</a>
                    </div>
                  </div>
                </div>
                <div class="col-sm-6">
                  <div class="form-group">
                    <label>To Time</label>
                    <select class="form-control minimal" [(ngModel)]="totime_edit" formControlName="totime" (change)="selecttotime($event.target.value)"
                      required>
                      <option selected="selected" disabled="disabled" value="">--Select--</option>
                      <option *ngFor="let zm of timearr" [value]="zm.title_code">{{zm.title}}</option>
                    </select>
                    <div class="color_error shake" *ngIf="addplanform.controls['totime'].invalid && submittedvalue ">
                      <a class="text-left shake">
                        <img src="assets/img/error.png" />Please select to time</a>
                    </div>
                    <div class="color_error shake"  *ngIf="addplanform.controls['fromtime'].value>addplanform.controls['totime'].value  && addplanform.controls['totime'].value!='' && submittedvalue ">
                      <a class="text-left shake">
                        <img src="assets/img/error.png" />Selected to time is should not less than from time
                        </a>
                  </div>
                </div>
              </div>

            </div>
          </div>
      </div>
      <div class="row">
        <div class="col-sm-12">
          <div class="text-right">
            <button class="common_btn" (click)='back()'>Close</button>
            <button class="common_btn" (click)="updateplan()">Save</button>
          </div>
        </div>
      </div>
      </form>
    </div>
  </div>
</div>
</div>