1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Updating design

This commit is contained in:
Hillel Coren 2015-04-22 22:21:04 +03:00
parent c0571b0b2e
commit dc6ed9fca1
30 changed files with 418 additions and 333 deletions

View File

@ -293,6 +293,7 @@ class AccountController extends BaseController
$account->pdf_email_attachment = Input::get('pdf_email_attachment') ? true : false;
$account->utf8_invoices = Input::get('utf8_invoices') ? true : false;
$account->auto_wrap = Input::get('auto_wrap') ? true : false;
if (!$account->share_counter) {
$account->quote_number_counter = Input::get('quote_number_counter');

View File

@ -145,12 +145,18 @@ class PaymentController extends BaseController
public function create($clientPublicId = 0, $invoicePublicId = 0)
{
$invoices = Invoice::scope()
->where('is_recurring', '=', false)
->where('is_quote', '=', false)
->where('invoices.balance', '>', 0)
->with('client', 'invoice_status')
->orderBy('invoice_number')->get();
$data = array(
'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId,
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : $invoicePublicId,
'invoice' => null,
'invoices' => Invoice::scope()->where('is_recurring', '=', false)->where('is_quote', '=', false)
->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
'invoices' => $invoices,
'payment' => null,
'method' => 'POST',
'url' => "payments",

View File

@ -16,6 +16,7 @@ class Kernel extends HttpKernel {
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'App\Http\Middleware\VerifyCsrfToken',
'App\Http\Middleware\DuplicateSubmissionCheck',
'App\Http\Middleware\StartupCheck',
];

View File

@ -0,0 +1,24 @@
<?php namespace app\Http\Middleware;
use Closure;
class DuplicateSubmissionCheck
{
// Prevent users from submitting forms twice
public function handle($request, Closure $next)
{
if (in_array($request->method(), ['POST', 'PUT', 'DELETE'])) {
$lastPage = session(SESSION_LAST_REQUEST_PAGE);
$lastTime = session(SESSION_LAST_REQUEST_TIME);
if ($lastPage == $request->path() && (microtime(true) - $lastTime <= 1.5)) {
return redirect($request->path());
}
session([SESSION_LAST_REQUEST_PAGE => $request->path()]);
session([SESSION_LAST_REQUEST_TIME => microtime(true)]);
}
return $next($request);
}
}

View File

@ -312,6 +312,9 @@ define('SESSION_DATETIME_FORMAT', 'datetimeFormat');
define('SESSION_COUNTER', 'sessionCounter');
define('SESSION_LOCALE', 'sessionLocale');
define('SESSION_LAST_REQUEST_PAGE', 'SESSION_LAST_REQUEST_PAGE');
define('SESSION_LAST_REQUEST_TIME', 'SESSION_LAST_REQUEST_TIME');
define('DEFAULT_TIMEZONE', 'US/Eastern');
define('DEFAULT_CURRENCY', 1); // US Dollar
define('DEFAULT_DATE_FORMAT', 'M j, Y');

View File

@ -355,7 +355,8 @@ class Account extends Eloquent
public function getEmailFooter()
{
if ($this->email_footer) {
return $this->email_footer;
// Add line breaks if HTML isn't already being used
return strip_tags($this->email_footer) == $this->email_footer ? nl2br($this->email_footer) : $this->email_footer;
} else {
return "<p>" . trans('texts.email_signature') . "<br>\$account</p>";
}

View File

@ -134,7 +134,7 @@ class InvoiceRepository
}
return $table->addColumn('due_date', function ($model) { return Utils::fromSqlDate($model->due_date); })
->addColumn('invoice_status_name', function ($model) { return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted')) : $model->invoice_status_name; })
->addColumn('invoice_status_name', function ($model) { return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted')) : self::getStatusLabel($model->invoice_status_id, $model->invoice_status_name); })
->addColumn('dropdown', function ($model) use ($entityType) {
if ($model->is_deleted) {
@ -187,6 +187,26 @@ class InvoiceRepository
->make();
}
private function getStatusLabel($statusId, $statusName) {
$label = trans("texts.{$statusName}");
$class = 'default';
switch ($statusId) {
case INVOICE_STATUS_SENT:
$class = 'info';
break;
case INVOICE_STATUS_VIEWED:
$class = 'warning';
break;
case INVOICE_STATUS_PARTIAL:
$class = 'primary';
break;
case INVOICE_STATUS_PAID:
$class = 'success';
break;
}
return "<h4><div class=\"label label-{$class}\">$statusName</div></h4>";
}
public function getErrors($input)
{
$contact = (array) $input->client->contacts[0];

View File

@ -20,6 +20,7 @@ class AddPartialAmountToInvoices extends Migration {
Schema::table('accounts', function($table)
{
$table->boolean('utf8_invoices')->default(false);
$table->boolean('auto_wrap')->default(true);
});
}
@ -38,6 +39,7 @@ class AddPartialAmountToInvoices extends Migration {
Schema::table('accounts', function($table)
{
$table->dropColumn('utf8_invoices');
$table->dropColumn('auto_wrap');
});
}

21
public/css/built.css vendored
View File

@ -2408,7 +2408,6 @@ div.checkbox > label {
.container input[type=email],
.container textarea,
.container select {
/*font-family: 'Roboto', sans-serif;*/
font-size: 16px;
font-weight: 400;
width: 100%;
@ -2424,6 +2423,24 @@ div.checkbox > label {
color: #444444;
}
.container input:disabled,
.container textarea:disabled,
.container select:disabled {
background-color: #EEE !important;
}
.panel-title {
font-size: 18px;
}
color: white;
}
.panel-heading {
/*background-color: #e37329 !important;*/
background-color: #0b4d78 !important;
}
/*
.panel-default {
border-color: #e37329 !important;
}
*/

20
public/css/style.css vendored
View File

@ -826,6 +826,24 @@ div.checkbox > label {
color: #444444;
}
.container input:disabled,
.container textarea:disabled,
.container select:disabled {
background-color: #EEE !important;
}
.panel-title {
font-size: 18px;
}
color: white;
}
.panel-heading {
/*background-color: #e37329 !important;*/
background-color: #0b4d78 !important;
}
/*
.panel-default {
border-color: #e37329 !important;
}
*/

View File

@ -31664,8 +31664,9 @@ function GetPdf(invoice, javascript){
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
var top = doc.internal.pageSize.height - layout.marginLeft;
if (!invoice.is_pro) top -= 25;
var numLines = invoice.invoice_footer.split("\n").length - 1;
doc.text(layout.marginLeft, top - (numLines * 8), invoice.invoice_footer);
var footer = doc.splitTextToSize(invoice.invoice_footer, 500);
var numLines = footer.length - 1;
doc.text(layout.marginLeft, top - (numLines * 8), footer);
}
return doc;
@ -32065,34 +32066,6 @@ if (window.ko) {
};
}
function wordWrapText(value, width)
{
var doc = new jsPDF('p', 'pt');
doc.setFont('Helvetica','');
doc.setFontSize(10);
var lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
var numLines = doc.splitTextToSize(lines[i], width).length;
if (numLines <= 1) continue;
var j = 0; space = lines[i].length;
while (j++ < lines[i].length) {
if (lines[i].charAt(j) === ' ') space = j;
}
if (space == lines[i].length) space = width/6;
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || '');
lines[i] = lines[i].substring(0, space);
}
var newValue = (lines.join("\n")).trim();
if (value == newValue) {
return newValue;
} else {
return wordWrapText(newValue, width);
}
}
function getClientDisplayName(client)
{
var contact = client.contacts ? client.contacts[0] : false;
@ -32473,17 +32446,19 @@ function displayNotesAndTerms(doc, layout, invoice, y)
var origY = y;
if (invoice.public_notes) {
doc.text(layout.marginLeft, y, invoice.public_notes);
y += 16 + (doc.splitTextToSize(invoice.public_notes, 300).length * doc.internal.getFontSize());
var notes = doc.splitTextToSize(invoice.public_notes, 260);
doc.text(layout.marginLeft, y, notes);
y += 16 + (notes.length * doc.internal.getFontSize());
}
if (invoice.terms) {
doc.setFontType("bold");
var terms = doc.splitTextToSize(invoice.terms, 260);
doc.setFontType("bold");
doc.text(layout.marginLeft, y, invoiceLabels.terms);
y += 16;
doc.setFontType("normal");
doc.text(layout.marginLeft, y, invoice.terms);
y += 16 + (doc.splitTextToSize(invoice.terms, 300).length * doc.internal.getFontSize());
doc.text(layout.marginLeft, y, terms);
y += 16 + (terms.length * doc.internal.getFontSize());
}
return y - origY;

View File

@ -102,8 +102,9 @@ function GetPdf(invoice, javascript){
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
var top = doc.internal.pageSize.height - layout.marginLeft;
if (!invoice.is_pro) top -= 25;
var numLines = invoice.invoice_footer.split("\n").length - 1;
doc.text(layout.marginLeft, top - (numLines * 8), invoice.invoice_footer);
var footer = doc.splitTextToSize(invoice.invoice_footer, 500);
var numLines = footer.length - 1;
doc.text(layout.marginLeft, top - (numLines * 8), footer);
}
return doc;
@ -503,34 +504,6 @@ if (window.ko) {
};
}
function wordWrapText(value, width)
{
var doc = new jsPDF('p', 'pt');
doc.setFont('Helvetica','');
doc.setFontSize(10);
var lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
var numLines = doc.splitTextToSize(lines[i], width).length;
if (numLines <= 1) continue;
var j = 0; space = lines[i].length;
while (j++ < lines[i].length) {
if (lines[i].charAt(j) === ' ') space = j;
}
if (space == lines[i].length) space = width/6;
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || '');
lines[i] = lines[i].substring(0, space);
}
var newValue = (lines.join("\n")).trim();
if (value == newValue) {
return newValue;
} else {
return wordWrapText(newValue, width);
}
}
function getClientDisplayName(client)
{
var contact = client.contacts ? client.contacts[0] : false;
@ -911,17 +884,19 @@ function displayNotesAndTerms(doc, layout, invoice, y)
var origY = y;
if (invoice.public_notes) {
doc.text(layout.marginLeft, y, invoice.public_notes);
y += 16 + (doc.splitTextToSize(invoice.public_notes, 300).length * doc.internal.getFontSize());
var notes = doc.splitTextToSize(invoice.public_notes, 260);
doc.text(layout.marginLeft, y, notes);
y += 16 + (notes.length * doc.internal.getFontSize());
}
if (invoice.terms) {
doc.setFontType("bold");
var terms = doc.splitTextToSize(invoice.terms, 260);
doc.setFontType("bold");
doc.text(layout.marginLeft, y, invoiceLabels.terms);
y += 16;
doc.setFontType("normal");
doc.text(layout.marginLeft, y, invoice.terms);
y += 16 + (doc.splitTextToSize(invoice.terms, 300).length * doc.internal.getFontSize());
doc.text(layout.marginLeft, y, terms);
y += 16 + (terms.length * doc.internal.getFontSize());
}
return y - origY;

View File

@ -207,7 +207,7 @@ return array(
'client_will_create' => 'client will be created',
'clients_will_create' => 'clients will be created',
'email_settings' => 'Email Settings',
'pdf_email_attachment' => 'Attach PDF to Emails',
'pdf_email_attachment' => 'Attach to Emails',
// application messages
'created_client' => 'Successfully created client',
@ -596,8 +596,10 @@ return array(
'more_fields' => 'More Fields',
'less_fields' => 'Less Fields',
'client_name' => 'Client Name',
'pdf_settings' => 'PDFF Settings',
'utf8_invoices' => 'UTF-8 Support <sup>Beta</sup>',
'pdf_settings' => 'PDF Settings',
'utf8_invoices' => 'Cyrillic Support',
'product_settings' => 'Product Settings',
'auto_wrap' => 'Auto Line Wrap',
);

View File

@ -7,9 +7,10 @@
{!! Former::populate($account) !!}
{!! Former::legend($title) !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans($title) !!}</h3>
</div>
<div class="panel-body">
@if ($accountGateway)

View File

@ -3,7 +3,7 @@
@section('content')
@parent
{!! Former::open_for_files('company/import_map')->addClass('col-md-9 col-md-offset-1') !!}
{!! Former::open_for_files('company/import_map')->addClass('col-md-8 col-md-offset-2') !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.import_clients') !!}</h3>
@ -16,7 +16,7 @@
{!! Former::close() !!}
{!! Former::open('company/export')->addClass('col-md-9 col-md-offset-1') !!}
{!! Former::open('company/export')->addClass('col-md-8 col-md-offset-2') !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.export_clients') !!}</h3>
@ -28,7 +28,7 @@
{!! Former::close() !!}
{!! Former::open('company/cancel_account')->addClass('col-md-9 col-md-offset-1 cancel-account') !!}
{!! Former::open('company/cancel_account')->addClass('col-md-8 col-md-offset-2 cancel-account') !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.cancel_account') !!}</h3>

View File

@ -24,6 +24,7 @@
{{ Former::populateField('share_counter', intval($account->share_counter)) }}
{{ Former::populateField('pdf_email_attachment', intval($account->pdf_email_attachment)) }}
{{ Former::populateField('utf8_invoices', intval($account->utf8_invoices)) }}
{{ Former::populateField('auto_wrap', intval($account->auto_wrap)) }}
<div class="row">
<div class="col-md-6">
@ -93,11 +94,12 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.email_settings') !!}</h3>
<h3 class="panel-title">{!! trans('texts.pdf_settings') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('pdf_email_attachment')->text(trans('texts.enable')) !!}
{!! Former::checkbox('utf8_invoices')->text(trans('texts.enable')) !!}
{!! Former::checkbox('auto_wrap')->text(trans('texts.enable')) !!}
</div>
</div>
</div>

View File

@ -53,11 +53,11 @@
<h3 class="panel-title">{!! trans('texts.custom_messages') !!}</h3>
</div>
<div class="panel-body">
{!! Former::textarea('invoice_terms')->label(trans('texts.default_invoice_terms'))
{!! Former::textarea('invoice_terms')->label(trans('texts.default_invoice_terms'))->rows(4)
->onchange("$('#invoice_terms').val(wordWrapText($('#invoice_terms').val(), 300))") !!}
{!! Former::textarea('invoice_footer')->label(trans('texts.default_invoice_footer'))
{!! Former::textarea('invoice_footer')->label(trans('texts.default_invoice_footer'))->rows(4)
->onchange("$('#invoice_footer').val(wordWrapText($('#invoice_footer').val(), 600))") !!}
{!! Former::textarea('email_footer')->label(trans('texts.default_email_footer')) !!}
{!! Former::textarea('email_footer')->label(trans('texts.default_email_footer'))->rows(4) !!}
</div>
</div>

View File

@ -4,7 +4,6 @@
@parent
{!! Former::open('gateways/delete')->addClass('user-form') !!}
{!! Former::legend(trans('texts.online_payments')) !!}
<div style="display:none">
{!! Former::text('accountGatewayPublicId') !!}

View File

@ -8,9 +8,10 @@
->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
{!! Former::legend($title) !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! $title !!}</h3>
</div>
<div class="panel-body">
@if ($product)

View File

@ -8,8 +8,10 @@
{{ Former::populateField('update_products', intval($account->update_products)) }}
{!! Former::legend(trans('texts.product_library')) !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.product_settings') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('fill_products')->text(trans('texts.fill_products_help')) !!}

View File

@ -8,9 +8,10 @@
'name' => 'required',
)); !!}
{!! Former::legend($title) !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans($title) !!}</h3>
</div>
<div class="panel-body">
@if ($token)

View File

@ -5,7 +5,6 @@
@include('accounts.nav_advanced')
{!! Former::open('tokens/delete')->addClass('user-form') !!}
{!! Former::legend('token_management') !!}
<div style="display:none">
{!! Former::text('tokenPublicId') !!}

View File

@ -5,7 +5,6 @@
@include('accounts.nav_advanced')
{!! Former::open('users/delete')->addClass('user-form') !!}
{!! Former::legend('user_management') !!}
<div style="display:none">
{!! Former::text('userPublicId') !!}

View File

@ -14,7 +14,7 @@
)) !!}
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-body">

View File

@ -56,7 +56,7 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default dashboard" style="min-height:320px">
<div class="panel-heading" style="background-color:#0b4d78">
<div class="panel-heading" style="background-color:#0b4d78 !important">
<h3 class="panel-title in-bold-white">
<i class="glyphicon glyphicon-exclamation-sign"></i> {{ trans('texts.notifications') }}
</h3>
@ -73,7 +73,7 @@
</div>
<div class="col-md-6">
<div class="panel panel-default dashboard" style="min-height:320px">
<div class="panel-heading" style="background-color:#e37329">
<div class="panel-heading" style="background-color:#e37329 !important">
<h3 class="panel-title in-bold-white">
<i class="glyphicon glyphicon-time"></i> {{ trans('texts.invoices_past_due') }}
</h3>
@ -107,8 +107,8 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default dashboard" style="min-height:320px;">
<div class="panel-heading" style="margin:0;">
<h3 class="panel-title">
<div class="panel-heading" style="margin:0; background-color: #f5f5f5 !important;">
<h3 class="panel-title" style="color: black !important">
<i class="glyphicon glyphicon-time"></i> {{ trans('texts.upcoming_invoices') }}
</h3>
</div>

View File

@ -23,6 +23,256 @@
@include('script')
<script type="text/javascript">
function setTheme(id)
{
$('#theme_id').val(id);
$('form.themeForm').submit();
}
@if (!Auth::check() || !Auth::user()->registered)
function validateSignUp(showError)
{
var isFormValid = true;
$(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field),
val = $.trim($input.val());
var isValid = val && val.length >= (field == 'password' ? 6 : 1);
if (isValid && field == 'email') {
isValid = isValidEmailAddress(val);
}
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');
}
}
});
if (!$('#terms_checkbox').is(':checked')) {
isFormValid = false;
}
$('#saveSignUpButton').prop('disabled', !isFormValid);
return isFormValid;
}
function validateServerSignUp()
{
if (!validateSignUp(true)) {
return;
}
$('#signUpDiv, #signUpFooter').hide();
$('#working').show();
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/validate') }}',
data: 'email=' + $('form.signUpForm #new_email').val(),
success: function(result) {
if (result == 'available') {
submitSignUp();
} else {
$('#errorTaken').show();
$('form.signUpForm #new_email').closest('div.form-group').removeClass('has-success').addClass('has-error');
$('#signUpDiv, #signUpFooter').show();
$('#working').hide();
}
}
});
}
function submitSignUp() {
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/submit') }}',
data: 'new_email=' + encodeURIComponent($('form.signUpForm #new_email').val()) +
'&new_password=' + encodeURIComponent($('form.signUpForm #new_password').val()) +
'&new_first_name=' + encodeURIComponent($('form.signUpForm #new_first_name').val()) +
'&new_last_name=' + encodeURIComponent($('form.signUpForm #new_last_name').val()) +
'&go_pro=' + $('#go_pro').val(),
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');
trackUrl('/signed_up');
NINJA.isRegistered = true;
$('#signUpButton').hide();
$('#myAccountButton').html(result);
}
$('#signUpSuccessDiv, #signUpFooter, #closeSignUpButton').show();
$('#working, #saveSignUpButton').hide();
}
});
}
function checkForEnter(event)
{
if (event.keyCode === 13){
event.preventDefault();
validateServerSignUp();
return false;
}
}
@endif
function logout(force)
{
if (force) {
NINJA.formIsChanged = false;
}
if (force || NINJA.isRegistered) {
window.location = '{{ URL::to('logout') }}';
} else {
$('#logoutModal').modal('show');
}
}
function showSignUp() {
$('#signUpModal').modal('show');
}
function buyProduct(affiliateKey, productId) {
window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/license?affiliate_key=' + affiliateKey + '&product_id=' + productId + '&return_url=' + window.location);
}
@if (Auth::check() && !Auth::user()->isPro())
var proPlanFeature = false;
function showProPlan(feature) {
proPlanFeature = feature;
$('#proPlanModal').modal('show');
trackUrl('/view_pro_plan/' + feature);
}
function submitProPlan() {
trackUrl('/submit_pro_plan/' + proPlanFeature);
if (NINJA.isRegistered) {
$('#proPlanDiv, #proPlanFooter').hide();
$('#proPlanWorking').show();
$.ajax({
type: 'POST',
url: '{{ URL::to('account/go_pro') }}',
success: function(result) {
NINJA.formIsChanged = false;
window.location = '{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/view/' + result;
}
});
} else {
$('#proPlanModal').modal('hide');
$('#go_pro').val('true');
showSignUp();
}
}
@endif
function hideMessage() {
$('.alert-info').fadeOut();
$.get('/hide_message', function(response) {
console.log('Reponse: %s', response);
});
}
function wordWrapText(value, width)
{
@if (Auth::user()->account->auto_wrap)
var doc = new jsPDF('p', 'pt');
doc.setFont('Helvetica','');
doc.setFontSize(10);
var lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
var numLines = doc.splitTextToSize(lines[i], width).length;
if (numLines <= 1) continue;
var j = 0; space = lines[i].length;
while (j++ < lines[i].length) {
if (lines[i].charAt(j) === ' ') space = j;
}
if (space == lines[i].length) space = width/6;
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || '');
lines[i] = lines[i].substring(0, space);
}
var newValue = (lines.join("\n")).trim();
if (value == newValue) {
return newValue;
} else {
return wordWrapText(newValue, width);
}
@else
return value;
@endif
}
$(function() {
$('#search').focus(function(){
if (!window.hasOwnProperty('searchData')) {
$.get('{{ URL::route('getSearchData') }}', function(data) {
window.searchData = true;
var datasets = [];
for (var type in data)
{
if (!data.hasOwnProperty(type)) continue;
datasets.push({
name: type,
header: '&nbsp;<b>' + type + '</b>',
local: data[type]
});
}
if (datasets.length == 0) {
return;
}
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
var type = name == 'Contacts' ? 'clients' : name.toLowerCase();
window.location = '{{ URL::to('/') }}' + '/' + type + '/' + datum.public_id;
}).focus().typeahead('setQuery', $('#search').val());
});
}
});
if (isStorageSupported()) {
@if (Auth::check() && !Auth::user()->registered)
localStorage.setItem('guest_key', '{{ Auth::user()->password }}');
@endif
}
@if (!Auth::check() || !Auth::user()->registered)
validateSignUp();
$('#signUpModal').on('shown.bs.modal', function () {
trackUrl('/view_sign_up');
$(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field);
if (!$input.val()) {
$input.focus();
return false;
}
});
})
@endif
@if (Auth::check() && !Utils::isNinja() && !Auth::user()->registered)
$('#closeSignUpButton').hide();
showSignUp();
@elseif(Session::get('sign_up') || Input::get('sign_up'))
showSignUp();
@endif
@yield('onReady')
});
</script>
@stop
@section('body')
@ -350,222 +600,5 @@
<p>&nbsp;</p>
<script type="text/javascript">
function setTheme(id)
{
$('#theme_id').val(id);
$('form.themeForm').submit();
}
@if (!Auth::check() || !Auth::user()->registered)
function validateSignUp(showError)
{
var isFormValid = true;
$(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field),
val = $.trim($input.val());
var isValid = val && val.length >= (field == 'password' ? 6 : 1);
if (isValid && field == 'email') {
isValid = isValidEmailAddress(val);
}
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');
}
}
});
if (!$('#terms_checkbox').is(':checked')) {
isFormValid = false;
}
$('#saveSignUpButton').prop('disabled', !isFormValid);
return isFormValid;
}
function validateServerSignUp()
{
if (!validateSignUp(true)) {
return;
}
$('#signUpDiv, #signUpFooter').hide();
$('#working').show();
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/validate') }}',
data: 'email=' + $('form.signUpForm #new_email').val(),
success: function(result) {
if (result == 'available') {
submitSignUp();
} else {
$('#errorTaken').show();
$('form.signUpForm #new_email').closest('div.form-group').removeClass('has-success').addClass('has-error');
$('#signUpDiv, #signUpFooter').show();
$('#working').hide();
}
}
});
}
function submitSignUp() {
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/submit') }}',
data: 'new_email=' + encodeURIComponent($('form.signUpForm #new_email').val()) +
'&new_password=' + encodeURIComponent($('form.signUpForm #new_password').val()) +
'&new_first_name=' + encodeURIComponent($('form.signUpForm #new_first_name').val()) +
'&new_last_name=' + encodeURIComponent($('form.signUpForm #new_last_name').val()) +
'&go_pro=' + $('#go_pro').val(),
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');
trackUrl('/signed_up');
NINJA.isRegistered = true;
$('#signUpButton').hide();
$('#myAccountButton').html(result);
}
$('#signUpSuccessDiv, #signUpFooter, #closeSignUpButton').show();
$('#working, #saveSignUpButton').hide();
}
});
}
function checkForEnter(event)
{
if (event.keyCode === 13){
event.preventDefault();
validateServerSignUp();
return false;
}
}
@endif
function logout(force)
{
if (force) {
NINJA.formIsChanged = false;
}
if (force || NINJA.isRegistered) {
window.location = '{{ URL::to('logout') }}';
} else {
$('#logoutModal').modal('show');
}
}
function showSignUp() {
$('#signUpModal').modal('show');
}
function buyProduct(affiliateKey, productId) {
window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/license?affiliate_key=' + affiliateKey + '&product_id=' + productId + '&return_url=' + window.location);
}
@if (Auth::check() && !Auth::user()->isPro())
var proPlanFeature = false;
function showProPlan(feature) {
proPlanFeature = feature;
$('#proPlanModal').modal('show');
trackUrl('/view_pro_plan/' + feature);
}
function submitProPlan() {
trackUrl('/submit_pro_plan/' + proPlanFeature);
if (NINJA.isRegistered) {
$('#proPlanDiv, #proPlanFooter').hide();
$('#proPlanWorking').show();
$.ajax({
type: 'POST',
url: '{{ URL::to('account/go_pro') }}',
success: function(result) {
NINJA.formIsChanged = false;
window.location = '{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/view/' + result;
}
});
} else {
$('#proPlanModal').modal('hide');
$('#go_pro').val('true');
showSignUp();
}
}
@endif
function hideMessage() {
$('.alert-info').fadeOut();
$.get('/hide_message', function(response) {
console.log('Reponse: %s', response);
});
}
$(function() {
$('#search').focus(function(){
if (!window.hasOwnProperty('searchData')) {
$.get('{{ URL::route('getSearchData') }}', function(data) {
window.searchData = true;
var datasets = [];
for (var type in data)
{
if (!data.hasOwnProperty(type)) continue;
datasets.push({
name: type,
header: '&nbsp;<b>' + type + '</b>',
local: data[type]
});
}
if (datasets.length == 0) {
return;
}
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
var type = name == 'Contacts' ? 'clients' : name.toLowerCase();
window.location = '{{ URL::to('/') }}' + '/' + type + '/' + datum.public_id;
}).focus().typeahead('setQuery', $('#search').val());
});
}
});
if (isStorageSupported()) {
@if (Auth::check() && !Auth::user()->registered)
localStorage.setItem('guest_key', '{{ Auth::user()->password }}');
@endif
}
@if (!Auth::check() || !Auth::user()->registered)
validateSignUp();
$('#signUpModal').on('shown.bs.modal', function () {
trackUrl('/view_sign_up');
$(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field);
if (!$input.val()) {
$input.focus();
return false;
}
});
})
@endif
@if (Auth::check() && !Utils::isNinja() && !Auth::user()->registered)
$('#closeSignUpButton').hide();
showSignUp();
@elseif(Session::get('sign_up') || Input::get('sign_up'))
showSignUp();
@endif
@yield('onReady')
});
</script>
@stop

View File

@ -359,7 +359,7 @@
{!! Button::normal(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'email_button', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
@endif
@if ($invoice && $invoice->id && $entityType == ENTITY_INVOICE && !$invoice->is_recurring)
@if ($invoice && $invoice->id && $entityType == ENTITY_INVOICE && !$invoice->is_recurring && !$invoice->isPaid())
{!! Button::primary(trans('texts.enter_payment'))->withAttributes(array('onclick' => 'onPaymentClick()'))->appendIcon(Icon::create('usd')) !!}
@endif
@elseif ($invoice && $invoice->trashed() && !$invoice->is_deleted == '1')

View File

@ -20,7 +20,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-body">

View File

@ -11,20 +11,22 @@
@include('accounts.nav_advanced')
<legend style="padding-bottom:32px">
{!! trans('texts.chart_builder') !!}
<div class="pull-right">
{!! Button::normal(trans('texts.data_visualizations'))->asLinkTo('/company/advanced_settings/data_visualizations')->appendIcon(Icon::create('globe')) !!}
</div>
</legend>
{!! Button::normal(trans('texts.data_visualizations'))
->asLinkTo('/company/advanced_settings/data_visualizations')
->withAttributes(['class' => 'pull-right'])
->appendIcon(Icon::create('globe')) !!}
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-lg-4">
{!! Former::open()->addClass('warn-on-exit') !!}
<div class="panel panel-default">
<div class="panel-body">
{!! Former::populateField('start_date', $startDate) !!}
{!! Former::populateField('end_date', $endDate) !!}
{!! Former::select('chart_type')->options($chartTypes, $chartType) !!}
@ -33,8 +35,6 @@
->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'start_date\')"></i>') !!}
{!! Former::text('end_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))
->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'end_date\')"></i>') !!}
</div>
</div>
@if (Auth::user()->isPro())
{!! Former::actions( Button::primary('Generate')->submit() ) !!}
@ -68,6 +68,8 @@
</div>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -10,13 +10,14 @@
'email' => 'required|email',
)); !!}
{!! Former::legend($title) !!}
@if ($user)
{!! Former::populate($user) !!}
@endif
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! $title !!}</h3>
</div>
<div class="panel-body">
{!! Former::text('first_name') !!}