<h1><i class="fa fa-edit text-muted"></i> <span translate>Invite a list of persons to register</span></h1>


<form role="form" class="top30">

    <div class="form-group">
        <label>
            <input type="checkbox" ng-model="template.usedepartment" />
            <span translate>Insert the invited users into a department</span>
        </label><br />
        &nbsp;&nbsp; <em translate>All the users who accept the invitation will be saved into the same department, used for leave requests approval</em>
    </div>

    <div ng-if="template.usedepartment">

        <div class="form-group" ng-if="departments.length>0">
            <label for="invitation_department" translate>Set the department where the invited peoples will be recorded</label>
            <select class="form-control" id="invitation_department" ng-model="template.department" ng-options="d._id as d.name for d in departments">
            </select>
        </div>

        <div class="form-group" ng-if="0 == template.department">
            <label for="new_department_name" translate>Set the new department name</label>
            <input type="text" class="form-control" id="new_department_name" ng-model="template.departmentName" placeholder="{{'For example, R&D or HR...'|translate}}" />
        </div>
    </div>

    <div class="form-group top30" ng-if="departments.length>0">
        <label for="invitation_department" translate>Set a non-working days calendar</label>
        <select class="form-control" id="invitation_nonWorkingDaysCalendar" ng-model="template.nonWorkingDaysCalendar" ng-options="c._id as c.name for c in nonWorkingDaysCalendars">
        </select>
    </div>

    <div class="form-group top30">
        <label for="emails" translate>List of emails to invite, one per line</label>
        <textarea class="form-control" id="emails" ng-model="template.emails" /></textarea>
    </div>

    <div class="col-md-12">
        <button class="btn btn-primary" ng-click="save()" translate>Send invitations</button>
        <button class="btn btn-link" ng-click="back()" translate>Cancel</button>
    </div>
</form>
