<div class="modal-header">
    <h3 ng-if="isSelectedParent">
        <ng-switch on="editMode || isEditParent">
            <span ng-switch-when="true" translate>common.editOrganization.parentTitle</span>
            <span ng-switch-default translate>common.addOrganization.parentTitle</span>
        </ng-switch>
    </h3>
    <h3 ng-if="!isSelectedParent">
        <ng-switch on="editMode || isEditParent">
            <span ng-switch-when="true" translate>common.editOrganization.title</span>
            <span ng-switch-default translate>common.addOrganization.title</span>
        </ng-switch>
    </h3>
</div>
<div class="modal-body">
    <form name="addOrganizationForm">
        <div class="row">
            <div class="col-sm-6 form-group">
                <label>&nbsp;</label>
                <button type="button" class="btn btn-primary" ng-show="(!editMode || isEditParent) && addNewEnabled"
                        ng-click="addNewOrganization()" translate>
                    common.addOrganization.addNew.label
                </button>
            </div>
            <div class="col-sm-6 form-group" ng-show="showSetPrimary">
                <label translate>common.addOrganization.setPrimary.label</label><span class="required-asterisk">*</span>
                <label>
                    <input type="radio" ng-model="isDefault" name="{{'common.addOrganization.radioName'}}" ng-value="true">
                    <translate>common.addOrganization.radioYes.text</translate>
                </label>
                <label ng-hide="hideNoField">
                    <input type="radio" ng-model="isDefault" name="{{'common.addOrganization.radioName'}}" ng-value="false">
                    <translate>common.addOrganization.radioNo.text</translate>
                </label>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6 form-group">
                <label for="organization" translate>common.addOrganization.organization.label</label><span
                    class="required-asterisk">*</span>
                <input id="organization" class="input-md form-control" type="text" ng-model="organizationValue" readonly
                        ng-disabled="editMode && !isEditParent" placeholder="{{'common.addOrganization.selectExisting.label' | translate}}"
                        ng-click="pickOrganization()" required>
                <small ng-if="hasSubCompany" translate>common.addOrganization.notifyParentOrgWillBeChanged</small>
            </div>
            <div class="col-sm-6 form-group" ng-if="!hideAssociationTypes">
                <label>{{assocTypeLabel}}</label><span class="required-asterisk">*</span>
                <select ng-show="!isSelectedParent" ng-change="notifyOrganizationParent($parent.type)" class="input-md form-control"
                        ng-model="$parent.type" ng-options="o.value | translate for o in $parent.types" required></select>

                <ng-switch ng-show="isSelectedParent" on="!!organizationValue">
                    <input translate ng-switch-when="true" class="input-md form-control" type="text" readonly
                            value="{{'common.addOrganization.type.label.text' | translate}}" />
                    <input translate ng-switch-default class="input-md form-control" type="text" readonly
                            value="{{'common.addOrganization.type.label.default.text' | translate}}" />
                </ng-switch>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <span class="text-danger" ng-if="duplicateOrganizationRoleError">
                    <span translate>
                        common.addOrganization.duplicateOrganizationRoleErrorMessage
                    </span>
                </span>
            </div>
        </div>
        <div class="row" ng-show="showDescription">
            <div class="col-sm-12 form-group">
                <label translate>common.addOrganization.description</label>
                <mention-textarea ng-model="description" params="params"></mention-textarea>
            </div>
        </div>
    </form>
</div>
<div class="modal-footer">
    <button class="btn btn-secondary" ng-click="onClickCancel()">
        <span translate>common.addOrganization.btnCancel.text</span>
    </button>
    <button class="btn btn-primary" ng-click="onClickOk()" ng-disabled="addOrganizationForm.$invalid || isInvalid()">
        <span translate>common.addOrganization.btnOk.text</span>
    </button>
</div>