Merge branch '676-new-ticket-types' into 'master'
Resolve "New ticket types" Closes #676 See merge request jankstudio/resq!790
This commit is contained in:
commit
80e61bbc92
17 changed files with 1916 additions and 325 deletions
|
|
@ -518,3 +518,38 @@ access_keys:
|
|||
label: Update
|
||||
- id: dealer.delete
|
||||
label: Delete
|
||||
|
||||
- id: database
|
||||
label: Database Access
|
||||
acls:
|
||||
- id: database.menu
|
||||
label: Menu
|
||||
|
||||
- id: ticket_type
|
||||
label: Ticket Type Access
|
||||
acls:
|
||||
- id: ticket_type.menu
|
||||
label: Menu
|
||||
- id: ticket_type.list
|
||||
label: List
|
||||
- id: ticket_type.add
|
||||
label: Add
|
||||
- id: ticket_type.update
|
||||
label: Update
|
||||
- id: ticket_type.delete
|
||||
label: Delete
|
||||
|
||||
- id: subticket_type
|
||||
label: Sub Ticket Type Access
|
||||
acls:
|
||||
- id: subticket_type.menu
|
||||
label: Menu
|
||||
- id: subticket_type.list
|
||||
label: List
|
||||
- id: subticket_type.add
|
||||
label: Add
|
||||
- id: subticket_type.update
|
||||
label: Update
|
||||
- id: subticket_type.delete
|
||||
label: Delete
|
||||
|
||||
|
|
|
|||
|
|
@ -224,3 +224,16 @@ main_menu:
|
|||
acl: analytics.forecast
|
||||
label: Forecasting
|
||||
parent: analytics
|
||||
|
||||
- id: database
|
||||
acl: database.menu
|
||||
label: Database
|
||||
icon: fa fa-database
|
||||
- id: ticket_type_list
|
||||
acl: ticket_type.menu
|
||||
label: Ticket Types
|
||||
parent: database
|
||||
- id: subticket_type_list
|
||||
acl: subticket_type.menu
|
||||
label: Sub Ticket Types
|
||||
parent: database
|
||||
|
|
|
|||
35
config/routes/subticket_type.yaml
Normal file
35
config/routes/subticket_type.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
subticket_type_list:
|
||||
path: /subticket-types
|
||||
controller: App\Controller\SubTicketTypeController::index
|
||||
methods: [GET]
|
||||
|
||||
subticket_type_rows:
|
||||
path: /subticket-types/rowdata
|
||||
controller: App\Controller\SubTicketTypeController::datatableRows
|
||||
methods: [POST]
|
||||
|
||||
subticket_type_add_form:
|
||||
path: /subticket-types/newform
|
||||
controller: App\Controller\SubTicketTypeController::addForm
|
||||
methods: [GET]
|
||||
|
||||
subticket_type_add_submit:
|
||||
path: /subticket-types
|
||||
controller: App\Controller\SubTicketTypeController::addSubmit
|
||||
methods: [POST]
|
||||
|
||||
subticket_type_update_form:
|
||||
path: /subticket-types/{id}
|
||||
controller: App\Controller\SubTicketTypeController::updateForm
|
||||
methods: [GET]
|
||||
|
||||
subticket_type_update_submit:
|
||||
path: /subticket-types/{id}
|
||||
controller: App\Controller\SubTicketTypeController::updateSubmit
|
||||
methods: [POST]
|
||||
|
||||
subticket_type_delete:
|
||||
path: /subticket-types/{id}
|
||||
controller: App\Controller\SubTicketTypeController::deleteSubmit
|
||||
methods: [DELETE]
|
||||
|
||||
35
config/routes/ticket_type.yaml
Normal file
35
config/routes/ticket_type.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
ticket_type_list:
|
||||
path: /ticket-types
|
||||
controller: App\Controller\TicketTypeController::index
|
||||
methods: [GET]
|
||||
|
||||
ticket_type_rows:
|
||||
path: /ticket-types/rowdata
|
||||
controller: App\Controller\TicketTypeController::datatableRows
|
||||
methods: [POST]
|
||||
|
||||
ticket_type_add_form:
|
||||
path: /ticket-types/newform
|
||||
controller: App\Controller\TicketTypeController::addForm
|
||||
methods: [GET]
|
||||
|
||||
ticket_type_add_submit:
|
||||
path: /ticket-types
|
||||
controller: App\Controller\TicketTypeController::addSubmit
|
||||
methods: [POST]
|
||||
|
||||
ticket_type_update_form:
|
||||
path: /ticket-types/{id}
|
||||
controller: App\Controller\TicketTypeController::updateForm
|
||||
methods: [GET]
|
||||
|
||||
ticket_type_update_submit:
|
||||
path: /ticket-types/{id}
|
||||
controller: App\Controller\TicketTypeController::updateSubmit
|
||||
methods: [POST]
|
||||
|
||||
ticket_type_delete:
|
||||
path: /ticket-types/{id}
|
||||
controller: App\Controller\TicketTypeController::deleteSubmit
|
||||
methods: [DELETE]
|
||||
|
||||
276
src/Controller/SubTicketTypeController.php
Normal file
276
src/Controller/SubTicketTypeController.php
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\SubTicketType;
|
||||
use App\Entity\TicketType;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
class SubTicketTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="subticket_type_list")
|
||||
* @IsGranted("subticket_type.list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->render('subticket-type/list.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("subticket_type.list")
|
||||
*/
|
||||
public function datatableRows(Request $req)
|
||||
{
|
||||
// get query builder
|
||||
$qb = $this->getDoctrine()
|
||||
->getRepository(SubTicketType::class)
|
||||
->createQueryBuilder('q');
|
||||
|
||||
// get datatable params
|
||||
$datatable = $req->request->get('datatable');
|
||||
|
||||
// count total records
|
||||
$tquery = $qb->select('COUNT(q)');
|
||||
$this->setQueryFilters($datatable, $tquery);
|
||||
$total = $tquery->getQuery()
|
||||
->getSingleScalarResult();
|
||||
|
||||
// get current page number
|
||||
$page = $datatable['pagination']['page'] ?? 1;
|
||||
|
||||
$perpage = $datatable['pagination']['perpage'];
|
||||
$offset = ($page - 1) * $perpage;
|
||||
|
||||
// add metadata
|
||||
$meta = [
|
||||
'page' => $page,
|
||||
'perpage' => $perpage,
|
||||
'pages' => ceil($total / $perpage),
|
||||
'total' => $total,
|
||||
'sort' => 'asc',
|
||||
'field' => 'id'
|
||||
];
|
||||
|
||||
// build query
|
||||
$query = $qb->select('q');
|
||||
$this->setQueryFilters($datatable, $query);
|
||||
|
||||
// check if sorting is present, otherwise use default
|
||||
if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) {
|
||||
$order = $datatable['sort']['sort'] ?? 'asc';
|
||||
$query->orderBy('q.' . $datatable['sort']['field'], $order);
|
||||
} else {
|
||||
$query->orderBy('q.id', 'asc');
|
||||
}
|
||||
|
||||
// get rows for this page
|
||||
$obj_rows = $query->setFirstResult($offset)
|
||||
->setMaxResults($perpage)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
// process rows
|
||||
$rows = [];
|
||||
foreach ($obj_rows as $orow) {
|
||||
// add row data
|
||||
$row['id'] = $orow->getID();
|
||||
$row['name'] = $orow->getName();
|
||||
|
||||
// add row metadata
|
||||
$row['meta'] = [
|
||||
'update_url' => '',
|
||||
'delete_url' => ''
|
||||
];
|
||||
|
||||
// add crud urls
|
||||
if ($this->isGranted('subticket_type.update'))
|
||||
$row['meta']['update_url'] = $this->generateUrl('subticket_type_update_form', ['id' => $row['id']]);
|
||||
if ($this->isGranted('subticket_type.delete'))
|
||||
$row['meta']['delete_url'] = $this->generateUrl('subticket_type_delete', ['id' => $row['id']]);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
// response
|
||||
return $this->json([
|
||||
'meta' => $meta,
|
||||
'data' => $rows
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="subticket_type.list")
|
||||
* @IsGranted("subticket_type.add")
|
||||
*/
|
||||
public function addForm(EntityManagerInterface $em)
|
||||
{
|
||||
$subticket_type = new SubTicketType();
|
||||
|
||||
$params = [
|
||||
'subticket_type' => $subticket_type,
|
||||
'mode' => 'create',
|
||||
'sets' => $this->generateFormSets($em),
|
||||
];
|
||||
|
||||
// response
|
||||
return $this->render('subticket-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("subticket_type.add")
|
||||
*/
|
||||
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
||||
{
|
||||
$subticket_type = new SubTicketType();
|
||||
|
||||
$this->setObject($subticket_type, $req, $em);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($subticket_type);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
||||
}
|
||||
|
||||
// check if any errors were found
|
||||
if (!empty($error_array)) {
|
||||
// return validation failure response
|
||||
return $this->json([
|
||||
'success' => false,
|
||||
'errors' => $error_array
|
||||
], 422);
|
||||
}
|
||||
|
||||
// validated! save the entity
|
||||
$em->persist($subticket_type);
|
||||
$em->flush();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="subticket_type_list")
|
||||
* @ParamConverter("subticket_type", class="App\Entity\SubTicketType")
|
||||
* @IsGranted("subticket_type.update")
|
||||
*/
|
||||
public function updateForm($id, EntityManagerInterface $em, SubTicketType $subticket_type)
|
||||
{
|
||||
$params = [
|
||||
'subticket_type' => $subticket_type,
|
||||
'mode' => 'update',
|
||||
'sets' => $this->generateFormSets($em),
|
||||
];
|
||||
|
||||
// response
|
||||
return $this->render('subticket-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("subticket_type", class="App\Entity\SubTicketType")
|
||||
* @IsGranted("subticket_type.update")
|
||||
*/
|
||||
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, SubTicketType $subticket_type)
|
||||
{
|
||||
$this->setObject($subticket_type, $req, $em);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($subticket_type);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
||||
}
|
||||
|
||||
// check if any errors were found
|
||||
if (!empty($error_array)) {
|
||||
// return validation failure response
|
||||
return $this->json([
|
||||
'success' => false,
|
||||
'errors' => $error_array
|
||||
], 422);
|
||||
}
|
||||
|
||||
// validated! save the entity
|
||||
$em->flush();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("subticket_type", class="App\Entity\SubTicketType")
|
||||
* @IsGranted("subticket_type.update")
|
||||
*/
|
||||
public function deleteSubmit(EntityManagerInterface $em, SubTicketType $subticket_type)
|
||||
{
|
||||
// delete this object
|
||||
$em->remove($subticket_type);
|
||||
$em->flush();
|
||||
|
||||
// response
|
||||
$response = new Response();
|
||||
$response->setStatusCode(Response::HTTP_OK);
|
||||
$response->send();
|
||||
}
|
||||
|
||||
protected function setObject(SubTicketType $obj, Request $req, EntityManagerInterface $em)
|
||||
{
|
||||
// get the ticket type id
|
||||
$ttype_id = $req->request->get('ticket_type_id', 0);
|
||||
$ttype = $em->getRepository(TicketType::class)->find($ttype_id);
|
||||
|
||||
// set and save values
|
||||
$obj->setName($req->request->get('name'))
|
||||
->setTicketType($ttype);
|
||||
}
|
||||
|
||||
protected function generateFormSets(EntityManagerInterface $em)
|
||||
{
|
||||
// get ticket types
|
||||
$ttypes = $em->getRepository(TicketType::class)->findBy([], ['name' => 'asc']);
|
||||
$ttypes_set = [];
|
||||
foreach ($ttypes as $ttype)
|
||||
{
|
||||
$ttypes_set[$ttype->getID()] = $ttype->getName();
|
||||
}
|
||||
|
||||
return [
|
||||
'ticket_types' => $ttypes_set,
|
||||
];
|
||||
}
|
||||
|
||||
protected function setQueryFilters($datatable, QueryBuilder $query)
|
||||
{
|
||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
||||
$query->where('q.name LIKE :filter')
|
||||
->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -9,8 +9,11 @@ use App\Ramcar\SourceOfAwareness;
|
|||
use App\Entity\Ticket;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\JobOrder;
|
||||
use App\Entity\TicketType as NewTicketType;
|
||||
use App\Entity\SubTicketType;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
|
@ -128,7 +131,7 @@ class TicketController extends Controller
|
|||
/**
|
||||
* @Menu(selected="ticket_list")
|
||||
*/
|
||||
public function addForm(Request $req, $customer_id, $job_order_id)
|
||||
public function addForm(Request $req, EntityManagerInterface $em, $customer_id, $job_order_id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ticket.add', null, 'No access.');
|
||||
|
||||
|
|
@ -140,7 +143,6 @@ class TicketController extends Controller
|
|||
|
||||
// get customer data
|
||||
if ($customer_id) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$customer = $em->getRepository(Customer::class)->find($customer_id);
|
||||
|
||||
// make sure this row exists
|
||||
|
|
@ -176,6 +178,8 @@ class TicketController extends Controller
|
|||
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
||||
$params['soa_types'] = SourceOfAwareness::getCollection();
|
||||
|
||||
$params['sets'] = $this->generateFormSets($em);
|
||||
|
||||
// set redirect url
|
||||
if ($customer)
|
||||
{
|
||||
|
|
@ -236,12 +240,16 @@ class TicketController extends Controller
|
|||
$obj = new Ticket();
|
||||
|
||||
// get ticket type
|
||||
$ticket_type = $req->request->get('ticket_type');
|
||||
$other_ticket_type = '';
|
||||
//$ticket_type = $req->request->get('ticket_type');
|
||||
//$other_ticket_type = '';
|
||||
|
||||
if ($ticket_type == TicketType::OTHER) {
|
||||
$other_ticket_type = $req->request->get('other_ticket_type');
|
||||
}
|
||||
//if ($ticket_type == TicketType::OTHER) {
|
||||
// $other_ticket_type = $req->request->get('other_ticket_type');
|
||||
//}
|
||||
|
||||
// get the "new" ticket type
|
||||
$ttype_id = $req->request->get('new_ticket_type');
|
||||
$sub_ttype_id = $req->request->get('sub_ticket_type');
|
||||
|
||||
// get source of awareness if any
|
||||
$soa_type = $req->request->get('source_of_awareness');
|
||||
|
|
@ -254,8 +262,8 @@ class TicketController extends Controller
|
|||
->setLastName($last_name)
|
||||
->setContactNumber($contact_num)
|
||||
->setStatus($req->request->get('status'))
|
||||
->setTicketType($ticket_type)
|
||||
->setOtherTicketType($other_ticket_type)
|
||||
//->setTicketType($ticket_type)
|
||||
//->setOtherTicketType($other_ticket_type)
|
||||
->setDetails($req->request->get('details'))
|
||||
->setPlateNumber($req->request->get('plate_number'))
|
||||
->setDateCreate(new DateTime())
|
||||
|
|
@ -280,9 +288,21 @@ class TicketController extends Controller
|
|||
$errors = $validator->validate($obj);
|
||||
|
||||
// custom validation for other ticket type
|
||||
if ($ticket_type == TicketType::OTHER && empty($other_ticket_type)) {
|
||||
$error_array['other_ticket_type'] = 'Ticket type not specified.';
|
||||
}
|
||||
//if ($ticket_type == TicketType::OTHER && empty($other_ticket_type)) {
|
||||
// $error_array['other_ticket_type'] = 'Ticket type not specified.';
|
||||
//}
|
||||
// get ticket and sub ticket type objects
|
||||
$ttype = $em->getRepository(NewTicketType::class)->find($ttype_id);
|
||||
if (empty($ttype))
|
||||
$error_array['new_ticket_type'] = 'Ticket type not specified.';
|
||||
|
||||
$sub_ttype = $em->getRepository(SubTicketType::class)->find($sub_ttype_id);
|
||||
if (empty($sub_ttype))
|
||||
$error_array['sub_ticket_type'] = 'Sub ticket type not specified.';
|
||||
|
||||
// set the ticket type and sub ticket type for ticket
|
||||
$obj->setNewTicketType($ttype)
|
||||
->setSubTicketType($sub_ttype);
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
|
|
@ -311,22 +331,19 @@ class TicketController extends Controller
|
|||
/**
|
||||
* @Menu(selected="ticket_list")
|
||||
*/
|
||||
public function updateForm(Request $req, $id)
|
||||
public function updateForm(Request $req, $id, EntityManagerInterface $em)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ticket.update', null, 'No access.');
|
||||
|
||||
$params['mode'] = 'update';
|
||||
|
||||
// get row data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(Ticket::class)->find($id);
|
||||
|
||||
// make sure this row exists
|
||||
if (empty($obj))
|
||||
throw $this->createNotFoundException('The item does not exist');
|
||||
|
||||
// $em = $this->getDoctrine()->getManager();
|
||||
|
||||
$customer = $obj->getCustomer();
|
||||
$job_order = $obj->getJobOrder();
|
||||
|
||||
|
|
@ -339,6 +356,8 @@ class TicketController extends Controller
|
|||
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
||||
$params['soa_types'] = SourceOfAwareness::getCollection();
|
||||
|
||||
$params['sets'] = $this->generateFormSets($em);
|
||||
|
||||
// set redirect url
|
||||
if ($customer)
|
||||
{
|
||||
|
|
@ -428,12 +447,16 @@ class TicketController extends Controller
|
|||
}
|
||||
|
||||
// get ticket type
|
||||
$ticket_type = $req->request->get('ticket_type');
|
||||
$other_ticket_type = '';
|
||||
//$ticket_type = $req->request->get('ticket_type');
|
||||
//$other_ticket_type = '';
|
||||
|
||||
if ($ticket_type == TicketType::OTHER) {
|
||||
$other_ticket_type = $req->request->get('other_ticket_type');
|
||||
}
|
||||
//if ($ticket_type == TicketType::OTHER) {
|
||||
// $other_ticket_type = $req->request->get('other_ticket_type');
|
||||
//}
|
||||
|
||||
// get the "new" ticket type
|
||||
$ttype_id = $req->request->get('new_ticket_type');
|
||||
$sub_ttype_id = $req->request->get('sub_ticket_type');
|
||||
|
||||
// get source of awareness if any
|
||||
$soa_type = $req->request->get('source_of_awareness');
|
||||
|
|
@ -446,8 +469,8 @@ class TicketController extends Controller
|
|||
->setLastName($last_name)
|
||||
->setContactNumber($contact_num)
|
||||
->setStatus($req->request->get('status'))
|
||||
->setTicketType($ticket_type)
|
||||
->setOtherTicketType($other_ticket_type)
|
||||
//->setTicketType($ticket_type)
|
||||
//->setOtherTicketType($other_ticket_type)
|
||||
->setDetails($req->request->get('details'))
|
||||
->setPlateNumber($req->request->get('plate_number'))
|
||||
->setSourceOfAwareness($soa_type)
|
||||
|
|
@ -460,9 +483,21 @@ class TicketController extends Controller
|
|||
$errors = $validator->validate($obj);
|
||||
|
||||
// custom validation for other ticket type
|
||||
if ($ticket_type == TicketType::OTHER && empty($other_ticket_type)) {
|
||||
$error_array['other_ticket_type'] = 'Ticket type not specified.';
|
||||
}
|
||||
//if ($ticket_type == TicketType::OTHER && empty($other_ticket_type)) {
|
||||
// $error_array['other_ticket_type'] = 'Ticket type not specified.';
|
||||
//}
|
||||
// get ticket and sub ticket type objects
|
||||
$ttype = $em->getRepository(NewTicketType::class)->find($ttype_id);
|
||||
if (empty($ttype))
|
||||
$error_array['new_ticket_type'] = 'Ticket type not specified.';
|
||||
|
||||
$sub_ttype = $em->getRepository(SubTicketType::class)->find($sub_ttype_id);
|
||||
if (empty($sub_ttype))
|
||||
$error_array['sub_ticket_type'] = 'Sub ticket type not specified.';
|
||||
|
||||
// set the ticket type and sub ticket type for ticket
|
||||
$obj->setNewTicketType($ttype)
|
||||
->setSubTicketType($sub_ttype);
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
|
|
@ -508,6 +543,35 @@ class TicketController extends Controller
|
|||
$response->send();
|
||||
}
|
||||
|
||||
protected function generateFormSets(EntityManagerInterface $em)
|
||||
{
|
||||
// get ticket types
|
||||
$ttypes = $em->getRepository(NewTicketType::class)->findBy([], ['name' => 'asc']);
|
||||
$ttypes_set = [];
|
||||
foreach ($ttypes as $ttype)
|
||||
{
|
||||
$ttypes_set[$ttype->getID()] = $ttype->getName();
|
||||
}
|
||||
|
||||
// get sub ticket types
|
||||
$sub_ttypes = $em->getRepository(SubTicketType::class)->findBy([], ['name' => 'asc']);
|
||||
$sub_ttypes_set = [];
|
||||
foreach ($sub_ttypes as $sub_ttype)
|
||||
{
|
||||
$sub_ttypes_set[] = [
|
||||
'id' => $sub_ttype->getID(),
|
||||
'name' => $sub_ttype->getName(),
|
||||
'ticket_type_id' => $sub_ttype->getTicketType()->getID(),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'new_ticket_types' => $ttypes_set,
|
||||
'sub_ticket_types' => $sub_ttypes_set,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// check if datatable filter is present and append to query
|
||||
protected function setQueryFilters($datatable, &$query, $qb) {
|
||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
||||
|
|
|
|||
254
src/Controller/TicketTypeController.php
Normal file
254
src/Controller/TicketTypeController.php
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\TicketType;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
class TicketTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="ticket_type_list")
|
||||
* @IsGranted("ticket_type.list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ticket_type.list', null, 'No access.');
|
||||
|
||||
return $this->render('ticket-type/list.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("ticket_type.list")
|
||||
*/
|
||||
public function datatableRows(Request $req)
|
||||
{
|
||||
// get query builder
|
||||
$qb = $this->getDoctrine()
|
||||
->getRepository(TicketType::class)
|
||||
->createQueryBuilder('q');
|
||||
|
||||
// get datatable params
|
||||
$datatable = $req->request->get('datatable');
|
||||
|
||||
// count total records
|
||||
$tquery = $qb->select('COUNT(q)');
|
||||
$this->setQueryFilters($datatable, $tquery);
|
||||
$total = $tquery->getQuery()
|
||||
->getSingleScalarResult();
|
||||
|
||||
// get current page number
|
||||
$page = $datatable['pagination']['page'] ?? 1;
|
||||
|
||||
$perpage = $datatable['pagination']['perpage'];
|
||||
$offset = ($page - 1) * $perpage;
|
||||
|
||||
// add metadata
|
||||
$meta = [
|
||||
'page' => $page,
|
||||
'perpage' => $perpage,
|
||||
'pages' => ceil($total / $perpage),
|
||||
'total' => $total,
|
||||
'sort' => 'asc',
|
||||
'field' => 'id'
|
||||
];
|
||||
|
||||
// build query
|
||||
$query = $qb->select('q');
|
||||
$this->setQueryFilters($datatable, $query);
|
||||
|
||||
// check if sorting is present, otherwise use default
|
||||
if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) {
|
||||
$order = $datatable['sort']['sort'] ?? 'asc';
|
||||
$query->orderBy('q.' . $datatable['sort']['field'], $order);
|
||||
} else {
|
||||
$query->orderBy('q.id', 'asc');
|
||||
}
|
||||
|
||||
// get rows for this page
|
||||
$obj_rows = $query->setFirstResult($offset)
|
||||
->setMaxResults($perpage)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
// process rows
|
||||
$rows = [];
|
||||
foreach ($obj_rows as $orow) {
|
||||
// add row data
|
||||
$row['id'] = $orow->getID();
|
||||
$row['name'] = $orow->getName();
|
||||
|
||||
// add row metadata
|
||||
$row['meta'] = [
|
||||
'update_url' => '',
|
||||
'delete_url' => ''
|
||||
];
|
||||
|
||||
// add crud urls
|
||||
if ($this->isGranted('ticket_type.update'))
|
||||
$row['meta']['update_url'] = $this->generateUrl('ticket_type_update_form', ['id' => $row['id']]);
|
||||
if ($this->isGranted('ticket_type.delete'))
|
||||
$row['meta']['delete_url'] = $this->generateUrl('ticket_type_delete', ['id' => $row['id']]);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
// response
|
||||
return $this->json([
|
||||
'meta' => $meta,
|
||||
'data' => $rows
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="ticket_type.list")
|
||||
* @IsGranted("ticket_type.add")
|
||||
*/
|
||||
public function addForm()
|
||||
{
|
||||
$ticket_type = new TicketType();
|
||||
$params = [
|
||||
'ticket_type' => $ticket_type,
|
||||
'mode' => 'create',
|
||||
];
|
||||
|
||||
// response
|
||||
return $this->render('ticket-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("ticket_type.add")
|
||||
*/
|
||||
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
||||
{
|
||||
$ticket_type = new TicketType();
|
||||
|
||||
$this->setObject($ticket_type, $req);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($ticket_type);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
||||
}
|
||||
|
||||
// check if any errors were found
|
||||
if (!empty($error_array)) {
|
||||
// return validation failure response
|
||||
return $this->json([
|
||||
'success' => false,
|
||||
'errors' => $error_array
|
||||
], 422);
|
||||
}
|
||||
|
||||
// validated! save the entity
|
||||
$em->persist($ticket_type);
|
||||
$em->flush();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="ticket_type_list")
|
||||
* @ParamConverter("ticket_type", class="App\Entity\TicketType")
|
||||
* @IsGranted("ticket_type.update")
|
||||
*/
|
||||
public function updateForm($id, EntityManagerInterface $em, TicketType $ticket_type)
|
||||
{
|
||||
$params = [];
|
||||
$params['ticket_type'] = $ticket_type;
|
||||
$params['mode'] = 'update';
|
||||
|
||||
// response
|
||||
return $this->render('ticket-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("ticket_type", class="App\Entity\TicketType")
|
||||
* @IsGranted("ticket_type.update")
|
||||
*/
|
||||
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, TicketType $ticket_type)
|
||||
{
|
||||
$this->setObject($ticket_type, $req);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($ticket_type);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
||||
// add errors to list
|
||||
foreach ($errors as $error) {
|
||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
||||
}
|
||||
|
||||
// check if any errors were found
|
||||
if (!empty($error_array)) {
|
||||
// return validation failure response
|
||||
return $this->json([
|
||||
'success' => false,
|
||||
'errors' => $error_array
|
||||
], 422);
|
||||
}
|
||||
|
||||
// validated! save the entity
|
||||
$em->flush();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("ticket_type", class="App\Entity\TicketType")
|
||||
* @IsGranted("ticket_type.update")
|
||||
*/
|
||||
public function deleteSubmit(EntityManagerInterface $em, TicketType $ticket_type)
|
||||
{
|
||||
// delete this object
|
||||
$em->remove($ticket_type);
|
||||
$em->flush();
|
||||
|
||||
// response
|
||||
$response = new Response();
|
||||
$response->setStatusCode(Response::HTTP_OK);
|
||||
$response->send();
|
||||
}
|
||||
|
||||
|
||||
protected function setObject(TicketType $obj, Request $req)
|
||||
{
|
||||
// set and save values
|
||||
$obj->setName($req->request->get('name'));
|
||||
}
|
||||
|
||||
protected function setQueryFilters($datatable, QueryBuilder $query)
|
||||
{
|
||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
||||
$query->where('q.name LIKE :filter')
|
||||
->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
63
src/Entity/SubTicketType.php
Normal file
63
src/Entity/SubTicketType.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="subticket_type")
|
||||
*/
|
||||
class SubTicketType
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// ticket type
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="TicketType")
|
||||
* @ORM\JoinColumn(name="ticket_type_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $ticket_type;
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setTicketType(TicketType $ticket_type)
|
||||
{
|
||||
$this->ticket_type = $ticket_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTicketType()
|
||||
{
|
||||
return $this->ticket_type;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Ramcar\TicketType;
|
||||
use App\Ramcar\TicketType as LegacyTicketType;
|
||||
use App\Ramcar\TicketStatus;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
|
@ -44,8 +44,7 @@ class Ticket
|
|||
|
||||
// ticket type
|
||||
/**
|
||||
* @ORM\Column(type="string", length=15)
|
||||
* @Assert\NotBlank()
|
||||
* @ORM\Column(type="string", length=15, nullable=true)
|
||||
*/
|
||||
protected $ticket_type;
|
||||
|
||||
|
|
@ -120,6 +119,20 @@ class Ticket
|
|||
*/
|
||||
protected $remarks;
|
||||
|
||||
// new ticket type
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="TicketType", inversedBy="tickets")
|
||||
* @ORM\JoinColumn(name="ticket_type_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $new_ticket_type;
|
||||
|
||||
// sub ticket type
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="SubTicketType", inversedBy="subtickets")
|
||||
* @ORM\JoinColumn(name="subticket_type_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $subticket_type;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -182,10 +195,10 @@ class Ticket
|
|||
|
||||
public function getTicketTypeText()
|
||||
{
|
||||
if ($this->ticket_type == TicketType::OTHER) {
|
||||
if ($this->ticket_type == LegacyTicketType::OTHER) {
|
||||
return $this->other_ticket_type;
|
||||
} else {
|
||||
$types = TicketType::getCollection();
|
||||
$types = LegacyTicketType::getCollection();
|
||||
return $types[$this->ticket_type] ?? "";
|
||||
}
|
||||
}
|
||||
|
|
@ -300,4 +313,25 @@ class Ticket
|
|||
return $this->remarks;
|
||||
}
|
||||
|
||||
public function setNewTicketType(TicketType $new_ticket_type = null)
|
||||
{
|
||||
$this->new_ticket_type = $new_ticket_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNewTicketType()
|
||||
{
|
||||
return $this->new_ticket_type;
|
||||
}
|
||||
|
||||
public function setSubTicketType(SubTicketType $subticket_type = null)
|
||||
{
|
||||
$this->subticket_type = $subticket_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSubTicketType()
|
||||
{
|
||||
return $this->subticket_type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
45
src/Entity/TicketType.php
Normal file
45
src/Entity/TicketType.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="ticket_type")
|
||||
* })
|
||||
*/
|
||||
class TicketType
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25)a
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
150
templates/subticket-type/form.html.twig
Normal file
150
templates/subticket-type/form.html.twig
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<!-- BEGIN: Subheader -->
|
||||
<div class="m-subheader">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-auto">
|
||||
<h3 class="m-subheader__title">Sub Ticket Types</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Subheader -->
|
||||
<div class="m-content">
|
||||
<!--Begin::Section-->
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<div class="m-portlet__head">
|
||||
<div class="m-portlet__head-caption">
|
||||
<div class="m-portlet__head-title">
|
||||
<span class="m-portlet__head-icon">
|
||||
<i class="la la-industry"></i>
|
||||
</span>
|
||||
<h3 class="m-portlet__head-text">
|
||||
{% if mode == 'update' %}
|
||||
Edit Sub Ticket Type
|
||||
<small>{{ subticket_type.getName() }}</small>
|
||||
{% else %}
|
||||
New Sub Ticket Type
|
||||
{% endif %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('subticket_type_update_submit', {'id': subticket_type.getId()}) : url('subticket_type_add_submit') }}">
|
||||
<div class="m-portlet__body">
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<label class="col-lg-3 col-form-label" data-field="name">
|
||||
Name:
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<input type="text" name="name" class="form-control m-input" value="{{ subticket_type.getName() }}">
|
||||
<div class="form-control-feedback hide" data-field="name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<label class="col-lg-3 col-form-label" data-field="name">
|
||||
Ticket Type:
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<select class="form-control m-input" id="ticket-type" name="ticket_type_id">
|
||||
{% for id, label in sets.ticket_types %}
|
||||
{% if subticket_type.getTicketType %}
|
||||
<option value="{{ id }}"{{ subticket_type.getTicketType.getID == id ? ' selected' }}>{{ label }}</option>
|
||||
{% else %}
|
||||
<option value="{{ id }}">{{ label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="ticket_type_id"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<a href="{{ url('subticket_type_list') }}" class="btn btn-secondary">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(function() {
|
||||
$("#row-form").submit(function(e) {
|
||||
var form = $(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: form.prop('action'),
|
||||
data: form.serialize()
|
||||
}).done(function(response) {
|
||||
// remove all error classes
|
||||
removeErrors();
|
||||
swal({
|
||||
title: 'Done!',
|
||||
text: 'Your changes have been saved!',
|
||||
type: 'success',
|
||||
onClose: function() {
|
||||
window.location.href = "{{ url('subticket_type_list') }}";
|
||||
}
|
||||
});
|
||||
}).fail(function(response) {
|
||||
if (response.status == 422) {
|
||||
var errors = response.responseJSON.errors;
|
||||
var firstfield = false;
|
||||
|
||||
// remove all error classes first
|
||||
removeErrors();
|
||||
|
||||
// display errors contextually
|
||||
$.each(errors, function(field, msg) {
|
||||
var formfield = $("[name='" + field + "']");
|
||||
var label = $("label[data-field='" + field + "']");
|
||||
var msgbox = $(".form-control-feedback[data-field='" + field + "']");
|
||||
|
||||
// add error classes to bad fields
|
||||
formfield.addClass('form-control-danger');
|
||||
label.addClass('has-danger');
|
||||
msgbox.html(msg).addClass('has-danger').removeClass('hide');
|
||||
|
||||
// check if this field comes first in DOM
|
||||
var domfield = formfield.get(0);
|
||||
|
||||
if (!firstfield || (firstfield && firstfield.compareDocumentPosition(domfield) === 2)) {
|
||||
firstfield = domfield;
|
||||
}
|
||||
});
|
||||
|
||||
// focus on first bad field
|
||||
firstfield.focus();
|
||||
|
||||
// scroll to above that field to make it visible
|
||||
$('html, body').animate({
|
||||
scrollTop: $(firstfield).offset().top - 200
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// remove all error classes
|
||||
function removeErrors() {
|
||||
$(".form-control-danger").removeClass('form-control-danger');
|
||||
$("[data-field]").removeClass('has-danger');
|
||||
$(".form-control-feedback[data-field]").addClass('hide');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
146
templates/subticket-type/list.html.twig
Normal file
146
templates/subticket-type/list.html.twig
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<!-- BEGIN: Subheader -->
|
||||
<div class="m-subheader">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-auto">
|
||||
<h3 class="m-subheader__title">
|
||||
Sub Ticket Types
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Subheader -->
|
||||
<div class="m-content">
|
||||
<!--Begin::Section-->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<div class="m-portlet__body">
|
||||
<div class="m-form m-form--label-align-right m--margin-top-20 m--margin-bottom-30">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-xl-8 order-2 order-xl-1">
|
||||
<div class="form-group m-form__group row align-items-center">
|
||||
<div class="col-md-4">
|
||||
<div class="m-input-icon m-input-icon--left">
|
||||
<input type="text" class="form-control m-input m-input--solid" placeholder="Search..." id="data-rows-search">
|
||||
<span class="m-input-icon__icon m-input-icon__icon--left">
|
||||
<span><i class="la la-search"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 order-1 order-xl-2 m--align-right">
|
||||
<a href="{{ url('subticket_type_add_form') }}" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
|
||||
<span>
|
||||
<i class="la la-industry"></i>
|
||||
<span>New Sub Ticket Type</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="m-separator m-separator--dashed d-xl-none"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--begin: Datatable -->
|
||||
<div id="data-rows"></div>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(function() {
|
||||
var options = {
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: '{{ url("subticket_type_rows") }}',
|
||||
method: 'POST'
|
||||
}
|
||||
},
|
||||
saveState: {
|
||||
cookie: false,
|
||||
webstorage: false
|
||||
},
|
||||
pageSize: 10,
|
||||
serverPaging: true,
|
||||
serverFiltering: true,
|
||||
serverSorting: true
|
||||
},
|
||||
layout: {
|
||||
scroll: true
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
width: 30
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: 'Name'
|
||||
},
|
||||
{
|
||||
field: 'Actions',
|
||||
width: 110,
|
||||
title: 'Actions',
|
||||
sortable: false,
|
||||
overflow: 'visible',
|
||||
template: function (row, index, datatable) {
|
||||
var actions = '';
|
||||
|
||||
if (row.meta.update_url != '') {
|
||||
actions += '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" data-id="' + row.name + '" title="Edit"><i class="la la-edit"></i></a>';
|
||||
}
|
||||
|
||||
if (row.meta.delete_url != '') {
|
||||
actions += '<a href="' + row.meta.delete_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-danger m-btn--icon m-btn--icon-only m-btn--pill btn-delete" data-id="' + row.name + '" title="Delete"><i class="la la-trash"></i></a>';
|
||||
}
|
||||
|
||||
return actions;
|
||||
},
|
||||
}
|
||||
],
|
||||
search: {
|
||||
onEnter: false,
|
||||
input: $('#data-rows-search'),
|
||||
delay: 400
|
||||
}
|
||||
};
|
||||
|
||||
var table = $("#data-rows").mDatatable(options);
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
var url = $(this).prop('href');
|
||||
var id = $(this).data('id');
|
||||
var btn = $(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
swal({
|
||||
title: 'Confirmation',
|
||||
html: 'Are you sure you want to delete <strong>' + id + '</strong>?',
|
||||
type: 'warning',
|
||||
showCancelButton: true
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
method: "DELETE",
|
||||
url: url
|
||||
}).done(function(response) {
|
||||
table.row(btn.parents('tr')).remove();
|
||||
table.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
133
templates/ticket-type/form.html.twig
Normal file
133
templates/ticket-type/form.html.twig
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<!-- BEGIN: Subheader -->
|
||||
<div class="m-subheader">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-auto">
|
||||
<h3 class="m-subheader__title">Ticket Types</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Subheader -->
|
||||
<div class="m-content">
|
||||
<!--Begin::Section-->
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<div class="m-portlet__head">
|
||||
<div class="m-portlet__head-caption">
|
||||
<div class="m-portlet__head-title">
|
||||
<span class="m-portlet__head-icon">
|
||||
<i class="la la-industry"></i>
|
||||
</span>
|
||||
<h3 class="m-portlet__head-text">
|
||||
{% if mode == 'update' %}
|
||||
Edit Ticket Type
|
||||
<small>{{ ticket_type.getName() }}</small>
|
||||
{% else %}
|
||||
New Ticket Type
|
||||
{% endif %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('ticket_type_update_submit', {'id': ticket_type.getId()}) : url('ticket_type_add_submit') }}">
|
||||
<div class="m-portlet__body">
|
||||
<div class="form-group m-form__group row">
|
||||
<label class="col-lg-3 col-form-label" data-field="name">
|
||||
Name:
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<input type="text" name="name" class="form-control m-input" value="{{ ticket_type.getName() }}">
|
||||
<div class="form-control-feedback hide" data-field="name"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<a href="{{ url('ticket_type_list') }}" class="btn btn-secondary">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(function() {
|
||||
$("#row-form").submit(function(e) {
|
||||
var form = $(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: form.prop('action'),
|
||||
data: form.serialize()
|
||||
}).done(function(response) {
|
||||
// remove all error classes
|
||||
removeErrors();
|
||||
swal({
|
||||
title: 'Done!',
|
||||
text: 'Your changes have been saved!',
|
||||
type: 'success',
|
||||
onClose: function() {
|
||||
window.location.href = "{{ url('ticket_type_list') }}";
|
||||
}
|
||||
});
|
||||
}).fail(function(response) {
|
||||
if (response.status == 422) {
|
||||
var errors = response.responseJSON.errors;
|
||||
var firstfield = false;
|
||||
|
||||
// remove all error classes first
|
||||
removeErrors();
|
||||
|
||||
// display errors contextually
|
||||
$.each(errors, function(field, msg) {
|
||||
var formfield = $("[name='" + field + "']");
|
||||
var label = $("label[data-field='" + field + "']");
|
||||
var msgbox = $(".form-control-feedback[data-field='" + field + "']");
|
||||
|
||||
// add error classes to bad fields
|
||||
formfield.addClass('form-control-danger');
|
||||
label.addClass('has-danger');
|
||||
msgbox.html(msg).addClass('has-danger').removeClass('hide');
|
||||
|
||||
// check if this field comes first in DOM
|
||||
var domfield = formfield.get(0);
|
||||
|
||||
if (!firstfield || (firstfield && firstfield.compareDocumentPosition(domfield) === 2)) {
|
||||
firstfield = domfield;
|
||||
}
|
||||
});
|
||||
|
||||
// focus on first bad field
|
||||
firstfield.focus();
|
||||
|
||||
// scroll to above that field to make it visible
|
||||
$('html, body').animate({
|
||||
scrollTop: $(firstfield).offset().top - 200
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// remove all error classes
|
||||
function removeErrors() {
|
||||
$(".form-control-danger").removeClass('form-control-danger');
|
||||
$("[data-field]").removeClass('has-danger');
|
||||
$(".form-control-feedback[data-field]").addClass('hide');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
146
templates/ticket-type/list.html.twig
Normal file
146
templates/ticket-type/list.html.twig
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<!-- BEGIN: Subheader -->
|
||||
<div class="m-subheader">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-auto">
|
||||
<h3 class="m-subheader__title">
|
||||
Ticket Types
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Subheader -->
|
||||
<div class="m-content">
|
||||
<!--Begin::Section-->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<div class="m-portlet__body">
|
||||
<div class="m-form m-form--label-align-right m--margin-top-20 m--margin-bottom-30">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-xl-8 order-2 order-xl-1">
|
||||
<div class="form-group m-form__group row align-items-center">
|
||||
<div class="col-md-4">
|
||||
<div class="m-input-icon m-input-icon--left">
|
||||
<input type="text" class="form-control m-input m-input--solid" placeholder="Search..." id="data-rows-search">
|
||||
<span class="m-input-icon__icon m-input-icon__icon--left">
|
||||
<span><i class="la la-search"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 order-1 order-xl-2 m--align-right">
|
||||
<a href="{{ url('ticket_type_add_form') }}" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
|
||||
<span>
|
||||
<i class="la la-industry"></i>
|
||||
<span>New Ticket Type</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="m-separator m-separator--dashed d-xl-none"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--begin: Datatable -->
|
||||
<div id="data-rows"></div>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(function() {
|
||||
var options = {
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: '{{ url("ticket_type_rows") }}',
|
||||
method: 'POST'
|
||||
}
|
||||
},
|
||||
saveState: {
|
||||
cookie: false,
|
||||
webstorage: false
|
||||
},
|
||||
pageSize: 10,
|
||||
serverPaging: true,
|
||||
serverFiltering: true,
|
||||
serverSorting: true
|
||||
},
|
||||
layout: {
|
||||
scroll: true
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
width: 30
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: 'Name'
|
||||
},
|
||||
{
|
||||
field: 'Actions',
|
||||
width: 110,
|
||||
title: 'Actions',
|
||||
sortable: false,
|
||||
overflow: 'visible',
|
||||
template: function (row, index, datatable) {
|
||||
var actions = '';
|
||||
|
||||
if (row.meta.update_url != '') {
|
||||
actions += '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" data-id="' + row.name + '" title="Edit"><i class="la la-edit"></i></a>';
|
||||
}
|
||||
|
||||
if (row.meta.delete_url != '') {
|
||||
actions += '<a href="' + row.meta.delete_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-danger m-btn--icon m-btn--icon-only m-btn--pill btn-delete" data-id="' + row.name + '" title="Delete"><i class="la la-trash"></i></a>';
|
||||
}
|
||||
|
||||
return actions;
|
||||
},
|
||||
}
|
||||
],
|
||||
search: {
|
||||
onEnter: false,
|
||||
input: $('#data-rows-search'),
|
||||
delay: 400
|
||||
}
|
||||
};
|
||||
|
||||
var table = $("#data-rows").mDatatable(options);
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
var url = $(this).prop('href');
|
||||
var id = $(this).data('id');
|
||||
var btn = $(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
swal({
|
||||
title: 'Confirmation',
|
||||
html: 'Are you sure you want to delete <strong>' + id + '</strong>?',
|
||||
type: 'warning',
|
||||
showCancelButton: true
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
method: "DELETE",
|
||||
url: url
|
||||
}).done(function(response) {
|
||||
table.row(btn.parents('tr')).remove();
|
||||
table.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
@ -38,10 +38,11 @@
|
|||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right" method="post" action="{{ mode == 'update' ? url('ticket_update_submit', {'id': obj.getId}) : url('ticket_create_submit', {'customer_id': customer ? customer.getID : false, 'job_order_id': job_order ? job_order.getID : false}) }}">
|
||||
<div class="m-portlet__body">
|
||||
<div class="m-form__section m-form__section--first{{ mode == 'create' ? ' m-form__section--last' }}">
|
||||
{% if (mode == 'update') and (obj.getTicketType != null) %}
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="status">Ticket Type</label>
|
||||
<select class="form-control m-input" id="ticket-type" name="ticket_type">
|
||||
<label data-field="status">Legacy Ticket Type</label>
|
||||
<select class="form-control m-input" id="ticket-type" name="ticket_type" disabled>
|
||||
<option value=""></option>
|
||||
{% for key, ticket_type in ticket_types %}
|
||||
<option value="{{ key }}"{{ key == obj.getTicketType ? ' selected' }}>{{ ticket_type }}</option>
|
||||
|
|
@ -50,11 +51,48 @@
|
|||
<div class="form-control-feedback hide" data-field="ticket_type"></div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<label data-field="other_ticket_type">Other Ticket Type <small>(please specify)</small></label>
|
||||
<label data-field="other_ticket_type">Legacy Other Ticket Type <small>(please specify)</small></label>
|
||||
<input type="text" name="other_ticket_type" id="other-ticket-type" class="form-control m-input" value="{{ obj.getOtherTicketType }}" disabled>
|
||||
<div class="form-control-feedback hide" data-field="other_ticket_type"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="status">Ticket Type</label>
|
||||
<select class="form-control m-input" id="new-ticket-type" name="new_ticket_type">
|
||||
<option value="">Select a ticket type</option>
|
||||
{% for id, label in sets.new_ticket_types %}
|
||||
{% if obj.getNewTicketType %}
|
||||
<option value="{{ id }}"{{ id == obj.getNewTicketType.getID ? ' selected' }}>{{ label }}</option>
|
||||
{% else %}
|
||||
<option value="{{ id }}">{{ label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="new_ticket_type"></div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<label data-field="sub_ticket_type">Sub Ticket Type</label>
|
||||
<select class="form-control m-input" id="sub-ticket-type" name="sub_ticket_type">
|
||||
{% if obj.getSubTicketType == null %}
|
||||
<option value="0">Select a ticket type first</option>
|
||||
{% else %}
|
||||
<option value="0">Select a sub-ticket type</option>
|
||||
{% for sub_ttype in sets.sub_ticket_types %}
|
||||
{% if sub_ttype.ticket_type_id == obj.getNewTicketType.getID %}
|
||||
{% if sub_ttype.id == obj.getSubTicketType.getID|default(0) %}
|
||||
<option value="{{ sub_ttype.id }}" selected>{{ sub_ttype.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ sub_ttype.id }}">{{ sub_ttype.name }}</option>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="sub_ticket_type"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="first_name">First Name</label>
|
||||
|
|
@ -317,5 +355,24 @@
|
|||
var ticketTable = $("#data-related-tickets").mDatatable(ticketOptions);
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
var subticket_type_list = {{ sets.sub_ticket_types|json_encode|raw }};
|
||||
|
||||
// populate sub ticket type field
|
||||
$('form').on('change', '#new-ticket-type', function() {
|
||||
console.log('ticket type change');
|
||||
var ticket_type_id = $(this).val();
|
||||
|
||||
// build options for sub ticket type based on selected ticket type
|
||||
var options = '<option value="0">Select sub ticket type</option>';
|
||||
for (var i in subticket_type_list) {
|
||||
if (subticket_type_list[i].ticket_type_id == ticket_type_id) {
|
||||
options += '<option value="' + subticket_type_list[i].id + '">' + subticket_type_list[i].name + '</option>'
|
||||
}
|
||||
}
|
||||
|
||||
$('#sub-ticket-type').html(options);
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
54
utils/ticket_types/subticket_type.sql
Normal file
54
utils/ticket_types/subticket_type.sql
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
-- MySQL dump 10.19 Distrib 10.3.32-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: resq
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.32-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `subticket_type`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `subticket_type`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `subticket_type` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ticket_type_id` int(11) DEFAULT NULL,
|
||||
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_F18521A4C980D5C1` (`ticket_type_id`),
|
||||
CONSTRAINT `FK_F18521A4C980D5C1` FOREIGN KEY (`ticket_type_id`) REFERENCES `ticket_type` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `subticket_type`
|
||||
--
|
||||
|
||||
LOCK TABLES `subticket_type` WRITE;
|
||||
/*!40000 ALTER TABLE `subticket_type` DISABLE KEYS */;
|
||||
INSERT INTO `subticket_type` VALUES (1,1,'Hub / Distributor'),(2,1,'Rider / Technician'),(3,1,'Service Procedure (Incomplete Document/s)'),(4,1,'Agent'),(5,1,'Wrong Battery'),(6,2,'Delivery Time'),(7,2,'Line Up Status'),(8,2,'Recharged / Replacement Battery'),(9,3,'Battery Brand'),(10,3,'Battery Life Span'),(11,3,'Battery Price and Trade-in'),(12,3,'Battery Specifications'),(13,3,'Battery Warranty'),(14,3,'Call Out Request'),(15,3,'Dealership'),(16,3,'Distributor Call'),(17,3,'For Generator Set (GenSet)'),(18,3,'Grab'),(19,3,'Mode of Payment'),(20,3,'Motorcycle Batteries'),(21,3,'Operating Hours'),(22,3,'Outlet nearby details (Province)'),(23,3,'Pezza or EWT'),(24,3,'Promo or Discount'),(25,3,'PVC'),(26,3,'ResQ Services and Fee'),(27,3,'Service Fee'),(28,3,'Serviceable Area'),(29,3,'Shell'),(30,3,'VAT Exempt'),(31,3,'Warranty Claim / Procedures'),(32,3,'Test Call'),(33,4,'Ghost Call'),(34,4,'Line Cut'),(35,4,'System Problem'),(36,4,'Transferred Calls'),(37,4,'VPN Down');
|
||||
/*!40000 ALTER TABLE `subticket_type` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-06-03 9:53:08
|
||||
51
utils/ticket_types/ticket_type.sql
Normal file
51
utils/ticket_types/ticket_type.sql
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
-- MySQL dump 10.19 Distrib 10.3.32-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: resq
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.32-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ticket_type`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ticket_type`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `ticket_type` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `ticket_type`
|
||||
--
|
||||
|
||||
LOCK TABLES `ticket_type` WRITE;
|
||||
/*!40000 ALTER TABLE `ticket_type` DISABLE KEYS */;
|
||||
INSERT INTO `ticket_type` VALUES (1,'Complaint'),(2,'Follow up'),(3,'Inquiry'),(4,'Others');
|
||||
/*!40000 ALTER TABLE `ticket_type` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-06-03 9:52:51
|
||||
Loading…
Reference in a new issue