bug fixes

This commit is contained in:
Hillel Coren 2014-01-08 08:35:35 +00:00
parent 2b56c8a299
commit 4f8d5d7890
4 changed files with 7 additions and 6 deletions

View File

@ -67,7 +67,7 @@ class CreditController extends \BaseController {
'url' => 'credits', 'url' => 'credits',
'title' => '- New Credit', 'title' => '- New Credit',
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'invoices' => Invoice::scope()->with('client')->where('balance','>',0)->orderBy('invoice_number')->get(), 'invoices' => Invoice::scope()->with('client', 'invoice_status')->where('balance','>',0)->orderBy('invoice_number')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get()); 'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('credits.edit', $data); return View::make('credits.edit', $data);

View File

@ -62,7 +62,7 @@ class PaymentController extends \BaseController
'clientPublicId' => $clientPublicId, 'clientPublicId' => $clientPublicId,
'invoicePublicId' => $invoicePublicId, 'invoicePublicId' => $invoicePublicId,
'invoice' => null, 'invoice' => null,
'invoices' => Invoice::scope()->with('client')->where('balance','>',0)->orderBy('invoice_number')->get(), 'invoices' => Invoice::scope()->with('client', 'invoice_status')->where('balance','>',0)->orderBy('invoice_number')->get(),
'payment' => null, 'payment' => null,
'method' => 'POST', 'method' => 'POST',
'url' => 'payments', 'url' => 'payments',
@ -81,7 +81,7 @@ class PaymentController extends \BaseController
$data = array( $data = array(
'client' => null, 'client' => null,
'invoice' => null, 'invoice' => null,
'invoices' => Invoice::scope()->with('client')->orderBy('invoice_number')->get(array('public_id','invoice_number')), 'invoices' => Invoice::scope()->with('client', 'invoice_status')->orderBy('invoice_number')->get(array('public_id','invoice_number')),
'payment' => $payment, 'payment' => $payment,
'method' => 'PUT', 'method' => 'PUT',
'url' => 'payments/' . $publicId, 'url' => 'payments/' . $publicId,

View File

@ -1198,7 +1198,7 @@
this.prettyQty = ko.computed({ this.prettyQty = ko.computed({
read: function () { read: function () {
return this.qty() ? parseFloat(this.qty()) : ''; return parseFloat(this.qty()) ? parseFloat(this.qty()) : '';
}, },
write: function (value) { write: function (value) {
this.qty(value); this.qty(value);

View File

@ -830,7 +830,7 @@ function populateInvoiceComboboxes(clientId, invoiceId) {
for (var i=0; i<list.length; i++) { for (var i=0; i<list.length; i++) {
var invoice = list[i]; var invoice = list[i];
var client = clientMap[invoice.client.public_id]; var client = clientMap[invoice.client.public_id];
$invoiceCombobox.append(new Option(invoice.invoice_number + ' - ' + getClientDisplayName(client) + ' - ' + formatMoney(invoice.balance, invoice.currency_id), invoice.public_id)); $invoiceCombobox.append(new Option(invoice.invoice_number + ' - ' + invoice.invoice_status.name + ' - ' + getClientDisplayName(client) + ' - ' + formatMoney(invoice.amount, invoice.currency_id) + ' | ' + formatMoney(invoice.balance, invoice.currency_id), invoice.public_id));
} }
$('select#invoice').combobox('refresh'); $('select#invoice').combobox('refresh');
}); });
@ -853,7 +853,8 @@ function populateInvoiceComboboxes(clientId, invoiceId) {
if (invoiceId) { if (invoiceId) {
var invoice = invoiceMap[invoiceId]; var invoice = invoiceMap[invoiceId];
var client = clientMap[invoice.client.public_id]; var client = clientMap[invoice.client.public_id];
setComboboxValue($('.invoice-select'), invoice.public_id, (invoice.invoice_number + ' - ' + getClientDisplayName(client) + ' - ' + formatMoney(invoice.balance, invoice.currency_id))); console.log(invoice);
setComboboxValue($('.invoice-select'), invoice.public_id, (invoice.invoice_number + ' - ' + invoice.invoice_status.name + ' - ' + getClientDisplayName(client) + ' - ' + formatMoney(invoice.amount, invoice.currency_id) + ' | ' + formatMoney(invoice.balance, invoice.currency_id)));
$invoiceSelect.trigger('change'); $invoiceSelect.trigger('change');
} else if (clientId) { } else if (clientId) {
var client = clientMap[clientId]; var client = clientMap[clientId];