<!--

    Copyright © 2016-2020 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<tb-grid grid-configuration="vm.userGridConfig">
	<details-buttons tb-help="'users'" help-container-id="help-container">
		<div id="help-container"></div>
	</details-buttons>
	<md-tabs ng-class="{'tb-headless': vm.grid.detailsConfig.isDetailsEditMode}"
			 id="tabs" md-border-bottom flex class="tb-absolute-fill">
		<md-tab label="{{ 'user.details' | translate }}">
			<tb-user user="vm.grid.operatingItem()"
					 is-edit="vm.grid.detailsConfig.isDetailsEditMode"
					 the-form="vm.grid.detailsForm"
					 on-display-activation-link="vm.displayActivationLink(event, vm.grid.detailsConfig.currentItem)"
					 on-resend-activation="vm.resendActivation(vm.grid.detailsConfig.currentItem)"
                     on-login-as-user="vm.loginAsUser(vm.grid.detailsConfig.currentItem)"
					 on-delete-user="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"
					 on-set-user-credentials-enabled="vm.setUserCredentialsEnabled(vm.grid.detailsConfig.currentItem, userCredentialsEnabled)"></tb-user>
		</md-tab>
		<md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode && vm.grid.isTenantAdmin()" md-on-select="vm.grid.triggerResize()" label="{{ 'audit-log.audit-logs' | translate }}">
			<tb-audit-log-table flex user-id="vm.grid.operatingItem().id.id"
								audit-log-mode="{{vm.types.auditLogMode.user}}">
			</tb-audit-log-table>
		</md-tab>
	</md-tabs>
</tb-grid>
