170 lines
6.6 KiB
HTML
170 lines
6.6 KiB
HTML
<div class="header">
|
|
<div class="title">
|
|
<div class="submenu">
|
|
<a ui-sref="users.user.list" class="btn btn-sm btn-default">
|
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
|
<translate>Back to overview</translate>
|
|
</a>
|
|
</div>
|
|
<h1 translate>Import participants</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="details">
|
|
<h2 translate>Import by copy/paste</h2>
|
|
<p translate>Copy and paste your participant names in this textbox.
|
|
Keep each person in a single line.</p>
|
|
|
|
<div class="row">
|
|
<div class="form-group col-sm-6">
|
|
<textarea ng-model="userlist" rows="5" class="form-control" ng-list="/\n/"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="clearfix">
|
|
<button ng-click="importByLine()" class="btn btn-primary pull-left" translate>Import</button>
|
|
<div class="col-xs-5" ng-if="usernames">
|
|
<progressbar animate="false" type="success" max="usernames.length" value="importcounter">
|
|
<i>{{ importcounter }} / {{ usernames.length }} {{ "imported" | translate }}</i>
|
|
</progressbar>
|
|
</div>
|
|
</div>
|
|
<div class="spacer">
|
|
<a ng-if="importcounter > 0 && importcounter == usernames.length" ui-sref="users.user.list"
|
|
class="btn btn-default">
|
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
|
<translate>Back to users overview</translate>
|
|
</a>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<h2 translate>Import by CSV file</h2>
|
|
|
|
<div class="block row">
|
|
<div class="title">
|
|
<h3 translate>Select a CSV file
|
|
</div>
|
|
<div class="block right import">
|
|
<label class="label" for="inputSeparator" translate>Separator</label>
|
|
<input type="text" ng-model="separator" ng-change="setSeparator()" ng-init="separator=separator" id="inputSeparator">
|
|
<br>
|
|
<label class="label" for="selectEncoding" translate>Encoding</label>
|
|
<select ng-model="encoding" ng-options="enc as enc for enc in encodingOptions"
|
|
ng-selected="setEncoding()" ng-init="encoding=encoding" id="selectEncoding"></select>
|
|
<ng-csv-import
|
|
content="csv.content"
|
|
header="csv.header"
|
|
header-visible="csv.headerVisible"
|
|
separator="csv.separator"
|
|
separator-visible="csv.separatorVisible"
|
|
result="csv.result"
|
|
encoding="csv.encoding"
|
|
encoding-visible="csv.encodingVisible"></ng-csv-import>
|
|
</div>
|
|
</div>
|
|
|
|
<h4 translate>Please note:</h4>
|
|
<ul>
|
|
<li><translate>Required comma or semicolon separated values with these column header names in the first row</translate>:<br>
|
|
<code>title, first_name, last_name, structure_level, groups, comment, is_active</code>
|
|
<li><translate>Default groups</translate>:
|
|
<translate>Delegates</translate> <code>3</code>,
|
|
<translate>Staff</translate> <code>4</code>
|
|
<li translate>At least first name or last name have to be filled in. All
|
|
other fields are optional and may be empty.
|
|
<li translate>Only double quotes are accepted as text delimiter (no single quotes).
|
|
<li><a id="downloadLink" href="" ng-click="downloadCSVExample()" translate>Download CSV example file</a>
|
|
</ul>
|
|
|
|
<div ng-show="csv.result">
|
|
<h3 translate>Preview</h3>
|
|
<table ng-if="!csvImporting" class="table table-striped table-bordered table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
<th>#
|
|
<th translate>Title
|
|
<th translate>First name
|
|
<th translate>Last name
|
|
<th translate>Structure level
|
|
<th translate>Groups
|
|
<th translate>Comment
|
|
<th translate>Is active</th>
|
|
<tbody>
|
|
<tr ng-repeat="user in users | limitTo : itemsPerPage : limitBegin">
|
|
<td class="minimum"
|
|
ng-class="{ 'text-danger': user.importerror, 'text-success': user.imported }">
|
|
<span ng-if="user.importerror">
|
|
<i class="fa fa-exclamation-triangle fa-lg"></i>
|
|
</span>
|
|
<span ng-if="!user.importerror && !user.imported">
|
|
<i class="fa fa-check-circle-o fa-lg"></i>
|
|
</span>
|
|
<span ng-if="user.imported">
|
|
<i class="fa fa-check-circle fa-lg"></i>
|
|
</span>
|
|
<td>
|
|
{{ $index + 1 }}
|
|
<td>
|
|
{{ user.title }}
|
|
<td ng-class="{ 'text-danger': user.name_error }">
|
|
<span ng-if="!user.first_name && user.name_error" title="{{ user.name_error | translate }}">
|
|
<i class="fa fa-exclamation-triangle"></i>
|
|
</span>
|
|
{{ user.first_name }}
|
|
<td ng-class="{ 'text-danger': user.name_error }">
|
|
<span ng-if="!user.last_name && user.name_error" title="{{ user.name_error | translate }}">
|
|
<i class="fa fa-exclamation-triangle"></i>
|
|
</span>
|
|
{{ user.last_name }}
|
|
<td>
|
|
{{ user.structure_level }}
|
|
<td>
|
|
<div ng-repeat="groupname in user.groupnames">
|
|
{{ groupname | translate }}
|
|
</div>
|
|
<td>
|
|
{{ user.comment }}
|
|
<td>
|
|
<i ng-if="user.is_active" class="fa fa-check-square-o"></i>
|
|
</table>
|
|
<uib-pagination total-items="users.length" items-per-page="itemsPerPage" ng-model="currentPage" ng-change="pageChanged()"></uib-pagination>
|
|
|
|
<div class="text-danger">
|
|
<div ng-repeat="user in usersFailed = (users | filter:{importerror:true})"></div>
|
|
<i class="fa fa-exclamation-triangle"></i>
|
|
{{ usersFailed.length }}
|
|
<translate>participants will be not imported.</translate>
|
|
</div>
|
|
<div>
|
|
<div ng-repeat="user in usersPassed = (users | filter:{importerror:false})"></div>
|
|
<i class="fa fa-check-circle-o fa-lg"></i>
|
|
{{ users.length - usersFailed.length }}
|
|
<translate>participants will be imported.</translate>
|
|
</div>
|
|
<div ng-repeat="user in usersImported = (users | filter:{imported:true})"></div>
|
|
<div ng-if="usersImported.length > 0" class="text-success">
|
|
<hr class="smallhr">
|
|
<i class="fa fa-check-circle fa-lg"></i>
|
|
{{ usersImported.length }}
|
|
<translate>participants were successfully imported.</translate>
|
|
</div>
|
|
|
|
<div class="spacer">
|
|
<button ng-if="!csvImporting" ng-click="clear()" class="btn btn-default" translate>
|
|
Clear preview
|
|
</button>
|
|
<button ng-if="!csvImporting" ng-click="import()" class="btn btn-primary" translate>
|
|
Import {{ users.length - usersFailed.length }} participants
|
|
</button>
|
|
</div>
|
|
<div class="spacer">
|
|
<a ng-if="csvimported" ui-sref="users.user.list" class="btn btn-default">
|
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
|
<translate>Back to users overview</translate>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|