<div class="card col-10">
  <div class="card-body">
    <h5 class="card-title text-center"><strong>طرح مشروع جديد</strong></h5>

    <!-- Multi Columns Form -->
    <form class="row g-3" [formGroup]="projectForm" (ngSubmit)="onSubmit(request)">
      <div class="row">
      <mat-form-field class="col-4"> 
        <input type="text" placeholder="مدير المشروع" formControlName="projectManager" matInput [matAutocomplete]="autoPM">
        <mat-autocomplete #autoPM="matAutocomplete" (optionSelected)="onManagerSelected($event.option.value)">
          <mat-option *ngFor="let manager of filteredManagers | async" [value]="manager">
            {{ manager.personalInfo | fullname }} , {{manager.email}}
          </mat-option>
        </mat-autocomplete>
      </mat-form-field>
    
      <!-- Team Leader -->
      <mat-form-field class="col-4">
        <input type="text" placeholder="رئيس فريق العمل" formControlName="teamLeader" matInput [matAutocomplete]="autoTL">
        <mat-autocomplete #autoTL="matAutocomplete" (optionSelected)="onLeaderSelected($event.option.value)">
          <mat-option *ngFor="let leader of filteredLeaders | async" [value]="leader">
            {{ leader.personalInfo | fullname  }} , {{leader.email}}
          </mat-option>
        </mat-autocomplete>
      </mat-form-field>
    
      <!-- Customer -->
      <mat-form-field class="col-4">
        <input type="text" placeholder="الجهة الطارحة" formControlName="customer" matInput [matAutocomplete]="autoCustomer">
        <mat-autocomplete #autoCustomer="matAutocomplete" (optionSelected)="onCustomerSelected($event.option.value)">
          <mat-option *ngFor="let customer of filteredCustomers | async" [value]="customer">
            {{ customer.customerName }} , {{customer.email}}
          </mat-option>
        </mat-autocomplete>
      </mat-form-field>

      </div>
      <hr>
    <div class="row mb-4" formGroupName="projectInfo">

        <mat-form-field class=" col-4">
          <mat-label for="name" class="mat-form-field-label ">اسم النشاط</mat-label>
          <input matInput  formControlName="name" [value]="request.projectInfo.name" placeholder="اسم المشروع" class="form-control" id="name">
        </mat-form-field>
      
    
        <mat-form-field class="example-full-width col-8">
          <mat-label  for="description" class="form-label">وصف النشاط</mat-label>
          <textarea matInput formControlName="description" placeholder="تعريف النشاط " class="form-control"></textarea>
        </mat-form-field>
        <mat-form-field class="col-4">
          <mat-label for="code" class="form-label">رمز المشروع</mat-label>
          <input matInput formControlName="code" class="form-control" id="code">
        </mat-form-field>
      
        <mat-form-field class="col-4">
          <mat-label for="endDate" class="form-label">تاريخ الانتهاء المتوقع</mat-label>
          <input formControlName="expectedEndDate" class="form-control" id="endDate"  matInput [matDatepicker]="end">

          <mat-datepicker-toggle matIconSuffix [for]="end"></mat-datepicker-toggle>
          <mat-datepicker #end></mat-datepicker>
        </mat-form-field>

        <mat-form-field class="col-4">
          <mat-label for="startDate" class="form-label">تاريخ البدء بالمشروع</mat-label>
          <input formControlName="startDate" class="form-control" id="startDate" matInput [matDatepicker]="start">
          <mat-datepicker-toggle matIconSuffix [for]="start"></mat-datepicker-toggle>
          <mat-datepicker #start></mat-datepicker>
        </mat-form-field>

    </div>
          
      <!-- <div class="row mb-4" formGroupName="projectInfo">
      
      </div> -->
    
      <div class="row mb-4" formGroupName="financialFund">
      
        
        <mat-form-field class="col-4">
          <mat-label  for="source" class="form-label">مصدر التمويل</mat-label>
          <input formControlName="source" class="form-control" id="source" matInput />
        </mat-form-field>
     
        <mat-form-field class="col-4">
          <mat-label  for="financialStatus" class="form-label" >وضع التمويل</mat-label>
          <input formControlName="financialStatus" class="form-control" id="financialStatus" matInput />
        </mat-form-field>
     
      </div>
    
      <div class="row" formGroupName="projectAggreement">
        <div class="col-4">
          <mat-form-field>
            <mat-label>تاريخ كتاب الموافقة</mat-label>
            <input  formControlName="aggreementDate" class="form-control" id="source" matInput [matDatepicker]="aggreement">
            <mat-datepicker-toggle matIconSuffix [for]="aggreement"></mat-datepicker-toggle>
            <mat-datepicker #aggreement></mat-datepicker>
          </mat-form-field>
          </div>
        <mat-form-field class="col-4">
          <mat-label  for="aggreementNumber" class="form-label">رقم كتاب الموافقة</mat-label>
          <input formControlName="aggreementNumber" class="form-control" id="aggreementNumber" matInput/>
        </mat-form-field>
     
      </div>
      <div class="row" formGroupName="proposalInfo">
        <div class="col-4">
          <mat-form-field>
            <mat-label>تاريخ كتاب الطرح</mat-label>
            <input  formControlName="proposingBookDate" class="form-control" id="proposingBookDate" matInput [matDatepicker]="proposingBookDate">
            <mat-datepicker-toggle matIconSuffix [for]="proposingBookDate"></mat-datepicker-toggle>
            <mat-datepicker #proposingBookDate></mat-datepicker>
          </mat-form-field>
          </div>
        <mat-form-field class="col-4">
          <mat-label  for="proposingBookNumber" class="form-label">رقم كتاب الطرح</mat-label>
          <input formControlName="proposingBookNumber" class="form-control" id="proposingBookNumber" matInput/>
        </mat-form-field>
     
      </div>
    
      <div class="col-4">
        <mat-form-field>
          <mat-label>الفعالية المنفذة </mat-label>
          <mat-select formControlName="executerId">
            <mat-option value="1">قسم المعلوميات</mat-option>
            <mat-option value="2">قسم النظم الاكترونية</mat-option>
          </mat-select>
        </mat-form-field>
        
      </div>
    
      <div class="row mb-4" formGroupName="projectClassification">
      
        <mat-form-field class="col-4">
          <mat-label  for="projectStatus" class="form-label" >حالة النشاط</mat-label>
          <input formControlName="projectStatus" class="form-control" id="projectStatus" matInput />
        </mat-form-field>
     
        <mat-form-field class="col-4">
          <mat-label  for="projectNature" class="form-label" >طبيعة النشاط</mat-label>
          <input formControlName="projectNature" class="form-control" id="projectNature" matInput />
        </mat-form-field>
        <mat-form-field class="col-4">
          <mat-label for="projectType" class="form-label" >وضع النشاط</mat-label>
          <input formControlName="projectType" class="form-control" id="projectType" matInput />
        </mat-form-field>
     
      </div>
    
      <hr>
      <div class="text-center">

        <button type="submit" class="btn btn-primary">إضافة</button>
      </div>
      
    </form><!-- End Multi Columns Form -->

  </div>
</div>
