Skip to content

Commit

Permalink
Merge branch 'feature/view-sent-flows' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldemylla committed Oct 27, 2023
2 parents f6bf94e + adcf715 commit 01cb4f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/components/chats/FlowsTrigger/ModalListTriggeredFlows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ export default {
const response = await FlowsTrigger.listFlowsStart({
offset,
limit: triggeredFlowsLimit,
end_time: filterDate.end,
start_time: filterDate.start,
created_on_after: filterDate.start,
created_on_before: filterDate.end,
});
this.triggeredFlows = response.results || response;
this.triggeredFlowsCount = response.count || 0;
this.triggeredFlowsCountPages = Math.ceil(response.count || 0 / triggeredFlowsLimit);
this.triggeredFlows = response.results;
this.triggeredFlowsCount = response.count;
this.triggeredFlowsCountPages = Math.ceil(response.count / triggeredFlowsLimit);
} catch (error) {
console.log(error);
}
Expand Down
33 changes: 19 additions & 14 deletions src/components/chats/FlowsTrigger/SelectFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,26 @@ export default {
async sendFlow() {
this.loading = true;
if (!this.selectedContact) this.findId(this.contacts, this.groups);
const prepareObj = {
flow: this.selectedFlow,
groups: this.idGruops,
contacts: this.selectedContact ? [this.selectedContact.external_id] : this.idContactsList,
room: this.room?.uuid,
};

this.openModalProgress();
try {
await FlowsTrigger.sendFlow(prepareObj);
this.loading = false;
this.closeModaProgress();
} catch (error) {
this.loading = false;
console.log(error);
}
(this.selectedContact ? [this.selectedContact] : this.contacts).forEach(async (contact) => {
const prepareObj = {
flow: this.selectedFlow,
groups: this.idGruops,
contacts: this.selectedContact ? [this.selectedContact.external_id] : [contact.uuid],
room: this.room?.uuid,
contact_name: this.selectedContact ? this.selectedContact.name : contact.name,
};

try {
await FlowsTrigger.sendFlow(prepareObj);
this.loading = false;
this.closeModaProgress();
} catch (error) {
this.loading = false;
console.log(error);
}
});
},

findId(contacts, groups) {
Expand Down
6 changes: 3 additions & 3 deletions src/services/api/resources/chats/flowsTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export default {
});
return response.data;
},
async listFlowsStart({ offset = 0, limit = 5, start_time = '', end_time = '' }) {
async listFlowsStart({ offset = 0, limit = 5, created_on_before = '', created_on_after = '' }) {
const response = await http.get(`/project/${getProject()}/list_flows_start/`, {
params: {
offset,
limit,
start_time,
end_time,
created_on_before,
created_on_after,
},
});
return response.data;
Expand Down

0 comments on commit 01cb4f4

Please sign in to comment.