Skip to content

Commit

Permalink
Merge branch 'main' into feat/escalation_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad committed Jun 20, 2023
2 parents c023852 + 10765e9 commit d869ca0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
6 changes: 3 additions & 3 deletions desk/src/pages/desk/ticket/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class="flex items-start gap-2"
>
<div class="h-5 w-5">
<component :is="contact.icon" class="h-5 w-5 text-gray-600" />
<component :is="contact.icon" class="h-4 w-4 text-gray-600" />
</div>
<div class="text-gray-900">{{ contact.value }}</div>
</div>
Expand All @@ -51,7 +51,7 @@ import { Avatar, Button, createDocumentResource } from "frappe-ui";
import { useTicketStore } from "./data";
import CustomFieldList from "./CustomFieldList.vue";
import OpenTicketList from "./OpenTicketList.vue";
import IconEmail from "~icons/espresso/email";
import IconMail from "~icons/lucide/mail";
const { sidebar, ticket } = useTicketStore();
Expand All @@ -64,7 +64,7 @@ const c = createDocumentResource({
const fields = [
{
field: "email_id",
icon: IconEmail,
icon: IconMail,
},
];
Expand Down
36 changes: 18 additions & 18 deletions desk/src/pages/desk/ticket/CustomFieldList.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<template>
<div v-if="!isEmpty(fields)" class="flex flex-col gap-5 border-b py-4">
<div v-for="field in fields" :key="field.label">
<div v-if="field.value" class="flex flex-col gap-2.5">
<div class="text-base text-gray-600">{{ field.label }}</div>
<a :href="field.route || null" target="_blank">
<div class="flex items-center gap-2">
<div class="flex h-5 w-5 items-center justify-center">
<IconWebLink v-if="field.route" class="h-5 w-5 text-gray-600" />
<IconTeams v-else class="h-5 w-5 text-gray-600" />
</div>
<div class="text-base text-gray-800">{{ field.value }}</div>
</div>
</a>
</div>
</div>
</div>
<div v-if="!isEmpty(fields)" class="flex flex-col gap-5 border-b py-4">
<div v-for="field in fields" :key="field.label">
<div v-if="field.value" class="flex flex-col gap-2.5">
<div class="text-base text-gray-600">{{ field.label }}</div>
<a :href="field.route || null" target="_blank">
<div class="flex items-center gap-2">
<div class="flex h-4 w-4 items-center justify-center">
<IconLink v-if="field.route" class="h-5 w-5 text-gray-600" />
<IconLayer v-else class="h-4 w-4 text-gray-600" />
</div>
<div class="text-base text-gray-800">{{ field.value }}</div>
</div>
</a>
</div>
</div>
</div>
</template>

<script setup lang="ts">
import { isEmpty } from "lodash";
import { computed } from "vue";
import { useTicketStore } from "./data";
import IconTeams from "~icons/espresso/teams";
import IconWebLink from "~icons/espresso/web-link";
import IconLayer from "~icons/lucide/layers";
import IconLink from "~icons/lucide/external-link";
const { ticket } = useTicketStore();
const fields = computed(() => ticket.doc?.custom_fields);
Expand Down
13 changes: 11 additions & 2 deletions helpdesk/api/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import frappe
from frappe.query_builder.functions import Count
from frappe.utils.caching import redis_cache


@frappe.whitelist()
def get_all():
return [
avg_first_response_time(),
resolution_within_sla(),
my_open_tickets(),
my_tickets(),
ticket_statuses(),
new_tickets(),
ticket_types(),
Expand All @@ -18,6 +19,7 @@ def get_all():
]


@redis_cache(ttl=60 * 5)
def ticket_statuses():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {"creation": [">=", thirty_days_ago.strftime("%Y-%m-%d")]}
Expand All @@ -37,6 +39,7 @@ def ticket_statuses():
}


@redis_cache(ttl=60 * 5)
def avg_first_response_time():
average_resolution_time = float(0.0)
thirty_days_ago = datetime.now() - timedelta(days=30)
Expand Down Expand Up @@ -67,6 +70,7 @@ def avg_first_response_time():
}


@redis_cache(ttl=60 * 5)
def ticket_types():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {"creation": [">=", thirty_days_ago.strftime("%Y-%m-%d")]}
Expand All @@ -86,6 +90,7 @@ def ticket_types():
}


@redis_cache(ttl=60 * 5)
def new_tickets():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {"creation": [">=", thirty_days_ago.strftime("%Y-%m-%d")]}
Expand All @@ -106,6 +111,7 @@ def new_tickets():
}


@redis_cache(ttl=60 * 5)
def resolution_within_sla():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {
Expand Down Expand Up @@ -140,6 +146,7 @@ def resolution_within_sla():
}


@redis_cache(ttl=60 * 5)
def ticket_activity():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {"creation": [">=", thirty_days_ago.strftime("%Y-%m-%d")]}
Expand All @@ -160,6 +167,7 @@ def ticket_activity():
}


@redis_cache(ttl=60 * 5)
def ticket_priority():
thirty_days_ago = datetime.now() - timedelta(days=30)
filters = {"creation": [">=", thirty_days_ago.strftime("%Y-%m-%d")]}
Expand All @@ -179,7 +187,8 @@ def ticket_priority():
}


def my_open_tickets():
@redis_cache(ttl=60 * 5, user=True)
def my_tickets():
QBTicket = frappe.qb.DocType("HD Ticket")
like_str = f"%{frappe.session.user}%"
like_query = QBTicket._assign.like(like_str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ def after_insert(self):
self.send_verification_email()

def send_verification_email(self):
url = get_url(f"/support/verify/{self.request_key}")

url = get_url(f"/helpdesk/verify/{self.request_key}")
subject = "Verify your account"

sender = None
if frappe.db.exists("Email Account", {"name": "Support", "enable_outgoing": True}):

if frappe.db.exists(
"Email Account", {"name": "Support", "enable_outgoing": True}
):
sender = frappe.get_doc("Email Account", "Support").email_id

try:
Expand Down

0 comments on commit d869ca0

Please sign in to comment.