diff --git a/package-lock.json b/package-lock.json
index 861cd34fc..4e4a11943 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -33,7 +33,7 @@
"vue-router": "^4.2.5",
"vue2-dropzone": "^3.6.0",
"vuex": "^4.1.0",
- "webitel-sdk": "^24.2.3"
+ "webitel-sdk": "^24.02.06"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.4.0",
@@ -8366,9 +8366,9 @@
}
},
"node_modules/webitel-sdk": {
- "version": "24.2.4",
- "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-24.2.4.tgz",
- "integrity": "sha512-7lg2CKR4iAdAQOOexi8A/5QqizK0mZ0JgV4E1x0L3hCZb6hP2UTapvwjUXx8Sie4WbJlq0wamIPuRVqoB/2r0Q==",
+ "version": "24.2.6",
+ "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-24.2.6.tgz",
+ "integrity": "sha512-pesFApYZJwKXSTAzxuFhkt/aVGqodEbOn0zUlDkALdj/6Za0/dZmAAZ4iBXar8YDUOeLxCnLRLrJxsQVAC7i1w==",
"dependencies": {
"@types/webrtc": "~0.0.41",
"deep-copy": "1.4.2",
diff --git a/package.json b/package.json
index 3c5535c68..d16301d03 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"vue-router": "^4.2.5",
"vue2-dropzone": "^3.6.0",
"vuex": "^4.1.0",
- "webitel-sdk": "^24.2.3"
+ "webitel-sdk": "^24.02.06"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.4.0",
diff --git a/src/app/locale/en/en.js b/src/app/locale/en/en.js
index cc8dac3fd..c79ec4b0f 100644
--- a/src/app/locale/en/en.js
+++ b/src/app/locale/en/en.js
@@ -709,6 +709,11 @@ export default {
agentStatus: 'Agent status changed',
}
},
+ scheme: {
+ scheme: 'Scheme | Schemes',
+ addScheme: 'Add scheme',
+ editScheme: 'Edit scheme',
+ },
},
members: {
diff --git a/src/app/locale/ru/ru.js b/src/app/locale/ru/ru.js
index 76c714d63..7137a0188 100644
--- a/src/app/locale/ru/ru.js
+++ b/src/app/locale/ru/ru.js
@@ -707,6 +707,11 @@ export default {
agentStatus: 'Изменение статуса оператора',
}
},
+ scheme: {
+ scheme: 'Схема | Схемы',
+ addScheme: 'Добавить схему',
+ editScheme: 'Редактировать схему',
+ },
},
members: {
diff --git a/src/app/locale/ua/ua.js b/src/app/locale/ua/ua.js
index 90232cbcd..81800dd7f 100644
--- a/src/app/locale/ua/ua.js
+++ b/src/app/locale/ua/ua.js
@@ -709,6 +709,11 @@ export default {
agentStatus: 'Зміна статуту оператора',
}
},
+ scheme: {
+ scheme: 'Схема | Схеми',
+ addScheme: 'Додати схему',
+ editScheme: 'Редагувати схему',
+ },
},
members: {
diff --git a/src/modules/contact-center/modules/teams/components/opened-team.vue b/src/modules/contact-center/modules/teams/components/opened-team.vue
index 78545ebcd..d8d2ed95d 100644
--- a/src/modules/contact-center/modules/teams/components/opened-team.vue
+++ b/src/modules/contact-center/modules/teams/components/opened-team.vue
@@ -95,7 +95,7 @@ export default {
text: this.$tc('objects.ccenter.queues.hooks.hooks', 2),
value: 'hooks',
}, {
- text: 'schemes',
+ text: this.$tc('objects.ccenter.teams.scheme.scheme', 2),
value: 'schemes',
}
];
diff --git a/src/modules/contact-center/modules/teams/modules/hooks/components/opened-team-hooks-popup.vue b/src/modules/contact-center/modules/teams/modules/hooks/components/opened-team-hooks-popup.vue
index 5957fbb06..d6fa6f421 100644
--- a/src/modules/contact-center/modules/teams/modules/hooks/components/opened-team-hooks-popup.vue
+++ b/src/modules/contact-center/modules/teams/modules/hooks/components/opened-team-hooks-popup.vue
@@ -57,7 +57,7 @@ import FlowsAPI from '../../../../../../routing/modules/flow/api/flow';
import HookEvent from '../enum/HookTeamEvent.enum';
export default {
- name: 'OpenedQueueHooksPopup',
+ name: 'OpenedTeamHooksPopup',
mixins: [nestedObjectMixin],
setup: () => ({
diff --git a/src/modules/contact-center/modules/teams/modules/schemes/api/teamSchemes.js b/src/modules/contact-center/modules/teams/modules/schemes/api/teamSchemes.js
index 6c684c644..8d49600e6 100644
--- a/src/modules/contact-center/modules/teams/modules/schemes/api/teamSchemes.js
+++ b/src/modules/contact-center/modules/teams/modules/schemes/api/teamSchemes.js
@@ -1,4 +1,4 @@
-import { AgentServiceApiFactory } from 'webitel-sdk';
+import { TeamTriggerServiceApi } from 'webitel-sdk';
import {
getDefaultGetListResponse,
getDefaultGetParams,
@@ -6,47 +6,51 @@ import {
import applyTransform, {
camelToSnake,
merge, mergeEach,
- notify,
+ notify, sanitize,
snakeToCamel,
starToSearch,
} from '@webitel/ui-sdk/src/api/transformers';
import instance from '../../../../../../../app/api/instance';
import configuration from '../../../../../../../app/api/openAPIConfig';
-const agentService = new AgentServiceApiFactory(configuration, '', instance);
+const schemeService = new TeamTriggerServiceApi(configuration, '', instance);
-const getTeamSchemesList = async (params) => {
- const fields = ['id', 'name', 'status', 'supervisor', 'skills'];
+const fieldsToSend = ['name', 'schema', 'enabled', 'description'];
+
+const preRequestHandler = (parentId) => (item) => ({
+ ...item,
+ teamId: parentId,
+});
+const getTeamSchemesList = async (params) => {
const defaultObject = {
- name: '',
- status: '',
- supervisor: {},
- skills: [],
+ enabled: false,
};
const {
- parentId,
- page = 1,
- size = 10,
+ page,
+ size,
search,
sort,
+ fields,
+ id,
+ enabled,
+ parentId,
} = applyTransform(params, [
merge(getDefaultGetParams()),
starToSearch('search'),
]);
try {
- const response = await agentService.searchAgent(
+ const response = await schemeService.searchTeamTrigger(
+ parentId,
page,
size,
search,
sort,
fields,
- undefined,
- undefined,
- undefined,
- parentId,
+ enabled,
+ id,
);
const { items, next } = applyTransform(response.data, [
snakeToCamel(),
@@ -65,14 +69,20 @@ const getTeamSchemesList = async (params) => {
}
};
-const getTeamSchemes = async ({ itemId: id }) => {
- const responseHandler = (agent) => ({ agent });
+const getTeamSchemes = async ({ parentId, itemId: id }) => {
+
+ const defaultObject = {
+ name: '',
+ description: '',
+ enabled: false,
+ schema: {},
+ };
try {
- const response = await agentService.readAgent(id);
+ const response = await schemeService.readTeamTrigger(parentId, id);
return applyTransform(response.data, [
snakeToCamel(),
- responseHandler,
+ merge(defaultObject),
]);
} catch (err) {
throw applyTransform(err, [
@@ -81,27 +91,50 @@ const getTeamSchemes = async ({ itemId: id }) => {
}
};
-const addTeamSchemes = ({ parentId, itemInstance }) => {
- const { id } = itemInstance.agent;
- const changes = { team: { id: parentId } };
- return patchAgent({ id, changes });
+const addTeamSchemes = async ({ parentId, itemInstance }) => {
+ const item = applyTransform(itemInstance, [
+ preRequestHandler(parentId),
+ sanitize(fieldsToSend),
+ camelToSnake(),
+ ]);
+ try {
+ const response = await schemeService.createTeamTrigger(parentId, item);
+ return applyTransform(response.data, [
+ snakeToCamel(),
+ ]);
+ } catch (err) {
+ throw applyTransform(err, [
+ notify,
+ ]);
+ }
};
-const updateTeamSchemes = async ({ parentId, itemId, itemInstance }) => {
+const patchTeamSchemes = async ({ changes, id, parentId }) => {
+ const body = applyTransform(changes, [
+ sanitize(fieldsToSend),
+ camelToSnake(),
+ ]);
+
try {
- await addTeamAgent({ parentId, itemInstance });
- await deleteTeamAgent({ id: itemId });
+ const response = await schemeService.patchTeamTrigger(parentId, id, body);
+ return applyTransform(response.data, [
+ snakeToCamel(),
+ ]);
} catch (err) {
- throw err;
+ throw applyTransform(err, [
+ notify,
+ ]);
}
};
-const patchSchemes = async ({ id, changes }) => {
- const item = applyTransform(changes, [
+const updateTeamSchemes = async ({ itemInstance, itemId: id, parentId }) => {
+ const item = applyTransform(itemInstance, [
+ preRequestHandler(parentId),
+ sanitize(fieldsToSend),
camelToSnake(),
]);
try {
- const response = await agentService.patchAgent(id, item);
+ const response = await schemeService.updateTeamTrigger(parentId, id, item);
return applyTransform(response.data, [
snakeToCamel(),
]);
@@ -112,9 +145,15 @@ const patchSchemes = async ({ id, changes }) => {
}
};
-const deleteTeamSchemes = ({ id }) => {
- const changes = { team: { id: null } };
- return patchAgent({ id, changes });
+const deleteTeamSchemes = async ({ parentId, id }) => {
+ try {
+ const response = await schemeService.deleteTeamTrigger(parentId, id);
+ return applyTransform(response.data, []);
+ } catch (err) {
+ throw applyTransform(err, [
+ notify,
+ ]);
+ }
};
const TeamAgentsAPI = {
@@ -122,7 +161,7 @@ const TeamAgentsAPI = {
get: getTeamSchemes,
add: addTeamSchemes,
update: updateTeamSchemes,
- putch: patchSchemes,
+ patch: patchTeamSchemes,
delete: deleteTeamSchemes,
};
diff --git a/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes-popup.vue b/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-scheme-popup.vue
similarity index 50%
rename from src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes-popup.vue
rename to src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-scheme-popup.vue
index 432c2479c..bc6747fd5 100644
--- a/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes-popup.vue
+++ b/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-scheme-popup.vue
@@ -5,18 +5,27 @@
@close="close"
>
- {{ $tc('objects.ccenter.agents.agents', 1) }}
+ {{ itemInstance.id
+ ? $tc('objects.ccenter.teams.scheme.editScheme')
+ : $tc('objects.ccenter.teams.scheme.addScheme') }}
@@ -25,7 +34,7 @@
:disabled="disabledSave"
@click="save"
>
- {{ $t('objects.add') }}
+ {{ $t('objects.save') }}
diff --git a/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes.vue b/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes.vue
index e355c0aa3..9f695fdfc 100644
--- a/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes.vue
+++ b/src/modules/contact-center/modules/teams/modules/schemes/components/opened-team-schemes.vue
@@ -1,7 +1,7 @@
-