mpdroog / invoiced

Simple hour registration + invoice generator.
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

Saving Invoice generates 400 request failed error #18

Closed c-nv-s closed 3 years ago

c-nv-s commented 3 years ago

error didn't seem to be very descriptive to me, however it's copied below.

mpdroog-invoiced-saveinvoiceissue-00

{"error":"Error","url":"http://localhost:9999/static/#name/2021/invoices/add","stack":"Request failed with status code 400"}
mpdroog commented 3 years ago

1- Added error handling for Axios (AJAX handling), meaning it now shows the AJAX-error responseText 2- I'm guessing the 400 means one or more fields are not properly set: adjusted invoice form to show asterisk for required fields and I've changed the default quantity format (as it has to contain a .00)

Could you check again with the latest pull and npm run dev?

c-nv-s commented 3 years ago

You're right the more verbose error was showing the "Quantity" wasn't the right format.

 Lines[0].Quantity: qty did not match string, Lines[1].Quantity: qty did not match string,

...Just a suggestion, I think the banking details section should not be amendable from this screen seeing as the values are pulled from the user's settings. If a user amends the any of the numbers in that section and tries to save, they receive an error that the field does not match anyway. Maybe just make them grey like the "Line Total" fields with a note along the lines of "edit these from your settings file".

With the field entries made in the correct format the app does allow me to save, so this issue is resolved.

I will raise a separate issue for the repeated errors the user receives if you completely delete the contents of a mandatory field

mpdroog commented 3 years ago

I think the banking details section should not be amendable from this screen

Agree, put it behind a LockedInput and showing to please adjust it in the settings-file to discourage editing it.

Why still allow editing? Control. Real-world example: I received a new VAT-number some time ago, forgot to update the config and charged customer with wrong VAT-number on the invoice, it was quite useful to 'Reset' the invoice, change the VAT-manually once and then finalize it again and send it to the customer.