mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Remove blank contacts
This commit is contained in:
parent
d8076f08fc
commit
23e9dd6a97
@ -35,6 +35,16 @@ function ViewModel(data) {
|
|||||||
@endif
|
@endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.clearBlankContacts = function() {
|
||||||
|
var client = self.invoice().client();
|
||||||
|
var contacts = client.contacts();
|
||||||
|
$(contacts).each(function(index, contact) {
|
||||||
|
if (index > 0 && contact.isBlank()) {
|
||||||
|
client.contacts.remove(contact);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.invoice_taxes = ko.observable({{ Auth::user()->account->invoice_taxes ? 'true' : 'false' }});
|
self.invoice_taxes = ko.observable({{ Auth::user()->account->invoice_taxes ? 'true' : 'false' }});
|
||||||
self.invoice_item_taxes = ko.observable({{ Auth::user()->account->invoice_item_taxes ? 'true' : 'false' }});
|
self.invoice_item_taxes = ko.observable({{ Auth::user()->account->invoice_item_taxes ? 'true' : 'false' }});
|
||||||
self.show_item_taxes = ko.observable({{ Auth::user()->account->show_item_taxes ? 'true' : 'false' }});
|
self.show_item_taxes = ko.observable({{ Auth::user()->account->show_item_taxes ? 'true' : 'false' }});
|
||||||
@ -115,6 +125,8 @@ function ViewModel(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.setDueDate();
|
model.setDueDate();
|
||||||
|
model.clearBlankContacts();
|
||||||
|
|
||||||
setComboboxValue($('.client_select'), -1, name);
|
setComboboxValue($('.client_select'), -1, name);
|
||||||
|
|
||||||
var client = $.parseJSON(ko.toJSON(self.invoice().client()));
|
var client = $.parseJSON(ko.toJSON(self.invoice().client()));
|
||||||
@ -638,6 +650,10 @@ function ContactModel(data) {
|
|||||||
ko.mapping.fromJS(data, {}, this);
|
ko.mapping.fromJS(data, {}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.isBlank = ko.computed(function() {
|
||||||
|
return ! self.first_name() && ! self.last_name() && ! self.email() && ! self.phone();
|
||||||
|
});
|
||||||
|
|
||||||
self.displayName = ko.computed(function() {
|
self.displayName = ko.computed(function() {
|
||||||
var str = '';
|
var str = '';
|
||||||
if (self.first_name() || self.last_name()) {
|
if (self.first_name() || self.last_name()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user