Skip to content

Commit c2c23fc

Browse files
changements impact/prio
1 parent 34a865e commit c2c23fc

File tree

2 files changed

+72
-39
lines changed

2 files changed

+72
-39
lines changed

app/src/components/ticket/rightPanel.vue

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,25 @@ q-scroll-area(:style="{height: '100%'}")
4444
.col-6
4545
q-chip(:icon="typeOfTicket.icon" :color="typeOfTicket.color" outline).q-mx-auto {{ typeOfTicket.label }}
4646
q-select.q-my-xs(
47-
label="Projet(s)" filled v-model="ticket.project"
48-
use-input use-chips
49-
new-value-mode="add-unique"
50-
:options="projects.data"
47+
label="Projet(s)" filled
48+
v-model="ticket.project"
49+
:options="getProjectsData"
5150
option-label="name"
5251
)
5352
q-select.q-my-xs(
5453
label="Priorité" filled
55-
use-input use-chips
5654
v-model="ticket.priority"
5755
:options="priority"
5856
option-label="name"
5957
)
6058
q-select.q-my-xs(
6159
label="Impact" filled
62-
use-input use-chips
63-
new-value-mode="add-unique"
6460
v-model="ticket.impact"
6561
:options="impact"
6662
option-label="name"
6763
)
6864
q-select.q-my-xs(
6965
label="SLA" filled
70-
use-input use-chips
71-
new-value-mode="add-unique"
7266
v-model="ticket.sla"
7367
:options="sla.data"
7468
option-label="name"
@@ -129,39 +123,55 @@ const stateOfTicket = computed(() => {
129123
return states.value?.data.find((state: any) => state._id === ticket.value.state.id)
130124
})
131125
126+
const getProjectsData = computed(() => {
127+
return projects.value?.data.map((project: any) => {
128+
return {
129+
id: project._id,
130+
name: project.name,
131+
}
132+
})
133+
})
134+
135+
const getSlaData = computed(() => {
136+
return sla.value?.data.map((sla: any) => {
137+
return {
138+
id: sla._id,
139+
name: sla.name,
140+
}
141+
})
142+
})
143+
132144
const countdown = ref(0)
133145
let interval: NodeJS.Timeout
134146
135147
watch(ticket, (newTicket, oldTicket) => {
136-
startCountdown()
137148
console.log('ticket changed')
138149
console.log(newTicket)
139150
console.log(oldTicket)
140-
}, { deep: true })
141-
142-
watch(countdown, (newCountdown) => {
143-
if (newCountdown === 0) {
144-
resetCountdown()
145-
const body = omit(ticket.value, ['_id', 'metadata', 'tags', 'sequence', 'subject'])
146-
useHttpApi(`/tickets/ticket/${ticket.value._id}`, {
147-
method: 'patch',
148-
body
149-
})
150-
}
151-
})
152-
153-
const startCountdown = () => {
154-
resetCountdown()
151+
countdown.value = 3
152+
clearInterval(interval)
155153
interval = setInterval(() => {
156154
countdown.value--
155+
if (countdown.value === 0) {
156+
clearInterval(interval)
157+
useHttpApi(`/tickets/ticket/${ticket.value._id}`, {
158+
method: 'patch',
159+
body: {
160+
envelope: {
161+
...newTicket.envelope,
162+
},
163+
project: { ...newTicket.project },
164+
priority: { ...newTicket.priority },
165+
impact: { ...newTicket.impact },
166+
state: { ...newTicket.state },
167+
// sla: { ...newTicket.sla}
168+
lifestep: newTicket.lifestep,
169+
}
170+
})
171+
}
157172
console.log(countdown.value)
158173
}, 1000)
159-
}
160-
161-
const resetCountdown = () => {
162-
countdown.value = 15
163-
clearInterval(interval)
164-
}
174+
}, { deep: true })
165175
166176
const ticketCountdown = computed(() => {
167177
const dueAt = dayjs(ticket.value.sla.dueAt)

app/src/utils/statics.ts

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,61 @@ export enum Priority {
3232

3333
export const impact = [
3434
{
35-
_id: generateMongoId(),
35+
id: '612345678901234567890123',
3636
name: Impact.Low,
3737
},
3838
{
39-
_id: generateMongoId(),
39+
id: '712345678901234567890123',
4040
name: Impact.Medium,
4141
},
4242
{
43-
_id: generateMongoId(),
43+
id: '812345678901234567890123',
4444
name: Impact.High,
4545
},
4646
{
47-
_id: generateMongoId(),
47+
id: '912345678901234567890123',
4848
name: Impact.Critical,
4949
},
5050
]
5151

5252
export const priority = [
5353
{
54-
_id: generateMongoId(),
54+
id: '612345678901234567890123',
5555
name: Priority.Low,
5656
},
5757
{
58-
_id: generateMongoId(),
58+
id: '712345678901234567890123',
5959
name: Priority.Normal,
6060
},
6161
{
62-
_id: generateMongoId(),
62+
id: '812345678901234567890123',
6363
name: Priority.High,
6464
},
6565
{
66-
_id: generateMongoId(),
66+
id: '912345678901234567890123',
6767
name: Priority.Urgent,
6868
},
6969
]
70+
71+
export const threadTypes = [
72+
{
73+
label: 'Système',
74+
value: ThreadType.SYSTEM,
75+
},
76+
{
77+
label: 'Interne',
78+
value: ThreadType.INTERNAL,
79+
},
80+
{
81+
label: 'Externe',
82+
value: ThreadType.EXTERNAL,
83+
},
84+
{
85+
label: 'Entrant',
86+
value: ThreadType.INCOMING,
87+
},
88+
{
89+
label: 'Sortant',
90+
value: ThreadType.OUTGOING,
91+
},
92+
]

0 commit comments

Comments
 (0)