Akaunting/app/View/Components/Documents/Show/Send.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2022-06-01 07:15:55 +00:00
<?php
namespace App\View\Components\Documents\Show;
use App\Abstracts\View\Components\Documents\Show as Component;
2023-10-03 08:06:08 +00:00
use Illuminate\Support\Str;
2022-06-01 07:15:55 +00:00
class Send extends Component
{
public $description;
2023-10-03 08:06:08 +00:00
public $user_name;
public $type_lowercase;
public $last_sent;
public $last_sent_date;
public $histories;
2022-06-01 07:15:55 +00:00
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
2023-10-03 08:06:08 +00:00
$this->description = $this->document->isRecurringDocument() ? 'documents.slider.create_recurring' : 'general.last_sent';
$this->histories = $this->document->histories()->status('sent')->latest()->get();
$this->last_sent = $this->histories->first();
$this->user_name = ($this->last_sent) ? $this->last_sent->owner->name : trans('general.na');
2022-06-01 07:15:55 +00:00
2023-10-03 08:06:08 +00:00
$this->type_lowercase = Str::lower(trans_choice($this->textPage, 1));
2022-06-01 07:15:55 +00:00
2023-10-03 08:06:08 +00:00
$date = ($this->last_sent) ? company_date($this->last_sent->created_at) : trans('general.na');
2022-06-01 07:15:55 +00:00
2023-10-03 08:06:08 +00:00
$this->last_sent_date = '<span class="font-medium">' . $date . '</span>';
2022-06-01 07:15:55 +00:00
return view('components.documents.show.send');
}
}