<div class="box box-primary"><div class="box-header"><h3 class="box-title" x-ng-if="state === 'create'">{{ 'DOMAIN_POLICIES.BOX_FORM.TITLE_CREATION' | translate }}</h3><h3 class="box-title" x-ng-if="state === 'edit'">{{domainPolicy.identifier}}</h3><div class="pull-right box-tools"><button class="btn btn-maroon btn-sm" tooltip="{{'COMMON.BASIC_FORM.BUTTON_CLOSE' | translate}}" x-ng-click="cancel()"><i class="fa fa-bars"></i></button></div></div><form class="form" name="domainPolicyForm" role="form" novalidate x-ls-form-submit="submit()" x-ls-form-attempt><fieldset><div class="box-body"><div x-ng-if="state === 'create'"><!-- Identifier --><div class="form-group" x-ng-class="{'has-error': domainPolicyForm.identifier.$invalid &&
                (domainPolicyForm.identifier.$dirty || ls.domainPolicyForm.attempted)}"><label for="identifier">{{ 'DOMAIN_POLICIES.BOX_FORM.LABEL_IDENTIFIER' | translate }}</label><input id="identifier" name="identifier" class="form-control" type="text" required x-ng-model="domainPolicy.identifier"></div></div><!-- Description --><div class="form-group"><label for="description">{{ 'DOMAIN_POLICIES.BOX_FORM.LABEL_DESCRIPTION' | translate }}</label><textarea id="description" name="description" class="form-control" x-ng-model="domainPolicy.description">
          </textarea></div><div class="form-group"><label>{{ 'DOMAIN_POLICIES.BOX_FORM.LABEL_RULES' | translate }}</label><div class="form-inline form-group"><div class="form-group"><label class="sr-only" for="ruleType">{{ 'DOMAIN_POLICIES.BOX_FORM.LABEL_RULE_TYPES' | translate }}</label><select name="ruleType" class="form-control" x-ng-model="ruleToAdd.type" x-ng-options="type as 'COMMON.ENUM.DOMAIN_ACCESS_RULE_TYPE.' + type | translate for type in allRuleTypes | orderBy:'toString()'"></select></div><div class="form-group"><label class="sr-only" for="ruleDomain">{{ 'DOMAIN_POLICIES.BOX_FORM.LABEL_DOMAINS' | translate }}</label><select name="ruleDomain" class="form-control" x-ng-model="ruleToAdd.domain" x-ng-disabled="ruleToAdd.type === 'ALLOW_ALL' || ruleToAdd.type === 'DENY_ALL'" x-ng-options="domain.originalElement as domain.label for domain in allDomains | orderBy:'label'"></select></div><button type="button" class="btn btn-success" x-ng-click="addRule(ruleToAdd)"><i class="fa fa-plus"></i>&nbsp; {{ 'DOMAIN_POLICIES.BOX_FORM.BUTTON_ADD_RULE' | translate }}</button></div><table class="table table-striped" x-ng-table="tableParams"><tbody><tr x-ng-repeat="rule in $data" class="not-linked"><td data-title="'DOMAIN_POLICIES.BOX_FORM.TABLE.HEADER_POSITION' | translate"><div class="btn-group"><button type="button" class="btn btn-primary" x-ng-click="swap($index, $index - 1)" x-ng-disabled="$first"><i class="fa fa-arrow-circle-up"></i></button> <button type="button" class="btn btn-primary" x-ng-click="swap($index, $index + 1)" x-ng-disabled="$last"><i class="fa fa-arrow-circle-down"></i></button></div><td data-title="'DOMAIN_POLICIES.BOX_FORM.TABLE.HEADER_DOMAIN' | translate"><span>{{rule.domain.label}}</span><td data-title="'DOMAIN_POLICIES.BOX_FORM.TABLE.HEADER_TYPE' | translate"><span>{{ 'COMMON.ENUM.DOMAIN_ACCESS_RULE_TYPE.' + rule.type | translate }}</span><td class="col-sm-2" data-title="'DOMAIN_POLICIES.BOX_FORM.TABLE.HEADER_ACTIONS' | translate"><button class="btn btn-danger" type="button" x-ng-show="confirm === undefined" x-ng-click="confirm = $index">{{ 'DOMAIN_POLICIES.BOX_FORM.TABLE.BUTTON_DELETE_RULE' | translate }}</button> <button class="btn" type="button" x-ng-show="confirm === $index" x-ng-click="confirm = undefined">{{ 'DOMAIN_POLICIES.BOX_FORM.TABLE.BUTTON_DELETE_RULE_NO' | translate }}</button> <button class="btn btn-danger" type="button" x-ng-show="confirm === $index" x-ng-click="deleteRule($index)">{{ 'DOMAIN_POLICIES.BOX_FORM.TABLE.BUTTON_DELETE_RULE_YES' | translate }}</button></table></div></div><div class="box-footer"><!-- Validation --><button id="delete" name="delete" type="button" class="btn btn-danger" x-ng-show="state==='edit'" x-ng-click="remove()">{{ 'DOMAIN_POLICIES.BOX_FORM.FORM_ACTIONS.BUTTON_DELETE' | translate }}</button> <button type="button" id="reset" name="reset" class="btn btn-warning" x-ng-click="reset()">{{ 'DOMAIN_POLICIES.BOX_FORM.FORM_ACTIONS.BUTTON_RESET' | translate }}</button> <button type="submit" id="submit" name="submit" class="btn btn-success">{{ 'DOMAIN_POLICIES.BOX_FORM.FORM_ACTIONS.BUTTON_SUBMIT' | translate }}</button></div></fieldset></form></div>