Update cost calculation display and management in CostCalculator module.

Show page Design added for cost calculation
This commit is contained in:
2025-08-16 23:24:40 +05:45
parent 6d6d1c9a8a
commit 75ebf99990
7 changed files with 307 additions and 28 deletions

View File

@@ -2,6 +2,9 @@
<a href="{{ route('cost.edit', $id) }}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Edit"
class="link-success fs-15 edit-item-btn"><i class=" ri-edit-2-line"></i></a>
<a href="{{ route('cost.show', $id) }}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="View"
class="link-success fs-15"><i class="ri-eye-line"></i></a>
{{-- <a data-link="{{ route('cost.toggle', $id) }}" data-bs-toggle="tooltip" data-bs-placement="bottom"
data-bs-title="Toggle" data-status="{{ $status == 1 ? 'Draft' : 'Published' }}"
class="link-info fs-15 toggle-item"><i class="{{ $status == 1 ? 'ri-toggle-line' : 'ri-toggle-fill' }}"></i></a> --}}

View File

@@ -6,11 +6,11 @@
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('accomodation_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->monthly ?? null)->placeholder('Monthly') }}
{{ html()->text('accomodation_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->pivot->monthly ?? null)->placeholder('Monthly') }}
</td>
<td>
{{ html()->text('accomodation_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->yearly ?? null)->placeholder('Yearly') }}
{{ html()->text('accomodation_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->pivot->yearly ?? null)->placeholder('Yearly') }}
</td>
<td class="align-middle">

View File

@@ -6,11 +6,11 @@
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('living_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->monthly ?? null)->placeholder('Monthly') }}
{{ html()->text('living_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->pivot->monthly ?? null)->placeholder('Monthly') }}
</td>
<td>
{{ html()->text('living_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->yearly ?? null)->placeholder('Yearly') }}
{{ html()->text('living_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->pivot->yearly ?? null)->placeholder('Yearly') }}
</td>
<td class="align-middle">

View File

@@ -5,19 +5,19 @@
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('onetime_cost[' . $numInc . '][visa]')->class('form-control')->value($value->visa ?? null)->placeholder('Visa') }}
{{ html()->text('onetime_cost[' . $numInc . '][visa]')->class('form-control')->value($value->pivot->visa ?? null)->placeholder('Visa') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][biometrics]')->class('form-control')->value($value->biometrics ?? null)->placeholder('Biometrics') }}
{{ html()->text('onetime_cost[' . $numInc . '][biometrics]')->class('form-control')->value($value->pivot->biometrics ?? null)->placeholder('Biometrics') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][sevis]')->class('form-control')->value($value->sevis ?? null)->placeholder('Sevis') }}
{{ html()->text('onetime_cost[' . $numInc . '][sevis]')->class('form-control')->value($value->pivot->sevis ?? null)->placeholder('Sevis') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][application]')->class('form-control')->value($value->application ?? null)->placeholder('Application') }}
{{ html()->text('onetime_cost[' . $numInc . '][application]')->class('form-control')->value($value->pivot->application ?? null)->placeholder('Application') }}
</td>
<td class="align-middle">

View File

@@ -6,15 +6,15 @@
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('service_cost[' . $numInc . '][flight_ticket]')->class('form-control')->value($value->flight_ticket ?? null)->placeholder('Flight Ticket') }}
{{ html()->text('service_cost[' . $numInc . '][flight_ticket]')->class('form-control')->value($value->pivot->flight_ticket ?? null)->placeholder('Flight Ticket') }}
</td>
<td>
{{ html()->text('service_cost[' . $numInc . '][insurance]')->class('form-control')->value($value->insurance ?? null)->placeholder('Health Insurance') }}
{{ html()->text('service_cost[' . $numInc . '][insurance]')->class('form-control')->value($value->pivot->insurance ?? null)->placeholder('Health Insurance') }}
</td>
<td>
{{ html()->text('service_cost[' . $numInc . '][extra]')->class('form-control')->value($value->extra ?? null)->placeholder('Extra') }}
{{ html()->text('service_cost[' . $numInc . '][extra]')->class('form-control')->value($value->pivot->extra ?? null)->placeholder('Extra') }}
</td>
<td class="align-middle">

View File

@@ -0,0 +1,181 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<x-dashboard.breadcumb :title="$title" />
<div class="row justify-content-center">
<div class="col-lg-11">
@foreach ($breakdowns as $type => $breakdown)
<div class="card shadow-lg border-0 rounded-4 mb-5">
<!-- Header -->
<div class="bg-warning-subtle position-relative">
<div class="card-body p-5 text-center">
<a class="navbar-brand flex p-0 relative w-140" href="{{ url('/') }}" rel="home"><span
class="navbar-brand-inner post-rel"><img src="{{ asset(setting('logo')) }}"
alt="raffle logo" /></span></a>
</div>
<div class="shape">
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="60"
preserveAspectRatio="none" viewBox="0 0 1440 60">
<path d="M 0,4 C 144,13 432,48 720,49 C 1008,50 1296,17 1440,9L1440 60L0 60z"
style="fill: var(--vz-secondary-bg);"></path>
</svg>
</div>
</div>
<!-- Header -->
<div class="text-center">
<p class="mb-0 fs-5 test-muted"><i>Estimated Cost Calculation For
{{ $cost->country?->title ?? 'N/A' }}</i> (<strong
class="text-capitalize">{{ str_replace('_', ' ', $type) }}</strong>)
</p>
</div>
<!-- Body -->
<div class="card-body p-4">
<!-- Living & Accommodation -->
<h5 class="fw-bold mt-4 text-primary">Recurring Costs</h5>
<div class="table-responsive">
<table
class="table table-bordered table-striped shadow-sm rounded align-middle text-center">
<thead class="">
<tr class="fw-bold text-uppercase">
<th></th>
<th>Monthly</th>
<th>Yearly</th>
</tr>
</thead>
<tbody class="small">
<tr>
<td class="fw-semibold text-muted">Living Cost</td>
<td class="">
{{ $breakdown['living']['monthly'] }}
</td>
<td class="">
{{ $breakdown['living']['yearly'] }}
</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Accommodation Cost</td>
<td class="">
{{ $breakdown['accomodation']['monthly'] }}
</td>
<td class="">
{{ $breakdown['accomodation']['yearly'] }}
</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total Recurring</td>
<td class="fw-bold">
<span class="badge bg-success fs-6 px-3 py-2">
{{ $breakdown['living']['monthly'] + $breakdown['accomodation']['monthly'] }}
</span>
</td>
<td class="fw-bold">
<span class="badge bg-success fs-6 px-3 py-2">
{{ $breakdown['living']['yearly'] + $breakdown['accomodation']['yearly'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Living & Accommodation -->
<!-- One-time Costs -->
<h5 class="fw-bold mt-4 text-primary">One-time Costs</h5>
<div class="table-responsive">
<table class="table table-hover align-middle table-striped border rounded shadow-sm">
<tbody class="small">
<tr>
<td class="fw-semibold text-muted">Visa</td>
<td class="text-end">{{ $breakdown['onetime']['visa'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Biometrics</td>
<td class="text-end">{{ $breakdown['onetime']['biometrics'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">SEVIS</td>
<td class="text-end">{{ $breakdown['onetime']['sevis'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Application</td>
<td class="text-end">{{ $breakdown['onetime']['application'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total One-time</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-3 py-2">
{{ $breakdown['onetime']['total'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Service Costs -->
<h5 class="fw-bold mt-4 text-primary">Service Costs</h5>
<div class="table-responsive">
<table class="table table-hover align-middle table-striped border rounded shadow-sm">
<tbody class="small">
<tr>
<td class="fw-semibold text-muted">Flight Ticket</td>
<td class="text-end">{{ $breakdown['service']['flight_ticket'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Insurance</td>
<td class="text-end">{{ $breakdown['service']['insurance'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Extra</td>
<td class="text-end">{{ $breakdown['service']['extra'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total Service</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-3 py-2">
{{ $breakdown['service']['total'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Overall -->
<div class="table-responsive mt-4">
<table class="table shadow-lg rounded-4 text-center align-middle"
style="background: #f8f9fa;">
<thead style="background: linear-gradient(90deg, #4e54c8, #8f94fb);">
<tr>
<th class="fs-5 fw-bold text-white text-uppercase py-3">
Overall Estimated Cost
<div class="small fw-normal fst-italic text-light mt-1">
(Excluding Recurring Costs)
</div>
</th>
<th class="p-3">
<div class="d-flex justify-content-center align-items-center h-100">
<span class="badge bg-warning text-dark fs-4 px-4 py-3">
{{ $breakdown['service']['total'] + $breakdown['onetime']['total'] }}
</span>
</div>
</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
@endsection