<div class="addHospital-w">
    <div class="container">
      <div class="row" style="margin-bottom: 30px;">
        <div class="col-12">
          <ul class="list-unstyled titileLi-w">
            <li class="headingText-w">خدمه الحركه  </li>
            <li class="headingText-w" style="cursor:pointer" (click)="authSer.perviousLocation()"> تسجيل حركه المركبه</li>
            <li class="headingText-w activeLi-w" style="margin-right:5px"> {{typePage}} </li>
          </ul>
        </div>
      </div>
      <div class="containerContent-w">

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

          <form (ngSubmit)="onSubmitted()" #f="ngForm">
            <div class="row">

              <div class="col-12 col-sm-12 col-md-4">
                <div class="form-group">
                  <label for="vehicle_type_id" style="float: right; margin-right: 5px">نوع المركبه</label>
                  <select class="form-control" name="vehicle_type_id" (input)="onChangeVehicleType($event)" [disabled]="checkEdit" [(ngModel)]="formData.vehicle_type_id" required>
                    <option *ngFor="let type of vehicle_types" [value]="type.id">{{type.name}}</option>
                  </select>
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4" *ngIf='show'>
                  <div class="form-group">
                    <label for="vehicle_id" style="float: right; margin-right: 5px"> رقم اللوحات</label>
                    <select class="form-control" name="vehicle_id" [(ngModel)]="formData.vehicle_id" [disabled]="checkEdit" required>
                      <option *ngFor="let num of licenseNum" [value]="num.id">{{num.plate_number}}</option>
                    </select>
                  </div>
                </div>
              <div class="col-12 col-sm-12 col-md-4">
                <div class="form-group">
                   <label for="vehicle_recipient_name" style="float: right; margin-right: 5px">إسم الموظف</label>
                   <input type="text" class="form-control" placeholder="إسم الموظف" name="vehicle_recipient_name" id="vehicle_recipient_name" [(ngModel)]="formData.vehicle_recipient_name" ngModel required />
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4">
                <div class="form-group">
                    <label for="phone" style="float: right; margin-right: 5px">الجوال</label>
                    <input type="text" class="form-control" placeholder="الهاتف" name="phone" id="phone" appOnlyNumber [(ngModel)]="formData.phone" ngModel required />
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                <div class="form-group">
                  <label for="startDate" style="float:right" >تاريخ إستلام المركبه<span class="spanReqired-w">*</span></label>
                  <div *ngIf='bindingDateSplitStart && typeMode'>
                    <app-higri-date (onDatePicked)="getDate($event, 'start')" [myDate]="bindingDateSplitStart"></app-higri-date>
                  </div>
                  <div *ngIf='!typeMode'>
                    <app-higri-date (onDatePicked)="getDate($event, 'start')" ></app-higri-date>
                  </div>
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                <div class="form-group">
                  <label for="endDate" style="float:right" >تاريخ تسليم البطاقه <span class="spanReqired-w">*</span></label>
                  <div *ngIf='bindingDateSplitEnd && typeMode'>
                    <app-end-higri-date  (onDatePicked)="getDate($event, 'end')" [myEndDate]="bindingDateSplitEnd"> </app-end-higri-date>
                  </div>
                  <div *ngIf='!typeMode'>
                    <app-end-higri-date  (onDatePicked)="getDate($event, 'end')" ></app-end-higri-date>
                  </div>
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4">
                <div class="form-group">
                    <label for="start_mileage_recording" style="float: right; margin-right: 5px">تسجيل عدد الكيلومترات البداية</label>
                    <input type="number" class="form-control" placeholder="تسجيل عدد الكيلومترات البداية" name="start_mileage_recording" id="start_mileage_recording" [(ngModel)]="formData.start_mileage_recording" ngModel required />
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-4">
                <div class="form-group">
                    <label for="end_mileage_recording" style="float: right; margin-right: 5px">تسجيل عدد الكيلومترات للنهاية</label>
                    <input type="number" class="form-control" placeholder="تسجيل عدد الكيلومترات للنهاية" name="end_mileage_recording" id="end_mileage_recording" [(ngModel)]="formData.end_mileage_recording" ngModel required />
                </div>
              </div>

              <div class="col-12 col-sm-12 col-md-12">
                <div class="form-group">
                  <label for="movement_notes" style="float: right;margin-right: 5px"> الملاحظات<span class="spanReqired-w">*</span></label>
                  <quill-editor id="movement_notes" name="movement_notes" [(ngModel)]="formData.movement_notes" >
                  </quill-editor>
                </div>
              </div>

              <div class="col-12">
                  <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid || checkSaveclick">حفظ</button>
                  <button type="button" class="btn btn-warning rightW" (click)="authSer.backFromEdit()">إلغاء</button>
              </div>

            </div>
          </form>

        </div>
      </div>

      <hr class="hr" *ngIf='typeMode'>

      <div class="row" *ngIf='typeMode'>
        <div class="col-12 col-sm-12 col-md-12 col-lg-6" style="margin: 10px 0;">
          <div class="form-group">
            <span class="spanSelect-w">
              <select [ngModel]="dataTableNumber" class="form-control selectButton-w" (input)="onGetValue($event)">
                <option value="5">5</option>
                <option value="10">10</option>
                <option value="15">15</option>
                <option value="20">20</option>
              </select>
              من العناصر يتم عرضها
            </span>
          </div>
        </div>
        <div class="col-12">
          <!-- taaaaaaaaaaable -->
          <h2 *ngIf="vehicleDataTable.length == 0" class="title"> لايوجد بيانات لعرضها في الجدول </h2>
          <table class="table table-bordered">
            <thead class="headBackground-w">
              <tr>
                <th> تاريخ إستلام المركبه</th>
                <th>تاريخ إستلام البطاقه </th>
                <th>تسجيل عدد الكيلومترات البداية</th>
                <th>تسجيل عدد الكيلومترات للنهايه</th>
              </tr>
            </thead>
            <tbody>
              <tr *ngFor="let data of vehicleDataTable | paginate: { itemsPerPage: perPagePagenation, currentPage: currentPage, totalItems: count }; let i = index ">
                <td>{{data.vehicle_receipt_date}}</td>
                <td>{{data.vehicle_delivery_date}}</td>
                <td>{{data.start_mileage_recording}}</td>
                <td>{{data.end_mileage_recording}}</td>
              </tr>
            </tbody>
          </table>
          <pagination-controls nextLabel="التالي" previousLabel="السابق" (pageChange)="onPageChange($event)"></pagination-controls>
        </div>
      </div>

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