mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor improvements
This commit is contained in:
parent
d35b0f7f35
commit
61ed298699
@ -590,8 +590,8 @@ class AccountController extends BaseController
|
||||
}
|
||||
|
||||
$labels = [];
|
||||
foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total'] as $field) {
|
||||
$labels[$field] = trim(Input::get("labels_{$field}"));
|
||||
foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms'] as $field) {
|
||||
$labels[$field] = Input::get("labels_{$field}");
|
||||
}
|
||||
$account->invoice_labels = json_encode($labels);
|
||||
|
||||
|
@ -79,7 +79,7 @@ class AuthController extends Controller {
|
||||
$userId = Auth::check() ? Auth::user()->id : null;
|
||||
$user = User::where('email', '=', $request->input('email'))->first();
|
||||
|
||||
if ($user && $user->failed_logins >= 3) {
|
||||
if ($user && $user->failed_logins >= MAX_FAILED_LOGINS) {
|
||||
Session::flash('error', trans('texts.invalid_credentials'));
|
||||
return redirect()->to('login');
|
||||
}
|
||||
|
@ -338,6 +338,7 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
define('MAX_SUBDOMAIN_LENGTH', 30);
|
||||
define('MAX_IFRAME_URL_LENGTH', 250);
|
||||
define('MAX_LOGO_FILE_SIZE', 200); // KB
|
||||
define('MAX_FAILED_LOGINS', 5);
|
||||
define('DEFAULT_FONT_SIZE', 9);
|
||||
define('DEFAULT_SEND_RECURRING_HOUR', 8);
|
||||
|
||||
@ -488,6 +489,12 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
define('SOCIAL_GITHUB', 'GitHub');
|
||||
define('SOCIAL_LINKEDIN', 'LinkedIn');
|
||||
|
||||
define('USER_STATE_ACTIVE', 'active');
|
||||
define('USER_STATE_PENDING', 'pending');
|
||||
define('USER_STATE_DISABLED', 'disabled');
|
||||
define('USER_STATE_ADMIN', 'admin');
|
||||
|
||||
|
||||
$creditCards = [
|
||||
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
|
||||
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
|
||||
|
@ -22,8 +22,7 @@ class UserRepository extends BaseRepository
|
||||
$query->where('users.deleted_at', '=', null);
|
||||
}
|
||||
|
||||
$query->where('users.public_id', '>', 0)
|
||||
->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at');
|
||||
$query->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@ -80,7 +80,9 @@ class DatatableService
|
||||
$str .= "<li class=\"divider\"></li>";
|
||||
}
|
||||
|
||||
if ($entityType != ENTITY_USER || $model->public_id) {
|
||||
$str .= "<li><a href=\"javascript:archiveEntity({$model->public_id})\">" . trans("texts.archive_{$entityType}") . "</a></li>";
|
||||
}
|
||||
} else {
|
||||
$str .= "<li><a href=\"javascript:restoreEntity({$model->public_id})\">" . trans("texts.restore_{$entityType}") . "</a></li>";
|
||||
}
|
||||
|
@ -52,7 +52,15 @@ class UserService extends BaseService
|
||||
[
|
||||
'confirmed',
|
||||
function ($model) {
|
||||
return $model->deleted_at ? trans('texts.deleted') : ($model->confirmed ? trans('texts.active') : trans('texts.pending'));
|
||||
if (!$model->public_id) {
|
||||
return self::getStatusLabel(USER_STATE_ADMIN);
|
||||
} elseif ($model->deleted_at) {
|
||||
return self::getStatusLabel(USER_STATE_DISABLED);
|
||||
} elseif ($model->confirmed) {
|
||||
return self::getStatusLabel(USER_STATE_ACTIVE);
|
||||
} else {
|
||||
return self::getStatusLabel(USER_STATE_PENDING);
|
||||
}
|
||||
}
|
||||
],
|
||||
];
|
||||
@ -65,6 +73,9 @@ class UserService extends BaseService
|
||||
uctrans('texts.edit_user'),
|
||||
function ($model) {
|
||||
return URL::to("users/{$model->public_id}/edit");
|
||||
},
|
||||
function ($model) {
|
||||
return $model->public_id;
|
||||
}
|
||||
],
|
||||
[
|
||||
@ -73,10 +84,31 @@ class UserService extends BaseService
|
||||
return URL::to("send_confirmation/{$model->public_id}");
|
||||
},
|
||||
function ($model) {
|
||||
return !$model->confirmed;
|
||||
return $model->public_id && ! $model->confirmed;
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
private function getStatusLabel($state)
|
||||
{
|
||||
$label = trans("texts.{$state}");
|
||||
$class = 'default';
|
||||
switch ($state) {
|
||||
case USER_STATE_PENDING:
|
||||
$class = 'info';
|
||||
break;
|
||||
case USER_STATE_ACTIVE:
|
||||
$class = 'primary';
|
||||
break;
|
||||
case USER_STATE_DISABLED:
|
||||
$class = 'warning';
|
||||
break;
|
||||
case USER_STATE_ADMIN:
|
||||
$class = 'success';
|
||||
break;
|
||||
}
|
||||
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
|
||||
}
|
||||
|
||||
}
|
@ -942,5 +942,7 @@ return array(
|
||||
],
|
||||
|
||||
'client_portal' => 'Client Portal',
|
||||
|
||||
'admin' => 'Admin',
|
||||
'disabled' => 'Disabled',
|
||||
'show_archived_users' => 'Show archived users',
|
||||
);
|
||||
|
@ -37,7 +37,7 @@
|
||||
NINJA.secondaryColor = $('#secondary_color').val();
|
||||
NINJA.fontSize = parseInt($('#font_size').val());
|
||||
|
||||
var fields = ['item', 'description', 'unit_cost', 'quantity', 'line_total'];
|
||||
var fields = ['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms'];
|
||||
invoiceLabels.old = {};
|
||||
for (var i=0; i<fields.length; i++) {
|
||||
var field = fields[i];
|
||||
@ -102,12 +102,22 @@
|
||||
<div class="panel-body">
|
||||
|
||||
@if (!Utils::isPro() || \App\Models\InvoiceDesign::count() == COUNT_FREE_DESIGNS_SELF_HOST)
|
||||
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id')->addOption(trans('texts.more_designs') . '...', '-1') !!}
|
||||
{!! Former::select('invoice_design_id')
|
||||
->style('display:inline; width:300px')
|
||||
->fromQuery($invoiceDesigns, 'name', 'id')
|
||||
->addOption(trans('texts.more_designs') . '...', '-1') !!}
|
||||
@else
|
||||
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id') !!}
|
||||
{!! Former::select('invoice_design_id')
|
||||
->style('display:inline; width:300px')
|
||||
->fromQuery($invoiceDesigns, 'name', 'id') !!}
|
||||
@endif
|
||||
|
||||
{!! Former::text('font_size')->type('number')->min('0')->step('1') !!}
|
||||
{!! Former::text('font_size')
|
||||
->style('width:300px')
|
||||
->type('number')
|
||||
->min('0')
|
||||
->step('1') !!}
|
||||
|
||||
{!! Former::text('primary_color') !!}
|
||||
{!! Former::text('secondary_color') !!}
|
||||
|
||||
@ -116,13 +126,18 @@
|
||||
<div role="tabpanel" class="tab-pane" id="invoiceLabels">
|
||||
<div class="panel-body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{!! Former::text('labels_item')->label(trans('texts.item')) !!}
|
||||
{!! Former::text('labels_description')->label(trans('texts.description')) !!}
|
||||
{!! Former::text('labels_unit_cost')->label(trans('texts.unit_cost')) !!}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{!! Former::text('labels_quantity')->label(trans('texts.quantity')) !!}
|
||||
{!! Former::text('labels_line_total')->label(trans('texts.line_total')) !!}
|
||||
|
||||
{!! Former::text('labels_terms')->label(trans('texts.terms')) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
||||
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
||||
{!! Session::get('show_trash:user') ? 'checked' : ''!!}/> {!! trans('texts.show_deleted_users')!!}
|
||||
{!! Session::get('show_trash:user') ? 'checked' : ''!!}/> {!! trans('texts.show_archived_users')!!}
|
||||
</label>
|
||||
|
||||
@include('partials.bulk_form', ['entityType' => ENTITY_USER])
|
||||
|
@ -68,7 +68,7 @@
|
||||
<div class="form-group" style="margin-bottom: 8px">
|
||||
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
|
||||
<a id="createClientLink" class="pointer" data-bind="click: $root.showClientForm, html: $root.clientLinkText"></a>
|
||||
<span data-bind="visible: $root.invoice().client().public_id() > 0">|
|
||||
<span data-bind="visible: $root.invoice().client().public_id() > 0" style="display:none">|
|
||||
<a data-bind="attr: {href: '{{ url('/clients') }}/' + $root.invoice().client().public_id()}" target="_blank">{{ trans('texts.view_client') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -72,7 +72,7 @@
|
||||
@endif
|
||||
|
||||
var NINJA = NINJA || {};
|
||||
@if (Utils::isPro())
|
||||
@if ($account->isPro())
|
||||
NINJA.primaryColor = "{{ $account->primary_color }}";
|
||||
NINJA.secondaryColor = "{{ $account->secondary_color }}";
|
||||
NINJA.fontSize = {{ $account->font_size }};
|
||||
|
@ -50,12 +50,20 @@
|
||||
return generatePDF(invoice, invoice.invoice_design.javascript, true, cb);
|
||||
}
|
||||
|
||||
if (window.hasOwnProperty('pjsc_meta')) {
|
||||
window['pjsc_meta'].remainingTasks++;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
@if (Input::has('phantomjs'))
|
||||
doc = getPDFString();
|
||||
doc.getDataUrl(function(pdfString) {
|
||||
document.write(pdfString);
|
||||
document.close();
|
||||
|
||||
if (window.hasOwnProperty('pjsc_meta')) {
|
||||
window['pjsc_meta'].remainingTasks--;
|
||||
}
|
||||
});
|
||||
@else
|
||||
refreshPDF();
|
||||
|
Loading…
x
Reference in New Issue
Block a user