@extends('layouts.app') @section('title', 'Task Preview') @section('content') @push('css') @endpush Task Details Task Details Task Name: {{ $task['task_name'] }} Task Type: {{ $task['task_type'] ?? "To Do" }} Task Priority: {{ $task['priority'] ?? "None" }} Start Date: {{ \Carbon\Carbon::parse($task['start_date'])->format('m/d/Y') }} Deadline Date:{{ !empty($task['deadline_date']) ? \Carbon\Carbon::parse($task['deadline_date'])->format('m/d/Y') : 'N/A' }} Start Time: {{ $task['s_time'] ?? "N/A" }} End Time: {{ $task['e_time'] ?? "N/A" }} Agent: {{ isset($task['agents']['f_name'], $task['agents']['l_name']) ? $task['agents']['f_name'] . ' ' . $task['agents']['l_name'] : "N/A" }} Contact: {{ isset($task['contacts']['f_name'], $task['contacts']['l_name']) ? $task['contacts']['f_name'] . ' ' . $task['contacts']['l_name'] : 'N/A' }} Property: {{ $task['properties'] ? implode(', ', collect($task['properties']['addresses'])->map(fn($address) => ($address['street'] ?? $address['state']) . ', ' . ($address['city'] ?? ''))->toArray()) : 'N/A' }} Task Reminder: {{ $task['task_reminder'] }} {{ $task['task_reminder_interval'] ?? "N/A" }} Task Repeat: {{ ucfirst($task['task_repeat'] ?? "N/A" ) }} @if ($task['task_repeat'] === 'weekly') Repeat Days: @if(!empty( $task['week_days'])) @foreach (json_decode($task['week_days'] ?? '[]') as $day) {{ ucfirst($day) }} @endforeach @endif @endif @if ($task['task_repeat'] === 'monthly') Repeat Dates: @php if (isset($task['month_date_range'])) { $dateString = trim($task['month_date_range'], '"\\'); // Check if the date string is not empty and not equal to 'null' or '[]' if (!empty($dateString) && $dateString !== 'null' && $dateString !== '[]') { // Handle JSON array format (e.g., ["2025-02-13", "2025-02-14"]) if (strpos($dateString, '[') === 0) { $datesArray = json_decode($dateString, true); } else { // Handle comma-separated string format (e.g., "2025-02-13, 2025-02-14, 2025-02-15") $datesArray = explode(',', $dateString); } // Filter out any empty values from the array $datesArray = array_filter($datesArray, function ($date) { return !empty(trim($date)); }); // Format each date using Carbon $formattedDates = array_map(function ($date) { return '' . \Carbon\Carbon::parse(trim($date))->format('m/d/Y') . ''; }, $datesArray); echo implode(' ', $formattedDates); // Output the dates with spaces } else { echo "No repeat dates available."; } } else { echo "No repeat dates available."; } @endphp @endif Task Tags: @foreach (json_decode($task['task_tags'] ?? '[]') as $tag) {{ $tag }} @endforeach Description {!! $task['task_description'] !!} @endsection