<div class="wrapper_target">
  <div class="nav">
    <ul class="tab">
      <li (click)="searchType=1;this.salesTargetQuery(1)" [ngClass]="{selected:searchType===1}">销售目标</li>
      <li (click)="searchType=2;salesTargetQuery(1)" [ngClass]="{selected:searchType===2}">销售活动量</li>
      <li (click)="searchType=5;this.salesTargetQuery(2)" *ngIf="isTeamleader==='1'"
        [ngClass]="{selected:searchType===5}">团队销售目标</li>
      <!-- <li (click)="searchType=6;this.salesTargetQuery(2)" *ngIf="isTeamleader==='1'"
        [ngClass]="{selected:searchType===6}">团队销售活动量</li> -->
      <li (click)="searchType=3;potentialGoalsQuery();" *ngIf="isTeamleader==='1'"
        [ngClass]="{selected:searchType===3}">
        增员目标</li>
      <li (click)="searchType=4;potentialGoalsActionsQuery()" *ngIf="isTeamleader==='1'"
        [ngClass]="{selected:searchType===4}">增员活动量</li>
    </ul>
  </div>

  <div class="content_target" *ngIf="searchType===1">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="personalSalesReadonlyFlag"
          (click)="personalSalesReadonlyFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!personalSalesReadonlyFlag" (click)="salesTargetSave(1)"></i>
        <div class="title">个人年度销售目标</div>
        <div class="content_target_item">
          <span>首年保费FYP</span>
          <input class="form-control" type="text" [(ngModel)]="premium" (ngModelChange)="getMonthAverage('premium');"
            (blur)="inputBlur()" placeholder="{{personalSalesReadonlyFlag?'暂无预计年保费':'请输入预计年保费'}}"
            [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item">
          <span>首年佣金FYC</span>
          <input class="form-control" type="text" [(ngModel)]="commission"
            (ngModelChange)="getMonthAverage('commission')" (blur)="inputBlur()"
            placeholder="{{personalSalesReadonlyFlag?'暂无预计年佣金':'请输入预计年佣金'}}" [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item">
          <span>件均保费</span>
          <input class="form-control" type="text" [(ngModel)]="pieceAveragePremium"
            (ngModelChange)="getMonthAverage('pieceAveragePremium')" (blur)="inputBlur()"
            placeholder="{{personalSalesReadonlyFlag?'暂无件均保费':'请输入年度件均保费'}}" [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item" style="border-bottom: none;">
          <span>成交件数(FYP/件均保费)</span>
          <input class="form-control" type="text" [(ngModel)]="pieces" style="width: 40%;"
            placeholder="{{personalSalesReadonlyFlag?'暂无预计成交件数':'FYP/年件均保费'}}" disabled />
        </div>
      </div>
      <div class="line">

        <div class="title">个人月销售目标</div>
        <div class="month_target_item_wrapper" *ngFor="let salesTargetMonthsItem of salesTargetMonths">
          <span class="dot" style="font-weight: bold;">{{salesTargetMonthsItem.monthNum}}月</span>
          <div class="content_target_item">
            <span>FYP</span>
            <input type="text" class="form-control" placeholder="{{personalSalesReadonlyFlag?'暂无目标保费':'请输入目标保费'}}"
              [(ngModel)]="salesTargetMonthsItem.premium" (ngModelChange)="changePremium();"
              [disabled]="personalSalesReadonlyFlag" (blur)="inputBlur()">
          </div>
          <div class="content_target_item">
            <span>FYC</span>
            <input type="number" class="form-control" placeholder="{{personalSalesReadonlyFlag?'暂无目标佣金':'请输入目标佣金'}}"
              [(ngModel)]="salesTargetMonthsItem.commission" (ngModelChange)="changePremium()"
              [disabled]="personalSalesReadonlyFlag" (blur)="inputBlur()">
          </div>
          <div class="content_target_item">
            <span>件数</span>
            <input type="number" class="form-control" placeholder="件数" disabled
              [(ngModel)]="salesTargetMonthsItem.pieces">
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="content_target" *ngIf="searchType===2">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="personalSalesActivityFlag"
          (click)="personalSalesActivityFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!readonlyFlag && salesTargetFlag && !personalSalesActivityFlag"
          (click)="salesTargetMonthSave(1)"></i>
        <div class="title">月均销售活动量目标</div>
        <div *ngIf="!salesTargetActions || salesTargetActions.length<=0" style="text-align: center;">请先设置销售目标</div>
        <div class="content_target_item" *ngFor="let salesTargetActionItem of salesTargetActions">
          <span>{{salesTargetActionItem.leadsActionName}}</span>
          <input class="form-control" type="text" [(ngModel)]="salesTargetActionItem.actionStandards"
            (blur)="inputBlur()" [disabled]="personalSalesActivityFlag" />
        </div>
      </div>
    </div>
  </div>

  <div class="content_target" *ngIf="searchType===3">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="recruitsReadonlyFlag" (click)="recruitsReadonlyFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!recruitsReadonlyFlag" (click)="potentialGoalsSetting()"></i>
        <div class="title">年增员目标</div>
        <div class="content_target_item">
          <span>年度增员目标</span>
          <input class="form-control" type="text" [(ngModel)]="numberRecruitsYear"
            (ngModelChange)="getMonthRecruitsAverage('Recruits')" [disabled]="recruitsReadonlyFlag"
            placeholder="{{readonlyFlag?'暂无年度增员目标':'请输入预计年度增员目标'}}" (blur)="inputBlur()" />
        </div>
        <div class="content_target_item" style="border-bottom: none;">
          <span>MDRT数量</span>
          <input class="form-control" type="text" [(ngModel)]="numberMDRTYear"
            (ngModelChange)="getMonthRecruitsAverage('MDRT')" [disabled]="recruitsReadonlyFlag"
            placeholder="{{readonlyFlag?'暂无年MDRT数量':'请输入预计年度MDRT数量'}}" (blur)="inputBlur()" />
        </div>
      </div>
      <div class="line">
        <div class="title">月增员目标</div>
        <div class="month_target_item_wrapper" *ngFor="let recruitGoalForMonthItem of recruitGoalForMonthList">
          <div class="content_target_item">
            <span>{{recruitGoalForMonthItem.month}}月增员目标数</span>
            <input type="number" class="form-control" placeholder="请输入增员目标数" [disabled]="recruitsReadonlyFlag"
              [(ngModel)]="recruitGoalForMonthItem.numberRecruits" (ngModelChange)="changeMonthRecruit()"
              (blur)="inputBlur()">
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="content_target" *ngIf="searchType===4">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="recruitsActivityReadonlyFlag"
          (click)="recruitsActivityReadonlyFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!readonlyFlag && recruitingTargetFlag && !recruitsActivityReadonlyFlag"
          (click)="potentialGoalsActionsUpdate()"></i>
        <div class="title">月均增员活动量目标</div>
        <div *ngIf="!goalsActionsInfoList || goalsActionsInfoList.length<=0" style="text-align: center;">请先设置增员目标</div>
        <div class="content_target_item" *ngFor="let goalsActionsInfoItem of goalsActionsInfoList">
          <span>{{goalsActionsInfoItem.potentialActionName}}</span>
          <input type="number" style="width: 30%;" class="form-control"
            [(ngModel)]="goalsActionsInfoItem.actionStandards" (blur)="inputBlur()"
            [disabled]="recruitsActivityReadonlyFlag" />
        </div>
      </div>
    </div>
  </div>

  <div class="content_target" *ngIf="searchType===5">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="personalSalesReadonlyFlag"
          (click)="personalSalesReadonlyFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!personalSalesReadonlyFlag" (click)="salesTargetSave(2)"></i>
        <div class="title">团队年度销售目标</div>
        <div class="content_target_item">
          <span>首年保费FYP</span>
          <input class="form-control" type="text" [(ngModel)]="premium" (ngModelChange)="getMonthAverage('premium')"
            placeholder="{{personalSalesReadonlyFlag?'暂无预计年保费':'请输入预计年保费'}}" [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item">
          <span>首年佣金FYC</span>
          <input class="form-control" type="text" [(ngModel)]="commission"
            (ngModelChange)="getMonthAverage('commission')"
            placeholder="{{personalSalesReadonlyFlag?'暂无预计年佣金':'请输入预计年佣金'}}" [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item">
          <span>件均保费</span>
          <input class="form-control" type="text" [(ngModel)]="pieceAveragePremium"
            (ngModelChange)="getMonthAverage('pieceAveragePremium')"
            placeholder="{{personalSalesReadonlyFlag?'暂无件均保费':'请输入年度件均保费'}}" [disabled]="personalSalesReadonlyFlag" />
        </div>
        <div class="content_target_item" style="border-bottom: none;">
          <span>成交件数(FYP/件均保费)</span>
          <input class="form-control" type="text" [(ngModel)]="pieces" style="width: 40%;"
            placeholder="{{personalSalesReadonlyFlag?'暂无预计成交件数':'FYP/年件均保费'}}" disabled />
        </div>
      </div>
      <div class="line">

        <div class="title">团队月销售目标</div>
        <div class="month_target_item_wrapper" *ngFor="let salesTargetMonthsItem of salesTargetMonths">
          <span class="dot" style="font-weight: bold;">{{salesTargetMonthsItem.monthNum}}月</span>
          <div class="content_target_item">
            <span>FYP</span>
            <input type="number" class="form-control" placeholder="{{personalSalesReadonlyFlag?'暂无目标保费':'请输入目标保费'}}"
              [(ngModel)]="salesTargetMonthsItem.premium" (ngModelChange)="changePremium()"
              [disabled]="personalSalesReadonlyFlag">
          </div>
          <div class="content_target_item">
            <span>FYC</span>
            <input type="number" class="form-control" placeholder="{{personalSalesReadonlyFlag?'暂无目标佣金':'请输入目标佣金'}}"
              [(ngModel)]="salesTargetMonthsItem.commission" (ngModelChange)="changePremium()"
              [disabled]="personalSalesReadonlyFlag">
          </div>
          <div class="content_target_item">
            <span>件数</span>
            <input type="number" class="form-control" placeholder="件数" disabled
              [(ngModel)]="salesTargetMonthsItem.pieces">
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- <div class="content_target" *ngIf="searchType===6">
    <div class="content_target_wrapper">
      <div class="line">
        <i class="iconfont icon-bianji" *ngIf="personalSalesActivityFlag"
          (click)="personalSalesActivityFlag = false;"></i>
        <i class="iconfont icon-save" *ngIf="!readonlyFlag && salesTargetFlag && !personalSalesActivityFlag"
          (click)="salesTargetMonthSave(2)"></i>
        <div class="title">月均销售活动量目标</div>
        <div *ngIf="!salesTargetFlag" style="text-align: center;">请先设置销售目标</div>
        <div class="content_target_item" *ngFor="let salesTargetActionItem of salesTargetActions">
          <span>{{salesTargetActionItem.leadsActionName}}</span>
          <input class="form-control" type="text" [(ngModel)]="salesTargetActionItem.actionStandards"
            (blur)="inputBlur()" [disabled]="personalSalesActivityFlag" />
        </div>
      </div>
    </div>
  </div> -->
</div>
<ydlife-toast *ngIf="toastDialog" [toastInfo]="toastInfo"></ydlife-toast>