Commit Graph

417 Commits

Author SHA1 Message Date
jordi fita mas fa57c4b191 Refactor inline tag edit form into its own file
I was repeating myself a lot for this use case, because each one needed
a different URL and SQL query, however they were kind of structurally
similar and could be refactored into common functions.
2024-08-15 04:18:18 +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 9ab08deaa1 Include the taxes when updating an expense to paid or partial 2024-08-15 03:51:30 +02:00
jordi fita mas 7f21a2131e Add the where company_id filter to accounts and payments queries
I actually did not forget them, and i did not add them on purpose,
mistakenly believing that PostgreSQL’s row-level policies would project
only rows from the current company.  That is actually how Camper works,
but that’s because we use the request’s domain name to select the
company; here we use the path, and the row-level policy would return
rows from all companies the user belongs to.
2024-08-15 02:59:46 +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 71a0a82a3f Change partial expenses to pending when reverting available status
Otherwise, i could have an expense that i have set to partial during
development that prevents sqitch to rebase because it is still in use.
2024-08-13 02:31:15 +02:00
jordi fita mas c95f172499 Add attachments to payments 2024-08-12 00:08:18 +02:00
jordi fita mas 58cef8c00b Refactor common code to download invoice and expenses attachments 2024-08-12 00:07:30 +02:00
jordi fita mas 4deb698265 No need for extension_pgcrypto for functions with UUID parameters 2024-08-11 23:30:57 +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
jordi fita mas f546632a89 Remove a stray Println from expenseForm.MustFillFromDatabase 2024-08-07 00:47:34 +02:00
jordi fita mas c3fa23727f Include customer’s VAT number to the expense list in ODS too
It was requested by Clara.
2024-07-20 22:52:23 +02:00
jordi fita mas 505fa0f154 Include customer’s VAT number to the invoice list in ODS
It was requested by Clara.
2024-07-20 22:52:23 +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
jordi fita mas 405c833490 Add Guix file 2024-02-06 17:43:05 +01:00
jordi fita mas 65413637ac Add a column for each tax type when exporting invoices and expenses
In the HTML tables i only compute the aggregated amount by tax class
(e.g., IVA, IRPF), but here we need the actual tax (e.g., IVA 4 %)
because this spreadsheet is intended for accountants.

I can easily extract the amounts from invoice_tax_amount and
expense_tax_amount, but i also need to add the columns to the
spreadsheet, and always with the same order—does not matter much which,
only the same—, that’s why i had to sort the tax IDs when exporting, as
Go does not guarantee an order for maps.

Closes #92
2024-01-26 02:30:11 +01:00
oriol carbonell pujolàs 6fcc19bebf Update styles and home page 2024-01-21 01:58:55 +01:00
jordi fita mas 5b0ca28b97 Fix the revert of contact_phone and contact_tax_details
This is mostly to be able to sqitch rebase and restart with the demo
data during development, as it is very unlikely that i will need to
revert those at this point.
2024-01-20 21:34:09 +01:00
jordi fita mas 662ba59be3 Add contacts, invoices, and expenses to the demo
This is mostly to have a better looking dashboard, especially with the
year and last year filters.
2024-01-20 21:33:16 +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 5f7b798eb4 Prefill login form when using the demo database
This is to help up “sell” the service: people can look around the demo
to see whether it fits them.  Of course, everyone should have the same
username in the demo.

We talked about having the username and password displayed above the
form in the template, but i think it makes more sense to give users as
little work as necessary.  Plus, that means i do not have to write them
down while developing.

Whether the database is demo or not is not something that directly
depends on the environment, but rather on which database we are
connected to, thus an environment variable would not make much sense—it
has to be something of the database.

PostgreSQL has no PRAGMA application_id or PRAGMA user_version as with
SQLite to include application-specific values to the database.  The
equivalent would be customized options[0], intended for modules
configuration, but that would require me to execute an ALTER DATABASE
in demo.sql with an specific datbase name, or force the use of psql to
run script the script, because then i can use the :DBNAME placeholder.

I guess that the most “standard” way is to just create a function that
returns a know value if the database is demo.  Sqitch does not add that
function, therefore it is unlikely to be there by change unless it is
the demo database.

https://www.postgresql.org/docs/15/runtime-config-custom.html
2024-01-20 20:23:26 +01:00
jordi fita mas 2bd7b2e952 Fix revert for contact_web
If there were contacts added with add_contact passing an empty string
to `web` parameter, contact_web would not have such row, and during the
revert the `web` parameter of contact would end up being NULL.
2024-01-20 19:47:26 +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 61fc8ee255 Debian: copy de modified build.go to the src folder in _build
I _believe_ this is the folder that Debian actually compiles, not the
top level.
2024-01-19 23:54:32 +01:00
jordi fita mas b28f29eb24 Fix DEB_UPSTREAM_VERSION to DEB_VERSION_UPSTREAM 2024-01-19 23:19:29 +01:00
jordi fita mas 4d2af368d2 Include pkg-info.mk in Debian rules for DEB_UPSTREAM_VERSION 2024-01-19 23:12:01 +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
jordi fita mas 22ee6343e2 Use errors.Is to compare ErrServerClosed in main 2024-01-19 19:44:11 +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