From d4e9fed71940d1432c02c13570b97f7ddbd539e7 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Thu, 2 Apr 2026 23:10:48 +0200 Subject: [PATCH] fix(hosting): fix site creation form + add delete to sites list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Site creation form: - Replace old "Create from Prospect" button (called removed endpoint) with inline prospect_id + merchant_id fields - Schema requires at least one — form validates before submit - Clean payload (strip nulls/empty strings before POST) Sites list: - Add trash icon delete button with confirmation dialog - Calls DELETE /admin/hosting/sites/{id} (existing endpoint) - Reloads list after successful deletion Co-Authored-By: Claude Opus 4.6 (1M context) --- .../templates/hosting/admin/site-new.html | 66 +++++++++++-------- .../templates/hosting/admin/sites.html | 15 +++++ 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/app/modules/hosting/templates/hosting/admin/site-new.html b/app/modules/hosting/templates/hosting/admin/site-new.html index 2e2446dd..affc62c9 100644 --- a/app/modules/hosting/templates/hosting/admin/site-new.html +++ b/app/modules/hosting/templates/hosting/admin/site-new.html @@ -44,18 +44,25 @@ class="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray dark:bg-gray-700 dark:text-gray-300"> - +
- -
- - +
+
+ + +
+
+ + +
+

At least one is required. Prospect ID auto-creates a merchant from prospect data.

@@ -66,7 +73,7 @@ Cancel @@ -144,6 +149,16 @@ function hostingSitesList() { this.loading = false; } }, + async deleteSite(site) { + if (!confirm('Delete "' + site.business_name + '"? This will also delete the associated store.')) return; + try { + await apiClient.delete('/admin/hosting/sites/' + site.id); + Utils.showToast('Site deleted', 'success'); + await this.loadSites(); + } catch (e) { + Utils.showToast('Failed: ' + e.message, 'error'); + } + }, get startIndex() { if (this.pagination.total === 0) return 0; return (this.pagination.page - 1) * this.pagination.per_page + 1;