<h1 ng-if="model.id" translate>Edit election</h1>
<h1 ng-if="!model.id" translate>New election</h1>

<div uib-alert ng-show="alert.show" ng-class="'alert-' + (alert.type || 'warning')" ng-click="alert={}" close="alert={}">
  {{ alert.msg }}
</div>

<form name="assignmentForm" ng-submit="save(model, gotoDetailView)">
  <formly-form model="model" fields="formFields">
    <hr class="smallhr">
    <div class="checkbox pointer" ng-click="$parent.$parent.gotoDetailView = !$parent.$parent.gotoDetailView">
      <i class="fa" ng-class="$parent.$parent.gotoDetailView ? 'fa-check-square-o' : 'fa-square-o'"></i>
      <translate>Open election detail view after save.</translate>
    </div>
    <button type="submit" ng-disabled="assignmentForm.$invalid" class="btn btn-primary" translate>
      Save
    </button>
    <button type="button" ng-click="closeThisDialog()" class="btn btn-default" translate>
      Cancel
    </button>
  </formly-form>
</form>
