gadael/gadael

View on GitHub
public/partials/admin/user-view-account.html

Summary

Maintainability
Test Coverage
<div class="row">

    <p><span translate>Current rights collection:</span> {{user.roles.account.currentCollection.name}}</p>

    <p class="text-warning" role="alert" ng-if="!user.roles.account.currentCollection">
        <i class="fa fa-warning fa-2x fa-pull-left"></i> <span translate>This user has no ongoing right collection, check the vacations collections planning to fix it</span>
    </p>

    <p><span translate>Current workschedule calendar:</span> {{user.roles.account.currentScheduleCalendar.name}}</p>

    <p class="text-warning" role="alert" ng-if="!user.roles.account.currentScheduleCalendar">
        <i class="fa fa-warning fa-2x fa-pull-left"></i> <span translate>This user has no ongoing workschedule calendar, check the workschedule calendar planning to fix it</span>
    </p>

    <p ng-if="user.roles.account.birth">
        <span translate>Birth date:</span>
        {{user.roles.account.birth|date}}
        (<span translate translate-n="age" translate-plural="{{$count}} years old">One year old</span>)
    </p>

    <p ng-if="user.roles.account.arrival">
        <span translate>Arrival date:</span>
        {{user.roles.account.arrival|date}}
    </p>

    <p ng-if="user.roles.account.seniority">
        <span translate>Seniority date:</span>
        {{user.roles.account.seniority|date}}
        (<span translate translate-n="seniority_years" translate-plural="{{$count}} years seniority">One year seniority</span>)
    </p>

    <p ng-if="user.roles.account.sage.registrationNumber">
        <span translate>Sage registration number:</span>
        {{user.roles.account.sage.registrationNumber}}
    </p>

    <p><i class="fa fa-envelope text-info"></i> <span translate>Notifications options:</span>
        <ul>
            <li ng-if="user.roles.account.notify.approvals">
                <span translate>Notify the user when a request is accepted or rejected</span>
            </li>
            <li ng-if="!user.roles.account.notify.approvals">
                <span translate>Do not notify the user when a request is accepted or rejected</span>
            </li>
        </ul>
    </p>
</div>

<div ng-include="'partials/admin/user-view-account-custom.html'"></div>

<div class="row">
    <h3  class="col-xs-10" translate>Vacations collections planning</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/account-collections" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Edit</span></a>
    </div>
</div>
<div class="row">
    <table class="table" ng-if="accountCollections.length>0">
        <thead>
        <tr>
            <th translate>Collection name</th>
            <th class="col-sm-3" translate>From</th>
            <th class="col-sm-3" translate>To</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="accountCollection in accountCollections">
            <td>{{accountCollection.rightCollection.name}}</td>
            <td>{{accountCollection.from|date}}</td>
            <td>{{accountCollection.to|date}}</td>
        </tr>
        </tbody>

    </table>
</div>


<div class="row">
    <h3  class="col-xs-10" translate>Vacations rights</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/account-rights" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Edit</span></a>
    </div>
</div>
<div class="row">
    <table class="table" ng-if="beneficiaries.length>0">
        <thead>
        <tr>
            <th translate>Right name</th>
            <th translate>Available quantity</th>
            <th class="hidden-xs" translate>Renewals with remaining quantity</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="beneficiary in beneficiaries">
            <td>
                <a ng-href="#/admin/beneficiaries/{{beneficiary._id}}?user={{user._id}}">
                    <i title="{{beneficiary.right.type.name}}" class="fa fa-asterisk" style="color:{{beneficiary.right.type.color}}"></i> {{beneficiary.right.name}}
                </a>

                <span ng-if="beneficiary.errors.length>0"><i class="fa fa-warning text-danger" title="{{'Some renewals are invalids'|translate}}"></i></span>
            </td>
            <td>{{beneficiary.available_quantity | rightQuantity}} {{beneficiary.available_quantity_dispUnit}}</td>
            <td class="hidden-xs">{{beneficiary.renewals.length}}
                <i ng-if="beneficiary.ref=='User'" class="fa fa-warning text-warning" title="{{'Out of collection right'|translate}}" bs-tooltip></i>
            </td>
        </tr>
        </tbody>

    </table>

    <div class="alert alert-danger" role="alert" ng-if="beneficiaries.$resolved && !beneficiaries.length">
        <i class="fa fa-times-circle fa-2x fa-pull-left"></i> <span translate>This user has no configured vacation rights for the current period</span>
    </div>
</div>


<div class="row" ng-if="overtimes.length>0">
    <h3  class="col-xs-10" translate>Overtime</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/convert-overtimesummary" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Convert or settle</span></a>
    </div>
</div>
<div class="row" ng-if="overtimes.length>0">
    <table class="table">
        <thead>
        <tr>
            <th translate>Year</th>
            <th translate>Declarations</th>
            <th class="col-sm-3" translate>Unsettled h.</th>
            <th class="col-sm-3" translate>Settled h.</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="overtime in overtimes">
            <td>{{overtime._id}}</td>
            <td>{{overtime.declarations}}</td>
            <td translate translate-n="overtime.unsettled" translate-plural="{{overtime.unsettled | number}} Hours">{{overtime.unsettled | number}} Hour</td>
            <td translate translate-n="overtime.settled" translate-plural="{{overtime.settled | number}} Hours">{{overtime.settled | number}} Hour</td>
        </tr>
        </tbody>
    </table>
</div>


<div class="row">
    <h3  class="col-xs-10" translate>Workschedule planning</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/account-schedulecalendars" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Edit</span></a>
    </div>
</div>
<div class="row">
    <table class="table" ng-if="accountScheduleCalendars.length>0">
        <thead>
        <tr>
            <th translate>Calendar name</th>
            <th class="col-sm-3" translate>From</th>
            <th class="col-sm-3" translate>To</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="accountScheduleCalendar in accountScheduleCalendars">
            <td>{{accountScheduleCalendar.calendar.name}}</td>
            <td>{{accountScheduleCalendar.from|date}}</td>
            <td>{{accountScheduleCalendar.to|date}}</td>
        </tr>
        </tbody>

    </table>

    <div class="alert alert-danger" role="alert" ng-if="accountScheduleCalendars.$resolved && !accountScheduleCalendars.length">
        <i class="fa fa-times-circle fa-2x fa-pull-left"></i> <span translate>This user has no configured work schedule</span>
    </div>
</div>




<div class="row">
    <h3  class="col-xs-10" translate>Non-working days planning</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/account-nwdayscalendars" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Edit</span></a>
    </div>
</div>
<div class="row">
    <table class="table" ng-if="accountNWDaysCalendars.length>0">
        <thead>
        <tr>
            <th translate>Calendar name</th>
            <th class="col-sm-3" translate>From</th>
            <th class="col-sm-3" translate>To</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="accountNWDaysCalendar in accountNWDaysCalendars">
            <td>{{accountNWDaysCalendar.calendar.name}}</td>
            <td>{{accountNWDaysCalendar.from|date}}</td>
            <td>{{accountNWDaysCalendar.to|date}}</td>
        </tr>
        </tbody>

    </table>

    <div class="alert alert-danger" role="alert" ng-if="accountNWDaysCalendars.$resolved && !accountNWDaysCalendars.length">
        <i class="fa fa-times-circle fa-2x fa-pull-left"></i> <span translate>This user has no configured non-working days</span>
    </div>
</div>




<div class="row">
    <h3  class="col-xs-10" translate>Exceptional quantity modifications</h3>
    <div class="col-xs-2 text-right">
        <br />
        <a ng-href="#/admin/users/{{user._id}}/account-renewalquantity" class="btn btn-info btn-xs hidden-print" role="button"><i class="fa fa-edit"></i> <span class="hidden-xs" translate>Edit</span></a>
    </div>
</div>
<div class="row">
    <table class="table" ng-if="adjustedRenewals.length > 0">
        <thead>
        <tr>
            <th translate>Right name</th>
            <th translate>Renewal</th>
            <th class="hidden-xs hidden-sm" translate>Default quantity</th>
            <th translate>User quantity</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="renewal in adjustedRenewals">
            <td>
                <i title="{{renewal.right.type.name}}" class="fa fa-asterisk" style="color:{{renewal.right.type.color}}"></i> {{renewal.right.name}}
            </td>
            <td>{{renewal.start|date}}<span class="hidden-xs"> <i class="fa fa-long-arrow-right text-primary"></i> {{renewal.finish|date}}</span></td>
            <td class="hidden-xs hidden-sm">{{renewal.defaultQuantity|number}} {{renewal.initial_quantity_dispUnit}}</td>
            <td>{{renewal.initial_quantity|number}} {{renewal.initial_quantity_dispUnit}}</td>
        </tr>
        </tbody>

    </table>

    <div class="alert alert-success" role="alert" ng-if="0==adjustedRenewals.length">
        <i class="fa fa-check-circle fa-2x fa-pull-left"></i> <span translate>This user has no configured specific quantity, rights are set by collection only</span>
    </div>
</div>