<vn-descriptor-content
    module="worker"
    description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName"
    summary="$ctrl.$.summary">
    <slot-before>
        <vn-user-photo user-id="{{$ctrl.worker.id}}"/>
    </slot-before>
    <slot-menu>
        <vn-item ng-click="$ctrl.handleExcluded()" translate>
            {{$ctrl.workerExcluded
                ? 'Click to allow the user to be disabled'
                : 'Click to exclude the user from getting disabled'}}
          </vn-item>
          <vn-item ng-click="setPassword.show()" translate>
            Change password 
          </vn-item>
    </slot-menu>
    <slot-body>
        <div class="attributes">
            <vn-label-value
                label="User"
                value="{{$ctrl.worker.user.name}}">
            </vn-label-value>
            <vn-label-value
                label="Email"
                value="{{$ctrl.worker.user.emailUser.email}}">
            </vn-label-value>
            <vn-label-value
                label="Department"
                value="{{$ctrl.worker.department.department.name}}">
            </vn-label-value>
            <vn-label-value
                label="Phone"
            >
                <vn-link-phone
                    phone-number="$ctrl.worker.phone"
                ></vn-link-phone>
            </vn-label-value>
            <vn-label-value
                label="Extension"
            >
                <vn-link-phone
                    phone-number="$ctrl.worker.sip.extension"
                ></vn-link-phone>
            </vn-label-value>
        </div>
        <div class="icons">
            <vn-icon
                vn-tooltip="This user can't be disabled"
                icon="person"
                ng-if="$ctrl.worker.excluded">
            </vn-icon>
        </div>
        <div class="quicklinks">
            <div ng-transclude="btnOne">
                <vn-quick-link
                    tooltip="Go to client"
                    state="['client.card.summary', {id: $ctrl.id}]"
                    icon="person">
                </vn-quick-link>
            </div>
            <div ng-transclude="btnTwo">
                <vn-quick-link
                    tooltip="Go to user"
                    state="['account.card.summary', {id: $ctrl.id}]"
                    icon="face">
                </vn-quick-link>
            </div>
            <div ng-transclude="btnThree"></div>
        </div>
    </slot-body>
</vn-descriptor-content>
<vn-popup vn-id="summary">
    <vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
</vn-popup>
<vn-dialog
    vn-id="setPassword"
    on-accept="$ctrl.setPassword($ctrl.worker.password)"
    message="Reset password"
>
    <tpl-body>
        <vn-textfield
            vn-one
            label="New password"
            required="true"
            ng-model="$ctrl.newPassword"
            type="password"
            info="{{'Password requirements' | translate:$ctrl.passRequirements}}"
        >
        </vn-textfield>
        <vn-textfield
            label="Repeat password"
            ng-model="$ctrl.repeatPassword"
            type="password">
        </vn-textfield>
    </tpl-body>
    <tpl-buttons>
        <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
        <button response="accept" translate>Confirm</button>
    </tpl-buttons>
</vn-dialog>