PK ZGAk}|- |- alfa-rex.phpnu [ PK ZGAk}|- |- Notifications/alfa-rex.phpnu [ PK ZhwZ ! Notifications/NewAppreciation.phpnu [ userAppreciation = $userAppreciation;
$this->emailSetting = EmailNotificationSetting::where('slug', 'appreciation-notification')->first();
$this->company = $this->userAppreciation->company;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && slack_setting()->status == 'active') {
array_push($via, 'slack');
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->status == 'active') {
array_push($via, OneSignalChannel::class);
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.newAppreciation.subject'), $this->userAppreciation->award->title);
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$build = parent::build($notifiable);
$content = __('email.newAppreciation.text', ['award' => $this->userAppreciation->award->title, 'award_at' => $this->userAppreciation->award_date->format($this->company->date_format)]);
$url = route('appreciations.show', $this->userAppreciation->id);
$url = getDomainSpecificUrl($url, $this->company);
$build
->subject(__('email.newAppreciation.subject'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.newAppreciation.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @return array
*/
public function toArray()
{
return [
'id' => $this->userAppreciation->id,
'created_at' => $this->userAppreciation->created_at->format('Y-m-d H:i:s'),
'award_at' => $this->userAppreciation->award_date->format('Y-m-d H:i:s'),
'heading' => $this->userAppreciation->award->title,
'icon' => $this->userAppreciation->award->awardIcon->icon,
'color_code' => $this->userAppreciation->award->color_code,
'image_url' => $this->userAppreciation->addedBy->image_url
];
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$url = route('appreciations.show', $this->userAppreciation->id);
$url = getDomainSpecificUrl($url, $this->company);
return $this->slackBuild($notifiable)
->content('*' . __('email.newAppreciation.subject') . '*' . "\n" . '<' . $url . '|' . $this->userAppreciation->award->title . '>');
}
// phpcs:ignore
public function toOneSignal($notifiable)
{
return OneSignalMessage::create()
->setSubject(__('email.newAppreciation.subject'))
->setBody($this->userAppreciation->award->title);
}
}
PK Z4
Notifications/NewTask.phpnu [ task = $task;
$this->emailSetting = EmailNotificationSetting::userAssignTask();
$this->company = $this->task->company;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->status == 'active') {
array_push($via, OneSignalChannel::class);
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.newTask.subject'), $this->task->heading);
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable): MailMessage
{
$build = parent::build($notifiable);
$url = route('tasks.show', $this->task->id);
$url = getDomainSpecificUrl($url, $this->company);
$dueDate = (!is_null($this->task->due_date)) ? $this->task->due_date->format($this->company->date_format) : null;
$taskShortCode = (!is_null($this->task->task_short_code)) ? '#' . $this->task->task_short_code . ' - ' : ' ';
$content = $this->task->heading . ' ' . $taskShortCode . '
' . __('app.dueDate') . ': ' . $dueDate . '
';
$subject = __('email.newTask.subject') . ' ' . $taskShortCode . config('app.name'). '.';
$build
->subject($subject)
->greeting(__('email.hello') . ' ' . $notifiable->name . ',')
->markdown('mail.task.created', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @return array
*/
public function toArray()
{
return [
'id' => $this->task->id,
'created_at' => $this->task->created_at->format('Y-m-d H:i:s'),
'heading' => $this->task->heading
];
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$dueDate = (!is_null($this->task->due_date)) ? $this->task->due_date->format($this->company->date_format) : null;
$url = route('tasks.show', $this->task->id);
$url = getDomainSpecificUrl($url, $this->company);
$taskShortCode = $this->task->task_short_code ? ' #' . $this->task->task_short_code : '';
return $this->slackBuild($notifiable)
->content('*' . __('email.newTask.subject') . '*' . "\n" . '<' . $url . '|' . $this->task->heading . '>' . "\n" . $taskShortCode . "\n" . __('app.dueDate') . ': ' . $dueDate . (!is_null($this->task->project) ? "\n" . __('app.project') . ' - ' . $this->task->project->project_name : ''));
}
// phpcs:ignore
public function toOneSignal($notifiable)
{
return OneSignalMessage::create()
->setSubject(__('email.newTask.subject'))
->setBody($this->task->heading);
}
}
PK Zp9
Notifications/NewEstimate.phpnu [ estimate = $estimate;
$this->user = User::findOrFail($estimate->client_id);
$this->company = $this->estimate->company;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if (push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.estimate.subject'), $this->estimate->estimate_number);
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
// phpcs:ignore
public function toMail($notifiable): MailMessage
{
$build = parent::build($notifiable);
$url = url()->temporarySignedRoute('front.estimate.show', now()->addDays(GlobalSetting::SIGNED_ROUTE_EXPIRY), $this->estimate->hash);
$url = getDomainSpecificUrl($url, $this->company);
$content = __('email.estimate.text') . '
' . __('app.menu.estimate') . ' ' . __('app.number') . ': ' .$this->estimate->estimate_number ;
$build
->subject(__('email.estimate.subject') . ' (' . $this->estimate->estimate_number . ') - ' . config('app.name') . '.')
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.estimateDeclined.action'),
'notifiableName' => $this->user->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->estimate->id,
'estimate_number' => $this->estimate->estimate_number
];
}
}
PK Zo:[ [ Notifications/NewLeadCreated.phpnu [ leadContact = $leadContact;
$this->company = $this->leadContact->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)->where('slug', 'lead-notification')->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = array('database');
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.lead.subject'), $this->leadContact->client_name);
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$build = parent::build($notifiable);
$url = route('lead-contact.show', $this->leadContact->id);
$url = getDomainSpecificUrl($url, $this->company);
$leadEmail = __('modules.lead.clientEmail') . ': ';
$clientEmail = !is_null($this->leadContact->client_email) ? $leadEmail . $this->leadContact->client_email . '
' : '';
$content = __('email.lead.subject') . '
' . __('modules.lead.clientName') . ': ' . $this->leadContact->client_name_salutation . '
' . $clientEmail;
if (session()->has('deal_name')) {
$content .= __('modules.deal.dealName') . ": " . session('deal_name') . '
';
}
$build
->subject(__('email.lead.subject') . ' - ' . config('app.name'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.lead.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->leadContact->id,
'name' => $this->leadContact->client_name,
'agent_id' => $notifiable->id,
'added_by' => $this->leadContact->added_by
];
}
}
PK Z'Ȼ" ) Notifications/EstimateRequestAccepted.phpnu [ estimateRequest = $estimateRequest;
$this->company = $this->estimateRequest->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)->where('slug', 'estimate-notification')->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$build = parent::build();
$url = route('estimate-request.show', $this->estimateRequest->id);
$url = getDomainSpecificUrl($url, $this->company);
$content = __('email.estimateRequestAccepted.text') . '
' . __('modules.estimateRequest.estimateRequest') . ' ' . __('app.number') . ': ' .$this->estimateRequest->estimate_request_number;
$build
->subject(__('email.estimateRequestAccepted.subject') . ' (' . $this->estimateRequest->estimate_request_number . ') - ' . config('app.name') . __('!'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.estimateRequestRejected.action'),
'notifiableName' => $notifiable->name,
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
// phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->estimateRequest->id,
'estimate_request_number' => $this->estimateRequest->estimate_request_number,
];
}
public function toSlack($notifiable)
{
return $this->slackBuild($notifiable)->content(__('email.hello') . ' ' . $notifiable->name . ' ' . __('email.estimateRequestAccepted.subject'));
}
}
PK Z%l # Notifications/TaskStatusUpdated.phpnu [ task = $task;
$this->updatedBy = $updatedBy;
$this->company = $this->task->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)
->where('slug', 'task-status-updated')
->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->status == 'active') {
array_push($via, OneSignalChannel::class);
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.taskUpdate.subject'), $this->task->heading);
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable): MailMessage
{
$build = parent::build($notifiable);
$url = route('tasks.show', $this->task->id);
$url = getDomainSpecificUrl($url, $this->company);
$projectTitle = (!is_null($this->task->project)) ? __('app.project') . ' - ' . $this->task->project->project_name : '';
$content = 'Updated Task Status: ' . $this->task->boardColumn->column_name . '
' . __('email.taskUpdate.updatedBy') . ': ' . $this->updatedBy->name . '
' . __('app.task') . ': ' . $this->task->heading . '
' . $projectTitle;
$taskShortCode = (!is_null($this->task->task_short_code)) ? '#' . $this->task->task_short_code : ' ';
$build
->subject(__('email.taskUpdate.subject') . $taskShortCode . ' - ' . config('app.name') . '.')
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.taskUpdate.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->task->id,
'created_at' => $this->task->created_at->format('Y-m-d H:i:s'),
'heading' => $this->task->heading,
'completed_on' => (!is_null($this->task->completed_on)) ? $this->task->completed_on->format('Y-m-d H:i:s') : now()->format('Y-m-d H:i:s')
];
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
* @return SlackMessage
*/
public function toSlack($notifiable)
{
$url = route('tasks.show', $this->task->id);
$url = getDomainSpecificUrl($url, $this->company);
$taskShortCode = $this->task->task_short_code ? ' #' . $this->task->task_short_code : '';
$taskStatus = $this->task->boardColumn->column_name ? 'Status: ' . $this->task->boardColumn->column_name : '';
$taskDescription = $this->task->description ? 'Description: ' . strip_tags($this->task->description) : '';
$taskAssigne = $this->task->users ? 'Task Assignees: ' . $this->task->users->pluck('name')->implode(', ') : '';
return $this->slackBuild($notifiable)
->content('*' . __('email.taskUpdate.slackStatusUpdated') . '*' . "\n" . '<' . $url . '|' . $this->task->heading . '>' .
"\n" . $taskShortCode . "\n" . $taskStatus . "\n" . $taskDescription .
"\n" . $taskAssigne . (!is_null($this->task->project) ? "\n" . __('app.project') . ': ' . $this->task->project->project_name : ''));
}
// phpcs:ignore
public function toOneSignal($notifiable)
{
return OneSignalMessage::create()
->setSubject(__('email.taskUpdate.subject'))
->setBody($this->task->heading . ' ' . __('email.taskUpdate.subject') . ' #' . $this->task->task_short_code);
}
}
PK Z0Z,
Notifications/NewUserSlack.phpnu [ company = $user->company;
// When there is company of user.
if ($this->company) {
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)->where('slug', 'user-registrationadded-by-admin')->first();
}
}
/**
* Get the notification's delivery channels.
*t('mail::layout')
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
return $via;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return $notifiable->toArray();
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
try {
$url = route('login');
$url = getDomainSpecificUrl($url, $this->company);
$content = '*' . __('email.newUser.subject') . ' ' . config('app.name') . '!*' . "\n" . __('email.newUser.text');
$url = "\n" . '<' . $url . '|' . __('email.newUser.action') . '>';
return $this->slackBuild($notifiable)->content($content . $url);
} catch (\Exception $e) {
return $this->slackRedirectMessage('email.newUser.subject', $notifiable);
}
}
}
PK ZN # Notifications/TaskUpdatedClient.phpnu [ task = $task;
$this->emailSetting = EmailNotificationSetting::userAssignTask();
$this->company = $this->task->company;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$build = parent::build($notifiable);
$url = route('tasks.show', $this->task->id);
$url = getDomainSpecificUrl($url, $this->company);
$content = $this->task->heading . ' ' . __('email.taskUpdate.subject') . '.';
$build
->subject(__('email.taskUpdate.subject') . ' - ' . config('app.name') . '.')
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.taskUpdate.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @return array
*/
public function toArray()
{
return [
'id' => $this->task->id,
'updated_at' => $this->task->updated_at->format('Y-m-d H:i:s'),
'created_at' => $this->task->created_at->format('Y-m-d H:i:s'),
'heading' => $this->task->heading
];
}
}
PK Zwz Notifications/EventInvite.phpnu [ event = $event;
$this->company = $this->event->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)->where('slug', 'event-notification')->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.newEvent.subject'), $this->event->event_name);
}
return $via;
}
/**
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
* @throws \Exception
*/
public function toMail($notifiable)
{
$eventInvite = parent::build($notifiable);
$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent
->setDtStart(new \DateTime($this->event->start_date_time))
->setDtEnd(new \DateTime($this->event->end_date_time))
->setNoTime(true)
->setSummary($this->event->event_name);
$vCalendar->addComponent($vEvent);
$vFile = $vCalendar->render();
$url = route('events.show', $this->event->id);
$url = getDomainSpecificUrl($url, $this->company);
$content = __('email.newEvent.text') . '
' . __('modules.events.eventName') . ': ' . $this->event->event_name . '
' . __('modules.events.startOn') . ': ' . $this->event->start_date_time->translatedFormat($this->company->date_format . ' - ' . $this->company->time_format) . '
' . __('modules.events.endOn') . ': ' . $this->event->end_date_time->translatedFormat($this->company->date_format . ' - ' . $this->company->time_format) . '
' . __('app.location') . ': ' . $this->event->where . '';
$eventInvite->subject(__('email.newEvent.subject') . ' - ' . config('app.name'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.newEvent.action'),
'notifiableName' => $notifiable->name
]);
$eventInvite->attachData($vFile, 'cal.ics', [
'mime' => 'text/calendar',
]);
return $eventInvite;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->event->id,
'start_date_time' => $this->event->start_date_time->format('Y-m-d H:i:s'),
'event_name' => $this->event->event_name
];
}
public function toSlack($notifiable)
{
return $this->slackBuild($notifiable)
->content(__('email.newEvent.subject') . "\n" . __('modules.events.eventName') . ': ' . $this->event->event_name . "\n" . __('modules.events.startOn') . ': ' . $this->event->start_date_time->format($this->company->date_format . ' - ' . $this->company->time_format) . "\n" . __('modules.events.endOn') . ': ' . $this->event->end_date_time->format($this->company->date_format . ' - ' . $this->company->time_format));
}
}
PK Zj_X X + Notifications/NewProductPurchaseRequest.phpnu [ invoice = $invoice;
$this->company = $this->invoice->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)->where('slug', 'new-product-purchase-request')->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->status == 'active') {
array_push($via, OneSignalChannel::class);
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.productPurchase.subject'), __('email.productPurchase.text') . ' ' . $this->invoice->client->name . '.');
}
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$build = parent::build($notifiable);
$url = route('invoices.show', $this->invoice->id);
$url = getDomainSpecificUrl($url, $this->company);
$content = __('email.productPurchase.subject') . '
' . __('email.productPurchase.text') . ' ' . $this->invoice->client->name . '.';
$build
->subject(__('email.productPurchase.subject') . ' - ' . config('app.name'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.productPurchase.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return $this->invoice->toArray();
}
//phpcs:ignore
public function toSlack($notifiable)
{
return $this->slackBuild($notifiable)
->content(__('email.productPurchase.subject') . "\n" . __('email.productPurchase.text') . ' ' . $this->invoice->client->name . '.');
}
//phpcs:ignore
public function toOneSignal($notifiable)
{
return OneSignalMessage::create()
->setSubject(__('email.productPurchase.subject'))
->setBody('by ' . $this->invoice->client->name);
}
}
PK ZK0A
A
Notifications/NewHoliday.phpnu [ holiday = $holiday;
$this->company = $this->holiday->company;
$this->emailSetting = EmailNotificationSetting::where('company_id', $this->company->id)
->where('slug', 'holiday-notification')
->first();
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['database'];
if ($this->emailSetting->send_email == 'yes' && $notifiable->email_notifications && $notifiable->email != '') {
array_push($via, 'mail');
}
if ($this->emailSetting->send_slack == 'yes' && $this->company->slackSetting->status == 'active') {
$this->slackUserNameCheck($notifiable) ? array_push($via, 'slack') : null;
}
if ($this->emailSetting->send_push == 'yes' && push_setting()->beams_push_status == 'active') {
$pushNotification = new \App\Http\Controllers\DashboardController();
$pushUsersIds = [[$notifiable->id]];
$pushNotification->sendPushNotifications($pushUsersIds, __('email.holidays.subject'), $this->holiday->occassion);
}
return $via;
}
/**
* @param mixed $notifiable
* @return MailMessage
* @throws \Exception
*/
public function toMail($notifiable)
{
$build = parent::build($notifiable);
$url = route('holidays.show', $this->holiday->id);
$url = getDomainSpecificUrl($url, $this->company);
$content = __('email.holidays.text') . '
' . __('app.occassion') . ': ' . $this->holiday->occassion . '
' . __('app.date') . ': ' . $this->holiday->date->translatedFormat($this->company->date_format) . '';
$build->subject(__('email.holidays.subject') . ' - ' . config('app.name'))
->markdown('mail.email', [
'url' => $url,
'content' => $content,
'themeColor' => $this->company->header_color,
'actionText' => __('email.leaves.action'),
'notifiableName' => $notifiable->name
]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
//phpcs:ignore
public function toArray($notifiable)
{
return [
'id' => $this->holiday->id,
'holiday_date' => $this->holiday->date->format('Y-m-d H:i:s'),
'holiday_name' => $this->holiday->occassion
];
}
public function toSlack($notifiable)
{
return $this->slackBuild($notifiable)
->content(__('email.holidays.subject') . "\n" . $notifiable->name . "\n" . '*' . __('app.date') . '*: ' . $this->holiday->date->format($this->company->date_format) . "\n" . __('modules.holiday.occasion') . ': ' . $this->holiday->occassion);
}
}
PK Zu $ Notifications/DailyTimeLogReport.phpnu [ user = $user;
$this->role = $role;
$this->company = $this->user->company;
$this->todayDate = Carbon::now()->toDateString();
}
/**
* Get the notification's delivery channels.
*
* @return array
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function attachments()
{
return [
Attachment::fromData(fn() => $this->domPdfObjectForDownload()['pdf']->output(), 'TimeLog-Report-' . $this->todayDate . '.pdf')
->withMime('application/pdf'),
];
}
public function domPdfObjectForDownload()
{
$company = $this->company;
$employees = User::select('users.id', 'users.name')
->with(['timeLogs' => function ($query) use ($company) {
$query->whereRaw('DATE(start_time) = ?', [$this->todayDate]);
$query->where('company_id', $company->id);
}, 'timeLogs.breaks'])
->when($this->role->name != 'admin', function ($query) {
$query->where('users.id', $this->user->id);
})
->join('role_user', 'role_user.user_id', '=', 'users.id')
->join('roles', 'roles.id', '=', 'role_user.role_id')->onlyEmployee()
->where('roles.company_id', $company->id)
->groupBy('users.id');
$employees = $employees->get();
$employeeData = [];
foreach ($employees as $employee) {
$employeeData[$employee->name] = [];
$employeeData[$employee->name]['timelog'] = 0;
$employeeData[$employee->name]['timelogBreaks'] = 0;
if (count($employee->timeLogs) > 0) {
foreach ($employee->timeLogs as $timeLog) {
$employeeData[$employee->name]['timelog'] += $timeLog->total_minutes;
if (count($timeLog->breaks) > 0) {
foreach ($timeLog->breaks as $timeLogBreak) {
$employeeData[$employee->name]['timelogBreaks'] += $timeLogBreak->total_minutes;
}
}
}
}
}
$now = $this->todayDate;
$requestedDate = $now;
$pdf = app('dompdf.wrapper')->setPaper('A4', 'landscape');
$options = $pdf->getOptions();
$options->set(array('enable_php' => true));
$pdf->getDomPDF()->setOptions($options);
/** @phpstan-ignore-line */
$pdf->loadView('timelog-report', ['employees' => $employeeData, 'date' => $now, 'company' => $company]);
$filename = 'timelog-report';
return [
'pdf' => $pdf,
'fileName' => $filename
];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
$build = parent::build($notifiable);
$pdfOption = $this->domPdfObjectForDownload();
$pdf = $pdfOption['pdf'];
$filename = $pdfOption['fileName'];
$build->attachData($pdf->output(), $filename . '.pdf');
App::setLocale($notifiable->locale ?? $this->company->locale ?? 'en');
$build->subject(__('email.dailyTimelogReport.subject') . ' ' . $this->todayDate)
->markdown('mail.timelog.timelog-report', ['date' => $this->todayDate, 'name' => $this->user->name]);
parent::resetLocale();
return $build;
}
/**
* Get the array representation of the notification.
*
* @return array
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}
PK Z䉀 &