<div class="modal-header">
  <h4 class="modal-title pull-left">费用详细信息</h4>
</div>
<div class="modal-body">
  <div class="card card-default">
    <div class="card-body">
      <ng-container [formGroup]="valForm">
        <div class="form-group row">
          <label class="col-lg-2 col-form-label text-lg-right">报考费用编号</label>
          <div class="col-lg-4 col-md-4">
            <input class="form-control" type="number" formControlName="fee_id"
                   [(ngModel)]="currentEntity.fee_id"
                   [readonly]="editModel === 'edit'" maxlength="2"/>
            <form-msg [valForm]="valForm" [fieldName]="'fee_id'"></form-msg>
            <form-msg [valForm]="valForm" [fieldName]="'fee_id'" [errorCode]="'min'"></form-msg>
            <form-msg [valForm]="valForm" [fieldName]="'fee_id'" [errorCode]="'max'"></form-msg>

          </div>
          <label class="col-lg-2 col-form-label text-lg-right">报考费用名称</label>
          <div class="col-lg-4 col-md-4">
            <input class="form-control" type="text" formControlName="fee_name" maxlength="128"
                   [(ngModel)]="currentEntity.fee_name"/>
            <form-msg [valForm]="valForm" [fieldName]="'fee_name'"></form-msg>
            <form-msg [valForm]="valForm" [fieldName]="'fee_name'" [errorCode]="'minLength'"></form-msg>
            <form-msg [valForm]="valForm" [fieldName]="'fee_name'" [errorCode]="'maxLength'"></form-msg>
          </div>
        </div>

        <div class="form-group row">
          <label class="col-lg-2 col-form-label text-lg-right">费用范围</label>
          <div class="col-lg-4 col-md-4">
            <select class="form-control" formControlName="fee_range" frameDict [dictName]="'ConfFeeRange'"
                    [tipFlag]="false" [(ngModel)]="currentEntity.fee_range"> </select>
            <form-msg [valForm]="valForm" [fieldName]="'fee_range'" [errorCode]="'required'"></form-msg>
          </div>
          <label class="col-lg-2 col-form-label text-lg-right">费用使用类型</label>
          <div class="col-lg-4 col-md-4">
            <select class="form-control" formControlName="fee_type" frameDict [dictName]="'ConfFeeType'"
                    [tipFlag]="false" [(ngModel)]="currentEntity.fee_type"> </select>
            <form-msg [valForm]="valForm" [fieldName]="'fee_type'" [errorCode]="'required'"></form-msg>

          </div>
        </div>
      </ng-container>
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">省内外区别收费</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" frameDict [dictName]="'FrameStatus'"
                  [tipFlag]="false" [(ngModel)]="currentEntity.province_flag"> </select>

        </div>
      </div>

      <ng-container *ngFor="let s of frameService.getParamValue('ExamBatchs') | numberArray">

        <div class="form-group row">
          <label class="col-lg-2 col-form-label text-lg-right">{{s | frameDict:
            'ExamBatchName'}}{{currentEntity.province_flag==='Active'?'省内':'统一'}}金额(单位分)</label>
          <div class="input-group col-lg-4 col-md-4">
            <div class="input-group-prepend">
              <div class="input-group-text">¥</div>
            </div>
            <input class="form-control" type="number" maxlength="6"
                   [(ngModel)]="currentEntity['amount_'+s]"/>
          </div>
          <ng-container *ngIf="currentEntity.province_flag === 'Active'">
            <label class="col-lg-2 col-form-label text-lg-right">{{s | frameDict: 'ExamBatchName'}}省外金额</label>
            <div class="input-group col-lg-4 col-md-4">
              <div class="input-group-prepend">
                <div class="input-group-text">¥</div>
              </div>
              <input class="form-control" type="number" maxlength="6"
                     [(ngModel)]="currentEntity['out_amount_'+s]"/>
            </div>
          </ng-container>
        </div>
      </ng-container>
    </div>

  </div>
</div>
<div class="modal-footer justify-content-between">
  <div>
    <div class="btn-group mb-1 mr-1" dropdown [hidden]="currentEntity.fee_id === undefined">
      <button class="btn dropdown-toggle btn-secondary" type="button" dropdownToggle>其他操作
        <span class="caret"></span>
      </button>
      <div *dropdownMenu class="dropdown-menu" role="menu">
        <a class="dropdown-item" href="#" (click)="removeFee(1)">删除省外初试</a>
        <div class="dropdown-divider"></div>
        <a class="dropdown-item" href="#" (click)="removeFee(2)">删除复试费用</a>
        <div class="dropdown-divider"></div>
        <a class="dropdown-item" href="#" (click)="removeFee(3)">删除三试费用</a>
      </div>
    </div>
  </div>
  <div>
    <button class="btn btn-primary" type="button"
            (click)="submitForm('conf/fee/add.htm', {successMsg: '报考费用添加完成!'})"
            *ngIf="editModel === 'add'">新增报考费用
    </button>
    <button class="btn btn-primary" type="button" (click)="submitForm('conf/fee/edit.htm')"
            *ngIf="editModel === 'edit'">
      修改报考费用
    </button>
    <button class="btn btn-secondary" type="button" (click)="closeWindow()">关闭窗口</button>
  </div>
</div>
