Add leads handlers, WhatsApp integration, and test files

This commit is contained in:
2026-05-02 17:40:38 +00:00
parent 8833e38b80
commit 57e6e5a6fd
24 changed files with 2305 additions and 115 deletions

View File

@@ -54,15 +54,21 @@ func ListClients(w http.ResponseWriter, r *http.Request) {
</div>
<table>
<thead>
<tr><th>Name</th><th>Phone</th><th>Email</th><th>Actions</th></tr>
<tr><th>Name</th><th>Phone</th><th>WhatsApp</th><th>Actions</th></tr>
</thead>
<tbody id="clientList">
`))
for _, c := range clients {
var whatsappCell string
if c.WhatsAppConnected == 1 && c.WhatsAppNumber != "" {
whatsappCell = c.WhatsAppNumber
} else {
whatsappCell = `<a href="/leads/connect?client_id=` + strconv.FormatInt(c.ClientID, 10) + `">Connect</a>`
}
w.Write([]byte(`<tr>
<td>` + c.Name + `</td>
<td>` + c.Phone + `</td>
<td>` + c.Email + `</td>
<td>` + whatsappCell + `</td>
<td>
<a href="/clients/` + strconv.FormatInt(c.ClientID, 10) + `">View</a>
<button type="button" onclick="document.getElementById('editForm` + strconv.FormatInt(c.ClientID, 10) + `').style.display='block'">Edit</button>