<div class="mt-3">
    <strong class="mb-2">اطلاعات وضعیت ها:</strong>
    <table class="step-table">
        @if (is_array($RequestInfo->step_info))
        @foreach ($RequestInfo->step_info as $step_info)
        <tr>
            <th>{{$step_info['action']}}</th>
            <td>{{$step_info['date']}}</td>
        </tr>
        @endforeach
        @endif
    </table>
</div>

<div class="mt-3">
    <strong class="mb-2">اطلاعات قرارداد:</strong>
    <table class="step-table">
        @if (is_array($RequestInfo->contract) && $RequestInfo->contract['isAccepted'])
            <tr>
                <th>توسط کشاورز تایید شد</th>
                <td>{{$RequestInfo->contract['acceptedDate']}}</td>
            </tr>
        @endif
        @if (is_array($RequestInfo->contract) && isset($RequestInfo->contract['priceperunit']))
            <tr>
                <th>قیمت واحد</th>
                @if (strstr($RequestInfo->contract['priceperunit'],",") || strstr($RequestInfo->contract['priceperunit'],"٬"))
                <td>{{$RequestInfo->contract['priceperunit']}}</td>    
                @else
                <td>{{number_format((int) $RequestInfo->contract['priceperunit'])}}</td>
                @endif
                
            </tr>
        @endif
        @if (is_array($RequestInfo->contract) && isset($RequestInfo->contract['pricetotal']))
            <tr>
                <th>قیمت کل</th>
                <td>{{number_format($RequestInfo->contract['pricetotal'])}}</td>
            </tr>
        @endif
        @if (is_array($RequestInfo->transportation) && isset($RequestInfo->transportation['price']) && $RequestInfo->transportation['price'] != '')
            <tr>
                <th>هزینه حمل و نقل</th>
                <td>{{number_format($RequestInfo->transportation['pricetotal'])}}</td>
            </tr>
        @endif
    </table>
</div>

<div class="mt-3">
    <strong class="mb-2">اطلاعات راننده:</strong>
    <table class="step-table">
        <tr>
            <th>نام و نام خانوادگی</th>
            <td>{{$Transporter->first_name ?? 'حمل توسط کشاورز'}} {{$Transporter->last_name ?? ''}}</td>
        </tr>
        <tr>
            <th>شماره تماس</th>
            <td>{{$Transporter->phone ?? $RequestInfo->phone}}</td>
        </tr>
    </table>
</div>

<div class="mt-3">
    <strong class="mb-2">اطلاعات وزن ها:</strong>
    <table class="step-table">
        @if (isset($weightInfo['farmer']))
        <tr>
            <th>کشاورز</th>
            <td>{{$weightInfo['farmer']}}</td>
        </tr>
        @endif
        @if (isset($weightInfo['transporter']))
        <tr>
            <th>راننده</th>
            <td>{{$weightInfo['transporter']}}</td>
        </tr>
        @endif
        @if (isset($weightInfo['chief']))
        @foreach ($weightInfo['chief'] as $weight)
        <tr>
            <th>سرتیم: {{$weight['name']}}</th>
            <td>کلاله تر {{$weight['کلاله']}} - ریشه {{$weight['ریشه']}} - گل {{$weight['گل']}}</td>
        </tr>
        @endforeach
        @endif
        @if (isset($weightInfo['dryer']))
        @if (isset($weightInfo['dryer']['کلاله']))
        <tr>
            <th>واحد خشک کن</th>
            <td>کلاله تر {{$weightInfo['dryer']['کلاله']}}</td>
        </tr>
        @endif
        @if (isset($weightInfo['dryer']['زعفران']))
        <tr>
            <th>واحد خشک کن</th>
            <td>زعفران {{$weightInfo['dryer']['زعفران']}}</td>
        </tr>
        @endif
        @endif
    </table>
</div>

