mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
eslint fixes
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<banner-component :ticket="ticket" />
|
||||
<div class="container-xxl pt-1" style="padding-bottom: 55px">
|
||||
<ticket-selector-component :tickets="[]" />
|
||||
<ticket-history-list-component :history="ticketHistory" />
|
||||
</div>
|
||||
<action-toolbar-component />
|
||||
<banner-component :ticket="ticket" />
|
||||
<div class="container-xxl pt-1" style="padding-bottom: 55px">
|
||||
<ticket-selector-component :tickets="[]" />
|
||||
<ticket-history-list-component :history="ticketHistory" />
|
||||
</div>
|
||||
<action-toolbar-component />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useToast } from "vue-toast-notification";
|
||||
@@ -30,14 +30,14 @@ const ticket = computed(() => store.getters.getTicket as Ticket);
|
||||
const ticketHistory = computed(() => store.getters.getDistinctAddressesHistory);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await store.dispatch("fetchMotives");
|
||||
await store.dispatch("fetchUserGroups");
|
||||
await store.dispatch("fetchUsers");
|
||||
await store.dispatch("getSuggestedPersons");
|
||||
} catch (error) {
|
||||
toast.error(error as string);
|
||||
}
|
||||
try {
|
||||
await store.dispatch("fetchMotives");
|
||||
await store.dispatch("fetchUserGroups");
|
||||
await store.dispatch("fetchUsers");
|
||||
await store.dispatch("getSuggestedPersons");
|
||||
} catch (error) {
|
||||
toast.error(error as string);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@@ -1,152 +1,127 @@
|
||||
<template>
|
||||
<div class="fixed-bottom">
|
||||
<div class="footer-ticket-details" v-if="activeTab">
|
||||
<div class="tab-content p-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link p-0"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 0.5rem;
|
||||
font-size: 2rem;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
text-decoration: none;
|
||||
"
|
||||
@click="closeAllActions"
|
||||
aria-label="Fermer"
|
||||
title="Fermer"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div v-if="activeTabTitle">
|
||||
<label class="col-form-label">
|
||||
{{ activeTabTitle }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="fixed-bottom">
|
||||
<div class="footer-ticket-details" v-if="activeTab">
|
||||
<div class="tab-content p-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link p-0"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 0.5rem;
|
||||
font-size: 2rem;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
text-decoration: none;
|
||||
"
|
||||
@click="closeAllActions"
|
||||
aria-label="Fermer"
|
||||
title="Fermer"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div v-if="activeTabTitle">
|
||||
<label class="col-form-label">
|
||||
{{ activeTabTitle }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submitAction">
|
||||
<add-comment-component
|
||||
v-model="content"
|
||||
v-if="activeTab === 'add_comment'"
|
||||
/>
|
||||
<addressee-selector-component
|
||||
v-model="addressees"
|
||||
:suggested="userGroups"
|
||||
v-if="activeTab === 'addressees_state'"
|
||||
/>
|
||||
<form @submit.prevent="submitAction">
|
||||
<add-comment-component
|
||||
v-model="content"
|
||||
v-if="activeTab === 'add_comment'"
|
||||
/>
|
||||
<addressee-selector-component
|
||||
v-model="addressees"
|
||||
:suggested="userGroups"
|
||||
v-if="activeTab === 'addressees_state'"
|
||||
/>
|
||||
|
||||
<motive-selector-component
|
||||
v-model="motive"
|
||||
:motives="motives"
|
||||
v-if="activeTab === 'set_motive'"
|
||||
/>
|
||||
<div v-if="activeTab === 'persons_state'">
|
||||
<div class="row">
|
||||
<label class="col col-form-label">
|
||||
{{
|
||||
trans(
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_CALLER,
|
||||
)
|
||||
}}
|
||||
</label>
|
||||
<label class="col col-form-label">
|
||||
{{
|
||||
trans(
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_PERSON,
|
||||
)
|
||||
}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<caller-selector-component
|
||||
v-model="caller"
|
||||
:suggested="[]"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<persons-selector-component
|
||||
v-model="persons"
|
||||
:suggested="suggestedPersons"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<button class="btn btn-save" type="submit">
|
||||
{{
|
||||
trans(
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_SAVE,
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<motive-selector-component
|
||||
v-model="motive"
|
||||
:motives="motives"
|
||||
v-if="activeTab === 'set_motive'"
|
||||
/>
|
||||
<div v-if="activeTab === 'persons_state'">
|
||||
<div class="row">
|
||||
<label class="col col-form-label">
|
||||
{{ trans(CHILL_TICKET_TICKET_SET_PERSONS_TITLE_CALLER) }}
|
||||
</label>
|
||||
<label class="col col-form-label">
|
||||
{{ trans(CHILL_TICKET_TICKET_SET_PERSONS_TITLE_PERSON) }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-ticket-main">
|
||||
<ul class="nav nav-tabs justify-content-end">
|
||||
<li v-if="hasReturnPath" class="nav-item p-2 go-back">
|
||||
<a :href="returnPath" class="btn btn-cancel">Annuler</a>
|
||||
</li>
|
||||
<li v-else class="nav-item p-2 go-back">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link p-0"
|
||||
style="font-size: 1.5rem; line-height: 1; color: #888"
|
||||
@click="closeAllActions"
|
||||
aria-label="Fermer"
|
||||
title="Fermer"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
>
|
||||
</li>
|
||||
<li
|
||||
v-for="btn in actionButtons"
|
||||
:key="btn.key"
|
||||
class="nav-item p-2"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
:class="`btn ${activeTab === btn.key ? 'btn-primary' : 'btn-light'}`"
|
||||
@click="
|
||||
activeTab === btn.key
|
||||
? (activeTab = '')
|
||||
: (activeTab = btn.key)
|
||||
"
|
||||
:disabled="btn.disabled.value"
|
||||
>
|
||||
<i :class="actionIcons[btn.key]" />
|
||||
{{ trans(btn.label) }}
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item p-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-light"
|
||||
@click="isOpen ? closeTicket() : reopenTicket()"
|
||||
>
|
||||
<i :class="actionIcons['state_change']"></i>
|
||||
{{
|
||||
isOpen
|
||||
? trans(
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE,
|
||||
)
|
||||
: trans(
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN,
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<caller-selector-component v-model="caller" :suggested="[]" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<persons-selector-component
|
||||
v-model="persons"
|
||||
:suggested="suggestedPersons"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<button class="btn btn-save" type="submit">
|
||||
{{ trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_SAVE) }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-ticket-main">
|
||||
<ul class="nav nav-tabs justify-content-end">
|
||||
<li v-if="hasReturnPath" class="nav-item p-2 go-back">
|
||||
<a :href="returnPath" class="btn btn-cancel">Annuler</a>
|
||||
</li>
|
||||
<li v-else class="nav-item p-2 go-back">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link p-0"
|
||||
style="font-size: 1.5rem; line-height: 1; color: #888"
|
||||
@click="closeAllActions"
|
||||
aria-label="Fermer"
|
||||
title="Fermer"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
>
|
||||
</li>
|
||||
<li v-for="btn in actionButtons" :key="btn.key" class="nav-item p-2">
|
||||
<button
|
||||
type="button"
|
||||
:class="`btn ${activeTab === btn.key ? 'btn-primary' : 'btn-light'}`"
|
||||
@click="
|
||||
activeTab === btn.key ? (activeTab = '') : (activeTab = btn.key)
|
||||
"
|
||||
:disabled="btn.disabled.value"
|
||||
>
|
||||
<i :class="actionIcons[btn.key]" />
|
||||
{{ trans(btn.label) }}
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item p-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-light"
|
||||
@click="isOpen ? closeTicket() : reopenTicket()"
|
||||
>
|
||||
<i :class="actionIcons['state_change']"></i>
|
||||
{{
|
||||
isOpen
|
||||
? trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE)
|
||||
: trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN)
|
||||
}}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -163,33 +138,33 @@ import CallerSelectorComponent from "./CallerSelectorComponent.vue";
|
||||
|
||||
// Translations
|
||||
import {
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_ERROR,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_TITLE,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_ERROR,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_SUCCESS,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_TITLE,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_ERROR,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_PERSON,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_CALLER,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_SAVE,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_ERROR,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_ERROR,
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_ERROR,
|
||||
CHILL_TICKET_TICKET_ADD_ADDRESSEE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_TITLE,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_ERROR,
|
||||
CHILL_TICKET_TICKET_ADD_COMMENT_SUCCESS,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_TITLE,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_ERROR,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_PERSON,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE_CALLER,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_TITLE,
|
||||
CHILL_TICKET_TICKET_SET_PERSONS_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_SAVE,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_ERROR,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_SUCCESS,
|
||||
CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_ERROR,
|
||||
} from "translator";
|
||||
|
||||
// Types
|
||||
import {
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
} from "../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
import { Comment, Motive, Ticket } from "../../../types";
|
||||
import { Person } from "ChillPersonAssets/types";
|
||||
@@ -201,43 +176,43 @@ const activeTab = ref("" as string);
|
||||
const actionIcons = ref(store.getters.getActionIcons);
|
||||
|
||||
const activeTabTitle = computed((): string => {
|
||||
switch (activeTab.value) {
|
||||
case "add_comment":
|
||||
return trans(CHILL_TICKET_TICKET_ADD_COMMENT_TITLE);
|
||||
case "set_motive":
|
||||
return trans(CHILL_TICKET_TICKET_SET_MOTIVE_TITLE);
|
||||
case "addressees_state":
|
||||
return trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
switch (activeTab.value) {
|
||||
case "add_comment":
|
||||
return trans(CHILL_TICKET_TICKET_ADD_COMMENT_TITLE);
|
||||
case "set_motive":
|
||||
return trans(CHILL_TICKET_TICKET_SET_MOTIVE_TITLE);
|
||||
case "addressees_state":
|
||||
return trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
const actionButtons = [
|
||||
{
|
||||
key: "set_motive",
|
||||
label: CHILL_TICKET_TICKET_SET_MOTIVE_TITLE,
|
||||
icon: computed(() => actionIcons.value["set_motive"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "add_comment",
|
||||
label: CHILL_TICKET_TICKET_ADD_COMMENT_TITLE,
|
||||
icon: computed(() => actionIcons.value["add_comment"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "addressees_state",
|
||||
label: CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE,
|
||||
icon: computed(() => actionIcons.value["addressees_state"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "persons_state",
|
||||
label: CHILL_TICKET_TICKET_SET_PERSONS_TITLE,
|
||||
icon: computed(() => actionIcons.value["persons_state"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "set_motive",
|
||||
label: CHILL_TICKET_TICKET_SET_MOTIVE_TITLE,
|
||||
icon: computed(() => actionIcons.value["set_motive"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "add_comment",
|
||||
label: CHILL_TICKET_TICKET_ADD_COMMENT_TITLE,
|
||||
icon: computed(() => actionIcons.value["add_comment"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "addressees_state",
|
||||
label: CHILL_TICKET_TICKET_ADD_ADDRESSEE_TITLE,
|
||||
icon: computed(() => actionIcons.value["addressees_state"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
{
|
||||
key: "persons_state",
|
||||
label: CHILL_TICKET_TICKET_SET_PERSONS_TITLE,
|
||||
icon: computed(() => actionIcons.value["persons_state"]),
|
||||
disabled: computed(() => !isOpen.value),
|
||||
},
|
||||
];
|
||||
|
||||
const ticket = computed(() => store.getters.getTicket as Ticket);
|
||||
@@ -247,25 +222,25 @@ const userGroups = computed(() => store.getters.getUserGroups as UserGroup[]);
|
||||
const suggestedPersons = computed(() => store.getters.getPersons as Person[]);
|
||||
console.log("suggestedPersons", suggestedPersons.value);
|
||||
const hasReturnPath = computed((): boolean => {
|
||||
const params = new URL(document.location.toString()).searchParams;
|
||||
return params.has("returnPath");
|
||||
const params = new URL(document.location.toString()).searchParams;
|
||||
return params.has("returnPath");
|
||||
});
|
||||
|
||||
const returnPath = computed((): string => {
|
||||
const params = new URL(document.location.toString()).searchParams;
|
||||
const returnPath = params.get("returnPath");
|
||||
const params = new URL(document.location.toString()).searchParams;
|
||||
const returnPath = params.get("returnPath");
|
||||
|
||||
if (null === returnPath) {
|
||||
throw new Error(
|
||||
"there isn't any returnPath, please check the existence before",
|
||||
);
|
||||
}
|
||||
if (null === returnPath) {
|
||||
throw new Error(
|
||||
"there isn't any returnPath, please check the existence before",
|
||||
);
|
||||
}
|
||||
|
||||
return returnPath;
|
||||
return returnPath;
|
||||
});
|
||||
|
||||
const motive = ref(
|
||||
ticket.value.currentMotive ? ticket.value.currentMotive : ({} as Motive),
|
||||
ticket.value.currentMotive ? ticket.value.currentMotive : ({} as Motive),
|
||||
);
|
||||
const content = ref("" as Comment["content"]);
|
||||
const addressees = ref(ticket.value.currentAddressees as UserGroupOrUser[]);
|
||||
@@ -273,117 +248,109 @@ const persons = ref(ticket.value.currentPersons as Person[]);
|
||||
const caller = ref(ticket.value.caller as Person);
|
||||
|
||||
async function submitAction() {
|
||||
try {
|
||||
switch (activeTab.value) {
|
||||
case "add_comment":
|
||||
if (!content.value) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ADD_COMMENT_ERROR));
|
||||
} else {
|
||||
await store.dispatch("createComment", {
|
||||
ticketId: ticket.value.id,
|
||||
content: content.value,
|
||||
});
|
||||
content.value = "";
|
||||
activeTab.value = "";
|
||||
toast.success(
|
||||
trans(CHILL_TICKET_TICKET_ADD_COMMENT_SUCCESS),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "set_motive":
|
||||
if (!motive.value.id) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_SET_MOTIVE_ERROR));
|
||||
} else {
|
||||
await store.dispatch("createMotive", {
|
||||
ticketId: ticket.value.id,
|
||||
motive: motive.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(
|
||||
trans(CHILL_TICKET_TICKET_SET_MOTIVE_SUCCESS),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "addressees_state":
|
||||
if (!addressees.value.length) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_ERROR));
|
||||
} else {
|
||||
await store.dispatch("setAdressees", {
|
||||
ticketId: ticket.value.id,
|
||||
addressees: addressees.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(
|
||||
trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_SUCCESS),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "persons_state":
|
||||
await store.dispatch("setPersons", {
|
||||
persons: persons.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(trans(CHILL_TICKET_TICKET_SET_PERSONS_SUCCESS));
|
||||
break;
|
||||
try {
|
||||
switch (activeTab.value) {
|
||||
case "add_comment":
|
||||
if (!content.value) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ADD_COMMENT_ERROR));
|
||||
} else {
|
||||
await store.dispatch("createComment", {
|
||||
ticketId: ticket.value.id,
|
||||
content: content.value,
|
||||
});
|
||||
content.value = "";
|
||||
activeTab.value = "";
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ADD_COMMENT_SUCCESS));
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error(error as string);
|
||||
break;
|
||||
case "set_motive":
|
||||
if (!motive.value.id) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_SET_MOTIVE_ERROR));
|
||||
} else {
|
||||
await store.dispatch("createMotive", {
|
||||
ticketId: ticket.value.id,
|
||||
motive: motive.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(trans(CHILL_TICKET_TICKET_SET_MOTIVE_SUCCESS));
|
||||
}
|
||||
break;
|
||||
case "addressees_state":
|
||||
if (!addressees.value.length) {
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_ERROR));
|
||||
} else {
|
||||
await store.dispatch("setAdressees", {
|
||||
ticketId: ticket.value.id,
|
||||
addressees: addressees.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ADD_ADDRESSEE_SUCCESS));
|
||||
}
|
||||
break;
|
||||
case "persons_state":
|
||||
await store.dispatch("setPersons", {
|
||||
persons: persons.value,
|
||||
});
|
||||
activeTab.value = "";
|
||||
toast.success(trans(CHILL_TICKET_TICKET_SET_PERSONS_SUCCESS));
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error(error as string);
|
||||
}
|
||||
}
|
||||
|
||||
async function closeTicket() {
|
||||
try {
|
||||
await store.dispatch("closeTicket");
|
||||
closeAllActions();
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_SUCCESS));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_ERROR));
|
||||
}
|
||||
try {
|
||||
await store.dispatch("closeTicket");
|
||||
closeAllActions();
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_SUCCESS));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_CLOSE_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
async function reopenTicket() {
|
||||
try {
|
||||
await store.dispatch("reopenTicket");
|
||||
toast.success(
|
||||
trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_SUCCESS),
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_ERROR));
|
||||
}
|
||||
try {
|
||||
await store.dispatch("reopenTicket");
|
||||
toast.success(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_SUCCESS));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error(trans(CHILL_TICKET_TICKET_ACTIONS_TOOLBAR_REOPEN_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
function closeAllActions() {
|
||||
activeTab.value = "";
|
||||
activeTab.value = "";
|
||||
}
|
||||
|
||||
watch(caller, async (newCaller) => {
|
||||
await store.dispatch("setCaller", { caller: newCaller });
|
||||
await store.dispatch("getSuggestedPersons");
|
||||
await store.dispatch("setCaller", { caller: newCaller });
|
||||
await store.dispatch("getSuggestedPersons");
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.go-back {
|
||||
margin-right: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.sticky-form-buttons {
|
||||
margin-top: 0px;
|
||||
background: none;
|
||||
margin-top: 0px;
|
||||
background: none;
|
||||
}
|
||||
div.footer-ticket-main {
|
||||
background: none repeat scroll 0 0 #cabb9f;
|
||||
background: none repeat scroll 0 0 #cabb9f;
|
||||
}
|
||||
|
||||
div.footer-ticket-details {
|
||||
background: none repeat scroll 0 0 #efe2ca;
|
||||
background: none repeat scroll 0 0 #efe2ca;
|
||||
}
|
||||
|
||||
.fixed-bottom {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<comment-editor v-model="content" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<comment-editor v-model="content" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -11,16 +11,16 @@ import { ref, watch } from "vue";
|
||||
import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: string;
|
||||
modelValue?: string;
|
||||
}>();
|
||||
|
||||
const emit =
|
||||
defineEmits<(e: "update:modelValue", value: string | undefined) => void>();
|
||||
defineEmits<(e: "update:modelValue", value: string | undefined) => void>();
|
||||
|
||||
const content = ref(props.modelValue);
|
||||
|
||||
watch(content, (value) => {
|
||||
emit("update:modelValue", value);
|
||||
emit("update:modelValue", value);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@@ -1,29 +1,29 @@
|
||||
<template>
|
||||
<div class="col-12">
|
||||
<span
|
||||
v-for="userGroup in userGroupLevels"
|
||||
:key="userGroup.id"
|
||||
class="badge-user-group"
|
||||
:style="`background-color: ${userGroup.backgroundColor}; color: ${userGroup.foregroundColor};`"
|
||||
>
|
||||
{{ userGroup.label.fr }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<span
|
||||
v-for="userGroup in userGroups"
|
||||
:key="userGroup.id"
|
||||
class="badge-user-group"
|
||||
:style="`background-color: ${userGroup.backgroundColor}; color: ${userGroup.foregroundColor};`"
|
||||
>
|
||||
{{ userGroup.label.fr }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="users.length > 0" class="col-12">
|
||||
<span class="badge-user" v-for="user in users" :key="user.id">
|
||||
<user-render-box-badge :user="user" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<span
|
||||
v-for="userGroup in userGroupLevels"
|
||||
:key="userGroup.id"
|
||||
class="badge-user-group"
|
||||
:style="`background-color: ${userGroup.backgroundColor}; color: ${userGroup.foregroundColor};`"
|
||||
>
|
||||
{{ userGroup.label.fr }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<span
|
||||
v-for="userGroup in userGroups"
|
||||
:key="userGroup.id"
|
||||
class="badge-user-group"
|
||||
:style="`background-color: ${userGroup.backgroundColor}; color: ${userGroup.foregroundColor};`"
|
||||
>
|
||||
{{ userGroup.label.fr }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="users.length > 0" class="col-12">
|
||||
<span class="badge-user" v-for="user in users" :key="user.id">
|
||||
<user-render-box-badge :user="user" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -34,35 +34,34 @@ import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRen
|
||||
|
||||
// Types
|
||||
import {
|
||||
User,
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
User,
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
} from "../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
const props = defineProps<{ addressees: UserGroupOrUser[] }>();
|
||||
|
||||
const userGroups = computed(
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) =>
|
||||
addressee.type == "user_group" && addressee.excludeKey == "",
|
||||
) as UserGroup[],
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) =>
|
||||
addressee.type == "user_group" && addressee.excludeKey == "",
|
||||
) as UserGroup[],
|
||||
);
|
||||
|
||||
const userGroupLevels = computed(
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) =>
|
||||
addressee.type == "user_group" &&
|
||||
addressee.excludeKey == "level",
|
||||
) as UserGroup[],
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) =>
|
||||
addressee.type == "user_group" && addressee.excludeKey == "level",
|
||||
) as UserGroup[],
|
||||
);
|
||||
|
||||
const users = computed(
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) => addressee.type == "user",
|
||||
) as User[],
|
||||
() =>
|
||||
props.addressees.filter(
|
||||
(addressee: UserGroupOrUser) => addressee.type == "user",
|
||||
) as User[],
|
||||
);
|
||||
</script>
|
||||
|
||||
|
@@ -1,25 +1,25 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<vue-multiselect
|
||||
name="selectMotive"
|
||||
id="selectMotive"
|
||||
label="label"
|
||||
:custom-label="customLabel"
|
||||
track-by="id"
|
||||
open-direction="top"
|
||||
:multiple="false"
|
||||
:searchable="true"
|
||||
:placeholder="trans(CHILL_TICKET_TICKET_SET_MOTIVE_LABEL)"
|
||||
:select-label="trans(MULTISELECT_SELECT_LABEL)"
|
||||
:deselect-label="trans(MULTISELECT_DESELECT_LABEL)"
|
||||
:selected-label="trans(MULTISELECT_SELECTED_LABEL)"
|
||||
:options="motives"
|
||||
v-model="motive"
|
||||
class="mb-4"
|
||||
/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<vue-multiselect
|
||||
name="selectMotive"
|
||||
id="selectMotive"
|
||||
label="label"
|
||||
:custom-label="customLabel"
|
||||
track-by="id"
|
||||
open-direction="top"
|
||||
:multiple="false"
|
||||
:searchable="true"
|
||||
:placeholder="trans(CHILL_TICKET_TICKET_SET_MOTIVE_LABEL)"
|
||||
:select-label="trans(MULTISELECT_SELECT_LABEL)"
|
||||
:deselect-label="trans(MULTISELECT_DESELECT_LABEL)"
|
||||
:selected-label="trans(MULTISELECT_SELECTED_LABEL)"
|
||||
:options="motives"
|
||||
v-model="motive"
|
||||
class="mb-4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -31,41 +31,41 @@ import { Motive } from "../../../types";
|
||||
|
||||
// Translations
|
||||
import {
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_LABEL,
|
||||
MULTISELECT_SELECT_LABEL,
|
||||
MULTISELECT_DESELECT_LABEL,
|
||||
MULTISELECT_SELECTED_LABEL,
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_SET_MOTIVE_LABEL,
|
||||
MULTISELECT_SELECT_LABEL,
|
||||
MULTISELECT_DESELECT_LABEL,
|
||||
MULTISELECT_SELECTED_LABEL,
|
||||
} from "translator";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: Motive;
|
||||
motives: Motive[];
|
||||
modelValue?: Motive;
|
||||
motives: Motive[];
|
||||
}>();
|
||||
|
||||
const emit =
|
||||
defineEmits<(e: "update:modelValue", value: Motive | undefined) => void>();
|
||||
defineEmits<(e: "update:modelValue", value: Motive | undefined) => void>();
|
||||
|
||||
const motive = ref(props.modelValue);
|
||||
|
||||
watch(motive, (val) => {
|
||||
emit("update:modelValue", val);
|
||||
emit("update:modelValue", val);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
motive.value = val;
|
||||
},
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
motive.value = val;
|
||||
},
|
||||
);
|
||||
|
||||
function customLabel(motive: Motive) {
|
||||
return motive?.label?.fr ?? trans(CHILL_TICKET_TICKET_SET_MOTIVE_LABEL);
|
||||
return motive?.label?.fr ?? trans(CHILL_TICKET_TICKET_SET_MOTIVE_LABEL);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#selectMotive {
|
||||
margin-bottom: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<pick-entity
|
||||
uniqid="ticket-person-selector"
|
||||
:types="['person']"
|
||||
:picked="selectedEntities"
|
||||
:suggested="suggestedValues"
|
||||
:multiple="false"
|
||||
:removable-if-set="true"
|
||||
:display-picked="true"
|
||||
:label="trans(CHILL_TICKET_TICKET_SET_PERSONS_USER_LABEL)"
|
||||
@add-new-entity="addNewEntity"
|
||||
@remove-entity="removeEntity"
|
||||
/>
|
||||
<pick-entity
|
||||
uniqid="ticket-person-selector"
|
||||
:types="['person']"
|
||||
:picked="selectedEntities"
|
||||
:suggested="suggestedValues"
|
||||
:multiple="false"
|
||||
:removable-if-set="true"
|
||||
:display-picked="true"
|
||||
:label="trans(CHILL_TICKET_TICKET_SET_PERSONS_USER_LABEL)"
|
||||
@add-new-entity="addNewEntity"
|
||||
@remove-entity="removeEntity"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -26,66 +26,65 @@ import { Entities } from "ChillPersonAssets/types";
|
||||
import { trans, CHILL_TICKET_TICKET_SET_PERSONS_USER_LABEL } from "translator";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Entities[];
|
||||
suggested: Entities[];
|
||||
modelValue: Entities[];
|
||||
suggested: Entities[];
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: Entities[]];
|
||||
"update:modelValue": [value: Entities[]];
|
||||
}>();
|
||||
|
||||
const selectedEntities = ref<Entities[]>([...props.modelValue]);
|
||||
const suggestedValues = ref<Entities[]>([...props.suggested]);
|
||||
|
||||
watch(
|
||||
() => [props.suggested, props.modelValue],
|
||||
() => {
|
||||
suggestedValues.value = props.suggested.filter(
|
||||
(suggested: Entities) =>
|
||||
!props.modelValue.some(
|
||||
(selected: Entities) =>
|
||||
suggested.id === selected.id &&
|
||||
suggested.type === selected.type,
|
||||
),
|
||||
);
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
() => [props.suggested, props.modelValue],
|
||||
() => {
|
||||
suggestedValues.value = props.suggested.filter(
|
||||
(suggested: Entities) =>
|
||||
!props.modelValue.some(
|
||||
(selected: Entities) =>
|
||||
suggested.id === selected.id && suggested.type === selected.type,
|
||||
),
|
||||
);
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
|
||||
function addNewEntity({ entity }: { entity: Entities }) {
|
||||
selectedEntities.value.push(entity);
|
||||
emit("update:modelValue", selectedEntities.value);
|
||||
selectedEntities.value.push(entity);
|
||||
emit("update:modelValue", selectedEntities.value);
|
||||
}
|
||||
|
||||
function removeEntity({ entity }: { entity: Entities }) {
|
||||
const index = selectedEntities.value.findIndex(
|
||||
(selectedEntity) => selectedEntity === entity,
|
||||
);
|
||||
if (index !== -1) {
|
||||
selectedEntities.value.splice(index, 1);
|
||||
}
|
||||
emit("update:modelValue", selectedEntities.value);
|
||||
const index = selectedEntities.value.findIndex(
|
||||
(selectedEntity) => selectedEntity === entity,
|
||||
);
|
||||
if (index !== -1) {
|
||||
selectedEntities.value.splice(index, 1);
|
||||
}
|
||||
emit("update:modelValue", selectedEntities.value);
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
ul.person-list {
|
||||
list-style-type: none;
|
||||
list-style-type: none;
|
||||
|
||||
& > li {
|
||||
display: inline-block;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
& > li {
|
||||
display: inline-block;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
|
||||
button.remove-person {
|
||||
opacity: 10%;
|
||||
}
|
||||
button.remove-person {
|
||||
opacity: 10%;
|
||||
}
|
||||
}
|
||||
|
||||
& > li:hover {
|
||||
border: 1px solid white;
|
||||
& > li:hover {
|
||||
border: 1px solid white;
|
||||
|
||||
button.remove-person {
|
||||
opacity: 100%;
|
||||
}
|
||||
button.remove-person {
|
||||
opacity: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="col-12">
|
||||
<addressee-component :addressees="addresseeState.addressees" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<addressee-component :addressees="addresseeState.addressees" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
// Types
|
||||
@@ -11,7 +11,7 @@ import { AddresseeState } from "../../../types";
|
||||
import AddresseeComponent from "./AddresseeComponent.vue";
|
||||
|
||||
defineProps<{
|
||||
addresseeState: AddresseeState;
|
||||
addresseeState: AddresseeState;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="col-12">
|
||||
<blockquote class="chill-user-quote">
|
||||
<p v-html="convertMarkdownToHtml(commentHistory.content)"></p>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<blockquote class="chill-user-quote">
|
||||
<p v-html="convertMarkdownToHtml(commentHistory.content)"></p>
|
||||
</blockquote>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -16,30 +16,30 @@ import { Comment } from "../../../types";
|
||||
defineProps<{ commentHistory: Comment }>();
|
||||
|
||||
const preprocess = (markdown: string): string => {
|
||||
return markdown;
|
||||
return markdown;
|
||||
};
|
||||
|
||||
const postprocess = (html: string): string => {
|
||||
DOMPurify.addHook("afterSanitizeAttributes", (node: Element) => {
|
||||
if ("target" in node) {
|
||||
node.setAttribute("target", "_blank");
|
||||
node.setAttribute("rel", "noopener noreferrer");
|
||||
}
|
||||
if (
|
||||
!node.hasAttribute("target") &&
|
||||
(node.hasAttribute("xlink:href") || node.hasAttribute("href"))
|
||||
) {
|
||||
node.setAttribute("xlink:show", "new");
|
||||
}
|
||||
});
|
||||
DOMPurify.addHook("afterSanitizeAttributes", (node: Element) => {
|
||||
if ("target" in node) {
|
||||
node.setAttribute("target", "_blank");
|
||||
node.setAttribute("rel", "noopener noreferrer");
|
||||
}
|
||||
if (
|
||||
!node.hasAttribute("target") &&
|
||||
(node.hasAttribute("xlink:href") || node.hasAttribute("href"))
|
||||
) {
|
||||
node.setAttribute("xlink:show", "new");
|
||||
}
|
||||
});
|
||||
|
||||
return DOMPurify.sanitize(html);
|
||||
return DOMPurify.sanitize(html);
|
||||
};
|
||||
|
||||
const convertMarkdownToHtml = (markdown: string): string => {
|
||||
marked.use({ hooks: { postprocess, preprocess } });
|
||||
const rawHtml = marked(markdown) as string;
|
||||
return rawHtml;
|
||||
marked.use({ hooks: { postprocess, preprocess } });
|
||||
const rawHtml = marked(markdown) as string;
|
||||
return rawHtml;
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<p>Ticket créé par {{ props.by.text }}</p>
|
||||
<p>Ticket créé par {{ props.by.text }}</p>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -7,7 +7,7 @@
|
||||
import { User } from "../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
interface TicketHistoryCreateComponentConfig {
|
||||
by: User;
|
||||
by: User;
|
||||
}
|
||||
|
||||
const props = defineProps<TicketHistoryCreateComponentConfig>();
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
<span
|
||||
class="badge rounded-pill me-1 mx-2"
|
||||
:class="{
|
||||
'bg-danger': new_emergency === 'yes',
|
||||
'bg-secondary': new_emergency === 'no',
|
||||
}"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_EMERGENCY) }}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span
|
||||
class="badge rounded-pill me-1 mx-2"
|
||||
:class="{
|
||||
'bg-danger': new_emergency === 'yes',
|
||||
'bg-secondary': new_emergency === 'no',
|
||||
}"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_EMERGENCY) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { trans, CHILL_TICKET_TICKET_BANNER_EMERGENCY } from "translator";
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="col-12 fw-bolder">
|
||||
{{ motiveHistory.motive.label.fr }}
|
||||
</div>
|
||||
<div class="col-12 fw-bolder">
|
||||
{{ motiveHistory.motive.label.fr }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<span
|
||||
class="badge rounded-pill me-1 mx-2"
|
||||
:class="{
|
||||
'bg-chill-red': props.new_state == 'closed',
|
||||
'bg-chill-green': props.new_state == 'open',
|
||||
}"
|
||||
>
|
||||
<template v-if="props.new_state == 'open'">
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_OPEN) }}
|
||||
</template>
|
||||
<template v-else-if="props.new_state == 'closed'">
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_CLOSED) }}
|
||||
</template>
|
||||
</span>
|
||||
<!--
|
||||
<span
|
||||
class="badge rounded-pill me-1 mx-2"
|
||||
:class="{
|
||||
'bg-chill-red': props.new_state == 'closed',
|
||||
'bg-chill-green': props.new_state == 'open',
|
||||
}"
|
||||
>
|
||||
<template v-if="props.new_state == 'open'">
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_OPEN) }}
|
||||
</template>
|
||||
<template v-else-if="props.new_state == 'closed'">
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_CLOSED) }}
|
||||
</template>
|
||||
</span>
|
||||
<!--
|
||||
<span
|
||||
class="text-chill-green mx-2"
|
||||
style="
|
||||
@@ -46,9 +46,9 @@ import { StateChange } from "../../../types";
|
||||
|
||||
// Translations
|
||||
import {
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_BANNER_OPEN,
|
||||
CHILL_TICKET_TICKET_BANNER_CLOSED,
|
||||
trans,
|
||||
CHILL_TICKET_TICKET_BANNER_OPEN,
|
||||
CHILL_TICKET_TICKET_BANNER_CLOSED,
|
||||
} from "translator";
|
||||
const props = defineProps<StateChange>();
|
||||
</script>
|
||||
|
@@ -1,22 +1,22 @@
|
||||
<template>
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="btn-group" @click="handleClick">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-light dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_PREVIOUS_TICKETS) }}
|
||||
<span
|
||||
class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-chill-green"
|
||||
>
|
||||
{{ tickets.length }}
|
||||
<span class="visually-hidden">Tickets</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="btn-group" @click="handleClick">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-light dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_PREVIOUS_TICKETS) }}
|
||||
<span
|
||||
class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-chill-green"
|
||||
>
|
||||
{{ tickets.length }}
|
||||
<span class="visually-hidden">Tickets</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -29,7 +29,7 @@ import { Ticket } from "../../../types";
|
||||
defineProps<{ tickets: Ticket[] }>();
|
||||
|
||||
function handleClick() {
|
||||
alert("Sera disponible plus tard");
|
||||
alert("Sera disponible plus tard");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<span class="d-block d-sm-inline-block ms-sm-3 ms-md-0">
|
||||
<button
|
||||
class="badge rounded-pill me-1"
|
||||
:class="{
|
||||
'bg-danger': isEmergency,
|
||||
'bg-secondary': !isEmergency,
|
||||
}"
|
||||
@click="toggleEmergency"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_EMERGENCY) }}
|
||||
</button>
|
||||
</span>
|
||||
<span class="d-block d-sm-inline-block ms-sm-3 ms-md-0">
|
||||
<button
|
||||
class="badge rounded-pill me-1"
|
||||
:class="{
|
||||
'bg-danger': isEmergency,
|
||||
'bg-secondary': !isEmergency,
|
||||
}"
|
||||
@click="toggleEmergency"
|
||||
>
|
||||
{{ trans(CHILL_TICKET_TICKET_BANNER_EMERGENCY) }}
|
||||
</button>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -26,42 +26,42 @@ const isEmergency = computed(() => store.getters.isEmergency);
|
||||
|
||||
// Methods
|
||||
function toggleEmergency() {
|
||||
store
|
||||
.dispatch("toggleEmergency", isEmergency.value ? "no" : "yes")
|
||||
.catch(({ name, violations }) => {
|
||||
if (name === "ValidationException" || name === "AccessException") {
|
||||
violations.forEach((violation: string) =>
|
||||
toast.open({ message: violation }),
|
||||
);
|
||||
} else {
|
||||
toast.open({ message: "An error occurred" });
|
||||
}
|
||||
});
|
||||
store
|
||||
.dispatch("toggleEmergency", isEmergency.value ? "no" : "yes")
|
||||
.catch(({ name, violations }) => {
|
||||
if (name === "ValidationException" || name === "AccessException") {
|
||||
violations.forEach((violation: string) =>
|
||||
toast.open({ message: violation }),
|
||||
);
|
||||
} else {
|
||||
toast.open({ message: "An error occurred" });
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
a.flag-toggle {
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: white;
|
||||
text-decoration: underline;
|
||||
border-radius: 20px;
|
||||
}
|
||||
i {
|
||||
margin: auto 0.4em;
|
||||
}
|
||||
span.on {
|
||||
font-weight: bolder;
|
||||
}
|
||||
text-decoration: underline;
|
||||
border-radius: 20px;
|
||||
}
|
||||
i {
|
||||
margin: auto 0.4em;
|
||||
}
|
||||
span.on {
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
button.badge {
|
||||
&.bg-secondary {
|
||||
opacity: 0.5;
|
||||
&:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
&.bg-secondary {
|
||||
opacity: 0.5;
|
||||
&:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -7,18 +7,19 @@ import "vue-toast-notification/dist/theme-sugar.css";
|
||||
import { store } from "./store";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
initialTicket: string;
|
||||
ticketPersonPerTicket: 'one'|'multi';
|
||||
}
|
||||
interface Window {
|
||||
initialTicket: string;
|
||||
ticketPersonPerTicket: "one" | "multi";
|
||||
}
|
||||
}
|
||||
|
||||
const _app = createApp({
|
||||
template: "<app></app>",
|
||||
template: "<app></app>",
|
||||
});
|
||||
|
||||
_app.use(store)
|
||||
.use(VueToast)
|
||||
.provide("toast", _app.config.globalProperties.$toast)
|
||||
.component("app", App)
|
||||
.mount("#ticketRoot");
|
||||
_app
|
||||
.use(store)
|
||||
.use(VueToast)
|
||||
.provide("toast", _app.config.globalProperties.$toast)
|
||||
.component("app", App)
|
||||
.mount("#ticketRoot");
|
||||
|
@@ -6,19 +6,19 @@ import { State as AddresseeStates, moduleAddressee } from "./modules/addressee";
|
||||
import { State as PersonsState, modulePersons } from "./modules/persons";
|
||||
|
||||
export interface RootState {
|
||||
motive: MotiveStates;
|
||||
ticket: TicketStates;
|
||||
comment: CommentStates;
|
||||
addressee: AddresseeStates;
|
||||
persons: PersonsState;
|
||||
motive: MotiveStates;
|
||||
ticket: TicketStates;
|
||||
comment: CommentStates;
|
||||
addressee: AddresseeStates;
|
||||
persons: PersonsState;
|
||||
}
|
||||
|
||||
export const store = createStore<RootState>({
|
||||
modules: {
|
||||
motive: moduleMotive,
|
||||
ticket: moduleTicket,
|
||||
comment: moduleComment,
|
||||
addressee: moduleAddressee,
|
||||
persons: modulePersons,
|
||||
},
|
||||
modules: {
|
||||
motive: moduleMotive,
|
||||
ticket: moduleTicket,
|
||||
comment: moduleComment,
|
||||
addressee: moduleAddressee,
|
||||
persons: modulePersons,
|
||||
},
|
||||
});
|
||||
|
@@ -1,88 +1,86 @@
|
||||
import {
|
||||
fetchResults,
|
||||
makeFetch,
|
||||
fetchResults,
|
||||
makeFetch,
|
||||
} from "../../../../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
|
||||
|
||||
import { Module } from "vuex";
|
||||
import { RootState } from "..";
|
||||
|
||||
import {
|
||||
ApiException,
|
||||
User,
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
ApiException,
|
||||
User,
|
||||
UserGroup,
|
||||
UserGroupOrUser,
|
||||
} from "../../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
export interface State {
|
||||
userGroups: UserGroup[];
|
||||
users: User[];
|
||||
userGroups: UserGroup[];
|
||||
users: User[];
|
||||
}
|
||||
|
||||
export const moduleAddressee: Module<State, RootState> = {
|
||||
state: () => ({
|
||||
userGroups: [] as UserGroup[],
|
||||
users: [] as User[],
|
||||
}),
|
||||
getters: {
|
||||
getUserGroups(state) {
|
||||
return state.userGroups;
|
||||
},
|
||||
getUsers(state) {
|
||||
return state.users;
|
||||
},
|
||||
state: () => ({
|
||||
userGroups: [] as UserGroup[],
|
||||
users: [] as User[],
|
||||
}),
|
||||
getters: {
|
||||
getUserGroups(state) {
|
||||
return state.userGroups;
|
||||
},
|
||||
mutations: {
|
||||
setUserGroups(state, userGroups) {
|
||||
state.userGroups = userGroups;
|
||||
},
|
||||
setUsers(state, users) {
|
||||
state.users = users;
|
||||
},
|
||||
getUsers(state) {
|
||||
return state.users;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setUserGroups(state, userGroups) {
|
||||
state.userGroups = userGroups;
|
||||
},
|
||||
setUsers(state, users) {
|
||||
state.users = users;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
fetchUserGroups({ commit }) {
|
||||
try {
|
||||
fetchResults("/api/1.0/main/user-group.json").then((results) => {
|
||||
commit("setUserGroups", results);
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
fetchUsers({ commit }) {
|
||||
try {
|
||||
fetchResults("/api/1.0/main/user.json").then((results) => {
|
||||
commit("setUsers", results);
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
fetchUserGroups({ commit }) {
|
||||
try {
|
||||
fetchResults("/api/1.0/main/user-group.json").then(
|
||||
(results) => {
|
||||
commit("setUserGroups", results);
|
||||
},
|
||||
);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
fetchUsers({ commit }) {
|
||||
try {
|
||||
fetchResults("/api/1.0/main/user.json").then((results) => {
|
||||
commit("setUsers", results);
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
|
||||
async setAdressees(
|
||||
{ commit },
|
||||
datas: { ticketId: number; addressees: UserGroupOrUser[] },
|
||||
) {
|
||||
const { ticketId, addressees } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/addressees/set`,
|
||||
{
|
||||
addressees: addressees.map((addressee) => {
|
||||
return { id: addressee.id, type: addressee.type };
|
||||
}),
|
||||
},
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async setAdressees(
|
||||
{ commit },
|
||||
datas: { ticketId: number; addressees: UserGroupOrUser[] },
|
||||
) {
|
||||
const { ticketId, addressees } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/addressees/set`,
|
||||
{
|
||||
addressees: addressees.map((addressee) => {
|
||||
return { id: addressee.id, type: addressee.type };
|
||||
}),
|
||||
},
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -7,32 +7,32 @@ import { Comment } from "../../../../types";
|
||||
import { ApiException } from "../../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
export interface State {
|
||||
comments: Comment[];
|
||||
comments: Comment[];
|
||||
}
|
||||
|
||||
export const moduleComment: Module<State, RootState> = {
|
||||
state: () => ({
|
||||
comments: [] as Comment[],
|
||||
}),
|
||||
getters: {},
|
||||
mutations: {},
|
||||
actions: {
|
||||
async createComment(
|
||||
{ commit },
|
||||
datas: { ticketId: number; content: Comment["content"] },
|
||||
) {
|
||||
const { ticketId, content } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/comment/add`,
|
||||
{ content },
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
state: () => ({
|
||||
comments: [] as Comment[],
|
||||
}),
|
||||
getters: {},
|
||||
mutations: {},
|
||||
actions: {
|
||||
async createComment(
|
||||
{ commit },
|
||||
datas: { ticketId: number; content: Comment["content"] },
|
||||
) {
|
||||
const { ticketId, content } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/comment/add`,
|
||||
{ content },
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
fetchResults,
|
||||
makeFetch,
|
||||
fetchResults,
|
||||
makeFetch,
|
||||
} from "../../../../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
|
||||
|
||||
import { Module } from "vuex";
|
||||
@@ -10,57 +10,57 @@ import { Motive } from "../../../../types";
|
||||
import { ApiException } from "../../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
export interface State {
|
||||
motives: Motive[];
|
||||
motives: Motive[];
|
||||
}
|
||||
|
||||
export const moduleMotive: Module<State, RootState> = {
|
||||
state: () => ({
|
||||
motives: [] as Motive[],
|
||||
}),
|
||||
getters: {
|
||||
getMotives(state) {
|
||||
return state.motives;
|
||||
},
|
||||
state: () => ({
|
||||
motives: [] as Motive[],
|
||||
}),
|
||||
getters: {
|
||||
getMotives(state) {
|
||||
return state.motives;
|
||||
},
|
||||
mutations: {
|
||||
setMotives(state, motives) {
|
||||
state.motives = motives;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setMotives(state, motives) {
|
||||
state.motives = motives;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async fetchMotives({ commit }) {
|
||||
try {
|
||||
const results = (await fetchResults(
|
||||
"/api/1.0/ticket/motive.json",
|
||||
)) as Motive[];
|
||||
commit("setMotives", results);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async fetchMotives({ commit }) {
|
||||
try {
|
||||
const results = (await fetchResults(
|
||||
"/api/1.0/ticket/motive.json",
|
||||
)) as Motive[];
|
||||
commit("setMotives", results);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
|
||||
async createMotive(
|
||||
{ commit },
|
||||
datas: { ticketId: number; motive: Motive },
|
||||
) {
|
||||
const { ticketId, motive } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/motive/set`,
|
||||
{
|
||||
motive: {
|
||||
id: motive.id,
|
||||
type: motive.type,
|
||||
},
|
||||
},
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async createMotive(
|
||||
{ commit },
|
||||
datas: { ticketId: number; motive: Motive },
|
||||
) {
|
||||
const { ticketId, motive } = datas;
|
||||
try {
|
||||
const result = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${ticketId}/motive/set`,
|
||||
{
|
||||
motive: {
|
||||
id: motive.id,
|
||||
type: motive.type,
|
||||
},
|
||||
},
|
||||
);
|
||||
commit("setTicket", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -6,81 +6,81 @@ import { RootState } from "..";
|
||||
import { Ticket } from "../../../../types";
|
||||
|
||||
export interface State {
|
||||
persons: Person[];
|
||||
persons: Person[];
|
||||
}
|
||||
|
||||
export const modulePersons: Module<State, RootState> = {
|
||||
state: () => ({
|
||||
persons: [] as Person[],
|
||||
}),
|
||||
getters: {
|
||||
getPersons(state) {
|
||||
return state.persons;
|
||||
},
|
||||
state: () => ({
|
||||
persons: [] as Person[],
|
||||
}),
|
||||
getters: {
|
||||
getPersons(state) {
|
||||
return state.persons;
|
||||
},
|
||||
mutations: {
|
||||
setPersons(state, persons: Person[]) {
|
||||
state.persons = persons;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setPersons(state, persons: Person[]) {
|
||||
state.persons = persons;
|
||||
},
|
||||
actions: {
|
||||
async setPersons(
|
||||
{ commit, rootState: RootState },
|
||||
payload: { persons: Person[] },
|
||||
) {
|
||||
const persons = payload.persons.map((person: Person) => ({
|
||||
id: person.id,
|
||||
type: person.type,
|
||||
}));
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${RootState.ticket.ticket.id}/persons/set`,
|
||||
{ persons },
|
||||
);
|
||||
commit("setTicket", result);
|
||||
},
|
||||
actions: {
|
||||
async setPersons(
|
||||
{ commit, rootState: RootState },
|
||||
payload: { persons: Person[] },
|
||||
) {
|
||||
const persons = payload.persons.map((person: Person) => ({
|
||||
id: person.id,
|
||||
type: person.type,
|
||||
}));
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/${RootState.ticket.ticket.id}/persons/set`,
|
||||
{ persons },
|
||||
);
|
||||
commit("setTicket", result);
|
||||
|
||||
return Promise.resolve();
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async setCaller(
|
||||
{ commit, rootState: RootState },
|
||||
payload: { caller: Person | null },
|
||||
) {
|
||||
try {
|
||||
const caller = payload.caller
|
||||
? {
|
||||
id: payload.caller.id,
|
||||
type: payload.caller.type,
|
||||
}
|
||||
: null;
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${RootState.ticket.ticket.id}/set-caller`,
|
||||
{ caller },
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
|
||||
async getSuggestedPersons({ commit, rootState: RootState }) {
|
||||
try {
|
||||
const ticketId = RootState.ticket.ticket.id;
|
||||
const result: Person[] = await makeFetch(
|
||||
"GET",
|
||||
`/api/1.0/ticket/ticket/${ticketId}/suggest-person`,
|
||||
);
|
||||
commit("setPersons", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
return Promise.resolve();
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async setCaller(
|
||||
{ commit, rootState: RootState },
|
||||
payload: { caller: Person | null },
|
||||
) {
|
||||
try {
|
||||
const caller = payload.caller
|
||||
? {
|
||||
id: payload.caller.id,
|
||||
type: payload.caller.type,
|
||||
}
|
||||
: null;
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${RootState.ticket.ticket.id}/set-caller`,
|
||||
{ caller },
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
|
||||
async getSuggestedPersons({ commit, rootState: RootState }) {
|
||||
try {
|
||||
const ticketId = RootState.ticket.ticket.id;
|
||||
const result: Person[] = await makeFetch(
|
||||
"GET",
|
||||
`/api/1.0/ticket/ticket/${ticketId}/suggest-person`,
|
||||
);
|
||||
commit("setPersons", result);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -6,89 +6,86 @@ import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { ApiException } from "../../../../../../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
export interface State {
|
||||
ticket: Ticket;
|
||||
action_icons: object;
|
||||
ticket: Ticket;
|
||||
action_icons: object;
|
||||
}
|
||||
|
||||
export const moduleTicket: Module<State, RootState> = {
|
||||
state: () => ({
|
||||
ticket: {} as Ticket,
|
||||
action_icons: {
|
||||
add_person: "fa fa-user-plus",
|
||||
add_comment: "fa fa-comment",
|
||||
set_motive: "fa fa-paint-brush",
|
||||
addressees_state: "fa fa-paper-plane",
|
||||
persons_state: "fa fa-user",
|
||||
set_caller: "fa fa-phone",
|
||||
state_change: "",
|
||||
emergency_change: "",
|
||||
},
|
||||
}),
|
||||
getters: {
|
||||
isOpen(state) {
|
||||
return state.ticket.currentState === "open";
|
||||
},
|
||||
isEmergency(state) {
|
||||
return state.ticket.emergency == "yes" ? true : false;
|
||||
},
|
||||
getTicket(state) {
|
||||
state.ticket.history = state.ticket.history.sort((a, b) =>
|
||||
b.at.datetime.localeCompare(a.at.datetime),
|
||||
);
|
||||
return state.ticket;
|
||||
},
|
||||
state: () => ({
|
||||
ticket: {} as Ticket,
|
||||
action_icons: {
|
||||
add_person: "fa fa-user-plus",
|
||||
add_comment: "fa fa-comment",
|
||||
set_motive: "fa fa-paint-brush",
|
||||
addressees_state: "fa fa-paper-plane",
|
||||
persons_state: "fa fa-user",
|
||||
set_caller: "fa fa-phone",
|
||||
state_change: "",
|
||||
emergency_change: "",
|
||||
},
|
||||
}),
|
||||
getters: {
|
||||
isOpen(state) {
|
||||
return state.ticket.currentState === "open";
|
||||
},
|
||||
isEmergency(state) {
|
||||
return state.ticket.emergency == "yes" ? true : false;
|
||||
},
|
||||
getTicket(state) {
|
||||
state.ticket.history = state.ticket.history.sort((a, b) =>
|
||||
b.at.datetime.localeCompare(a.at.datetime),
|
||||
);
|
||||
return state.ticket;
|
||||
},
|
||||
|
||||
getActionIcons(state) {
|
||||
return state.action_icons;
|
||||
},
|
||||
getDistinctAddressesHistory(state) {
|
||||
return state.ticket.history;
|
||||
},
|
||||
getActionIcons(state) {
|
||||
return state.action_icons;
|
||||
},
|
||||
mutations: {
|
||||
setTicket(state, ticket: Ticket) {
|
||||
state.ticket = ticket;
|
||||
},
|
||||
getDistinctAddressesHistory(state) {
|
||||
return state.ticket.history;
|
||||
},
|
||||
actions: {
|
||||
async closeTicket({ commit, state }) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/close`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async reopenTicket({ commit, state }) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/open`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async toggleEmergency(
|
||||
{ commit, state },
|
||||
emergency: TicketEmergencyState,
|
||||
) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/emergency/${emergency}`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setTicket(state, ticket: Ticket) {
|
||||
state.ticket = ticket;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async closeTicket({ commit, state }) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/close`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async reopenTicket({ commit, state }) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/open`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
async toggleEmergency({ commit, state }, emergency: TicketEmergencyState) {
|
||||
try {
|
||||
const result: Ticket = await makeFetch(
|
||||
"POST",
|
||||
`/api/1.0/ticket/ticket/${state.ticket.id}/emergency/${emergency}`,
|
||||
);
|
||||
commit("setTicket", result as Ticket);
|
||||
} catch (e: unknown) {
|
||||
const error = e as ApiException;
|
||||
throw error.name;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user