mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
no message
This commit is contained in:
1 parent
3b8250db8f
commit
069f5a04e1
2 files changed
+37
-25
No files matched your search
@@ -27,7 +27,7 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('intranet:sync-vacations')->twiceDaily();
|
$schedule->command('intranet:sync-vacations')->twiceDaily();
|
||||||
$schedule->command('karat:sync-users')->daily();
|
$schedule->command('karat:sync-users')->daily();
|
||||||
$schedule->command('karat:sync-clients')->hourly();
|
$schedule->command('karat:sync-clients')->hourly();
|
||||||
$schedule->command('karat:sync-projects')->hourly();
|
$schedule->command('karat:sync-projects')->everyFiveMinutes();
|
||||||
$schedule->command('karat:sync-timesheets')->everyFiveMinutes();
|
$schedule->command('karat:sync-timesheets')->everyFiveMinutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,42 @@ class MasterTaskController extends Controller
|
|||||||
return response()->json($validator->errors(), 400);
|
return response()->json($validator->errors(), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mastertask = MasterTask::find($id);
|
||||||
|
|
||||||
|
// ak je Master task v stave ukončený, nedovolime update. vynimkou je iba znovuotvorenie mastertasku
|
||||||
|
if ($mastertask->is_finished == 1 && isset($request->all()['data']['is_finished']) && $request->all()['data']['is_finished'] == 1) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Cannot update mastertask that is finished.',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ak chcem ukoncit mastertask, ktory nema ani jeden subtask, ktory ma natrackovany cas, tak to nedovolim
|
||||||
|
if (isset($request->all()['data']['is_finished']) && $request->all()['data']['is_finished'] == 1) {
|
||||||
|
$atLeastOneSubtaskHasTimesheet = false;
|
||||||
|
|
||||||
|
foreach ($mastertask->subtasks as $subtask) {
|
||||||
|
if ($subtask->timesheets()->exists()) {
|
||||||
|
$atLeastOneSubtaskHasTimesheet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$atLeastOneSubtaskHasTimesheet)
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Finishing mastertask is only possible where at least one subtask contains timesheet',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ukoncenie master tasku
|
||||||
|
if ($mastertask->is_finished == 0 && isset($request->all()['data']['is_finished']) && $request->all()['data']['is_finished'] == 1) {
|
||||||
|
$mastertask->is_finished = 1;
|
||||||
|
$mastertask->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Master Task finished successfully',
|
||||||
|
'mastertask' => $mastertask
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// validacia na max 50MB size pre attachmenty. neslo dat do klasickeho laravel validation, tak je to separe
|
// validacia na max 50MB size pre attachmenty. neslo dat do klasickeho laravel validation, tak je to separe
|
||||||
if ($files = $request->file('data')) {
|
if ($files = $request->file('data')) {
|
||||||
foreach ( $files['files'] as $file ) {
|
foreach ( $files['files'] as $file ) {
|
||||||
@@ -154,30 +190,6 @@ class MasterTaskController extends Controller
|
|||||||
|
|
||||||
$request->merge($data);
|
$request->merge($data);
|
||||||
|
|
||||||
$mastertask = MasterTask::find($id);
|
|
||||||
|
|
||||||
// ak je Master task v stave ukončený, nedovolime update. vynimkou je iba znovuotvorenie mastertasku
|
|
||||||
if ($mastertask->is_finished == 1 && isset($request->all()['data']['is_finished']) && $request->all()['data']['is_finished'] == 1) {
|
|
||||||
return response()->json([
|
|
||||||
'message' => 'Cannot update mastertask with is_finished 1.',
|
|
||||||
], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ak chcem ukoncit mastertask, ktory nema ani jeden subtask, ktory ma natrackovany cas, tak to nedovolim
|
|
||||||
if (isset($request->all()['data']['is_finished']) && $request->all()['data']['is_finished'] == 1) {
|
|
||||||
$atLeastOneSubtaskHasTimesheet = false;
|
|
||||||
|
|
||||||
foreach ($mastertask->subtasks as $subtask) {
|
|
||||||
if ($subtask->timesheets()->exists()) {
|
|
||||||
$atLeastOneSubtaskHasTimesheet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$atLeastOneSubtaskHasTimesheet)
|
|
||||||
return response()->json([
|
|
||||||
'message' => 'Finishing mastertask is only possible where at least one subtask contains timesheet',
|
|
||||||
], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mastertask->update($request->all()['data']);
|
$mastertask->update($request->all()['data']);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user