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
e1a8a3fe1a
commit
eaceee3f7f
5 files changed
+87
-9
No files matched your search
@@ -51,12 +51,15 @@ class SubTaskController extends Controller
|
||||
return response()->json($validator->errors(), 400);
|
||||
}
|
||||
|
||||
$start = Carbon::parse($parameters['start']);
|
||||
$end = Carbon::parse($parameters['end'])->addDay();
|
||||
|
||||
if (isset($parameters['team_id'])) {
|
||||
$subtasks = SubTask::whereHas('mastertask', function ($query) use ($parameters) {
|
||||
$query->where('team_id', $parameters['team_id']);
|
||||
})->whereHas('timeblocks', function ($query) use ($parameters) {
|
||||
$query->where('start', '>', $parameters['start']);
|
||||
$query->where('end', '<=', $parameters['end']);
|
||||
})->whereHas('timeblocks', function ($query) use ($start, $end) {
|
||||
$query->where('start', '>', $start);
|
||||
$query->where('end', '<', $end);
|
||||
})->get();
|
||||
|
||||
$userIdArray = User::whereHas('teams', function ($query) use ($parameters) {
|
||||
@@ -64,15 +67,15 @@ class SubTaskController extends Controller
|
||||
})->get()->pluck('id')->toArray();
|
||||
|
||||
} else if (isset($parameters['user_id'])) {
|
||||
$subtasks = SubTask::where('user_id', $parameters['user_id'])->whereHas('timeblocks', function ($query) use ($parameters) {
|
||||
$query->where('start', '>', $parameters['start']);
|
||||
$query->where('end', '<=', $parameters['end']);
|
||||
$subtasks = SubTask::where('user_id', $parameters['user_id'])->whereHas('timeblocks', function ($query) use ($start, $end) {
|
||||
$query->where('start', '>', $start);
|
||||
$query->where('end', '<', $end);
|
||||
})->get();
|
||||
|
||||
$userIdArray = [$parameters['user_id']];
|
||||
}
|
||||
|
||||
$blockers = Blocker::whereIn('user_id', $userIdArray)->where('start', '>=', $parameters['start'])->where('end', '<=', $parameters['end'])->get();
|
||||
$blockers = Blocker::whereIn('user_id', $userIdArray)->where('start', '>', $start)->where('end', '<', $end)->get();
|
||||
|
||||
return response()->json([
|
||||
'subtasks' => SubTaskResource::collection($subtasks),
|
||||
|
||||
@@ -43,7 +43,7 @@ class SendEditedMasterTaskNotification implements ShouldQueue
|
||||
$modelDiff = array_diff_assoc($editedMasterTaskArray, $originalMasterTaskArray);
|
||||
|
||||
foreach ( $modelDiff as $key => $diff ) {
|
||||
if (in_array($key, ['status'])) {
|
||||
if (in_array($key, ['status', 'tracked_time'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\SubTaskEdited;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendEditedSubTaskNotification
|
||||
class SendEditedSubTaskNotification implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
@@ -56,6 +57,15 @@ class SendEditedSubTaskNotification
|
||||
continue;
|
||||
}
|
||||
|
||||
// ukoncenie sub tasku - Pokiaľ je sub task ukončený s vyšším počtom vykázaných hodín ako bol pôvodne zadaný, posiela sa e-mailová notifikácia o tejto skutočnosti zadávateľovi master tasku (soft warning).
|
||||
if ($key == 'is_finished' && $diff == 1 && $event->subtask->tracked_time > $event->subtask->estimated_time) {
|
||||
// $creatorEmail = User::find($event->subtask->created_by)->email;
|
||||
|
||||
// Mail::to( $creatorEmail )->send( new \App\Mail\SubTaskFinishedWithHigherTrackedTime( $event->subtask ) );
|
||||
Mail::to( 'feher@studiotem.com' )->send( new \App\Mail\SubTaskFinishedWithHigherTrackedTime( $event->subtask ) );
|
||||
|
||||
}
|
||||
|
||||
$difference[$key] = $diff;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\SubTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SubTaskFinishedWithHigherTrackedTime extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $subtask;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SubTask $subtask)
|
||||
{
|
||||
$this->subtask = $subtask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Envelope
|
||||
*/
|
||||
public function envelope()
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Sub Task Finished With Higher Tracked Time Than Estimated'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Content
|
||||
*/
|
||||
public function content()
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.task.sub_task_finished_with_higher_tracked_time'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attachments()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Sub Task {{$subtask->mastertask->title}} finished with higher tracker time than estimated. <br><br>
|
||||
Estimated: {{$subtask->estimated_time}} <br>
|
||||
Tracked: {{$subtask->tracked_time}} <br>
|
||||
Reference in new issue
Block a user