Last active
December 17, 2015 03:49
-
-
Save ecoologic/5545962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form#new_invoice:not(".invoice-project-select")').submit -> | |
$form = $('form#new_invoice') | |
$tasks = $form.find('.task-checkbox') | |
$flatFees = $form.find('[data-flatfee]') | |
confirmCheckAll = 'You have not selected a single item. Please take note that all items that are unbillable are unchecked by default.\n\nDo you want to check them all and create the invoice?' | |
confirmInvoiceWithFlatFees = "There are either tasks or projects that have a fixed fee set. If you would like to instead invoice these by hours logged, please set them to 'hourly' before creating the invoice.\n\nDo you still wish to create the invoice now?" | |
# $tasks.find(':not(:checked)').click() # this keeps the graphic in sync | |
$tasks.attr('checked', true) if $tasks.find(':checked').length == 0 && confirm(confirmCheckAll) | |
invoice = $tasks.find(':checked').length > 0 # this is ALWAYS false, why? | |
invoice = confirm(confirmInvoiceWithFlatFees) if invoice && $flatFees.find('.task, .project').length > 0 | |
invoice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment