resq/templates/user/form.html.twig
2018-01-07 19:21:37 +08:00

157 lines
No EOL
7.2 KiB
Twig

{% extends 'base.html.twig' %}
{% block body %}
<!-- BEGIN: Subheader -->
<div class="m-subheader">
<div class="d-flex align-items-center">
<div class="mr-auto">
<h3 class="m-subheader__title">Users</h3>
</div>
</div>
</div>
<!-- END: Subheader -->
<div class="m-content">
<!--Begin::Section-->
<div class="row">
<div class="col-xl-8 offset-xl-2">
<div class="m-portlet m-portlet--mobile">
<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<span class="m-portlet__head-icon">
<i class="la la-user"></i>
</span>
<h3 class="m-portlet__head-text">
{% if row is defined %}
Edit User
<small>{{ row.getUsername() }}</small>
{% else %}
New User
{% endif %}
</h3>
</div>
</div>
</div>
<form class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ row is defined ? url('user_update_submit', {'id': row.getId()}) : url('user_create_submit') }}">
<div class="m-portlet__body">
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
Username:
</label>
<div class="col-lg-4{{ error.username is defined ? ' has-danger' }}">
<input type="text" name="username" class="form-control m-input{{ error.username is defined ? ' form-control-danger' }}" value="{{ values.username is defined ? values.username : (row is defined ? row.getUsername()) }}">
{% if error.username is defined %}
<div class="form-control-feedback">{{ error.username }}</div>
{% endif %}
<span class="m-form__help">Unique alias for this user</span>
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
First Name:
</label>
<div class="col-lg-4{{ error.first_name is defined ? ' has-danger' }}">
<input type="text" name="first_name" class="form-control m-input{{ error.first_name is defined ? ' form-control-danger' }}" value="{{ values.first_name is defined ? values.first_name : (row is defined ? row.getFirstName()) }}">
{% if error.first_name is defined %}
<div class="form-control-feedback">{{ error.first_name }}</div>
{% endif %}
</div>
<label class="col-lg-2 col-form-label">
Last Name:
</label>
<div class="col-lg-4{{ error.last_name is defined ? ' has-danger' }}">
<input type="text" name="last_name" class="form-control m-input{{ error.last_name is defined ? ' form-control-danger' }}" value="{{ values.last_name is defined ? values.last_name : (row is defined ? row.getLastName()) }}">
{% if error.last_name is defined %}
<div class="form-control-feedback">{{ error.last_name }}</div>
{% endif %}
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
Password:
</label>
<div class="col-lg-4{{ error.password is defined ? ' has-danger' }}">
<input type="password" name="password" class="form-control m-input{{ error.password is defined ? ' form-control-danger' }}">
{% if error.password is defined %}
<div class="form-control-feedback">{{ error.password }}</div>
{% endif %}
{% if row is defined %}
<span class="m-form__help">Leave both fields blank for unchanged</span>
{% endif %}
</div>
<label class="col-lg-2 col-form-label">
Confirm Password:
</label>
<div class="col-lg-4{{ error.confirm_password is defined ? ' has-danger' }}">
<input type="password" name="confirm_password" class="form-control m-input{{ error.confirm_password is defined ? ' form-control-danger' }}">
{% if error.confirm_password is defined %}
<div class="form-control-feedback">{{ error.confirm_password }}</div>
{% endif %}
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
E-mail Address:
</label>
<div class="col-lg-4{{ error.email is defined ? ' has-danger' }}">
<input type="email" name="email" class="form-control m-input{{ error.email is defined ? ' form-control-danger' }}" value="{{ values.email is defined ? values.email : (row is defined ? row.getEmail()) }}">
{% if error.email is defined %}
<div class="form-control-feedback">{{ error.email }}</div>
{% endif %}
</div>
<label class="col-lg-2 col-form-label">
Contact Number:
</label>
<div class="col-lg-4{{ error.contact_no is defined ? ' has-danger' }}">
<input type="text" name="contact_no" class="form-control m-input{{ error.contact_no is defined ? ' form-control-danger' }}" value="{{ values.contact_no is defined ? values.contact_no : (row is defined ? row.getContactNumber()) }}">
{% if error.contact_no is defined %}
<div class="form-control-feedback">{{ error.contact_no }}</div>
{% endif %}
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
Roles:
</label>
<div class="col-lg-10">
<div class="m-checkbox-list">
{% for role in roles %}
<label class="m-checkbox">
<input type="checkbox" name="roles[]" value="{{ role.getID() }}"{{ (values.roles is defined and role.getID() in value.roles) or (row is defined and values.roles is not defined and role.getID() in row.getRoles()) ? ' checked' : '' }}>
{{ role.getName() }}
<span></span>
</label>
{% endfor %}
</div>
<span class="m-form__help">Check all roles that apply</span>
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-lg-2 col-form-label">
Enabled:
</label>
<span class="m-switch m-switch--icon">
<label>
<input type="checkbox" name="enabled" value="1"{{ (values.enabled is defined and values.enabled) or (row is defined and values.enabled is not defined and row.isEnabled()) or (values.enabled is not defined and row is not defined) ? ' checked' }}>
<span></span>
</label>
</span>
</div>
</div>
<div class="m-portlet__foot m-portlet__foot--fit">
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
<div class="row">
<div class="col-lg-12">
<button type="submit" class="btn btn-success">Submit</button>
<a href="{{ url('user_list') }}" class="btn btn-secondary">Cancel</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}