mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 00:11:35 +02:00
Remove blank contacts
This commit is contained in:
parent
d8076f08fc
commit
23e9dd6a97
@ -35,6 +35,16 @@ function ViewModel(data) {
|
||||
@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_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' }});
|
||||
@ -115,6 +125,8 @@ function ViewModel(data) {
|
||||
}
|
||||
|
||||
model.setDueDate();
|
||||
model.clearBlankContacts();
|
||||
|
||||
setComboboxValue($('.client_select'), -1, name);
|
||||
|
||||
var client = $.parseJSON(ko.toJSON(self.invoice().client()));
|
||||
@ -638,6 +650,10 @@ function ContactModel(data) {
|
||||
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() {
|
||||
var str = '';
|
||||
if (self.first_name() || self.last_name()) {
|
||||
|
Loading…
Reference in New Issue
Block a user