/.form-row
  .form-label= t 'attributes.project.name'
  .form-field= input value=model.name enter='saveRecord'
/.form-row
  .form-label= t 'attributes.project.start_date'
  .form-field= pick-a-date date=model.start_date on-selected=(action (mut model.start_date))
/.form-row
  .form-label= t 'attributes.project.end_date'
  .form-field= pick-a-date date=model.end_date on-selected=(action (mut model.end_date))
/.form-row
  .form-label= t 'attributes.project.instance_scope'
  .form-field
    x-select value=model.instance_scope action=(action (mut model.instance_scope)) as |xs|
      each globals.project.instance_scope_options as |instance_scope|
        xs.option value=instance_scope
          = instance_scope
/.form-row
  .form-label= t 'attributes.project.expected_number_of_workflow_instances'
  .form-field= number-input numericValue=model.expected_number_of_workflow_instances
/.form-row
  .form-label= t 'models.plural.user'
  .form-field= ui-multi-select options=possible_users labelProperty='nickname' selected=project_users
/.form-row
  .form-label= t 'models.workflow_instance_type'
  .form-field
    x-select value=model.workflow_instance_type.content on-change=(action 'selectWorkflowInstanceType') as |xs|
      option --
      each possible_workflow_instance_types as |record|
        xs.option value=record
          = record.name
table.ui.compact.definition.table
  tr
    td= t 'attributes.project.name'
    td= input value=model.name enter='saveRecord'
  tr
    td= t 'attributes.project.start_date'
    td= ui-calendar-moment type='date' momentValue=(readonly model.start_date) onChange=(action (mut model.start_date))
  tr
    td= t 'attributes.project.end_date'
    td= ui-calendar-moment type='date' momentValue=(readonly model.end_date) onChange=(action (mut model.end_date))
  tr
    td= t 'attributes.project.expected_number_of_workflow_instances'
    td= number-input numericValue=model.expected_number_of_workflow_instances
  /tr
    td= t 'models.plural.user'
    td= ui-multi-select options=possible_users labelProperty='nickname' selected=project_users
  tr
    td= t 'models.workflow_instance_type'
    td
      x-select value=model.workflow_instance_type.content on-change=(action 'selectWorkflowInstanceType') as |xs|
        option --
        each possible_workflow_instance_types as |record|
          xs.option value=record
            = record.name
  tr
    td= t 'attributes.project.instance_scope'
    td
      x-select value=model.instance_scope action=(action (mut model.instance_scope)) as |xs|
        each globals.project.instance_scope_options as |instance_scope|
          xs.option value=instance_scope
            = instance_scope
  if model.instance_scope_batch
    tr
      td= t 'attributes.project.batch_size_lower_value'
      td= number-input numericValue=model.batch_size_lower_value
    tr
      td= t 'attributes.project.batch_size_upper_value'
      td= number-input numericValue=model.batch_size_upper_value
  tr
    td= t 'attributes.project.reference_date_day_of_week'
    td
      = ui-dropdown class='selection' selected=model.reference_date_day_of_week onChange=(action (mut model.reference_date_day_of_week))
        .default.text= t 'project.select_reference_date_day_of_week'
        i.dropdown.icon
        .menu
          .item data-value='': span --
          each globals.week_days as |week_day|
            .item data-value=week_day.name
              = t week_day.name scope='date.week_day'

unless model.isNew
  h3.ui.top.attached.header
    .ui.right.floated.icon.buttons
      = push-action type='new' action='newProjectScenario' description=(t 'action.add_model' modelPath='models.project_scenario')
      if model.project_scenarios.length
        = push-action type='raster' action=(route-action 'show_project_scenarios_grid' model)
    = t 'models.plural.project_scenario'
  .ui.bottom.attached.segment
    .ui.segments
      each (sort-by 'name' model.project_scenarios) as |project_scenario|
        project/scenario-edit-item model=project_scenario
      else
        .ui.segment No scenarios defined
.modal-actions.sticky
  button.ui.primary.button.modal-save.pull-right{action 'saveRecord'}= t 'general.save'
  button.ui.negative.button.modal-destroy.pull-right{action 'destroyRecord'}= t 'general.destroy.button'
  button.ui.basic.button.modal-rollback{action 'rollback_and_close'}= t 'general.rollback'
  if model.isNew
    button.ui.secondary.button{action (route-action 'new_project_from_contract' model)}= t 'project.new_project_from_contract.title'
