diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-04-26 10:06:03 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-04-26 10:06:03 +0200 |
commit | f9b93c4bbb23b452551bd46ce86cc6e3602fd594 (patch) | |
tree | 3fd8f14afb8248fcd9a3092a3f8ee1755dc936c3 /web/clients | |
parent | 975c0b735be0808883116616d934ee257a24fb08 (diff) | |
download | faktura-f9b93c4bbb23b452551bd46ce86cc6e3602fd594.tar.gz faktura-f9b93c4bbb23b452551bd46ce86cc6e3602fd594.tar.bz2 faktura-f9b93c4bbb23b452551bd46ce86cc6e3602fd594.zip |
Begin web app frontend in PHP.main
While I'd like a command line client for retreiving information and
scripting stuff based on the db contents, a web app is convenient for
the less common stuff like adding and editing data.
The web app could also have been done in rust, however, I feel php is so
convenient for simple web stuff that I think it makes more sense this
way.
Diffstat (limited to 'web/clients')
-rw-r--r-- | web/clients/index.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/web/clients/index.php b/web/clients/index.php new file mode 100644 index 0000000..4725b17 --- /dev/null +++ b/web/clients/index.php @@ -0,0 +1,45 @@ +<?php +/** + * Clients index view + * + * @package volse.faktura.web + */ + +namespace Faktura; + +require_once __DIR__ . '/../faktura.php'; + +$result = API\call('GET', 'clients'); +$clients = json_decode($result); +?> +<!DOCTYPE html> +<head> + <title>faktura: clients</title> +</head> +<body> + <h1>Clients</h1> + <table> + <tr> + <th>#</th> + <th>Name</th> + <th>Contact</th> + <th>Email</th> + <th>Phone</th> + <th>VAT</th> + </tr> + <?php foreach ($clients as $client) { ?> + <tr> + <td><?php echo esc_html($client->id); ?></td> + <td> + <a href="/client/?id=<?php echo esc_attr($client->id); ?>"> + <?php echo esc_html($client->name); ?> + </a> + </td> + <td><?php echo esc_html($client->contact); ?></td> + <td><?php echo esc_html($client->email); ?></td> + <td><?php echo esc_html($client->phone); ?></td> + <td><?php echo esc_html($client->vat ? 'X' : ''); ?></td> + </tr> + <?php } ?> + </table> +</body> |