Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #360 from InfyOmLabs/develop
Browse files Browse the repository at this point in the history
Release Alpha v1.8.4
  • Loading branch information
mitulgolakiya authored Sep 13, 2019
2 parents 3f34648 + 8507fd0 commit 5b09dc0
Show file tree
Hide file tree
Showing 72 changed files with 630 additions and 250 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
use App\Repositories\UserRepository;
use Crypt;
use Exception;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
use Session;

class AuthController extends AppBaseController
Expand All @@ -27,7 +30,7 @@ public function __construct(AccountRepository $accountRepository, UserRepository
}

/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
* @return RedirectResponse|Redirector|View
*/
public function verifyAccount()
{
Expand Down Expand Up @@ -84,7 +87,7 @@ public function verifyAccount()
*
* @throws Exception
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return RedirectResponse|Redirector
*/
public function setPassword(Request $request)
{
Expand Down
15 changes: 9 additions & 6 deletions app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use App\Models\Comment;
use App\Models\Task;
use App\Repositories\TaskRepository;
use Auth;
use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;

Expand All @@ -22,7 +25,7 @@ public function __construct(TaskRepository $taskRepo)
* @param Task $task
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function addComment(Task $task, Request $request)
{
Expand All @@ -38,13 +41,13 @@ public function addComment(Task $task, Request $request)
* @param Task $task
* @param Comment $comment
*
* @throws \Exception
* @throws Exception
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function deleteComment(Task $task, Comment $comment)
{
if ($comment->task_id != $task->id || $comment->created_by != \Auth::user()->id) {
if ($comment->task_id != $task->id || $comment->created_by != Auth::user()->id) {
throw new UnprocessableEntityHttpException('Unable to delete comment.');
}

Expand All @@ -59,11 +62,11 @@ public function deleteComment(Task $task, Comment $comment)
* @param Comment $comment
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function editComment(Task $task, Comment $comment, Request $request)
{
if ($comment->task_id != $task->id || $comment->created_by != \Auth::user()->id) {
if ($comment->task_id != $task->id || $comment->created_by != Auth::user()->id) {
throw new UnprocessableEntityHttpException('Unable to update comment.');
}

Expand Down
8 changes: 5 additions & 3 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use App\Repositories\DashboardRepository;
use App\Repositories\UserRepository;
use Auth;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class HomeController extends AppBaseController
{
Expand All @@ -31,7 +33,7 @@ public function __construct(DashboardRepository $dashboardRepository, UserReposi
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index()
{
Expand All @@ -43,7 +45,7 @@ public function index()
/**
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function workReport(Request $request)
{
Expand All @@ -58,7 +60,7 @@ public function workReport(Request $request)
/**
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function developerWorkReport(Request $request)
{
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
use DataTables;
use Exception;
use Flash;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Response;

class ReportController extends AppBaseController
Expand Down Expand Up @@ -177,7 +180,7 @@ public function update(Report $report, UpdateReportRequest $request)
*
* @throws Exception
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return JsonResponse|RedirectResponse|Redirector
*/
public function destroy(Report $report)
{
Expand Down
11 changes: 7 additions & 4 deletions app/Http/Controllers/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
use DataTables;
use Exception;
use Flash;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

Expand Down Expand Up @@ -106,10 +109,10 @@ public function edit(Role $role)
}

/**
* @param Role $role
* @param Request $request
* @param Role $role
* @param UpdateRoleRequest $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return RedirectResponse|Redirector
*/
public function update(Role $role, UpdateRoleRequest $request)
{
Expand All @@ -131,7 +134,7 @@ public function update(Role $role, UpdateRoleRequest $request)
*
* @throws Exception
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return JsonResponse|RedirectResponse|Redirector
*/
public function destroy(Role $role)
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function index(Request $request)
})->filterColumn('title', function ($query, $search) {
$query->where(function ($query) use ($search) {
$query->where('title', 'like', "%$search%")
->orWhereRaw("concat(ifnull(p.prefix,''),'-',ifnull(tasks.task_number,'')) LIKE ?",
->orWhereRaw("concat(if null(p.prefix,''),'-',if null(tasks.task_number,'')) LIKE ?",
["%$search%"]);
});
})
Expand Down Expand Up @@ -88,7 +88,7 @@ public function store(CreateTaskRequest $request)

private function fill($input)
{
$input['status'] = (isset($input['status']) && !empty($input['status'])) ? $input['status'] : 0;
$input['status'] = (isset($input['status']) && !empty($input['status'])) ? $input['status'] : Task::STATUS_ACTIVE;
$input['description'] = is_null($input['description']) ? '' : $input['description'];

return $input;
Expand Down
42 changes: 26 additions & 16 deletions app/Http/Controllers/TimeEntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
use Auth;
use Carbon\Carbon;
use DataTables;
use Exception;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\UnauthorizedException;
use Illuminate\View\View;
use Log;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

Expand All @@ -31,9 +35,9 @@ public function __construct(TimeEntryRepository $timeEntryRepo)
*
* @param Request $request
*
* @throws \Exception
* @throws Exception
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Factory|View
*/
public function index(Request $request)
{
Expand All @@ -53,7 +57,7 @@ public function index(Request $request)
*
* @param CreateTimeEntryRequest $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function store(CreateTimeEntryRequest $request)
{
Expand All @@ -70,7 +74,7 @@ public function store(CreateTimeEntryRequest $request)
*
* @param TimeEntry $timeEntry
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function edit(TimeEntry $timeEntry)
{
Expand All @@ -85,16 +89,19 @@ public function edit(TimeEntry $timeEntry)
* @param TimeEntry $timeEntry
* @param UpdateTimeEntryRequest $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function update(TimeEntry $timeEntry, UpdateTimeEntryRequest $request)
{
$entry = TimeEntry::ofCurrentUser()->find($timeEntry->id);
if (empty($entry)) {
$user = getLoggedInUser();
if (!$user->can('manage_projects')) {
$timeEntry = TimeEntry::ofCurrentUser()->find($timeEntry->id);
}
if (empty($timeEntry)) {
return $this->sendError('Time Entry not found.', Response::HTTP_NOT_FOUND);
}
$input = $this->validateInput($request->all(), $timeEntry->id);
$existEntry = $entry->only([
$existEntry = $timeEntry->only([
'id',
'task_id',
'activity_type_id',
Expand All @@ -106,8 +113,8 @@ public function update(TimeEntry $timeEntry, UpdateTimeEntryRequest $request)
]);
$inputDiff = array_diff($existEntry, $input);
if (!empty($inputDiff)) {
Log::info('Entry Id: '.$entry->id);
Log::info('Task Id: '.$entry->task_id);
Log::info('Entry Id: '.$timeEntry->id);
Log::info('Task Id: '.$timeEntry->task_id);
Log::info('fields changed: ', $inputDiff);
Log::info('Entry updated by: '.Auth::user()->name);
}
Expand All @@ -119,9 +126,9 @@ public function update(TimeEntry $timeEntry, UpdateTimeEntryRequest $request)
/**
* @param TimeEntry $timeEntry
*
* @throws \Exception
* @throws Exception
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function destroy(TimeEntry $timeEntry)
{
Expand All @@ -137,8 +144,9 @@ public function destroy(TimeEntry $timeEntry)

/**
* @param array $input
* @param null $id
*
* @return array|\Illuminate\Http\JsonResponse
* @return array|JsonResponse
*/
public function validateInput($input, $id = null)
{
Expand Down Expand Up @@ -177,7 +185,7 @@ public function validateInput($input, $id = null)
}

/**
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function getUserLastTask()
{
Expand All @@ -190,7 +198,7 @@ public function getUserLastTask()
* @param int $projectId
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function getTasks($projectId, Request $request)
{
Expand All @@ -201,7 +209,9 @@ public function getTasks($projectId, Request $request)
}

/**
* @return \Illuminate\Http\JsonResponse
* @param Request $request
*
* @return JsonResponse
*/
public function getStartTimer(Request $request)
{
Expand Down
15 changes: 9 additions & 6 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
use App\Repositories\UserRepository;
use Crypt;
use DataTables;
use Exception;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;

class UserController extends AppBaseController
{
Expand Down Expand Up @@ -58,9 +61,9 @@ public function __construct(
*
* @param Request $request
*
* @throws \Exception
* @throws Exception
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Factory|View
*/
public function index(Request $request)
{
Expand All @@ -80,7 +83,7 @@ public function index(Request $request)
*
* @param CreateUserRequest $request
*
* @throws \Exception
* @throws Exception
*
* @return JsonResponse
*/
Expand Down Expand Up @@ -134,7 +137,7 @@ public function edit(User $user)
* @param User $user
* @param UpdateUserRequest $request
*
* @throws \Exception
* @throws Exception
*
* @return JsonResponse|RedirectResponse
*/
Expand Down Expand Up @@ -171,7 +174,7 @@ public function update(User $user, UpdateUserRequest $request)
*
* @param User $user
*
* @throws \Exception
* @throws Exception
*
* @return JsonResponse
*/
Expand All @@ -187,7 +190,7 @@ public function destroy(User $user)
/**
* @param User $user
*
* @throws \Exception
* @throws Exception
*
* @return JsonResponse
*/
Expand Down
Loading

0 comments on commit 5b09dc0

Please sign in to comment.