@extends('admin.layout.master') @section('title','NTMP API RESPONSE') @section('content')

NTMP API RESPONSES

@php $first_booking = $infos->first()->getBookingInfo ?? null; @endphp @if($first_booking)
Booking No: {{ $first_booking->resv_code }}
Check In No: {{ $first_booking->checkin_code }}
Check Out No: {{ $first_booking->checkout_bill }}
@php $type_arr = [ 1 => 'Booking', 2 => 'Booking Edit', 3 => 'Direct Checkin', 4 => 'Checkin From Booking', 5 => 'Checkin Edit', 6 => 'Checkout', 7 => 'Booking Cancel', 8 => 'Occupancy Update', 9 => 'Admin Adjustment' ]; function roundJsonValues($jsonStr) { $keysToRound = ["dailyRoomRate", "totalRoomRate", "vat", "municipalityTax", "grandTotal"]; $data = json_decode($jsonStr, true); // Decode to associative array if (!is_array($data)) return $jsonStr; // Fallback if not valid array_walk_recursive($data, function (&$value, $key) use ($keysToRound) { if (in_array($key, $keysToRound) && is_numeric($value)) { // Force cast to float to ensure proper rounding $value = number_format((float) $value, 4, '.', ''); } }); return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } @endphp
@foreach ($infos as $info) @php $request = json_encode(json_decode($info->request), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); $response = json_encode(json_decode($info->response), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); @endphp
Action: {{ array_key_exists($info->type, $type_arr) ? $type_arr[$info->type] : $info->type }}
@{{ $info->created_at->format('d-m-Y') }} {{ $info->created_at->format('h:i A') }}
By: {{ $info->getPostedBy->name }}
{{ roundJsonValues($request) }}
{{ $response }}
@endforeach
@else

No Data Found.

@endif
@endsection @section('script') @endsection