<loading-panel ng-if="loading"></loading-panel>
<div ng-if="!loading">
    <heading-bar heading="Network"
        subheading="[[network.network_address]]/[[network.prefix_length]]">
        <button ng-if="admin"
            class="btn btn-info"
            data-toggle="modal"
            data-target="#updateNetworkModal"
        >Update Network</button>
        <button ng-if="admin"
            class="btn btn-danger"
            data-toggle="modal"
            data-target="#deleteNetworkModal"
        >Delete Network</button>
    </heading-bar>

    <nsot-modal title="Update Network" modal-id="updateNetworkModal" modal-size="large">
        <div class="modal-body">
            <div ng-if="updateError" class="alert alert-danger">
                [[updateError.code]] - [[updateError.message]]
            </div>
            <form novalidate name="networkForm" class="nsot-form">
                <div ng-include="formUrl"></div>
            </form>

        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">
                Close
            </button>
            <button type="submit" ng-click="updateNetwork()"
                    class="btn btn-primary" ng-disabled="networkForm.$invalid"
            >
                Update
            </button>
        </div>
    </nsot-modal>

    <nsot-modal title="Delete Network" modal-id="deleteNetworkModal">
        <div class="modal-body">
            <div ng-if="deleteError" class="alert alert-danger">
                [[deleteError.code]] - [[deleteError.message]]
            </div>
            Are you sure you want to delete this network?
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">
                Close
            </button>
            <button type="submit"
                    ng-click="deleteNetwork()"
                    class="btn btn-primary"
            >
                Delete
            </button>
        </div>
    </nsot-modal>



</div>
