From adc6c48ea4b0c823318f7a647863b06250b2a622 Mon Sep 17 00:00:00 2001 From: KNaveenraj-ladybird Date: Wed, 6 Sep 2023 14:37:02 +0530 Subject: [PATCH 1/6] fixes --- .../Agent/helpdesk/TicketController.php | 2 +- .../agent/helpdesk/ticket/timeline.blade.php | 21 ++++++++++++------- .../client/helpdesk/mytickets.blade.php | 3 ++- routes/web.php | 1 + 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 3563e7c40..eba94f5c1 100755 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -437,7 +437,7 @@ class TicketController extends Controller return response()->json(compact('result')); } - $result = ['success' => 'Replyed successfully']; + $result = ['success' => 'Replied successfully']; return response()->json(compact('result')); } diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php index d251246cd..a28c56a1a 100755 --- a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php @@ -1828,13 +1828,19 @@ if ($thread->title != "") { }, 500); }, success: function(json) { - $("#alert21").show(); - $('#message-success2').html(json.result.success); - location.reload(); - - // $('html, body').animate({ scrollTop: $("#heading").offset().top }, 500); + + setTimeout(function () { + location.reload(); + $("#alert21").show(); + + $('#message-success2').html(json.result.success); + }, 1000); + + + $('html, body').animate({ scrollTop: $("#inboxactions").offset().top }, 500); }, - error: function(json) { + + error: function(json) { $("#show3").hide(); $("#t1").show(); var res = ""; @@ -1846,6 +1852,7 @@ if ($thread->title != "") { } }) return false; + }); // Surrender $('#Surrender').on('click', function() { @@ -2147,7 +2154,7 @@ echo $ticket_data->title; // $("#alert21").show(); // $('#message-success2').html(message); $('#replybtn').attr('disabled', false); - // setInterval(function(){$("#alert21").hide(); },8000); + // setInterval(function(){$("#alert21").hide(); },8000); } else if (response == 1 || response == 4){ // alert(response); // var message = "{{Lang::get('lang.access-ticket')}}"+locktime/(60*1000) diff --git a/resources/views/themes/default1/client/helpdesk/mytickets.blade.php b/resources/views/themes/default1/client/helpdesk/mytickets.blade.php index 503e01c07..2fa5c2e0b 100644 --- a/resources/views/themes/default1/client/helpdesk/mytickets.blade.php +++ b/resources/views/themes/default1/client/helpdesk/mytickets.blade.php @@ -138,7 +138,8 @@ class="nav-item active" {{$priority->priority}} {!! $username !!} - {!! $title->updated_at !!} + updated_at ?> + {!! UTC::usertimezone($updated) !!} status)->first(); ?> {!! $status->name !!} diff --git a/routes/web.php b/routes/web.php index 4c1c7ec32..8779d6a19 100644 --- a/routes/web.php +++ b/routes/web.php @@ -347,6 +347,7 @@ Route::middleware('web')->group(function () { Route::post('/newticket/post', [Agent\helpdesk\TicketController::class, 'post_newticket'])->name('post.newticket'); /* Post Create New Ticket */ Route::get('/thread/{id}', [Agent\helpdesk\TicketController::class, 'thread'])->name('ticket.thread'); /* Get Thread by ID */ + Route::get('ticket/tooltip', [Agent\helpdesk\TicketController::class, 'getTooltip'])->name('ticket.tooltip'); Route::post('/thread/reply/{id}', [Agent\helpdesk\TicketController::class, 'reply'])->name('ticket.reply'); /* Patch Thread Reply */ Route::patch('/internal/note/{id}', [Agent\helpdesk\TicketController::class, 'InternalNote'])->name('Internal.note'); /* Patch Internal Note */ From 9dfedfc77cc88d4e2970cac1dc6e9c4d5a286641 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 6 Sep 2023 09:09:54 +0000 Subject: [PATCH 2/6] Apply fixes from StyleCI --- app/Api/v1/TokenAuthController.php | 4 ++-- app/Exceptions/Handler.php | 2 +- app/Helper/Finder.php | 8 ++++---- .../Admin/helpdesk/SettingsController.php | 18 +++++++++--------- .../Admin/helpdesk/SettingsController2.php | 16 ++++++++-------- .../helpdesk/Filter/FilterControllerOld.php | 4 ++-- .../Agent/helpdesk/NotificationController.php | 8 ++++---- .../Agent/helpdesk/TicketController.php | 4 ++-- .../Auth/ForgotPasswordController.php | 4 ++-- .../Controllers/Auth/PasswordController.php | 4 ++-- .../Client/helpdesk/GuestController.php | 4 ++-- .../Client/helpdesk/UnAuthController.php | 8 ++++---- .../Controllers/Common/PhpMailController.php | 2 +- .../Middleware/RedirectIfAuthenticated.php | 6 +++--- app/Http/Requests/helpdesk/AgentRequest.php | 4 ++-- app/Http/Requests/helpdesk/ClientRequest.php | 4 ++-- .../Requests/helpdesk/CreateTicketRequest.php | 6 +++--- app/Http/Requests/helpdesk/ProfileRequest.php | 2 +- app/Http/Requests/helpdesk/RegisterRequest.php | 4 ++-- app/Http/Requests/helpdesk/Sys_userRequest.php | 6 +++--- 20 files changed, 59 insertions(+), 59 deletions(-) diff --git a/app/Api/v1/TokenAuthController.php b/app/Api/v1/TokenAuthController.php index 577d5836b..5c596018c 100644 --- a/app/Api/v1/TokenAuthController.php +++ b/app/Api/v1/TokenAuthController.php @@ -174,8 +174,8 @@ class TokenAuthController extends Controller $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first(); if (isset($password_reset_table)) { $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]); - // $password_reset_table->token = $code; - // $password_reset_table->update(['token' => $code]); + // $password_reset_table->token = $code; + // $password_reset_table->update(['token' => $code]); } else { $create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5bc7cbdb3..f4a7c2d56 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -59,7 +59,7 @@ class Handler extends ExceptionHandler } /** - * @param $request + * @param $request * @param \Throwable $e * * @throws \Throwable diff --git a/app/Helper/Finder.php b/app/Helper/Finder.php index 594f9d1c4..f18d541b8 100644 --- a/app/Helper/Finder.php +++ b/app/Helper/Finder.php @@ -22,7 +22,7 @@ class Finder * DEPARTMENT * This function is used for returning department name with respect to id. * - * @param $id type int + * @param $id type int * @param $custom type array/null * * @return type string @@ -42,7 +42,7 @@ class Finder * GROUP * This function is used for returning group name with respect to id. * - * @param $id type int + * @param $id type int * @param $custom type array/null * * @return type string @@ -62,7 +62,7 @@ class Finder * STATUS TYPE * This function is used for returning status type name with respect to id. * - * @param $id type int + * @param $id type int * @param $custom type array/null * * @return type string @@ -82,7 +82,7 @@ class Finder * STATUS * This function is used for returning status name with respect to id. * - * @param $id type int + * @param $id type int * @param $custom type array/null * * @return type string diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController.php b/app/Http/Controllers/Admin/helpdesk/SettingsController.php index 6ff51b814..003a10779 100644 --- a/app/Http/Controllers/Admin/helpdesk/SettingsController.php +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController.php @@ -63,7 +63,7 @@ class SettingsController extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -118,7 +118,7 @@ class SettingsController extends Controller /** * function to delete system logo. * - * @return type string + * @return type string */ public function deleteLogo() { @@ -583,7 +583,7 @@ class SettingsController extends Controller /** * Generate Api key. * - * @return type json + * @return type json */ public function generateApiKey() { @@ -604,7 +604,7 @@ class SettingsController extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -624,7 +624,7 @@ class SettingsController extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -644,7 +644,7 @@ class SettingsController extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -780,7 +780,7 @@ class SettingsController extends Controller /** * To display the list of ratings in the system. * - * @return type View + * @return type View */ public function RatingSettings() { @@ -814,7 +814,7 @@ class SettingsController extends Controller /** * To store rating data. * - * @return type Redirect + * @return type Redirect */ public function PostRatingSettings($id, Rating $ratings, RatingUpdateRequest $request) { @@ -875,7 +875,7 @@ class SettingsController extends Controller /** * To delete a type of rating. * - * @return type Redirect + * @return type Redirect */ public function RatingDelete($slug, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs) { diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController2.php b/app/Http/Controllers/Admin/helpdesk/SettingsController2.php index 4841229fa..5a3260045 100644 --- a/app/Http/Controllers/Admin/helpdesk/SettingsController2.php +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController2.php @@ -98,7 +98,7 @@ class SettingsController2 extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -118,7 +118,7 @@ class SettingsController2 extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -189,7 +189,7 @@ class SettingsController2 extends Controller /** * @param int $id - * @param $compant instance of company table + * @param $compant instance of company table * * get the form for company setting page * @@ -244,7 +244,7 @@ class SettingsController2 extends Controller /** * function to delete system logo. * - * @return type string + * @return type string */ public function deleteLogo() { @@ -684,7 +684,7 @@ class SettingsController2 extends Controller /** * To display the list of ratings in the system. * - * @return type View + * @return type View */ public function RatingSettings() { @@ -696,7 +696,7 @@ class SettingsController2 extends Controller /** * To store rating data. * - * @return type Redirect + * @return type Redirect */ public function PostRatingSettings($slug) { @@ -721,7 +721,7 @@ class SettingsController2 extends Controller /** * To delete a type of rating. * - * @return type Redirect + * @return type Redirect */ public function RatingDelete($slug) { @@ -733,7 +733,7 @@ class SettingsController2 extends Controller /** * Generate Api key. * - * @return type json + * @return type json */ public function generateApiKey() { diff --git a/app/Http/Controllers/Agent/helpdesk/Filter/FilterControllerOld.php b/app/Http/Controllers/Agent/helpdesk/Filter/FilterControllerOld.php index 48919929a..7d0a7a4ab 100644 --- a/app/Http/Controllers/Agent/helpdesk/Filter/FilterControllerOld.php +++ b/app/Http/Controllers/Agent/helpdesk/Filter/FilterControllerOld.php @@ -315,9 +315,9 @@ class FilterControllerOld extends Controller /** *@category function to format and return user tickets * - *@param string $segment + * @param string $segment * - *@return builder + * @return builder */ public function formatUserTickets($segment) { diff --git a/app/Http/Controllers/Agent/helpdesk/NotificationController.php b/app/Http/Controllers/Agent/helpdesk/NotificationController.php index 13b4f6d9f..e289282dd 100644 --- a/app/Http/Controllers/Agent/helpdesk/NotificationController.php +++ b/app/Http/Controllers/Agent/helpdesk/NotificationController.php @@ -72,7 +72,7 @@ class NotificationController extends Controller * * @param company * - * @return mail + * @return mail * */ public function send_notification_to_admin($company) { @@ -102,7 +102,7 @@ class NotificationController extends Controller /** * Department Manager Notification/Report. * - * @return mail + * @return mail * */ public function send_notification_to_manager($company) { @@ -138,7 +138,7 @@ class NotificationController extends Controller /** * Team Lead Notification/Report. * - * @return mail + * @return mail * */ public function send_notification_to_team_lead($company) { @@ -174,7 +174,7 @@ class NotificationController extends Controller /** * Agent Notification/Report. * - * @return mail + * @return mail * */ public function send_notification_to_agent($company) { diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index eba94f5c1..bb73c9e8f 100755 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -2321,7 +2321,7 @@ class TicketController extends Controller * *@param null * - *@return string //script to load tooltip data + * @return string //script to load tooltip data */ public static function tooltip($ticketid) { @@ -2672,7 +2672,7 @@ class TicketController extends Controller * *@param srting array $t_id, $p_id * - *@return null + * @return null */ public function sendMergeNotification($p_id, $t_id) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 3ede1033d..c10a09bf7 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -58,8 +58,8 @@ class ForgotPasswordController extends Controller $password_reset_table = DB::table('password_resets')->where('email', '=', $user->email)->first(); if (isset($password_reset_table)) { $password_reset_table = DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]); - // $password_reset_table->token = $code; - // $password_reset_table->update(['token' => $code]); + // $password_reset_table->token = $code; + // $password_reset_table->update(['token' => $code]); } else { $create_password_reset = DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]); } diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 9c783fd5c..437cc3b72 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -63,8 +63,8 @@ class PasswordController extends Controller $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first(); if (isset($password_reset_table)) { $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]); - // $password_reset_table->token = $code; - // $password_reset_table->update(['token' => $code]); + // $password_reset_table->token = $code; + // $password_reset_table->update(['token' => $code]); } else { $create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]); } diff --git a/app/Http/Controllers/Client/helpdesk/GuestController.php b/app/Http/Controllers/Client/helpdesk/GuestController.php index 33f0d9eee..8ac8d7140 100644 --- a/app/Http/Controllers/Client/helpdesk/GuestController.php +++ b/app/Http/Controllers/Client/helpdesk/GuestController.php @@ -125,9 +125,9 @@ class GuestController extends Controller /** *@category fucntion to check if mobile number is unqique or not * - *@param string $mobile + * @param string $mobile * - *@return bool true(if mobile exists in users table)/false (if mobile does not exist in user table) + * @return bool true(if mobile exists in users table)/false (if mobile does not exist in user table) */ public function checkMobile($mobile) { diff --git a/app/Http/Controllers/Client/helpdesk/UnAuthController.php b/app/Http/Controllers/Client/helpdesk/UnAuthController.php index dd3fd8ed7..ac82e531a 100755 --- a/app/Http/Controllers/Client/helpdesk/UnAuthController.php +++ b/app/Http/Controllers/Client/helpdesk/UnAuthController.php @@ -327,9 +327,9 @@ class UnAuthController extends Controller /** *@category function to change system's language * - *@param string $lang //desired language's iso code + * @param string $lang //desired language's iso code * - *@return response + * @return response */ public static function changeLanguage($lang) { @@ -344,8 +344,8 @@ class UnAuthController extends Controller // app()->setLocale($lang); \Cache::forever('language', $lang); - // dd(Cache::get('language')); - // dd() + // dd(Cache::get('language')); + // dd() } else { return false; } diff --git a/app/Http/Controllers/Common/PhpMailController.php b/app/Http/Controllers/Common/PhpMailController.php index 7f77d1595..fc72eea75 100644 --- a/app/Http/Controllers/Common/PhpMailController.php +++ b/app/Http/Controllers/Common/PhpMailController.php @@ -17,7 +17,7 @@ use Mail; class PhpMailController extends Controller { /** - *@var variable to instantiate common mailer class + * @var variable to instantiate common mailer class */ public function __construct() { diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 539729fc3..5922fce87 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -11,9 +11,9 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @param string|null ...$guards + * @param \Illuminate\Http\Request $request + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next + * @param string|null ...$guards * * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ diff --git a/app/Http/Requests/helpdesk/AgentRequest.php b/app/Http/Requests/helpdesk/AgentRequest.php index 2f19c576c..4c8d62d02 100644 --- a/app/Http/Requests/helpdesk/AgentRequest.php +++ b/app/Http/Requests/helpdesk/AgentRequest.php @@ -53,11 +53,11 @@ class AgentRequest extends Request /** *@category Funcion to set rule if send opt is enabled * - *@param object $settings (instance of Model common settings) + * @param object $settings (instance of Model common settings) * *@author manish.verma@ladybirdweb.com * - *@return array|int + * @return array|int */ public function check($settings) { diff --git a/app/Http/Requests/helpdesk/ClientRequest.php b/app/Http/Requests/helpdesk/ClientRequest.php index 6a7301bd8..f6de79bfc 100644 --- a/app/Http/Requests/helpdesk/ClientRequest.php +++ b/app/Http/Requests/helpdesk/ClientRequest.php @@ -119,11 +119,11 @@ class ClientRequest extends Request /** *@category Funcion to set rule if send opt is enabled * - *@param object $settings (instance of Model common settings) + * @param object $settings (instance of Model common settings) * *@author manish.verma@ladybirdweb.com * - *@return array|int + * @return array|int */ public function check($settings) { diff --git a/app/Http/Requests/helpdesk/CreateTicketRequest.php b/app/Http/Requests/helpdesk/CreateTicketRequest.php index 311ce2486..273f134b5 100644 --- a/app/Http/Requests/helpdesk/CreateTicketRequest.php +++ b/app/Http/Requests/helpdesk/CreateTicketRequest.php @@ -58,11 +58,11 @@ class CreateTicketRequest extends Request /** *@category Funcion to set rule if send opt is enabled * - *@param object $settings (instance of Model common settings) + * @param object $settings (instance of Model common settings) * *@author manish.verma@ladybirdweb.com * - *@return array|int + * @return array|int */ public function check($settings) { @@ -102,7 +102,7 @@ class CreateTicketRequest extends Request * *@param null * - *@return array + * @return array */ public function onlyMobleRequired() { diff --git a/app/Http/Requests/helpdesk/ProfileRequest.php b/app/Http/Requests/helpdesk/ProfileRequest.php index 3b995c906..8dd3d4554 100644 --- a/app/Http/Requests/helpdesk/ProfileRequest.php +++ b/app/Http/Requests/helpdesk/ProfileRequest.php @@ -38,7 +38,7 @@ class ProfileRequest extends Request /** *Check the mobile number is unique or not. * - *@return string + * @return string */ public function checkMobile() { diff --git a/app/Http/Requests/helpdesk/RegisterRequest.php b/app/Http/Requests/helpdesk/RegisterRequest.php index 04ecfc11e..31436b8c4 100644 --- a/app/Http/Requests/helpdesk/RegisterRequest.php +++ b/app/Http/Requests/helpdesk/RegisterRequest.php @@ -45,11 +45,11 @@ class RegisterRequest extends Request /** *@category Funcion to set rule if send opt is enabled * - *@param object $settings (instance of Model common settings) + * @param object $settings (instance of Model common settings) * *@author manish.verma@ladybirdweb.com * - *@return array|int + * @return array|int */ public function check($settings) { diff --git a/app/Http/Requests/helpdesk/Sys_userRequest.php b/app/Http/Requests/helpdesk/Sys_userRequest.php index a8d829a97..d86b59ef2 100644 --- a/app/Http/Requests/helpdesk/Sys_userRequest.php +++ b/app/Http/Requests/helpdesk/Sys_userRequest.php @@ -45,11 +45,11 @@ class Sys_userRequest extends Request /** *@category Funcion to set rule if send opt is enabled * - *@param object $settings (instance of Model common settings) + * @param object $settings (instance of Model common settings) * *@author manish.verma@ladybirdweb.com * - *@return array|int + * @return array|int */ public function check($settings) { @@ -83,7 +83,7 @@ class Sys_userRequest extends Request * *@param null * - *@return array + * @return array */ public function onlyMobleRequired() { From a262dd298937e5bf3dfe1df554b7aa623864e363 Mon Sep 17 00:00:00 2001 From: KNaveenraj-ladybird Date: Tue, 12 Sep 2023 14:10:43 +0530 Subject: [PATCH 3/6] corrections --- .../Controllers/Agent/helpdesk/TicketController.php | 2 +- .../default1/agent/helpdesk/ticket/timeline.blade.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index bb73c9e8f..5c88f272f 100755 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -437,7 +437,7 @@ class TicketController extends Controller return response()->json(compact('result')); } - $result = ['success' => 'Replied successfully']; + $result = ['success' => Lang::get('lang.you_have_successfully_replied_to_your_ticket')]; return response()->json(compact('result')); } diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php index a28c56a1a..daba53fc6 100755 --- a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php @@ -1824,20 +1824,18 @@ if ($thread->title != "") { $("#t1").hide(); $("#show3").show(); $('html, body').animate({ - scrollTop: $("#form3").offset().top + scrollTop: $("#inboxactions").offset().top }, 500); }, success: function(json) { setTimeout(function () { location.reload(); - $("#alert21").show(); - - $('#message-success2').html(json.result.success); }, 1000); - - $('html, body').animate({ scrollTop: $("#inboxactions").offset().top }, 500); + $("#alert21").show(); + $('#message-success2').html(json.result.success); + //$('html, body').animate({ scrollTop: $("#inboxactions").offset().top }, 500); }, error: function(json) { From 04e7674fa17bd455455bd01100c8cb369585bc80 Mon Sep 17 00:00:00 2001 From: KNaveenraj-ladybird Date: Mon, 18 Sep 2023 10:51:25 +0530 Subject: [PATCH 4/6] testcase --- phpunit.xml | 59 +++-- .../agent/helpdesk/ticket/timeline.blade.php | 1 - tests/Unit/TicketControllerTest.php | 207 ++++++++++++++++++ 3 files changed, 232 insertions(+), 35 deletions(-) mode change 100644 => 100755 phpunit.xml create mode 100644 tests/Unit/TicketControllerTest.php diff --git a/phpunit.xml b/phpunit.xml old mode 100644 new mode 100755 index 3f968c80e..f0bedca0c --- a/phpunit.xml +++ b/phpunit.xml @@ -1,36 +1,27 @@ - - - - ./tests/ - - - ./tests/unit - - - - - app/ - - - - - - - - - - - - - - + + + + app/ + + + + + ./tests/ + + + ./tests/Unit + + + + + + + + + + + + + diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php index daba53fc6..041fbf64c 100755 --- a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php @@ -1835,7 +1835,6 @@ if ($thread->title != "") { $("#alert21").show(); $('#message-success2').html(json.result.success); - //$('html, body').animate({ scrollTop: $("#inboxactions").offset().top }, 500); }, error: function(json) { diff --git a/tests/Unit/TicketControllerTest.php b/tests/Unit/TicketControllerTest.php new file mode 100644 index 000000000..b908b4209 --- /dev/null +++ b/tests/Unit/TicketControllerTest.php @@ -0,0 +1,207 @@ + Agent + + //$str = Str::random(10); + $str ="demopass"; + $password = Hash::make($str); + $email = $faker->unique()->email(); + $user = new User([ + 'first_name' => $faker->firstName(), + 'last_name' => $faker->lastName(), + 'email' => $email, + 'user_name' => $faker->unique()->userName(), + 'password' => $password, + 'assign_group' => 1, + 'primary_dpt' => 1, + 'active' => 1, + 'role' => 'agent', + 'agent_tzone'=> 81, + ]); + $user->save(); + + // Check if data is inserted + $this->assertDatabaseHas('users',['email'=>$email]); + + // Authenticate as the created user + $this->actingAs($user); + + $this->assertAuthenticated(); + + // Define the dashboard route name + $dashboardRouteName = 'dashboard'; + + // Generate the dashboard route URL + $dashboardUrl = route($dashboardRouteName); + + // Simulate a GET request to the dashboard route + $dashboardResponse = $this->get($dashboardUrl); + + // Assert that the response status code is 200 (OK) + $dashboardResponse->assertStatus(200); + + + // Create a ticket for testing. + + $ticket = new Tickets( + [ + 'ticket_number' => 'TEST-0000-000'.$faker->randomDigit(), + 'user_id'=>$user->id, + 'priority_id' => 2, + 'sla' => 2, + 'help_topic_id' => 1, + 'status' => 1, + 'source'=>1, + ] + ); + + $ticket->save(); + $ticket->dept_id =1; + $ticket->save(); + + + //Create Ticket_thread for Testing + + $ticket_thread = new Ticket_Thread( + [ + 'ticket_id' => $ticket->id, + 'user_id' => $user->id, + 'poster' =>'client', + 'title' => 'TestCase2', + 'body' =>'Testing2', + ] + ); + + $ticket_thread->save(); + + + // Make a GET request to the getTooltip + $response = $this->get(route('ticket.tooltip', ['ticket_id' => $ticket->id])); + + // Assert that the response status is 200 (OK). + $response->assertStatus(200); + + //Accessing Tooltip url + + $url = 'http://127.0.0.1:8000/ticket/tooltip?ticketid='.$ticket->id; + + $result = $this->get(url($url)); + + // Define the expected tooltip content + + $expectedTooltip = ''; + + $threads = $ticket->thread()->select('user_id', 'poster', 'body')->get(); + $numThreads = $threads->count(); + + foreach ($threads as $thread) { + $expectedTooltip .= '' . $thread->user->user_name . ' (' . $thread->poster . ')
' + . $thread->purify() . '

'; + } + + $expectedTooltip .= 'This ticket has ' . $numThreads . ' threads.'; + + // Assert that the response content contains the expected tooltip content + $result->assertSee($expectedTooltip,$escaped=false); + + + } + + //Testing Reply Alert and Last Activity filed + public function test_reply() + { + $faker = FakerFactory::create(); + + // Get previously created user to authenticate + + $user = User::latest()->first(); + + $this->actingAs($user); + + $this->assertAuthenticated(); + + //Get previously created Ticket + + $tickets = Tickets::latest()->first(); + + // Define the route URL with the Ticket ID + + $url = route('ticket.thread', ['id' => $tickets->id]); + + + $response2 = $this->get($url); + + // Assert that the response status is 200 (OK). + $response2->assertStatus(200); + + + // Create fake data for the reply + + $replyData = [ + 'ticket_ID'=>$tickets->id, + 'reply_content' => $faker->paragraph, + 'created_at'=>date_default_timezone_set('UTC'), + 'updated_at'=>date_default_timezone_set('UTC'), + ]; + + // Make a POST request to the route with the reply data + $response3 = $this->post(route('ticket.reply', ['id' => $tickets->id]), $replyData); + // Assert that the response has a successful HTTP status code (e.g., 200 OK) or an appropriate status code + $response3->assertStatus(200); + $response3->assertSee(Lang::get('lang.you_have_successfully_replied_to_your_ticket')); + + //Accessing tickets to check last activity is updated + + $response4 = $this->get(route('ticket2')); + + $response4->assertStatus(200); + + $result_date = $response4->getDate(); + + $userTimeZone = new DateTimeZone("Asia/Kolkata"); + + // Convert the DateTime object to the user's time zone + + $result_date = $result_date->setTimezone($userTimeZone); + + $result_date = $result_date->format("d/m/Y H:i:s"); + + + //Converting Updated_at to User Timezone + + $last_thread = Tickets::latest()->first(); + + $updated_at = $last_thread->updated_at; + + $expected_date = UTC::usertimezone($updated_at); + + // Asserting if the last_activity is updated correctly + + $this->assertEquals($expected_date,$result_date); + + } +} + From 96a01671ffe88bff20c932b53ea53ca6f5e4647f Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 18 Sep 2023 05:23:17 +0000 Subject: [PATCH 5/6] Apply fixes from StyleCI --- tests/Unit/TicketControllerTest.php | 129 +++++++++++++--------------- 1 file changed, 60 insertions(+), 69 deletions(-) diff --git a/tests/Unit/TicketControllerTest.php b/tests/Unit/TicketControllerTest.php index b908b4209..349cf1a46 100644 --- a/tests/Unit/TicketControllerTest.php +++ b/tests/Unit/TicketControllerTest.php @@ -6,12 +6,13 @@ use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Tickets; use App\User; use DateTimeZone; +use Faker\Factory as FakerFactory; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Lang; use Illuminate\Support\Str; use Tests\TestCase; use UTC; -use Faker\Factory as FakerFactory; + class TicketControllerTest extends TestCase { /** @@ -26,25 +27,25 @@ class TicketControllerTest extends TestCase //Create User -> Agent //$str = Str::random(10); - $str ="demopass"; + $str = 'demopass'; $password = Hash::make($str); $email = $faker->unique()->email(); $user = new User([ - 'first_name' => $faker->firstName(), - 'last_name' => $faker->lastName(), - 'email' => $email, - 'user_name' => $faker->unique()->userName(), - 'password' => $password, + 'first_name' => $faker->firstName(), + 'last_name' => $faker->lastName(), + 'email' => $email, + 'user_name' => $faker->unique()->userName(), + 'password' => $password, 'assign_group' => 1, - 'primary_dpt' => 1, - 'active' => 1, - 'role' => 'agent', - 'agent_tzone'=> 81, + 'primary_dpt' => 1, + 'active' => 1, + 'role' => 'agent', + 'agent_tzone' => 81, ]); $user->save(); // Check if data is inserted - $this->assertDatabaseHas('users',['email'=>$email]); + $this->assertDatabaseHas('users', ['email'=>$email]); // Authenticate as the created user $this->actingAs($user); @@ -52,86 +53,81 @@ class TicketControllerTest extends TestCase $this->assertAuthenticated(); // Define the dashboard route name - $dashboardRouteName = 'dashboard'; + $dashboardRouteName = 'dashboard'; - // Generate the dashboard route URL - $dashboardUrl = route($dashboardRouteName); + // Generate the dashboard route URL + $dashboardUrl = route($dashboardRouteName); - // Simulate a GET request to the dashboard route - $dashboardResponse = $this->get($dashboardUrl); - - // Assert that the response status code is 200 (OK) - $dashboardResponse->assertStatus(200); + // Simulate a GET request to the dashboard route + $dashboardResponse = $this->get($dashboardUrl); + // Assert that the response status code is 200 (OK) + $dashboardResponse->assertStatus(200); // Create a ticket for testing. $ticket = new Tickets( [ 'ticket_number' => 'TEST-0000-000'.$faker->randomDigit(), - 'user_id'=>$user->id, - 'priority_id' => 2, - 'sla' => 2, + 'user_id' => $user->id, + 'priority_id' => 2, + 'sla' => 2, 'help_topic_id' => 1, - 'status' => 1, - 'source'=>1, + 'status' => 1, + 'source' => 1, ] ); $ticket->save(); - $ticket->dept_id =1; + $ticket->dept_id = 1; $ticket->save(); - - //Create Ticket_thread for Testing + //Create Ticket_thread for Testing $ticket_thread = new Ticket_Thread( [ 'ticket_id' => $ticket->id, - 'user_id' => $user->id, - 'poster' =>'client', - 'title' => 'TestCase2', - 'body' =>'Testing2', + 'user_id' => $user->id, + 'poster' => 'client', + 'title' => 'TestCase2', + 'body' => 'Testing2', ] ); $ticket_thread->save(); + // Make a GET request to the getTooltip + $response = $this->get(route('ticket.tooltip', ['ticket_id' => $ticket->id])); - // Make a GET request to the getTooltip - $response = $this->get(route('ticket.tooltip', ['ticket_id' => $ticket->id])); + // Assert that the response status is 200 (OK). + $response->assertStatus(200); - // Assert that the response status is 200 (OK). - $response->assertStatus(200); + //Accessing Tooltip url - //Accessing Tooltip url + $url = 'http://127.0.0.1:8000/ticket/tooltip?ticketid='.$ticket->id; - $url = 'http://127.0.0.1:8000/ticket/tooltip?ticketid='.$ticket->id; - - $result = $this->get(url($url)); + $result = $this->get(url($url)); // Define the expected tooltip content - $expectedTooltip = ''; + $expectedTooltip = ''; - $threads = $ticket->thread()->select('user_id', 'poster', 'body')->get(); - $numThreads = $threads->count(); + $threads = $ticket->thread()->select('user_id', 'poster', 'body')->get(); + $numThreads = $threads->count(); - foreach ($threads as $thread) { - $expectedTooltip .= '' . $thread->user->user_name . ' (' . $thread->poster . ')
' - . $thread->purify() . '

'; - } - - $expectedTooltip .= 'This ticket has ' . $numThreads . ' threads.'; - - // Assert that the response content contains the expected tooltip content - $result->assertSee($expectedTooltip,$escaped=false); + foreach ($threads as $thread) { + $expectedTooltip .= ''.$thread->user->user_name.' ('.$thread->poster.')
' + .$thread->purify().'

'; + } + $expectedTooltip .= 'This ticket has '.$numThreads.' threads.'; + // Assert that the response content contains the expected tooltip content + $result->assertSee($expectedTooltip, $escaped = false); } //Testing Reply Alert and Last Activity filed - public function test_reply() + public function test_reply() { $faker = FakerFactory::create(); @@ -151,20 +147,18 @@ class TicketControllerTest extends TestCase $url = route('ticket.thread', ['id' => $tickets->id]); - $response2 = $this->get($url); // Assert that the response status is 200 (OK). $response2->assertStatus(200); - // Create fake data for the reply $replyData = [ - 'ticket_ID'=>$tickets->id, + 'ticket_ID' => $tickets->id, 'reply_content' => $faker->paragraph, - 'created_at'=>date_default_timezone_set('UTC'), - 'updated_at'=>date_default_timezone_set('UTC'), + 'created_at' => date_default_timezone_set('UTC'), + 'updated_at' => date_default_timezone_set('UTC'), ]; // Make a POST request to the route with the reply data @@ -179,29 +173,26 @@ class TicketControllerTest extends TestCase $response4->assertStatus(200); - $result_date = $response4->getDate(); + $result_date = $response4->getDate(); - $userTimeZone = new DateTimeZone("Asia/Kolkata"); + $userTimeZone = new DateTimeZone('Asia/Kolkata'); - // Convert the DateTime object to the user's time zone + // Convert the DateTime object to the user's time zone - $result_date = $result_date->setTimezone($userTimeZone); + $result_date = $result_date->setTimezone($userTimeZone); - $result_date = $result_date->format("d/m/Y H:i:s"); + $result_date = $result_date->format('d/m/Y H:i:s'); - - //Converting Updated_at to User Timezone + //Converting Updated_at to User Timezone $last_thread = Tickets::latest()->first(); $updated_at = $last_thread->updated_at; - $expected_date = UTC::usertimezone($updated_at); + $expected_date = UTC::usertimezone($updated_at); // Asserting if the last_activity is updated correctly - $this->assertEquals($expected_date,$result_date); - + $this->assertEquals($expected_date, $result_date); } } - From 20e9884c8fdbfe829d41b681c09d71f2cf0d1366 Mon Sep 17 00:00:00 2001 From: KNaveenraj-ladybird Date: Tue, 3 Oct 2023 20:57:34 +0530 Subject: [PATCH 6/6] func_correction --- .../themes/default1/agent/helpdesk/ticket/timeline.blade.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php index b09c05889..65d552b88 100755 --- a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php @@ -1833,10 +1833,11 @@ if ($thread->title != "") { }, 500); }, success: function(json) { - + $("#show3").hide(); + $("#t1").show(); setTimeout(function () { location.reload(); - }, 1000); + }, 4000); $("#alert21").show(); $('#message-success2').html(json.result.success);