Bug fixes

This commit is contained in:
Hillel Coren 2015-12-22 14:06:53 +02:00
parent 8739a1b46b
commit 9341ea0c87
13 changed files with 38 additions and 11 deletions

View File

@ -115,7 +115,7 @@ class DashboardController extends BaseController
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('contacts.is_primary', '=', true) ->where('contacts.is_primary', '=', true)
->select(['payments.payment_date', 'payments.amount', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id']) ->select(['payments.payment_date', 'payments.amount', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id'])
->orderBy('payments.id', 'desc') ->orderBy('payments.payment_date', 'desc')
->take(50) ->take(50)
->get(); ->get();

View File

@ -26,6 +26,7 @@ class InvoiceTransformer extends BaseTransformer
'invoice_date_sql' => isset($data->invoice_date) ? $data->invoice_date : null, 'invoice_date_sql' => isset($data->invoice_date) ? $data->invoice_date : null,
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => isset($data->notes) ? $data->notes : null, 'notes' => isset($data->notes) ? $data->notes : null,
'cost' => isset($data->amount) ? (float) $data->amount : null, 'cost' => isset($data->amount) ? (float) $data->amount : null,
'qty' => 1, 'qty' => 1,

View File

@ -26,6 +26,7 @@ class InvoiceTransformer extends BaseTransformer
'invoice_date_sql' => $data->create_date, 'invoice_date_sql' => $data->create_date,
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->notes, 'notes' => $data->notes,
'cost' => (float) $data->amount, 'cost' => (float) $data->amount,
'qty' => 1, 'qty' => 1,

View File

@ -24,6 +24,7 @@ class InvoiceTransformer extends BaseTransformer
'invoice_date_sql' => $this->getDate($data->issue_date, 'm/d/Y'), 'invoice_date_sql' => $this->getDate($data->issue_date, 'm/d/Y'),
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->subject, 'notes' => $data->subject,
'cost' => (float) $data->invoice_amount, 'cost' => (float) $data->invoice_amount,
'qty' => 1, 'qty' => 1,

View File

@ -24,6 +24,7 @@ class InvoiceTransformer extends BaseTransformer
'due_date_sql' => $this->getDate($data->due_date), 'due_date_sql' => $this->getDate($data->due_date),
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->summary, 'notes' => $data->summary,
'cost' => (float) $data->billed_total, 'cost' => (float) $data->billed_total,
'qty' => 1, 'qty' => 1,

View File

@ -26,6 +26,7 @@ class InvoiceTransformer extends BaseTransformer
'paid' => (float) $data->paid, 'paid' => (float) $data->paid,
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->description, 'notes' => $data->description,
'cost' => (float) $data->total, 'cost' => (float) $data->total,
'qty' => 1, 'qty' => 1,

View File

@ -27,6 +27,7 @@ class InvoiceTransformer extends BaseTransformer
'due_date_sql' => $this->getDate($data->due_date), 'due_date_sql' => $this->getDate($data->due_date),
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->description, 'notes' => $data->description,
'cost' => (float) $data->total, 'cost' => (float) $data->total,
'qty' => 1, 'qty' => 1,

View File

@ -25,6 +25,7 @@ class InvoiceTransformer extends BaseTransformer
'due_date_sql' => $data->date_due, 'due_date_sql' => $data->date_due,
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->line_item, 'notes' => $data->line_item,
'cost' => (float) $data->total, 'cost' => (float) $data->total,
'qty' => 1, 'qty' => 1,

View File

@ -25,6 +25,7 @@ class InvoiceTransformer extends BaseTransformer
'invoice_date_sql' => $data->invoice_date, 'invoice_date_sql' => $data->invoice_date,
'invoice_items' => [ 'invoice_items' => [
[ [
'product_key' => '',
'notes' => $data->item_desc, 'notes' => $data->item_desc,
'cost' => (float) $data->total, 'cost' => (float) $data->total,
'qty' => 1, 'qty' => 1,

View File

@ -387,7 +387,7 @@ class InvoiceRepository extends BaseRepository
$task->save(); $task->save();
} }
if (isset($item['product_key']) && $item['product_key']) { if ($item['product_key']) {
if (!\Auth::user()->account->update_products) { if (!\Auth::user()->account->update_products) {
continue; continue;
} }

View File

@ -52,7 +52,6 @@ class AuthService
if ($result === true) { if ($result === true) {
if (!$isRegistered) { if (!$isRegistered) {
event(new UserSignedUp());
Session::flash('warning', trans('texts.success_message')); Session::flash('warning', trans('texts.success_message'));
Session::flash('onReady', 'handleSignedUp();'); Session::flash('onReady', 'handleSignedUp();');
} else { } else {

View File

@ -73,9 +73,10 @@
function saveEditor(data) function saveEditor(data)
{ {
setTimeout(function() { setTimeout(function() {
customDesign[editorSection] = editor.get(); customDesign[editorSection] = editor.get();
refreshPDF(); clearError();
}, 100) refreshPDF();
}, 100)
} }
function onSelectChange() function onSelectChange()
@ -89,16 +90,34 @@
} }
loadEditor(editorSection); loadEditor(editorSection);
refreshPDF(true); clearError();
refreshPDF(true);
} }
function submitForm() function submitForm()
{ {
if (!NINJA.isPDFValid) {
return;
}
$('#custom_design').val(JSON.stringify(customDesign)); $('#custom_design').val(JSON.stringify(customDesign));
$('form.warn-on-exit').submit(); $('form.warn-on-exit').submit();
} }
$(function() { window.onerror = function(e) {
$('#pdf-error').html(e.message ? e.message : e).show();
$('button.save-button').prop('disabled', true);
NINJA.isPDFValid = false;
}
function clearError() {
NINJA.isPDFValid = true;
$('#pdf-error').hide();
$('button.save-button').prop('disabled', false);
}
$(function() {
clearError();
refreshPDF(true); refreshPDF(true);
var container = document.getElementById("jsoneditor"); var container = document.getElementById("jsoneditor");
@ -109,14 +128,14 @@
saveEditor(); saveEditor();
} }
}; };
window.editor = new JSONEditor(container, options); window.editor = new JSONEditor(container, options);
loadEditor('content'); loadEditor('content');
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab var target = $(e.target).attr("href") // activated tab
target = target.substring(1); // strip leading # target = target.substring(1); // strip leading #
loadEditor(target); loadEditor(target);
}); });
}); });
</script> </script>
@ -195,6 +214,7 @@
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div id="pdf-error" class="alert alert-danger" style="display:none"></div>
@include('invoices.pdf', ['account' => Auth::user()->account, 'pdfHeight' => 800]) @include('invoices.pdf', ['account' => Auth::user()->account, 'pdfHeight' => 800])

View File

@ -355,7 +355,7 @@
</tr> </tr>
@endif @endif
<tr> <tr style="font-size:1.05em">
<td class="hide-border" colspan="3"/> <td class="hide-border" colspan="3"/>
<td class="hide-border" style="display:none" data-bind="visible: $root.invoice_item_taxes.show"/> <td class="hide-border" style="display:none" data-bind="visible: $root.invoice_item_taxes.show"/>
<td class="hide-border" colspan="{{ $account->hide_quantity ? 1 : 2 }}"><b>{{ trans($entityType == ENTITY_INVOICE ? 'texts.balance_due' : 'texts.total') }}</b></td> <td class="hide-border" colspan="{{ $account->hide_quantity ? 1 : 2 }}"><b>{{ trans($entityType == ENTITY_INVOICE ? 'texts.balance_due' : 'texts.total') }}</b></td>