expressCart/views/user-edit.hbs

48 lines
2.1 KiB
Handlebars

{{> partials/menu}}
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
<div class="col-md-12">
<div class="page-header">
<div class="float-right">
<button type="submit" class="btn btn-outline-success">{{ @root.__ "Update" }}</button>
</div>
<h2>{{ @root.__ "User edit" }}</h2>
</div>
<form id="userEditForm" data-toggle="validator">
<input type="hidden" id="userId" value="{{user._id}}" />
<div class="form-group">
<label>{{ @root.__ "Users name" }}</label>
<input type="text" class="form-control" id="usersName" value="{{user.usersName}}" required>
</div>
<div class="form-group">
<label>{{ @root.__ "User email" }}</label>
<input type="text" class="form-control" id="userEmail" value="{{user.userEmail}}" readonly>
</div>
<div class="form-group">
<label>{{ @root.__ "User password" }} {{#ifCond session.user '==' user.userEmail}}*{{/ifCond}}</label>
<input autocomplete="off" type="password" class="form-control" id="userPassword" {{#ifCond session.user '==' user.userEmail}}required{{/ifCond}}>
</div>
<div class="form-group">
<label>{{ @root.__ "Password confirm" }} {{#ifCond session.user '==' user.userEmail}}*{{/ifCond}}</label>
<input autocomplete="off" type="password" data-validation-match-match="userPassword" data-validation-match-message="Password values to not match" class="form-control" {{#ifCond session.user '==' user.userEmail}}required{{/ifCond}}>
</div>
{{#isAnAdmin @root.session.isAdmin}}
{{#ifCond @root.session.user '!=' user.userEmail}}
<div class="checkbox">
<label>
<input id="userAdmin" {{#checkedState @root.user.isAdmin}}{{/checkedState}} type="checkbox"> {{ @root.__ "User is admin?" }}
</label>
</div>
{{/ifCond}}
{{/isAnAdmin}}
<div class="form-group">
<label>API Key</label>
<div class="input-group">
<input type="text" class="form-control" id="apiKey" value="{{user.apiKey}}" aria-label="..." readonly>
<div class="input-group-append">
<button id="btnGenerateAPIkey" class="btn btn-outline-success">{{ @root.__ "Generate" }}</button>
</div>
</div>
</div>
</form>
</div>
</main>