Add tasks to client portal

This commit is contained in:
David Bomba 2024-01-25 14:06:26 +11:00
parent 6fbd80333a
commit 976d1f9f1a
3 changed files with 50 additions and 6 deletions

View File

@ -54,6 +54,7 @@ class TasksTable extends Component
return render('components.livewire.tasks-table', [ return render('components.livewire.tasks-table', [
'tasks' => $query, 'tasks' => $query,
'show_item_description' => auth()->guard('contact')->user()->company->invoice_task_item_description ?? false,
]); ]);
} }
} }

View File

@ -316,8 +316,8 @@ class Task extends BaseModel
$logged['end_date'] = ctrans('texts.running'); $logged['end_date'] = ctrans('texts.running');
} }
$logged['description'] = $log[2]; $logged['description'] = $log[2] ?? '';
$logged['billable'] = $log[3]; $logged['billable'] = $log[3] ?? false;
$logged['duration_raw'] = $duration; $logged['duration_raw'] = $duration;
$logged['duration'] = gmdate("H:i:s", $duration); $logged['duration'] = gmdate("H:i:s", $duration);

View File

@ -12,7 +12,7 @@
</div> </div>
<div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8"> <div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
<div class="align-middle inline-block min-w-full overflow-hidden rounded"> <div class="align-middle inline-block min-w-full overflow-hidden rounded">
<table class="min-w-full shadow rounded border border-gray-200 mt-4 credits-table"> <table class="min-w-full shadow rounded border border-gray-200 mt-4 credits-table bg-white">
<thead> <thead>
<tr> <tr>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary"> <th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
@ -38,7 +38,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@forelse($tasks as $task) @foreach($tasks as $task)
<tr class="bg-white group hover:bg-gray-100"> <tr class="bg-white group hover:bg-gray-100">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500"> <td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{{ \Illuminate\Support\Str::limit($task->description, 80) }} {{ \Illuminate\Support\Str::limit($task->description, 80) }}
@ -63,13 +63,56 @@
{{ \Carbon\CarbonInterval::seconds($task->calcDuration())->cascade()->forHumans() }} {{ \Carbon\CarbonInterval::seconds($task->calcDuration())->cascade()->forHumans() }}
</td> </td>
</tr> </tr>
@empty @if($show_item_description)
<tr><td width="100%" colspan="4">
<table class="min-w-full ml-5">
<thead>
<tr>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<span>
{{ ctrans('texts.date') }}
</span>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<span>
{{ ctrans('texts.duration') }}
</span>
</th>
<th colspan="4" class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<span>
{{ ctrans('texts.description') }}
</span>
</th>
</tr>
</thead>
<tbody>
@foreach($task->processLogsExpandedNotation() as $log)
@if(strlen($log['description']) > 1)
<tr class="bg-white group border-b border-gray-100">
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6">
{{ $log['start_date']}}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6">
{{ $log['duration']}}
</td>
<td colspan="4" class="px-6 py-4 text-sm leading-5 text-gray-500 w-4/6">
{!! nl2br(e($log['description'])) !!}
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</td></tr>
@endif
@endforeach
@if($tasks->count() == 0)
<tr class="bg-white group hover:bg-gray-100"> <tr class="bg-white group hover:bg-gray-100">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500" colspan="100%"> <td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500" colspan="100%">
{{ ctrans('texts.no_results') }} {{ ctrans('texts.no_results') }}
</td> </td>
</tr> </tr>
@endforelse @endif
</tbody> </tbody>
</table> </table>
</div> </div>