<!-- ============================================================== -->
<!-- Project Form Modal Content -->
<!-- ============================================================== -->
{% set project = entry.project %}
{% set is_manager = current_user.is_manager %}
{% set can_edit = is_manager or (project.user_can_edit and current_user == project.user) or current_user == project.creation_user %}
{% set readonly = '' if can_edit else 'readonly' %}
{% set disabled = '' if can_edit else 'disabled' %}

  <div class="modal-dialog modal-dialog-centered modal-xl" role="document" style="max-width: 80%">
    <div class="modal-content">
      <div class="modal-header">
        <h3 class="modal-title" id="entry-modal-title"> {{ entry_type_label }} (Id = {{ entry.id }})</h3>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="row">

            <!-- Entry Form -->
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                <form id="entry-form" data-parsley-validate="" novalidate="">
                    <input type="hidden" id="entry-id" name="entry-id" value="{{ entry.id }}">
                    <input type="hidden" id="entry-type" name="entry-type" value="{{ entry.type }}">
                    <input type="hidden" id="entry-project-id" name="entry-project-id" value="{{ project.id }}">
                    <input type="hidden" value="09:00:00.000", id="hour_id">

                    <!-- Date -->
                    <div class="form-group row">
                        <label class="col-12 col-sm-3 col-form-label text-sm-right">Date</label>
                        <div class="col-12 col-sm-8 col-lg-6">
                             <input type="text" class="form-control datetimepicker-input" data-target="#entry-date" id="entry-date" data-toggle="datetimepicker" />
                        </div>
                    </div>

                    <!-- Title Row -->
                    <div class="form-group row">
                        <label class="col-12 col-sm-3 col-form-label text-sm-right">Title</label>
                        <div class="col-12 col-sm-8 col-lg-6">
                            <input type="text" {{ readonly }} required="" placeholder="Enter Title" id="entry-title" class="form-control" value="{{ entry.title }}">
                        </div>
                    </div>

                    <!-- Description Row -->
                    <div class="form-group row">
                        <label class="col-12 col-sm-3 col-form-label text-sm-right">Description </label>
                        <div class="col-12 col-sm-8 col-lg-6">
                            <textarea {{ readonly }} required="" class="form-control" id="entry-description">{{ entry.description }}</textarea>
                        </div>
                    </div>

                </form>
            </div>
            <!-- end Entry Form -->

            {% if definition %}
                <div class="simple-outline-card col-11 ml-4">

                {% include "dynamic_form.html" %}

                </div>
            {% endif %}

        </div>

      </div>

      <div class="modal-footer">

        {% set btnCancelText = "Cancel" if can_edit else "Close" %}
          <button type="button" id="entry-btn-cancel"  class="btn btn-outline-secondary" data-dismiss="modal">{{ btnCancelText }}</button>

          {% if can_edit %}
              {% set btnOkText = "Update" if entry.id else "Create" %}
               <button class="btn btn-outline-dark" onclick="onEntryOkButtonClick()">{{ btnOkText }}</button>
          {% else %}

          {% endif %}

      </div>
    </div>
  </div>
<!-- ============================================================== -->
<!-- End of Application Modal Content -->
<!-- ============================================================== -->

<script>
    (function(window, document, $, undefined) {
    "use strict";

    $('#entry-date').datetimepicker({
        format: 'YYYY/MM/DD',
        date:  new Date('{{ entry.date|pretty_date }}')
    });

})(window, document, window.jQuery);
</script>