From 4b68f84b18e905b8f25b1e6d4510a80deabae038 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 6 May 2020 19:23:35 +0530 Subject: [PATCH 01/28] customfield in ticket create form --- .../views/Knowledgebase/ticket.html.twig | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/Resources/views/Knowledgebase/ticket.html.twig b/Resources/views/Knowledgebase/ticket.html.twig index a1c1d0b..aa12c7a 100644 --- a/Resources/views/Knowledgebase/ticket.html.twig +++ b/Resources/views/Knowledgebase/ticket.html.twig @@ -94,6 +94,93 @@ + {# CustomFields #} + {% set CustomerCustomFields = ticket_service.getCustomerCreateTicketCustomFieldSnippet() %} + {% set removeMe = [] %} + {% if CustomerCustomFields %} +
+ {% for key, customField in CustomerCustomFields %} +
+ + {% if customField.fieldType == 'text' %} +
+ +
+ + {% elseif customField.fieldType in ['date', 'time', 'datetime'] %} +
+ +
+ {% elseif customField.fieldType == 'textarea' %} +
+ +
+ + {% elseif customField.fieldType in ['file'] %} +
+ +
+ + {% elseif customField.fieldType in ['select'] %} + {% if customField.customFieldValues is not empty %} +
+ +
+ {% else %} + + {% set removeMe = removeMe|merge(["for"~customField.name~customField.id]) %} + {% endif %} + + {% elseif customField.fieldType in ['checkbox'] %} + {% if customField.customFieldValues is not empty %} + {% for customFieldValues in customField.customFieldValues %} +
+ +
+ {% endfor %} + {% else %} + + {% set removeMe = removeMe|merge(["for"~customField.name~customField.id]) %} + {% endif %} + + {% elseif customField.fieldType in ['radio'] %} + {% if customField.customFieldValues is not empty %} + {% for customFieldValues in customField.customFieldValues %} +
+ +
+ {% endfor %} + {% else %} + + {% set removeMe = removeMe|merge(["for"~customField.name~customField.id]) %} + {% endif %} + + {% endif %} + {% if formErrors['customFields['~customField.id~']'] is defined %} +
{{formErrors['customFields['~customField.id~']']}}
+ {% endif %} +
+ {% endfor %} +
+ {% endif %} +
From 806e321b83b8f7d12f2c5a5c2a45223173a399bc Mon Sep 17 00:00:00 2001 From: Akshay Kumar Date: Tue, 20 Oct 2020 10:55:14 +0530 Subject: [PATCH 02/28] Reset branch alias to branch 1.0 --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1ed2e4b..13eda2e 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,10 @@ "psr-4": { "Webkul\\UVDesk\\SupportCenterBundle\\": "" } }, "extra": { - "uvdesk-package-extension": "Webkul\\UVDesk\\SupportCenterBundle\\Package\\Composer" + "uvdesk-package-extension": "Webkul\\UVDesk\\SupportCenterBundle\\Package\\Composer", + "branch-alias": { + "dev-master": "1.0.x-dev" + } }, "minimum-stability": "dev" } From ecfa95e5e0c3013c9515ff7478607047418ab69a Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 7 Apr 2021 17:58:21 +0530 Subject: [PATCH 03/28] Collaborator reply issue and workflow running issue resolved from web --- Controller/Ticket.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 26e10f5..b756aca 100644 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -280,13 +280,22 @@ public function saveReply(int $id, Request $request) $data['ticket'] = $ticket; $data['user'] = $this->userService->getCurrentUser(); + // Checking if reply is from collaborator end + $isTicketCollaborator = $ticket->getCollaborators() ? $ticket->getCollaborators()->toArray() : []; + $isCollaborator = false; + foreach ($isTicketCollaborator as $value) { + if($value->getId() == $data['user']->getId()){ + $isCollaborator = true; + } + } + // @TODO: Refactor -> Why are we filtering only these two characters? $data['message'] = str_replace(['<script>', '</script>'], '', $data['message']); $userDetail = $this->userService->getCustomerPartialDetailById($data['user']->getId()); $data['fullname'] = $userDetail['name']; $data['source'] = 'website'; - $data['createdBy'] = 'customer'; + $data['createdBy'] = $isCollaborator ? 'collaborator' : 'customer'; $data['attachments'] = $request->files->get('attachments'); $thread = $this->ticketService->createThread($ticket, $data); @@ -303,10 +312,15 @@ public function saveReply(int $id, Request $request) $em->flush(); } - // Trigger customer reply event - $event = new GenericEvent(CoreWorkflowEvents\Ticket\CustomerReply::getId(), [ - 'entity' => $ticket, - ]); + if ($thread->getcreatedBy() == 'customer') { + $event = new GenericEvent(CoreWorkflowEvents\Ticket\CustomerReply::getId(), [ + 'entity' => $ticket, + ]); + } else { + $event = new GenericEvent(CoreWorkflowEvents\Ticket\CollaboratorReply::getId(), [ + 'entity' => $ticket, + ]); + } $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); From 203f502dfecdeee322d30a7596155e9d9ac229b3 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 15 Apr 2021 19:02:23 +0530 Subject: [PATCH 04/28] Updates for Marketing Announcement section --- Controller/Announcement.php | 124 +++++++ Entity/Announcement.php | 195 +++++++++++ Repository/AnnouncementRepository.php | 50 +++ .../config/routes/private-customers.yaml | 18 + .../Staff/Announcement/announcementForm.twig | 236 +++++++++++++ .../Announcement/listAnnouncement.html.twig | 313 ++++++++++++++++++ .../Dashboard/Homepage/Items/Announcement.php | 35 ++ .../Items/Knowledgebase/Announcement.php | 38 +++ .../Dashboard/Search/Announcement.php | 42 +++ 9 files changed, 1051 insertions(+) create mode 100755 Controller/Announcement.php create mode 100644 Entity/Announcement.php create mode 100644 Repository/AnnouncementRepository.php create mode 100644 Resources/views/Staff/Announcement/announcementForm.twig create mode 100644 Resources/views/Staff/Announcement/listAnnouncement.html.twig create mode 100644 UIComponents/Dashboard/Homepage/Items/Announcement.php create mode 100644 UIComponents/Dashboard/Panel/Items/Knowledgebase/Announcement.php create mode 100644 UIComponents/Dashboard/Search/Announcement.php diff --git a/Controller/Announcement.php b/Controller/Announcement.php new file mode 100755 index 0000000..15aac2e --- /dev/null +++ b/Controller/Announcement.php @@ -0,0 +1,124 @@ +translator = $translator; + $this->userService = $userService; + } + + public function listAnnouncement(Request $request) + { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_KNOWLEDGEBASE')) { + return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); + } + + return $this->render('@UVDeskSupportCenter/Staff/Announcement/listAnnouncement.html.twig'); + } + + public function listAnnouncementXHR(Request $request) + { + $json = array(); + $repository = $this->getDoctrine()->getRepository('UVDeskSupportCenterBundle:Announcement'); + $json = $repository->getAllAnnouncements($request->query, $this->container); + + $response = new Response(json_encode($json)); + $response->headers->set('Content-Type', 'application/json'); + return $response; + } + + public function updateAnnouncement(Request $request) + { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_KNOWLEDGEBASE')) { + return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); + } + + $em = $this->getDoctrine()->getManager(); + + if($request->attributes->get('id')){ + $announcement = $this->getDoctrine()->getRepository('UVDeskSupportCenterBundle:Announcement') + ->findOneBy([ + 'id' => $request->attributes->get('id') + ]); + $announcement->setCreatedAt(new \DateTime('now')); + if(!$announcement) + $this->noResultFound(); + } else { + $announcement = new Announcement; + $announcement->setCreatedAt(new \DateTime('now')); + } + + if($request->getMethod() == "POST") { + $request = $request->request->get('announcement_form'); + $group = $em->getRepository('UVDeskCoreFrameworkBundle:SupportGroup')->find($request['group']); + + $announcement->setTitle($request['title']); + $announcement->setPromoText($request['promotext']); + $announcement->setPromotag($request['promotag']); + $announcement->setTagColor($request['tagColor']); + $announcement->setLinkText($request['linkText']); + $announcement->setLinkURL($request['linkURL']); + $announcement->setIsActive($request['status']); + $announcement->setGroup($group); + $em->persist($announcement); + $em->flush(); + + $this->addFlash('success', 'Success! Announcement data saved successfully.'); + return $this->redirect($this->generateUrl('helpdesk_member_knowledgebase_marketing_announcement')); + + } + + return $this->render('@UVDeskSupportCenter/Staff/Announcement/announcementForm.html.twig', [ + 'announcement' => $announcement, + 'errors' => '' + ]); + } + + public function removeAnnouncementXHR(Request $request) + { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_KNOWLEDGEBASE')) { + return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); + } + + $entityManager = $this->getDoctrine()->getManager(); + $knowledgebaseAnnouncementId = $request->attributes->get('id'); + + $knowledgebaseAnnouncement = $entityManager->getRepository(Announcement::class)->findOneBy([ + 'id' => $knowledgebaseAnnouncementId + ]); + + if ($knowledgebaseAnnouncement) { + $entityManager->remove($knowledgebaseAnnouncement); + $entityManager->flush(); + + $json = [ + 'alertClass' => 'success', + 'alertMessage' => 'Announcement deleted successfully!', + ]; + $responseCode = 200; + } else { + $json = [ + 'alertClass' => 'warning', + 'alertMessage' => 'Announcement not found!', + ]; + } + + $response = new Response(json_encode($json)); + $response->headers->set('Content-Type', 'application/json'); + return $response; + } +} diff --git a/Entity/Announcement.php b/Entity/Announcement.php new file mode 100644 index 0000000..5680af9 --- /dev/null +++ b/Entity/Announcement.php @@ -0,0 +1,195 @@ +id; + } + + public function getGroup(): ?SupportGroup + { + return $this->group; + } + + public function setGroup(?SupportGroup $group): self + { + $this->group = $group; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(string $title): self + { + $this->title = $title; + + return $this; + } + + public function getPromoText(): ?string + { + return $this->promoText; + } + + public function setPromoText(string $promoText): self + { + $this->promoText = $promoText; + + return $this; + } + + public function getPromoTag(): ?string + { + return $this->promoTag; + } + + public function setPromoTag(string $promoTag): self + { + $this->promoTag = $promoTag; + + return $this; + } + + public function getTagColor(): ?string + { + return $this->tagColor; + } + + public function setTagColor(?string $tagColor): self + { + $this->tagColor = $tagColor; + + return $this; + } + + public function getLinkText(): ?string + { + return $this->linkText; + } + + public function setLinkText(string $linkText): self + { + $this->linkText = $linkText; + + return $this; + } + + public function getLinkUrl(): ?string + { + return $this->linkUrl; + } + + public function setLinkUrl(string $linkUrl): self + { + $this->linkUrl = $linkUrl; + + return $this; + } + + public function getIsActive(): ?bool + { + return $this->isActive; + } + + public function setIsActive(bool $isActive): self + { + $this->isActive = $isActive; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeInterface + { + return $this->createdAt; + } + + public function setCreatedAt(?\DateTimeInterface $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + public function getUpdatedAt(): ?\DateTimeInterface + { + return $this->updatedAt; + } + + public function setUpdatedAt(?\DateTimeInterface $updatedAt): self + { + $this->updatedAt = $updatedAt; + + return $this; + } +} diff --git a/Repository/AnnouncementRepository.php b/Repository/AnnouncementRepository.php new file mode 100644 index 0000000..0917e09 --- /dev/null +++ b/Repository/AnnouncementRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('a') + ->andWhere('a.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('a.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?Announcement + { + return $this->createQueryBuilder('a') + ->andWhere('a.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +} diff --git a/Resources/config/routes/private-customers.yaml b/Resources/config/routes/private-customers.yaml index 6d6e804..283f82d 100644 --- a/Resources/config/routes/private-customers.yaml +++ b/Resources/config/routes/private-customers.yaml @@ -81,3 +81,21 @@ helpdesk_customer_front_article_search: path: /search/article/{s} controller: Webkul\UVDesk\SupportCenterBundle\Controller\Customer::searchArticle defaults: { s: 0 } + +# Marketing Announcement section resources +helpdesk_member_knowledgebase_marketing_announcement: + path: /announcement/list + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncement + +helpdesk_member_knowledgebase_marketing_announcement_xhr: + path: /announcement/xhr + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncementXHR + +helpdesk_member_knowledgebase_create_marketing_announcement: + path: /knowledgebase/announcement/new + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement + +helpdesk_member_knowledgebase_update_marketing_announcement: + path: /knowledgebase/announcement/update/{announcementId} + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement + defaults: { announcementId: 0 } diff --git a/Resources/views/Staff/Announcement/announcementForm.twig b/Resources/views/Staff/Announcement/announcementForm.twig new file mode 100644 index 0000000..47be319 --- /dev/null +++ b/Resources/views/Staff/Announcement/announcementForm.twig @@ -0,0 +1,236 @@ +{% extends "@UVDeskCoreFramework//Templates//layout.html.twig" %} + +{% block title %}{{ 'Marketing Announcement'|trans }}{% endblock %} + +{% block pageContent %} +
+ {# Append Panel Aside #} + {% set asideTemplate = 'Webkul\\UVDesk\\CoreFrameworkBundle\\Dashboard\\AsideTemplate' %} + {% set asideSidebarReference = 'Webkul\\UVDesk\\SupportCenterBundle\\UIComponents\\Dashboard\\Panel\\Sidebars\\Knowledgebase' %} + + {{ uvdesk_extensibles.getRegisteredComponent(asideTemplate).renderSidebar(asideSidebarReference) | raw }} + +
+

+ {% if announcement.id %} + {{ 'Edit Announcement'|trans }} + {% else %} + {{ 'Add Announcement'|trans }} + {% endif %} +

+ + +
+ +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ Choose a promo tag +
+ + + +
+ +
+ +
+ Tag background color +
+ + + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ Choose a status +
+ + + +
+ +
+ +
+ Choose a group +
+ + + + + +
+ +
+
+{% endblock %} + +{% block footer %} + {{ parent() }} + +{% endblock %} \ No newline at end of file diff --git a/Resources/views/Staff/Announcement/listAnnouncement.html.twig b/Resources/views/Staff/Announcement/listAnnouncement.html.twig new file mode 100644 index 0000000..0370709 --- /dev/null +++ b/Resources/views/Staff/Announcement/listAnnouncement.html.twig @@ -0,0 +1,313 @@ +{% extends "@UVDeskCoreFramework//Templates//layout.html.twig" %} + +{% block title %} + {{ 'Marketing Announcement'|trans }} +{% endblock %} + +{% block pageContent %} + +
+ {# Append Panel Aside #} + {% set asideTemplate = 'Webkul\\UVDesk\\CoreFrameworkBundle\\Dashboard\\AsideTemplate' %} + {% set asideSidebarReference = 'Webkul\\UVDesk\\SupportCenterBundle\\UIComponents\\Dashboard\\Panel\\Sidebars\\Knowledgebase' %} + + {{ uvdesk_extensibles.getRegisteredComponent(asideTemplate).renderSidebar(asideSidebarReference) | raw }} + +
+

+ {{ 'Marketing Announcement'|trans }} +

+
+
+ +
+
+ {{ 'Sort By:'|trans }} {{ 'Created At'|trans }} +
+
+
+ +
    +
+
+
+
+ + + +
+
+ {{ 'Status:'|trans }} {{ 'All'|trans }} +
+
+ +
+
+ +
+ +
+ + +
+ + + + + + + + + + + + +
{{ "Name"|trans }}{{ "Group"|trans }}{{ "Advertisment"|trans }}{{ "Status"|trans }}{{ "Action"|trans }}
+ +
+
+
+{% endblock %} + +{% block footer %} + {{ parent() }} + + + + + + + + + + +{% endblock %} diff --git a/UIComponents/Dashboard/Homepage/Items/Announcement.php b/UIComponents/Dashboard/Homepage/Items/Announcement.php new file mode 100644 index 0000000..959e713 --- /dev/null +++ b/UIComponents/Dashboard/Homepage/Items/Announcement.php @@ -0,0 +1,35 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Marketing Announcement"; + } + + public static function getRouteName() : string + { + return 'helpdesk_member_knowledgebase_marketing_announcement'; + } + + public static function getSectionReferenceId() : string + { + return Knowledgebase::class; + } +} diff --git a/UIComponents/Dashboard/Panel/Items/Knowledgebase/Announcement.php b/UIComponents/Dashboard/Panel/Items/Knowledgebase/Announcement.php new file mode 100644 index 0000000..6652d2c --- /dev/null +++ b/UIComponents/Dashboard/Panel/Items/Knowledgebase/Announcement.php @@ -0,0 +1,38 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Marketing Announcement"; + } + + public static function getRouteName() : string + { + return 'helpdesk_member_knowledgebase_marketing_announcement'; + } + + public static function getRoles() : array + { + return ['ROLE_ADMIN','ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; + } + + public function getChildrenRoutes() : array + { + return []; + } +} From 1b430c22c79e78824d241186b8a532267a291ee3 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 16 Apr 2021 19:16:33 +0530 Subject: [PATCH 05/28] updates for marketing announcement --- Controller/Announcement.php | 14 +-- Repository/AnnouncementRepository.php | 95 ++++++++++++++----- Resources/config/routes/private-agents.yaml | 23 +++++ .../config/routes/private-customers.yaml | 20 +--- ...ntForm.twig => announcementForm.html.twig} | 2 +- .../Announcement/listAnnouncement.html.twig | 8 +- 6 files changed, 106 insertions(+), 56 deletions(-) rename Resources/views/Staff/Announcement/{announcementForm.twig => announcementForm.html.twig} (99%) diff --git a/Controller/Announcement.php b/Controller/Announcement.php index 15aac2e..2dcc0f0 100755 --- a/Controller/Announcement.php +++ b/Controller/Announcement.php @@ -5,12 +5,13 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Webkul\UVDesk\SupportCenterBundle\Entity\Website; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\SupportCenterBundle\Entity\Announcement as MarketingAnnouncement; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem; use Symfony\Component\Translation\TranslatorInterface; -Class Announcement extends AbstractController +Class Announcement extends Controller { private $translator; private $userService; @@ -35,7 +36,6 @@ public function listAnnouncementXHR(Request $request) $json = array(); $repository = $this->getDoctrine()->getRepository('UVDeskSupportCenterBundle:Announcement'); $json = $repository->getAllAnnouncements($request->query, $this->container); - $response = new Response(json_encode($json)); $response->headers->set('Content-Type', 'application/json'); return $response; @@ -49,19 +49,19 @@ public function updateAnnouncement(Request $request) $em = $this->getDoctrine()->getManager(); - if($request->attributes->get('id')){ + if($request->attributes->get('announcementId')){ $announcement = $this->getDoctrine()->getRepository('UVDeskSupportCenterBundle:Announcement') ->findOneBy([ - 'id' => $request->attributes->get('id') + 'id' => $request->attributes->get('announcementId') ]); $announcement->setCreatedAt(new \DateTime('now')); if(!$announcement) $this->noResultFound(); } else { - $announcement = new Announcement; + $announcement = new MarketingAnnouncement; $announcement->setCreatedAt(new \DateTime('now')); } - + if($request->getMethod() == "POST") { $request = $request->request->get('announcement_form'); $group = $em->getRepository('UVDeskCoreFrameworkBundle:SupportGroup')->find($request['group']); diff --git a/Repository/AnnouncementRepository.php b/Repository/AnnouncementRepository.php index 0917e09..31d3e44 100644 --- a/Repository/AnnouncementRepository.php +++ b/Repository/AnnouncementRepository.php @@ -5,6 +5,9 @@ use Webkul\UVDesk\SupportCenterBundle\Entity\Announcement; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Common\Persistence\ManagerRegistry; +use Doctrine\Common\Collections\Criteria; +use Doctrine\Common\Collections; +use Doctrine\ORM\Tools\Pagination\Paginator; /** * @method Announcement|null find($id, $lockMode = null, $lockVersion = null) @@ -14,37 +17,79 @@ */ class AnnouncementRepository extends ServiceEntityRepository { + public $safeFields = array('page','limit','sort','order','direction'); + const LIMIT = 10; + public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Announcement::class); } + - // /** - // * @return Announcement[] Returns an array of Announcement objects - // */ - /* - public function findByExampleField($value) + public function getAllAnnouncements(\Symfony\Component\HttpFoundation\ParameterBag $obj = null, $container) { - return $this->createQueryBuilder('a') - ->andWhere('a.exampleField = :val') - ->setParameter('val', $value) - ->orderBy('a.id', 'ASC') - ->setMaxResults(10) - ->getQuery() - ->getResult() - ; - } - */ + $json = array(); + $qb = $this->getEntityManager()->createQueryBuilder(); + $qb->select('a')->from($this->getEntityName(), 'a'); - /* - public function findOneBySomeField($value): ?Announcement - { - return $this->createQueryBuilder('a') - ->andWhere('a.exampleField = :val') - ->setParameter('val', $value) - ->getQuery() - ->getOneOrNullResult() - ; + $data = $obj->all(); + $data = array_reverse($data); + foreach ($data as $key => $value) { + if(!in_array($key,$this->safeFields)) { + if($key!='dateUpdated' AND $key!='dateAdded' AND $key!='search') { + $qb->Andwhere('a.'.$key.' = :'.$key); + $qb->setParameter($key, $value); + } else { + if($key == 'search') { + $qb->orwhere('a.title'.' LIKE :name'); + $qb->setParameter('name', '%'.urldecode($value).'%'); + $qb->orwhere('a.promoText'.' LIKE :promoText'); + $qb->setParameter('promoText', '%'.urldecode($value).'%'); + } + } + } + } + + if(!isset($data['sort'])){ + $qb->orderBy('a.id',Criteria::DESC); + } + + $paginator = $container->get('knp_paginator'); + + $results = $paginator->paginate( + $qb, + isset($data['page']) ? $data['page'] : 1, + self::LIMIT, + array('distinct' => false) + ); + + $newResult = []; + foreach ($results as $key => $result) { + $newResult[] = array( + 'id' => $result->getId(), + 'title' => $result->getTitle(), + 'promoText' => $result->getPromoText(), + 'promoTag' => $result->getPromoTag(), + 'tagColor' => $result->getTagColor(), + 'linkText' => $result->getLinkText(), + 'linkUrl' => $result->getLinkUrl(), + 'isActive' => $result->getIsActive(), + 'createdAt' => $result->getCreatedAt(), + 'group' => array( + 'id' => $result->getGroup()->getId(), + 'name' => $result->getGroup()->getName() + ) + ); + } + + $paginationData = $results->getPaginationData(); + $queryParameters = $results->getParams(); + + $paginationData['url'] = '#'.$container->get('uvdesk.service')->buildPaginationQuery($queryParameters); + + $json['groups'] = $newResult; + $json['pagination_data'] = $paginationData; + + return $json; } - */ } diff --git a/Resources/config/routes/private-agents.yaml b/Resources/config/routes/private-agents.yaml index 8cda20b..7605f90 100644 --- a/Resources/config/routes/private-agents.yaml +++ b/Resources/config/routes/private-agents.yaml @@ -132,3 +132,26 @@ helpdesk_member_knowledgebase_spam: helpdesk_member_knowledgebase_update_theme_xhr: path: /branding/ajax controller: Webkul\UVDesk\SupportCenterBundle\Controller\Branding::BrandingXhr + +# Marketing Announcement section resources +helpdesk_member_knowledgebase_marketing_announcement: + path: /announcement/list + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncement + +helpdesk_member_knowledgebase_marketing_announcement_xhr: + path: /announcement/xhr + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncementXHR + +helpdesk_member_knowledgebase_create_marketing_announcement: + path: /knowledgebase/announcement/new + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement + +helpdesk_member_knowledgebase_update_marketing_announcement: + path: /knowledgebase/announcement/update/{announcementId} + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement + defaults: { announcementId: 0 } + +helpdesk_member_knowledgebase_remove_marketing_announcement_xhr: + path: /knowledgebase/announcement/remove/{announcementId} + controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::removeAnnouncement + defaults: { announcementId: 0 } diff --git a/Resources/config/routes/private-customers.yaml b/Resources/config/routes/private-customers.yaml index 283f82d..a4afb11 100644 --- a/Resources/config/routes/private-customers.yaml +++ b/Resources/config/routes/private-customers.yaml @@ -80,22 +80,4 @@ helpdesk_customer_view_ticket_attachment: helpdesk_customer_front_article_search: path: /search/article/{s} controller: Webkul\UVDesk\SupportCenterBundle\Controller\Customer::searchArticle - defaults: { s: 0 } - -# Marketing Announcement section resources -helpdesk_member_knowledgebase_marketing_announcement: - path: /announcement/list - controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncement - -helpdesk_member_knowledgebase_marketing_announcement_xhr: - path: /announcement/xhr - controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::listAnnouncementXHR - -helpdesk_member_knowledgebase_create_marketing_announcement: - path: /knowledgebase/announcement/new - controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement - -helpdesk_member_knowledgebase_update_marketing_announcement: - path: /knowledgebase/announcement/update/{announcementId} - controller: Webkul\UVDesk\SupportCenterBundle\Controller\Announcement::updateAnnouncement - defaults: { announcementId: 0 } + defaults: { s: 0 } \ No newline at end of file diff --git a/Resources/views/Staff/Announcement/announcementForm.twig b/Resources/views/Staff/Announcement/announcementForm.html.twig similarity index 99% rename from Resources/views/Staff/Announcement/announcementForm.twig rename to Resources/views/Staff/Announcement/announcementForm.html.twig index 47be319..e3103c1 100644 --- a/Resources/views/Staff/Announcement/announcementForm.twig +++ b/Resources/views/Staff/Announcement/announcementForm.html.twig @@ -103,7 +103,7 @@
- + {{ "New Announcement"|trans }} @@ -137,7 +137,7 @@ +