feat(prospecting): add delete button to prospects list
- Trash icon button in Actions column with confirmation dialog
- Calls DELETE /admin/prospecting/prospects/{id} (existing endpoint)
- Reloads list after successful deletion
- Toast notification on success/failure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,18 @@ function prospectsList() {
|
|||||||
if (this.pagination.page > 1) { this.pagination.page--; this.loadProspects(); }
|
if (this.pagination.page > 1) { this.pagination.page--; this.loadProspects(); }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async deleteProspect(prospect) {
|
||||||
|
var name = prospect.business_name || prospect.domain_name || 'this prospect';
|
||||||
|
if (!confirm('Delete "' + name + '"? This cannot be undone.')) return;
|
||||||
|
try {
|
||||||
|
await apiClient.delete('/admin/prospecting/prospects/' + prospect.id);
|
||||||
|
Utils.showToast('Prospect deleted', 'success');
|
||||||
|
await this.loadProspects();
|
||||||
|
} catch (err) {
|
||||||
|
Utils.showToast('Failed: ' + err.message, 'error');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
statusBadgeClass(status) {
|
statusBadgeClass(status) {
|
||||||
const classes = {
|
const classes = {
|
||||||
pending: 'text-yellow-700 bg-yellow-100 dark:text-yellow-100 dark:bg-yellow-700',
|
pending: 'text-yellow-700 bg-yellow-100 dark:text-yellow-100 dark:bg-yellow-700',
|
||||||
|
|||||||
@@ -132,6 +132,11 @@
|
|||||||
title="View details">
|
title="View details">
|
||||||
<span x-html="$icon('eye', 'w-5 h-5')"></span>
|
<span x-html="$icon('eye', 'w-5 h-5')"></span>
|
||||||
</a>
|
</a>
|
||||||
|
<button type="button" @click="deleteProspect(p)"
|
||||||
|
class="flex items-center justify-center p-2 text-red-600 rounded-lg hover:bg-red-50 dark:text-red-400 dark:hover:bg-gray-700 focus:outline-none transition-colors"
|
||||||
|
title="Delete">
|
||||||
|
<span x-html="$icon('trash', 'w-5 h-5')"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user