2015-10-14 16:15:39 +02:00
|
|
|
@extends('header')
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
2015-10-14 16:15:39 +02:00
|
|
|
@include('accounts.nav', ['selected' => ACCOUNT_USER_MANAGEMENT])
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
{!! Former::open($url)->method($method)->addClass('warn-on-exit')->rules(array(
|
2015-03-16 22:45:25 +01:00
|
|
|
'first_name' => 'required',
|
|
|
|
'last_name' => 'required',
|
|
|
|
'email' => 'required|email',
|
2015-04-01 21:57:02 +02:00
|
|
|
)); !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if ($user)
|
2016-05-08 20:50:35 +02:00
|
|
|
{!! Former::populate($user) !!}
|
|
|
|
{{ Former::populateField('is_admin', intval($user->is_admin)) }}
|
|
|
|
{{ Former::populateField('permissions[create_all]', intval($user->hasPermission('create'))) }}
|
|
|
|
{{ Former::populateField('permissions[view_all]', intval($user->hasPermission('view_all'))) }}
|
|
|
|
{{ Former::populateField('permissions[edit_all]', intval($user->hasPermission('edit_all'))) }}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
2015-04-22 21:21:04 +02:00
|
|
|
<div class="panel-heading">
|
2016-03-21 21:00:59 +01:00
|
|
|
<h3 class="panel-title">{!! trans('texts.user_details') !!}</h3>
|
2015-04-22 21:21:04 +02:00
|
|
|
</div>
|
2015-10-14 19:18:19 +02:00
|
|
|
<div class="panel-body form-padding-right">
|
2015-04-20 16:34:23 +02:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('first_name') !!}
|
|
|
|
{!! Former::text('last_name') !!}
|
|
|
|
{!! Former::text('email') !!}
|
2016-03-21 21:00:59 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2016-04-19 04:35:18 +02:00
|
|
|
@if (Utils::hasFeature(FEATURE_USER_PERMISSIONS))
|
2016-03-21 21:00:59 +01:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.permissions') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body form-padding-right">
|
|
|
|
|
|
|
|
|
2016-03-16 00:08:00 +01:00
|
|
|
{!! Former::checkbox('is_admin')
|
|
|
|
->label(' ')
|
|
|
|
->text(trans('texts.administrator'))
|
|
|
|
->help(trans('texts.administrator_help')) !!}
|
|
|
|
{!! Former::checkbox('permissions[create_all]')
|
|
|
|
->value('create_all')
|
|
|
|
->label(' ')
|
|
|
|
->id('permissions_create_all')
|
2016-03-21 21:00:59 +01:00
|
|
|
->text(trans('texts.user_create_all'))
|
|
|
|
->help(trans('texts.create_all_help')) !!}
|
2016-03-16 00:08:00 +01:00
|
|
|
{!! Former::checkbox('permissions[view_all]')
|
|
|
|
->value('view_all')
|
|
|
|
->label(' ')
|
|
|
|
->id('permissions_view_all')
|
2016-03-21 21:00:59 +01:00
|
|
|
->text(trans('texts.user_view_all'))
|
|
|
|
->help(trans('texts.view_all_help')) !!}
|
2016-03-16 00:08:00 +01:00
|
|
|
{!! Former::checkbox('permissions[edit_all]')
|
|
|
|
->value('edit_all')
|
|
|
|
->label(' ')
|
|
|
|
->id('permissions_edit_all')
|
2016-03-21 21:00:59 +01:00
|
|
|
->text(trans('texts.user_edit_all'))
|
|
|
|
->help(trans('texts.edit_all_help')) !!}
|
2016-03-16 00:08:00 +01:00
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-04-19 04:35:18 +02:00
|
|
|
@endif
|
2015-04-20 16:34:23 +02:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::actions(
|
2015-10-14 16:15:39 +02:00
|
|
|
Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/user_management'))->appendIcon(Icon::create('remove-circle'))->large(),
|
2015-06-04 22:53:58 +02:00
|
|
|
Button::success(trans($user && $user->confirmed ? 'texts.save' : 'texts.send_invite'))->submit()->large()->appendIcon(Icon::create($user && $user->confirmed ? 'floppy-disk' : 'send'))
|
2015-04-01 21:57:02 +02:00
|
|
|
)!!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-05-09 20:25:16 +02:00
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('onReady')
|
|
|
|
$('#first_name').focus();
|
2016-03-16 00:08:00 +01:00
|
|
|
$('#is_admin, #permissions_view_all').change(fixCheckboxes);
|
|
|
|
function fixCheckboxes(){
|
|
|
|
var adminChecked = $('#is_admin').is(':checked');
|
|
|
|
var viewChecked = $('#permissions_view_all').is(':checked');
|
|
|
|
|
|
|
|
$('#permissions_view_all').prop('disabled', adminChecked);
|
|
|
|
$('#permissions_create_all').prop('disabled', adminChecked);
|
|
|
|
$('#permissions_edit_all').prop('disabled', adminChecked || !viewChecked);
|
2016-03-17 15:11:14 +01:00
|
|
|
if(!viewChecked)$('#permissions_edit_all').prop('checked',false)
|
2016-03-16 00:08:00 +01:00
|
|
|
}
|
|
|
|
fixCheckboxes();
|
2015-03-16 22:45:25 +01:00
|
|
|
@stop
|