From 561a28064700f1ad0902e3335b53f54933cdcdbe Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Tue, 7 Nov 2023 03:34:56 +0800 Subject: [PATCH 1/3] Add late documentation fields to ticket table #774 --- src/Entity/Ticket.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/Entity/Ticket.php b/src/Entity/Ticket.php index 0249d985..a3704526 100644 --- a/src/Entity/Ticket.php +++ b/src/Entity/Ticket.php @@ -139,9 +139,22 @@ class Ticket */ protected $other_description; + // is it a late documentation? + /** + * @ORM\Column(type="boolean", nullable=true) + */ + protected $flag_late_doc; + + // reason for late documentation + /** + * @ORM\Column(type="text", nullable=true) + */ + protected $late_doc_reason; + public function __construct() { $this->date_create = new DateTime(); + $this->flag_late_doc = false; } public function getID() @@ -354,4 +367,26 @@ class Ticket { return $this->other_description; } + + public function setLateDoc($flag_late_doc = true) + { + $this->flag_late_doc = $flag_late_doc; + return $this; + } + + public function isLateDoc() + { + return $this->flag_late_doc; + } + + public function setLateDocReason($late_doc_reason) + { + $this->late_doc_reason = $late_doc_reason; + return $this; + } + + public function getLateDocReason() + { + return $this->late_doc_reason; + } } -- 2.43.5 From d44323c097526eaf47731d025e5975c3e165e4d1 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Tue, 7 Nov 2023 04:02:33 +0800 Subject: [PATCH 2/3] Add late documentation fields to ticket form #774 --- src/Controller/TicketController.php | 21 ++++++++++++++++-- templates/ticket/form.html.twig | 33 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/Controller/TicketController.php b/src/Controller/TicketController.php index 0f918058..9752db3d 100644 --- a/src/Controller/TicketController.php +++ b/src/Controller/TicketController.php @@ -105,6 +105,7 @@ class TicketController extends Controller $row['status'] = TicketStatus::getName($orow->getStatus()); $row['ticket_type'] = $orow->getTicketTypeText(); $row['plate_number'] = $orow->getPlateNumber(); + $row['flag_late_doc'] = $orow->isLateDoc(); // add row metadata $row['meta'] = [ @@ -260,6 +261,12 @@ class TicketController extends Controller // get remarks $remarks = $req->request->get('remarks', ''); + // is this a late documentation + $flag_late_doc = $req->request->get('flag_late_doc', false); + + // reason for late documentation + $late_doc_reason = $flag_late_doc ? $req->request->get('late_doc_reason') : null; + // set and save values $obj->setFirstName($first_name) ->setLastName($last_name) @@ -273,7 +280,9 @@ class TicketController extends Controller ->setCreatedBy($this->getUser()) ->setSourceOfAwareness($soa_type) ->setRemarks($remarks) - ->setOtherDescription($other_desc); + ->setOtherDescription($other_desc) + ->setLateDoc($flag_late_doc) + ->setLateDocReason($late_doc_reason); // if assigned to customer, set association if ($customer_id) { @@ -471,6 +480,12 @@ class TicketController extends Controller // get remarks $remarks = $req->request->get('remarks', ''); + // is this a late documentation + $flag_late_doc = $req->request->get('flag_late_doc', false); + + // reason for late documentation + $late_doc_reason = $flag_late_doc ? $req->request->get('late_doc_reason') : null; + // set and save values $obj->setFirstName($first_name) ->setLastName($last_name) @@ -482,7 +497,9 @@ class TicketController extends Controller ->setPlateNumber($req->request->get('plate_number')) ->setSourceOfAwareness($soa_type) ->setRemarks($remarks) - ->setOtherDescription($other_desc); + ->setOtherDescription($other_desc) + ->setLateDoc($flag_late_doc) + ->setLateDocReason($late_doc_reason); // initialize error list $error_array = []; diff --git a/templates/ticket/form.html.twig b/templates/ticket/form.html.twig index ea97f4ac..0e6e048b 100644 --- a/templates/ticket/form.html.twig +++ b/templates/ticket/form.html.twig @@ -183,6 +183,28 @@ {% endif %} + +
+
+ + + +
+
+ +
+
+ + + +
+
{% if mode == 'update' %} @@ -381,5 +403,16 @@ $('form').on('change', '#new-ticket-type', function() { $('#sub-ticket-type').html(options); }); +$('form').on('change', '#flag_late_doc', (e) => { + const reasonBox = document.getElementById("late_doc_reason_box"); + + if (e.target.checked) { + reasonBox.classList.remove('hide'); + reasonBox.querySelector('textarea').focus(); + } else { + reasonBox.classList.add('hide'); + } +}); + {% endblock %} -- 2.43.5 From 2344ec716b956be0941fae167020e011b123997c Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Tue, 7 Nov 2023 04:02:57 +0800 Subject: [PATCH 3/3] Add documentation time column to ticket list #774 --- templates/ticket/list.html.twig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/ticket/list.html.twig b/templates/ticket/list.html.twig index cedd013f..90ee4337 100644 --- a/templates/ticket/list.html.twig +++ b/templates/ticket/list.html.twig @@ -112,6 +112,21 @@ field: 'status', title: 'Status' }, + { + field: 'flag_late_doc', + title: 'Documentation Time', + template: function (row, index, datatable) { + var tag = ''; + + if (!row.flag_late_doc) { + tag = 'On Time'; + } else { + tag = 'Late'; + } + + return tag; + } + }, { field: 'Actions', width: 110, -- 2.43.5