2015-03-16 22:45:25 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
#logo {
|
|
|
|
padding-top: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
{!! Former::open_for_files()->addClass('warn-on-exit')->rules(array(
|
2015-03-16 22:45:25 +01:00
|
|
|
'name' => 'required',
|
|
|
|
'email' => 'email|required'
|
2015-04-01 21:57:02 +02:00
|
|
|
)) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
{{ Former::populate($account) }}
|
|
|
|
@if ($showUser)
|
2015-07-30 16:44:47 +02:00
|
|
|
{{ Former::populateField('first_name', $primaryUser->first_name) }}
|
|
|
|
{{ Former::populateField('last_name', $primaryUser->last_name) }}
|
|
|
|
{{ Former::populateField('email', $primaryUser->email) }}
|
|
|
|
{{ Former::populateField('phone', $primaryUser->phone) }}
|
2015-07-12 21:43:45 +02:00
|
|
|
@if (Utils::isNinja())
|
2015-07-30 16:44:47 +02:00
|
|
|
{{ Former::populateField('dark_mode', intval($primaryUser->dark_mode)) }}
|
2015-07-12 21:43:45 +02:00
|
|
|
@endif
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
|
|
|
<div class="row">
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="col-md-6">
|
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.details') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('name') !!}
|
2015-04-28 22:13:52 +02:00
|
|
|
|
2015-05-10 21:02:35 +02:00
|
|
|
@if (Auth::user()->isPro() && Utils::isNinja())
|
2015-04-28 22:13:52 +02:00
|
|
|
{{ Former::setOption('capitalize_translations', false) }}
|
|
|
|
{!! Former::text('subdomain')->placeholder('texts.www')->onchange('onSubdomainChange()') !!}
|
2015-05-31 20:19:45 +02:00
|
|
|
@endif
|
2015-04-28 22:13:52 +02:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('id_number') !!}
|
|
|
|
{!! Former::text('vat_number') !!}
|
|
|
|
{!! Former::text('work_email') !!}
|
|
|
|
{!! Former::text('work_phone') !!}
|
|
|
|
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if (file_exists($account->getLogoPath()))
|
|
|
|
<center>
|
2015-08-03 21:08:07 +02:00
|
|
|
{!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
<a href="#" onclick="deleteLogo()">{{ trans('texts.remove_logo') }}</a>
|
|
|
|
</center><br/>
|
|
|
|
@endif
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::select('size_id')->addOption('','')->fromQuery($sizes, 'name', 'id') !!}
|
|
|
|
{!! Former::select('industry_id')->addOption('','')->fromQuery($industries, 'name', 'id') !!}
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.address') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('address1') !!}
|
|
|
|
{!! Former::text('address2') !!}
|
|
|
|
{!! Former::text('city') !!}
|
|
|
|
{!! Former::text('state') !!}
|
|
|
|
{!! Former::text('postal_code') !!}
|
|
|
|
{!! Former::select('country_id')->addOption('','')
|
|
|
|
->fromQuery($countries, 'name', 'id') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="col-md-6">
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if ($showUser)
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.users') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('first_name') !!}
|
|
|
|
{!! Former::text('last_name') !!}
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! Former::text('email') !!}
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text('phone') !!}
|
2015-07-12 21:43:45 +02:00
|
|
|
@if (Utils::isNinja())
|
|
|
|
{!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help')) !!}
|
|
|
|
@endif
|
|
|
|
|
2015-04-06 13:46:02 +02:00
|
|
|
@if (Auth::user()->confirmed)
|
|
|
|
{!! Former::actions( Button::primary(trans('texts.change_password'))->small()->withAttributes(['onclick'=>'showChangePassword()'])) !!}
|
2015-04-13 14:49:40 +02:00
|
|
|
@elseif (Auth::user()->registered)
|
2015-05-19 21:14:00 +02:00
|
|
|
{!! Former::actions( Button::primary(trans('texts.resend_confirmation'))->asLinkTo(URL::to('/resend_confirmation'))->small() ) !!}
|
2015-04-06 13:46:02 +02:00
|
|
|
@endif
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.localization') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::select('language_id')->addOption('','')
|
|
|
|
->fromQuery($languages, 'name', 'id') !!}
|
|
|
|
{!! Former::select('currency_id')->addOption('','')
|
|
|
|
->fromQuery($currencies, 'name', 'id') !!}
|
|
|
|
{!! Former::select('timezone_id')->addOption('','')
|
|
|
|
->fromQuery($timezones, 'location', 'id') !!}
|
|
|
|
{!! Former::select('date_format_id')->addOption('','')
|
|
|
|
->fromQuery($dateFormats, 'label', 'id') !!}
|
|
|
|
{!! Former::select('datetime_format_id')->addOption('','')
|
|
|
|
->fromQuery($datetimeFormats, 'label', 'id') !!}
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<center>
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</center>
|
|
|
|
|
2015-04-13 21:43:51 +02:00
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<div class="modal fade" id="passwordModal" tabindex="-1" role="dialog" aria-labelledby="passwordModalLabel" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
|
<h4 class="modal-title" id="passwordModalLabel">{{ trans('texts.change_password') }}</h4>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="background-color: #fff" id="changePasswordDiv" onkeyup="validateChangePassword()" onclick="validateChangePassword()" onkeydown="checkForEnter(event)">
|
|
|
|
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::password('current_password')->style('width:300px') !!}
|
2015-04-13 17:05:34 +02:00
|
|
|
{!! Former::password('newer_password')->style('width:300px')->label(trans('texts.new_password')) !!}
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::password('confirm_password')->style('width:300px') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
<center>
|
|
|
|
<div id="changePasswordError"></div>
|
|
|
|
</center>
|
|
|
|
<br/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="padding-left:40px;padding-right:40px;display:none;min-height:130px" id="working">
|
|
|
|
<h3>{{ trans('texts.working') }}...</h3>
|
|
|
|
<div class="progress progress-striped active">
|
|
|
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="background-color: #fff; padding-right:20px;padding-left:20px; display:none" id="successDiv">
|
|
|
|
<br/>
|
|
|
|
<h3>{{ trans('texts.success') }}</h3>
|
|
|
|
{{ trans('texts.updated_password') }}
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-footer" style="margin-top: 0px" id="changePasswordFooter">
|
|
|
|
<button type="button" class="btn btn-default" id="cancelChangePasswordButton" data-dismiss="modal">Cancel</button>
|
|
|
|
<button type="button" class="btn btn-success" onclick="submitChangePassword()" id="changePasswordButton" disabled>
|
|
|
|
{{ trans('texts.save') }}
|
|
|
|
<i class="glyphicon glyphicon-floppy-disk"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
{!! Former::close() !!}
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Form::open(['url' => 'remove_logo', 'class' => 'removeLogoForm']) !!}
|
|
|
|
{!! Form::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
$('#country_id').combobox();
|
|
|
|
|
|
|
|
$('#passwordModal').on('hidden.bs.modal', function () {
|
2015-04-13 17:05:34 +02:00
|
|
|
$(['current_password', 'newer_password', 'confirm_password']).each(function(i, field) {
|
2015-03-16 22:45:25 +01:00
|
|
|
var $input = $('form #'+field);
|
|
|
|
$input.val('');
|
|
|
|
$input.closest('div.form-group').removeClass('has-success');
|
|
|
|
});
|
|
|
|
$('#changePasswordButton').prop('disabled', true);
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#passwordModal').on('shown.bs.modal', function () {
|
|
|
|
$('#current_password').focus();
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function deleteLogo() {
|
2015-06-03 19:55:48 +02:00
|
|
|
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
|
2015-03-16 22:45:25 +01:00
|
|
|
$('.removeLogoForm').submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function showChangePassword() {
|
|
|
|
$('#passwordModal').modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkForEnter(event)
|
|
|
|
{
|
|
|
|
if (event.keyCode === 13){
|
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function validateChangePassword(showError)
|
|
|
|
{
|
|
|
|
var isFormValid = true;
|
2015-04-13 17:05:34 +02:00
|
|
|
$(['current_password', 'newer_password', 'confirm_password']).each(function(i, field) {
|
2015-03-16 22:45:25 +01:00
|
|
|
var $input = $('form #'+field),
|
|
|
|
val = $.trim($input.val());
|
|
|
|
var isValid = val && val.length >= 6;
|
|
|
|
|
|
|
|
if (isValid && field == 'confirm_password') {
|
2015-04-13 17:05:34 +02:00
|
|
|
isValid = val == $.trim($('#newer_password').val());
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isValid) {
|
|
|
|
$input.closest('div.form-group').removeClass('has-error').addClass('has-success');
|
|
|
|
} else {
|
|
|
|
isFormValid = false;
|
|
|
|
$input.closest('div.form-group').removeClass('has-success');
|
|
|
|
if (showError) {
|
|
|
|
$input.closest('div.form-group').addClass('has-error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#changePasswordButton').prop('disabled', !isFormValid);
|
|
|
|
|
|
|
|
return isFormValid;
|
|
|
|
}
|
|
|
|
|
|
|
|
function submitChangePassword()
|
|
|
|
{
|
|
|
|
if (!validateChangePassword(true)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#changePasswordDiv, #changePasswordFooter').hide();
|
|
|
|
$('#working').show();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
2015-04-13 17:05:34 +02:00
|
|
|
url: '{{ URL::to('/users/change_password') }}',
|
2015-03-16 22:45:25 +01:00
|
|
|
data: 'current_password=' + encodeURIComponent($('form #current_password').val()) +
|
2015-04-13 17:05:34 +02:00
|
|
|
'&new_password=' + encodeURIComponent($('form #newer_password').val()) +
|
2015-03-16 22:45:25 +01:00
|
|
|
'&confirm_password=' + encodeURIComponent($('form #confirm_password').val()),
|
|
|
|
success: function(result) {
|
|
|
|
if (result == 'success') {
|
2015-05-09 20:25:16 +02:00
|
|
|
NINJA.formIsChanged = false;
|
2015-03-16 22:45:25 +01:00
|
|
|
$('#changePasswordButton').hide();
|
|
|
|
$('#successDiv').show();
|
|
|
|
$('#cancelChangePasswordButton').html('{{ trans('texts.close') }}');
|
|
|
|
} else {
|
|
|
|
$('#changePasswordError').html(result);
|
|
|
|
$('#changePasswordDiv').show();
|
|
|
|
}
|
|
|
|
$('#changePasswordFooter').show();
|
|
|
|
$('#working').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-04-28 22:13:52 +02:00
|
|
|
function onSubdomainChange() {
|
|
|
|
var input = $('#subdomain');
|
|
|
|
var val = input.val();
|
|
|
|
if (!val) return;
|
|
|
|
val = val.replace(/[^a-zA-Z0-9_\-]/g, '').toLowerCase().substring(0, {{ MAX_SUBDOMAIN_LENGTH }});
|
|
|
|
input.val(val);
|
|
|
|
}
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</script>
|
|
|
|
|
2015-05-09 20:25:16 +02:00
|
|
|
@stop
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-05-09 20:25:16 +02:00
|
|
|
@section('onReady')
|
|
|
|
$('#name').focus();
|
2015-03-16 22:45:25 +01:00
|
|
|
@stop
|