Commit Graph

238 Commits

Author SHA1 Message Date
jordi fita mas e8a44e480e Add field to update default payment method
It is only shown if there is more than one payment method, otherwise
it seems useless as there are nothing to change.

This closes #72.
2024-08-28 11:10:03 +02:00
jordi fita mas 0b74c7a91c Instruct htmx that HTTP 422 is not a “fatal error”
I use HTTP 422 to signal that a form was submitted with bad data,
which i believe is the correct status code: “indicates that the server
understands the content type of the request content […], and the syntax
of the request content is correct, but it was unable to process the
contained instructions.”[0]

htmx, however, treats all 4xx status codes as error and, by default,
does not swap the target with the response’s content.  Until i found out
that i could change that behaviour, i worked around this limitation by
returning HTTP 200 for htmx requests, but it is a waste of time given
that htmx _can_ accept HTTP 422 as a non-error.

[0]: https://www.rfc-editor.org/rfc/rfc9110#name-422-unprocessable-content
2024-08-27 11:07:39 +02:00
jordi fita mas 790417e12c Swap payments/collections and downloads in invoice/expenses index
It makes more sense to have the payment link readily available, given
that downloads for expenses are rather uncommon, and, when we implement
electronic invoicing, the invoice PDF will be less useful too.
2024-08-26 14:47:22 +02:00
jordi fita mas b815a18967 Remove status parameter from edit_expense and forms
For the same reasons as with expenses[0], users are no longer expected
to manually set invoice status, and is now linked to their collections.

In this case, however, we had to remove the ‘sent’ and ‘unpaid’ status
options, because these _should_ only be set manually, as there is no
way for the application to know when to set them.  Thus, there could
be inconsistencies, like invoices set to ‘unpaid’ when they actually
have collections, or invoices that were ‘sent’, then transitioned to
‘partial’/‘paid’ due to a collection, but then reset to ‘created’ if the
collection was deleted.

[0]: ac0143b2b0
2024-08-26 10:42:38 +02:00
jordi fita mas 7b1220c9f6 Add top margin to form footers 2024-08-21 11:38:52 +02:00
jordi fita mas e3d1e1fd1d Show payments in negative in the index 2024-08-21 11:34:26 +02:00
jordi fita mas 93a95d77d0 Fix the URL to invoices from payment index 2024-08-21 11:23:55 +02:00
jordi fita mas d4ef6c3254 Add a new collection “subsection” for invoices
This is mostly the same subsection as payments is for expense, added in
4f646e35d.  In this case i call it “collections”, but it is actually
the same payments section.
2024-08-21 11:22:53 +02:00
jordi fita mas 7f31b10cce Add payment collection
This is the same as a payment, but the user is the payee instead of the
payer.

I used a different relation than payment because i do not know any other
way to encode the constraint that only invoices can have a collection,
while expenses have only payments.

Besides the name and the fact that they are related to invoices, a
collection is pretty much the same as a payment.
2024-08-21 03:36:12 +02:00
jordi fita mas 4f646e35d6 Add a new payments “subsection” for expenses
With Oriol we agreed that to add new payments to expenses we should
direct users to a separate payments section, much like the general
payments but centered around the payments of the given expense.

In fact, the only thing i had to do is extract the expense from the
URL, and then adjust the base URI to keep things always within the
correct section; the rest of the code is shared with the general
section.
2024-08-17 05:31:01 +02:00
jordi fita mas 268ab9989a Link from the invoice number in expense index to its edit form
If there is no invoice number, then they can use the edit item from the
menu, but most expenses do have an invoice, thus this is easier for the
most usual case.
2024-08-16 01:44:20 +02:00
jordi fita mas dda32db683 Show the invoice number in expense’s title, if any, or slug otherwise 2024-08-16 01:40:20 +02:00
jordi fita mas dca8b3a719 Add the document (expense) column to payment index page 2024-08-15 03:59:30 +02:00
jordi fita mas f95936c523 Split the tax details “mega dialog” into separate pages
I needed to place the payment accounts section somewhere, and the most
logical place seemed to be that dialog, where users can set up company
parameters.

However, that dialog was already saturated with related, but ultimately
independent forms, and adding the account section would make things
even worse, specially given that we need to be able to edit those
accounts in a separate page.

We agreed to separate that dialog into tabs, which means separate pages.
When i had everything in a separated page, then i did not know how to
actually share the code for the tabs, and decided that, for now, these
“tabs” would be items from the profile menu.  Same function, different
presentation.
2024-08-14 04:08:13 +02:00
jordi fita mas e626c7b4bd Style the payment status column in index 2024-08-13 02:36:07 +02:00
jordi fita mas ac0143b2b0 Remove the status parameter from add_expense and edit_expense, and forms
Users are no longer expected to manually set the status of an expense
and, instead, have to add payments to such expense to mark it as partial
or paid.

That means that the PL/pgSQL functions must not accept a status
parameter, the edit and new forms should no longer have a field for
the status, and that the expense list should no longer have the “quick
edit” for their status.  That’s why it no longer should have a pointer
cursor, unlike invoice or quote status.
2024-08-13 02:34:21 +02:00
jordi fita mas c95f172499 Add attachments to payments 2024-08-12 00:08:18 +02:00
jordi fita mas 778f9c1555 Allow removal of payments
I am using an htmx-infused button to remove the payment, but that
button can not have the CSRF token as value, thus i have to send it in a
header.

The removal of payments warrants a functions, instead of just DELETE
(and CASCADE) as i do for payment methods, because i have to adjust the
status of expenses too.  Since i already have functions for everything,
it is not worth using triggers just for that.
2024-08-11 03:22:37 +02:00
jordi fita mas ad5bc271b6 Add the payments section
This actually should be the “payments and receivables” section, however
this is quite a mouthful; a “receivable” is a payment made **to** you,
therefore “payments” is ok.

In fact, there is still no receivables in there, as they should be in
a separate relation, to constraint them to invoices instead of expenses.
It will be done in a separate commit.

Since this section will be, in a sense, sort of simplified accounting,
i needed to introduce the “payment account” concept.  There is no way,
yet, for users to add them, because i have to revamp the “tax details”
section, but this commit started to grow too big already.

The same reasoning for the attachment payment slips as PDF to payment:
something i have to add, but not yet in this commit.
2024-08-10 04:34:07 +02:00
oriol carbonell pujolàs 64be350677 Add styles for small screens 2024-04-08 09:19:52 +02:00
oriol carbonell pujolàs 4363073682 Add down-arrow icon next to download button 2024-04-08 09:18:49 +02:00
oriol carbonell pujolàs 3e6f44f778 Add Tàndem’s logo to home footer 2024-04-08 09:17:57 +02:00
jordi fita mas faf7ee8ed5 Set `white-space: pre-wrap` to first td of quotes and invoices
It is common to want to enumerate in a description, for instance when
adding specifications for a hosting, and that enumeration should be
formatted as the user wrote, otherwise it becomes useless.

Closes #94.
2024-03-13 02:56:37 +01:00
jordi fita mas a689e2f734 Hide footer when printing invoices and quotes
Closes #96
2024-03-13 02:53:02 +01:00
oriol carbonell pujolàs 6fcc19bebf Update styles and home page 2024-01-21 01:58:55 +01:00
jordi fita mas 24a4bf2583 Use kbd and samp for menu options in cookies privacy 2024-01-20 20:32:55 +01:00
jordi fita mas 2ec88eddae Add type comment to login.gohtml 2024-01-20 20:23:47 +01:00
jordi fita mas 843379a908 Remove the extra logo reference from login.gohtml
It is not in the common web.gohtml template file.
2024-01-20 19:06:59 +01:00
jordi fita mas b4b049aab9 Include numerusVersion to CSS and JavaScript’s URIs 2024-01-19 23:09:25 +01:00
jordi fita mas e0bdb89472 Add legal disclaimer and privacy and cookies policies’ texts
The legal stuff. Required by Spanish law when setting up a site intended
for pecuniary gain, directly or indirectly.

Now we have more pages to the “public web”, and moved the header and
footer from home to the common layout.  I also took the opportunity to
change the element from <div> to the appropriate element based on their
use (i.e., <header> and <footer>).

I removed the <div> around the logo because i did not see any use for
it.  I may be from a previous design iteration, but it had no style
applied nor any usage at all in JavaScript.
2024-01-19 23:05:01 +01:00
jordi fita mas f15294c042 Use <small> to mark the application’s version up
I mistakenly thought that <small> was de inverse of the deprecated <big>
element, but apparently it is for small-print text and such, thus suited
for this case.
2024-01-19 22:59:06 +01:00
jordi fita mas 0937cfcf33 Remove redundant units of measure from numerus.css 2024-01-19 20:03:37 +01:00
jordi fita mas 18b38f593c Add the application’s version on the footer
This is mostly to reassure people that we are running the same version
as published on numerus.cat.  Or at least, try.

Go 1.18 adds the info from git if the package is build from a git
repository, but this is not the case in OBS, so i instead relay on a
constant for the version number.  This constant is “updated” by Debian’s
rules, mostly due to the discussion in [0].

[0]: https://github.com/golang/go/issues/22706
2024-01-19 20:03:04 +01:00
oriol carbonell pujolàs 7e377f550c Add more content to home 2024-01-19 10:27:15 +01:00
oriol carbonell pujolàs d3afde9e21 Fix typos in user type description in home 2024-01-19 10:25:18 +01:00
oriol carbonell pujolàs a5fdeb9ab4 Update style and home page 2024-01-18 22:25:30 +01:00
oriol carbonell pujolàs 45a45d7cc9 Update styles 2024-01-18 21:19:20 +01:00
jordi fita mas b62f86950e Fix the link to AGPL and add a couple of NBSP to home 2024-01-18 21:15:52 +01:00
jordi fita mas 2d0572e1d6 Replace “open source” with “free software” in home 2024-01-18 21:12:58 +01:00
jordi fita mas 6de4135fa6 Reformat numerus.css 2024-01-18 21:10:54 +01:00
oriol carbonell pujolàs f3fdc0d743 Update home page with proper marketing text 2024-01-18 21:08:49 +01:00
jordi fita mas e34ef4f458 Remove the “sales” box from the dashboard
There are no sales yet in Numerus, and having that summary there
confuses people.

He left the space there, without any text or background color, to
maintain the position of the rest.

Closes #87.
2023-11-13 14:46:57 +01:00
jordi fita mas 31a655ae7f Add aria-current attribute to links in the top menu
This is mainly to be able to stylize them using CSS; the current style
i set i just a placeholder to check that it works as expected.

Most of these links needs to check for the URI’s prefix, because they
are links to a whole section, but the first link must check for the
exact match, otherwise it would match every other URI, as all of them
start with /company/{uuid}.

The server does not return the markup for the top navigation when usin
HTMx, though, hence i have to change the current class using JavaScript.

I am not sure if the correct value for aria-current is “page” when the
link is not for the actual page the user is currently in, like when is
in the new quote page, but it seems to be the most appropriate value
from the enumeration given in the specifications, except, perhaps, for
the “location” value, but i was unable to find any example of that value
anywhere.

Part of #89.
2023-11-13 14:42:27 +01:00
oriol carbonell pujolàs c3e1597972 Add rollover to top menu items 2023-11-13 13:11:33 +01:00
jordi fita mas e322ddd168 Add custom elements polyfill
I use customized built-in components, extended from any HTML elements
(e.g., HTMLDivElement), for product search, multiselect, and tags input
fields.  The idea is that people that without JavaScript could still use
the regular, non-customized, inputs.

It turns out, this does not work so well: the CSS assumes that
JavaScript is enabled, and web components supported by the browser. If
one of these fails, then the controls are unusable—the multiselect is
too short, and the tags field accepts invalid characters that the
backend does not validate until it fails with a database error.

We discovered this because Apple does not implement customized built-in
components[0], hence it does not use my JavaScript code and forms,
the expenses forms in particular, are almost useless.

The way to fix this is to replace the regular inputs with autonomous
web components, extended from HTMLElement, using JavaScript, because
it would only do so with JavaScript enabled, and the CSS style would
only apply to these components, not the regular input fields.

However, currently i do not have time to do the proper fix, and have
to use a polyfill for Safari to support customized built-in components.
Shame.

[0]: https://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0801.html
2023-11-11 03:32:03 +01:00
jordi fita mas 998159d1d7 Add option to switch to another company
This is for users that belong to more than one company.  It is just a
page with links to the home of each company that the user belongs to.

Had to add a second company to the demo data to test it properly, even
though i already have unit tests for multicompany, but, you know….
2023-11-06 13:52:34 +01:00
jordi fita mas 2501b7d226 Set enctype to multipart/form-data for invoice status form
Since this form is “shared” with the “full” form, that now includes
files, it has to be multipart/form-data too.
2023-10-02 18:48:28 +02:00
jordi fita mas 0fd0cf5a38 Add the sum of the base and taxes to expenses’ index
Expands on #79
2023-10-02 16:36:42 +02:00
jordi fita mas 831becf6fd Add the base and tax columns to expenses’ index
Closes #80
2023-10-02 12:16:50 +02:00
jordi fita mas 0c4ef97dff Add option to export the list of quotes, invoices, and expenses to ODS
This was requested by a potential user, as they want to be able to do
whatever they want to do to these lists with a spreadsheet.

In fact, they requested to be able to export to CSV, but, as always,
using CSV is a minefield because of Microsoft: since their Excel product
is fucking unable to write and read CSV from different locales, even if
using the same exact Excel product, i can not also create a CSV file
that is guaranteed to work on all locales.  If i used the non-standard
sep=; thing to tell Excel that it is a fucking stupid application, then
proper applications would show that line as a row, which is the correct
albeit undesirable behaviour.

The solution is to use a spreadsheet file format that does not have this
issue.  As far as I know, by default Excel is able to read XLSX and ODS
files, but i refuse to use the artificially complex, not the actually
used in Excel, and lobbied standard that Microsoft somehow convinced ISO
to publish, as i am using a different format because of the mess they
made, and i do not want to bend over in front of them, so ODS it is.

ODS is neither an elegant or good format by any means, but at least i
can write them using simple strings, because there is no ODS library
in Debian and i am not going to write yet another DEB package for an
overengineered package to write a simple table—all i want is to say
“here are these n columns, and these m columns; have a good day!”.

Part of #51.
2023-07-18 13:29:36 +02:00