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 Event;
use URL;
use Datatable;
use App\Models\Invoice;
use App\Models\Invitation;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,15 +1,18 @@
function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account;
eval(javascript);
/*
var fonts = {
Roboto: {
normal: 'Roboto-Regular.ttf',
bold: 'Roboto-Medium.ttf',
italics: 'Roboto-Italic.ttf',
bolditalics: 'Roboto-Italic.ttf'
}
},
};
*/
doc = pdfMake.createPdf(dd);
doc.save = function(fileName) {
this.download(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
* [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.
* [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
* [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

View File

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

View File

@ -113,7 +113,7 @@
<form class="navbar-form navbar-right" role="search">
<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') }}">
</div>
</form>

View File

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

View File

@ -20,7 +20,7 @@
</label>
<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')) !!}
</div>

View File

@ -24,7 +24,7 @@
<link rel="canonical" href="{{ NINJA_APP_URL }}/{{ Request::path() }}" />
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script src="{{ asset('js/vfs_fonts.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script src="{{ asset('js/vfs_fonts.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script type="text/javascript">
var NINJA = NINJA || {};