summaryrefslogtreecommitdiffstats
path: root/web/client/index.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-04-26 10:06:03 +0200
committerHarald Eilertsen <haraldei@anduin.net>2024-04-26 10:06:03 +0200
commitf9b93c4bbb23b452551bd46ce86cc6e3602fd594 (patch)
tree3fd8f14afb8248fcd9a3092a3f8ee1755dc936c3 /web/client/index.php
parent975c0b735be0808883116616d934ee257a24fb08 (diff)
downloadfaktura-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/client/index.php')
-rw-r--r--web/client/index.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/web/client/index.php b/web/client/index.php
new file mode 100644
index 0000000..c89bde1
--- /dev/null
+++ b/web/client/index.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * View to display information about a single client.
+ *
+ * @package volse.faktura.web
+ */
+
+namespace Faktura;
+
+require_once __DIR__ . '/../faktura.php';
+
+$result = API\call('GET', 'clients?id=eq.' . intval($_GET['id']));
+$client = json_decode($result)[0];
+?>
+<!DOCTYPE html>
+<head>
+ <title>faktura: client</title>
+</head>
+<body>
+<h1><?php echo esc_html($client->name); ?></h1>
+<table>
+ <tr class="field">
+ <th class="row-label">Contact:</th>
+ <td class="value"><?php echo esc_html($client->contact); ?></td>
+ </tr>
+ <tr class="field">
+ <th class="row-label">Email:</th>
+ <td class="value"><?php echo esc_html($client->email); ?></td>
+ </tr>
+ <tr class="field">
+ <th class="row-label">phone:</td>
+ <td class="value"><?php echo esc_html($client->phone); ?></td>
+ </tr>
+ <tr class="field">
+ <th class="row-label">Address:</th>
+ <td class="value"><?php echo esc_html($client->address); ?></td>
+ </tr>
+ <tr class="field">
+ <th class="row-label">VAT:</th>
+ <td class="value"><?php echo $client->vat ? 'Yes' : 'No'; ?></td>
+ </tr>
+</body>
+