<div bsModal #createModal="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createModal"
     aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-md">

        <div class="modal-content">

            <form #incidentCreateForm="ngForm" role="form" novalidate enctype="multipart/form-data" class="form-validation" *ngIf="active" (submit)="save()">
                <div class="modal-header">
                    <h5 class="modal-title">
                        <span>{{"Create Incident" | localize}}</span>
                    </h5>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')" [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">

                      <div class="form-group">
                          <label for="Content">{{"Content" | localize}} *</label>
                          <input id="contentInput" #contentInput="ngModel" type="text" name="Content" class="form-control"  [(ngModel)]="incident.content" required>
                          <validation-messages [formCtrl]="contentInput"></validation-messages>
                      </div>
                      <div class="form-group">
                        <div class="row">
                                      <div class="col-sm-6">
                                        <label for="IncidentDate" style="padding-bottom: 5px;">{{"Incident Date" | localize}} *</label>
                                        <input name="IncidentDate"
                                        type="text"
                                        class="form-control"
                                        id="IncidentDate"
                                        bsDatepicker
                                        [(ngModel)]="incidentDate"
                                        readonly="readonly"
                                        placeholder="Select Date" 
                                        #IncidentDate="ngModel"
                                        required/>
                                        <validation-messages [formCtrl]="IncidentDate"></validation-messages>
                                      </div>
                                      
                                      <div class="col-sm-6">
                                          <timepicker 
                                          name="incidentTime"
                                          [(ngModel)]="incidentTime" 
                                          [showSpinners]="true" 
                                          #incidentTimeCtrl="ngModel"></timepicker>
                                      </div>
                          </div>
                      </div>
                      
                      <div class="row">
                          <div class="col-sm-6">
                              <label for="Latitude">{{"Latitude" | localize}} *</label>
                              <input id="latitudeInput" #latitudeInput="ngModel" type="number" name="Latitude" class="form-control"  [(ngModel)]="geocode.latitude" required>
                              <validation-messages [formCtrl]="latitudeInput"></validation-messages>
                          </div>
                          <div class="col-sm-6">
                              <label for="Longitude">{{"Longitude" | localize}} *</label>
                              <input id="longitudeInput" #longitudeInput="ngModel" type="numbert" name="Longitude" class="form-control"  [(ngModel)]="geocode.longitude" required>
                              <validation-messages [formCtrl]="longitudeInput"></validation-messages>
                          </div>
                      </div>
                      <div class="form-group" style="padding-top: 25px;">
                          <label for="FileUploadFileInput">Add Image</label>
                          <p-fileUpload multiple="multiple"
                                        id="FileUploadFileInput"
                                        name="FileUploadFileInput[]"
                                        [url]="uploadUrl"
                                        accept="image/*"
                                        maxFileSize="1000000"
                                        (onSelect) = "getFile($event)"
                                        (onRemove) = "remove($event)"
                                        [showUploadButton]="false"
                                        [showCancelButton]="false"
                                        (onBeforeSend)="onBeforeSend($event)">

                              <ng-template pTemplate="content">
                                  <ul *ngIf="uploadedFiles.length">
                                      <li *ngFor="let file of uploadedFiles">{{file.name}} - {{file.size}} bytes</li>
                                  </ul>
                              </ng-template>
                          </p-fileUpload>
                      </div>
                      
                  

                </div>
                <div class="modal-footer">
                    <button type="button" [disabled]="saving" class="btn btn-secondary btn-elevate btn-pill" (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')" class="btn btn-primary btn-elevate btn-pill" [disabled]="!incidentCreateForm.form.valid || saving"><i class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>
