Bug fixes

This commit is contained in:
Hillel Coren 2015-04-21 23:09:45 +03:00
parent 8018bcad6c
commit c0571b0b2e
13 changed files with 42 additions and 27 deletions

View File

@ -10,6 +10,7 @@ use Redirect;
use DB; use DB;
use Event; use Event;
use URL; use URL;
use Datatable;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Invitation; use App\Models\Invitation;

View File

@ -292,6 +292,7 @@ class Activity extends Eloquent
$invoice = $payment->invoice; $invoice = $payment->invoice;
$invoice->balance = $invoice->balance - $payment->amount; $invoice->balance = $invoice->balance - $payment->amount;
$invoice->invoice_status_id = ($invoice->balance > 0) ? INVOICE_STATUS_PARTIAL : INVOICE_STATUS_PAID; $invoice->invoice_status_id = ($invoice->balance > 0) ? INVOICE_STATUS_PARTIAL : INVOICE_STATUS_PAID;
$invoice->partial = 0;
$invoice->save(); $invoice->save();
} }

View File

@ -7,6 +7,10 @@ class Invoice extends EntityModel
use SoftDeletes; use SoftDeletes;
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $casts = [
'is_recurring' => 'boolean',
];
public function account() public function account()
{ {
return $this->belongsTo('App\Models\Account'); return $this->belongsTo('App\Models\Account');

View File

@ -2408,13 +2408,13 @@ div.checkbox > label {
.container input[type=email], .container input[type=email],
.container textarea, .container textarea,
.container select { .container select {
font-family: 'Roboto', sans-serif; /*font-family: 'Roboto', sans-serif;*/
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
width: 100%; width: 100%;
color: #000 !important; color: #000 !important;
background: #f9f9f9 !important; background: #f9f9f9 !important;
border: 1px solid #ebe7e7; /*border: 1px solid #ebe7e7;*/
border-radius: 3px; border-radius: 3px;
} }

View File

@ -811,13 +811,12 @@ div.checkbox > label {
.container input[type=email], .container input[type=email],
.container textarea, .container textarea,
.container select { .container select {
font-family: 'Roboto', sans-serif;
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
width: 100%; width: 100%;
color: #000 !important; color: #000 !important;
background: #f9f9f9 !important; background: #f9f9f9 !important;
border: 1px solid #ebe7e7; /*border: 1px solid #ebe7e7;*/
border-radius: 3px; border-radius: 3px;
} }

View File

@ -33118,14 +33118,17 @@ function truncate(str, length) {
function GetPdfMake(invoice, javascript, callback) { function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account; var account = invoice.account;
eval(javascript); eval(javascript);
/*
var fonts = { var fonts = {
Roboto: { Roboto: {
normal: 'Roboto-Regular.ttf', normal: 'Roboto-Regular.ttf',
bold: 'Roboto-Medium.ttf', bold: 'Roboto-Medium.ttf',
italics: 'Roboto-Italic.ttf', italics: 'Roboto-Italic.ttf',
bolditalics: 'Roboto-Italic.ttf' bolditalics: 'Roboto-Italic.ttf'
} },
}; };
*/
doc = pdfMake.createPdf(dd); doc = pdfMake.createPdf(dd);
doc.save = function(fileName) { doc.save = function(fileName) {

View File

@ -1,14 +1,17 @@
function GetPdfMake(invoice, javascript, callback) { function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account; var account = invoice.account;
eval(javascript); eval(javascript);
/*
var fonts = { var fonts = {
Roboto: { Roboto: {
normal: 'Roboto-Regular.ttf', normal: 'Roboto-Regular.ttf',
bold: 'Roboto-Medium.ttf', bold: 'Roboto-Medium.ttf',
italics: 'Roboto-Italic.ttf', italics: 'Roboto-Italic.ttf',
bolditalics: 'Roboto-Italic.ttf' bolditalics: 'Roboto-Italic.ttf'
} },
}; };
*/
doc = pdfMake.createPdf(dd); doc = pdfMake.createPdf(dd);
doc.save = function(fileName) { doc.save = function(fileName) {

View File

@ -40,6 +40,7 @@ If you'd like to use our code to sell your own invoicing app we have an affiliat
* [knockout/knockout](https://github.com/knockout/knockout) - Knockout makes it easier to create rich, responsive UIs with JavaScript * [knockout/knockout](https://github.com/knockout/knockout) - Knockout makes it easier to create rich, responsive UIs with JavaScript
* [rniemeyer/knockout-sortable](https://github.com/rniemeyer/knockout-sortable) - A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality * [rniemeyer/knockout-sortable](https://github.com/rniemeyer/knockout-sortable) - A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality
* [MrRio/jsPDF](https://github.com/MrRio/jsPDF) - Generate PDF files in JavaScript. HTML5 FTW. * [MrRio/jsPDF](https://github.com/MrRio/jsPDF) - Generate PDF files in JavaScript. HTML5 FTW.
* [bpampuch/pdfmake](https://github.com/bpampuch/pdfmake) - Client/server side PDF printing in pure JavaScript
* [FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome) - The iconic font designed for Bootstrap that works with twitter bootstrap * [FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome) - The iconic font designed for Bootstrap that works with twitter bootstrap
* [Anahkiasen/former](https://github.com/Anahkiasen/former) - A powerful form builder, for Laravel and other frameworks (stand-alone too) * [Anahkiasen/former](https://github.com/Anahkiasen/former) - A powerful form builder, for Laravel and other frameworks (stand-alone too)
* [barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) - Laravel debugbar * [barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) - Laravel debugbar

View File

@ -43,6 +43,8 @@
</small></h3> </small></h3>
@endif @endif
<div class="panel panel-default">
<div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
@ -139,8 +141,8 @@
</div> </div>
</div> </div>
</div>
<p>&nbsp;</p> </div>
<ul class="nav nav-tabs nav-justified"> <ul class="nav nav-tabs nav-justified">
{!! HTML::tab_link('#activity', trans('texts.activity'), true) !!} {!! HTML::tab_link('#activity', trans('texts.activity'), true) !!}

View File

@ -113,7 +113,7 @@
<form class="navbar-form navbar-right" role="search"> <form class="navbar-form navbar-right" role="search">
<div class="form-group"> <div class="form-group">
<input type="text" id="search" style="width: 160px" <input type="text" id="search" style="width: 140px"
class="form-control" placeholder="{{ trans('texts.search') }}"> class="form-control" placeholder="{{ trans('texts.search') }}">
</div> </div>
</form> </form>

View File

@ -718,8 +718,10 @@
var invoice = createInvoiceModel(); var invoice = createInvoiceModel();
var design = getDesignJavascript(); var design = getDesignJavascript();
if (!design) return; if (!design) return;
doc = generatePDF(invoice, design, false); doc = generatePDF(invoice, design, false);
doc.getDataUrl(cb); if (!doc) return;
//return doc.output('datauristring');
doc.getDataUrl(cb);
} }
function getDesignJavascript() { function getDesignJavascript() {
@ -878,7 +880,9 @@
self.loadClient = function(client) { self.loadClient = function(client) {
ko.mapping.fromJS(client, model.invoice().client().mapping, model.invoice().client); ko.mapping.fromJS(client, model.invoice().client().mapping, model.invoice().client);
self.setDueDate(); @if (!$invoice)
self.setDueDate();
@endif
} }
self.showMoreFields = function() { self.showMoreFields = function() {
@ -886,6 +890,7 @@
} }
self.setDueDate = function() { self.setDueDate = function() {
@if ($entityType == ENTITY_INVOICE)
var paymentTerms = parseInt(self.invoice().client().payment_terms()); var paymentTerms = parseInt(self.invoice().client().payment_terms());
if (paymentTerms && !self.invoice().due_date()) if (paymentTerms && !self.invoice().due_date())
{ {
@ -895,6 +900,7 @@
// We're using the datepicker to handle the date formatting // We're using the datepicker to handle the date formatting
self.invoice().due_date($('#due_date').val()); self.invoice().due_date($('#due_date').val());
} }
@endif
} }
self.invoice_taxes = ko.observable({{ Auth::user()->account->invoice_taxes ? 'true' : 'false' }}); self.invoice_taxes = ko.observable({{ Auth::user()->account->invoice_taxes ? 'true' : 'false' }});
@ -1122,7 +1128,7 @@
self.mapping = { self.mapping = {
'client': { 'client': {
create: function(options) { create: function(options) {
return new ClientModel(options.data); return new ClientModel(options.data);
} }
}, },
'invoice_items': { 'invoice_items': {
@ -1148,7 +1154,6 @@
if (data) { if (data) {
ko.mapping.fromJS(data, self.mapping, self); ko.mapping.fromJS(data, self.mapping, self);
self.is_recurring(parseInt(data.is_recurring));
} else { } else {
self.addItem(); self.addItem();
} }
@ -1353,19 +1358,18 @@
self.mapping = { self.mapping = {
'contacts': { 'contacts': {
create: function(options) { create: function(options) {
var model = new ContactModel(options.data); var model = new ContactModel(options.data);
model.send_invoice(options.data.send_invoice == '1'); model.send_invoice(options.data.send_invoice == '1');
return model; return model;
} }
} }
} }
self.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() } self.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() }
self.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) } self.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) }
self.addContact = function() { self.addContact = function() {
var contact = new ContactModel(); var contact = new ContactModel();
contact.send_invoice(true); contact.send_invoice(true);
self.contacts.push(contact); self.contacts.push(contact);
return false; return false;
@ -1686,9 +1690,6 @@
@if ($invoice) @if ($invoice)
var invoice = {!! $invoice !!}; var invoice = {!! $invoice !!};
ko.mapping.fromJS(invoice, model.invoice().mapping, model.invoice); ko.mapping.fromJS(invoice, model.invoice().mapping, model.invoice);
if (model.invoice().is_recurring() === '0') {
model.invoice().is_recurring(false);
}
if (NINJA.parseFloat(model.invoice().partial())) { if (NINJA.parseFloat(model.invoice().partial())) {
model.invoice().is_partial(true); model.invoice().is_partial(true);
} }

View File

@ -20,7 +20,7 @@
</label> </label>
<div id="top_right_buttons" class="pull-right"> <div id="top_right_buttons" class="pull-right">
<input id="tableFilter" type="text" style="width:140px;margin-right:17px" class="form-control pull-left" placeholder="{{ trans('texts.filter') }}"/> <input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important" class="form-control pull-left" placeholder="{{ trans('texts.filter') }}"/>
{!! Button::primary(trans("texts.new_$entityType"))->asLinkTo("/{$entityType}s/create")->withAttributes(array('class' => 'pull-right'))->appendIcon(Icon::create('plus-sign')) !!} {!! Button::primary(trans("texts.new_$entityType"))->asLinkTo("/{$entityType}s/create")->withAttributes(array('class' => 'pull-right'))->appendIcon(Icon::create('plus-sign')) !!}
</div> </div>