add chatwoot auto_create and profile photo

This commit is contained in:
Gabriel Pastori 2023-12-11 18:32:46 -03:00
parent 35850135d7
commit 3dea085b60
6 changed files with 41 additions and 11 deletions

View File

@ -1,7 +1,7 @@
{
"name": "evolution-manager",
"description": "Evolution Manager is an open-source interface for managing the Evolution API, simplifying the creation and administration of API instances with advanced features and diverse integrations.",
"version": "0.4.0",
"version": "0.4.1",
"main": "dist",
"engines": {
"node": ">=16.0.0"

View File

@ -91,7 +91,7 @@ export default {
components: [
"ConnectionAlert",
"BasicInfo",
// "ProfilePhoto",
"ProfilePhoto",
"Privacy",
],
},

View File

@ -26,8 +26,7 @@
{{ error }}
</v-alert>
<div class="d-flex gap-x-4">
{{ instance.instance.profilePictureUrl }}
<div class="d-flex flex-wrap justify-center gap-x-4">
<v-avatar size="150">
<v-img
v-if="instance.instance.profilePictureUrl"
@ -46,13 +45,18 @@
width="150"
@click="selectPhoto"
>
<v-icon size="50">mdi-upload</v-icon>
<v-progress-circular
indeterminate
v-if="loading == 'uploading'"
size="50"
/>
<v-icon size="50" v-else>mdi-upload</v-icon>
Selecionar foto
</v-card>
<v-card
v-if="instance.instance.profilePictureUrl"
variant="outlined"
class="h-full d-flex justify-center align-center rounded-pill"
class="h-full d-flex flex-column justify-center align-center rounded-pill"
width="150"
@click="removePicture"
:disabled="loading"
@ -121,7 +125,7 @@ export default {
this.instance.instance.instanceName
);
await this.AppStore.reconnect();
this.AppStore.setPhoto(this.instance.instance.instanceName, null);
} catch (e) {
this.error = e.message?.message || e.message || e;
} finally {
@ -135,18 +139,19 @@ export default {
if (!this.isOpen) return;
const file = event.target.files[0];
const base64 = await this.fileToBase64(file);
await instanceController.profile.updatePicture(
this.instance.instance.instanceName,
base64
base64.split(",")[1]
);
await this.AppStore.reconnect();
this.AppStore.setPhoto(this.instance.instance.instanceName, base64);
} catch (e) {
this.error = e.message?.message || e.message || e;
} finally {
this.loading = false;
event.target.value = "";
}
},
fileToBase64(file) {

View File

@ -133,6 +133,23 @@
</template>
</v-checkbox>
</div>
<div v-if="chatwootData.auto_create !== undefined">
<v-checkbox
v-model="chatwootData.auto_create"
label="Conversa pendente"
:disabled="loading"
hide-details
class="mb-3"
density="compact"
>
<template v-slot:label>
<span>Criar Caixa de Entrada</span>
<HelpTooltip>
Cria automaticamente a caixa de entrada no Chatwoot
</HelpTooltip>
</template>
</v-checkbox>
</div>
</div>
</v-form>
</v-card-text>
@ -177,6 +194,7 @@ const defaultObj = () => ({
sign_msg: true,
reopen_conversation: true,
conversation_pending: false,
auto_create: undefined,
});
export default {

View File

@ -70,7 +70,7 @@ export default {
{
title: "Doc",
icon: "mdi-book-open-page-variant",
url: "https://doc.evolution-api.com/help-center",
url: "https://doc.evolution-api.com",
},
],
}),

View File

@ -123,6 +123,13 @@ export const useAppStore = defineStore('app', {
this.instancesList[index].instance.status = status
},
setPhoto(instanceName, photo) {
const index = this.instancesList.findIndex(
(instance) => instance.instance.instanceName === instanceName
)
if (index !== -1) this.instancesList[index].instance.profilePictureUrl = photo
},
addInstanceKey({ instance, key }) {
this.instancesKeys[instance] = key
},