modificando el patron del sistema, orientado mas al usuario
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { api } from "../lib/api.js";
|
||||
import { emit, on } from "../lib/bus.js";
|
||||
import { modal } from "../lib/modal.js";
|
||||
|
||||
class ConversationList extends HTMLElement {
|
||||
constructor() {
|
||||
@@ -90,7 +91,8 @@ class ConversationList extends HTMLElement {
|
||||
this.shadowRoot.getElementById("uaDeleteConv").onclick = async () => {
|
||||
if (!this.selectedUser) return;
|
||||
const chat_id = this.selectedUser.chat_id;
|
||||
if (!confirm(`¿Borrar conversación completa de ${chat_id}?`)) return;
|
||||
const confirmed = await modal.confirm(`¿Borrar conversación completa de ${chat_id}?`);
|
||||
if (!confirmed) return;
|
||||
await api.deleteConversation(chat_id);
|
||||
this.selectedUser = null;
|
||||
await this.refreshUsers();
|
||||
@@ -98,7 +100,8 @@ class ConversationList extends HTMLElement {
|
||||
this.shadowRoot.getElementById("uaDeleteUser").onclick = async () => {
|
||||
if (!this.selectedUser) return;
|
||||
const chat_id = this.selectedUser.chat_id;
|
||||
if (!confirm(`¿Borrar usuario ${chat_id}, sus conversaciones y el customer en Woo?`)) return;
|
||||
const confirmed = await modal.confirm(`¿Borrar usuario ${chat_id}, sus conversaciones y el customer en Woo?`);
|
||||
if (!confirmed) return;
|
||||
await api.deleteUser(chat_id, { deleteWoo: true });
|
||||
this.selectedUser = null;
|
||||
await this.refreshUsers();
|
||||
@@ -229,7 +232,8 @@ class ConversationList extends HTMLElement {
|
||||
el.onclick = async (e) => {
|
||||
if (e?.target?.dataset?.del) {
|
||||
e.stopPropagation();
|
||||
if (!confirm(`¿Borrar conversación completa de ${c.chat_id}?`)) return;
|
||||
const confirmed = await modal.confirm(`¿Borrar conversación completa de ${c.chat_id}?`);
|
||||
if (!confirmed) return;
|
||||
await api.deleteConversation(c.chat_id);
|
||||
if (this.selected === c.chat_id) this.selected = null;
|
||||
await this.refresh();
|
||||
|
||||
Reference in New Issue
Block a user