feat: Implement Cost Calculator module with CRUD operations and DataTables integration

This commit is contained in:
2025-08-14 16:17:13 +05:45
parent 165012ea56
commit 7771d57642
11 changed files with 280 additions and 212 deletions

View File

@@ -0,0 +1,25 @@
<tr class="accomodation-cost">
<td>
{{ html()->select('accomodation_cost[' . $numInc . '][status]', $livingStatusOptions)->class('form-select')->placeholder('-Select-')->value($value->id ?? null)->required() }}
{{ html()->div('Please enter living status')->class('invalid-feedback') }}
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('accomodation_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->monthly ?? null)->placeholder('Monthly') }}
</td>
<td>
{{ html()->text('accomodation_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->yearly ?? null)->placeholder('Yearly') }}
</td>
<td class="align-middle">
<div class="hstack gap-2">
<a href="javascript:void(0)" onclick="cloneRow(this)" class="btn btn-sm btn-secondary fw-medium"><i
class="ri-add-fill align-middle"></i></a>
<a href="javascript:void(0)" class="btn btn-sm btn-danger" onclick="removeRow(this)">
<i class="ri-subtract-line align-middle"></i>
</a>
</div>
</td>
</tr>

View File

@@ -22,30 +22,22 @@
</div>
<div class="card-body show collapse" id="collapse-personal">
<div class="row gy-3">
<div class="col-md-4">
<div class="col-md-6">
{{ html()->label('Country')->class('form-label') }}
{{ html()->span('*')->class('text-danger') }}
{{ html()->select('country_id', $countryOptions)->placeholder('Select')->class('form-select choices-select')->required() }}
{{ html()->div('Please select country')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
<div class="col-md-6">
{{ html()->label('Program Level')->class('form-label')->for('programlevel_id') }}
{{ html()->span('*')->class('text-danger') }}
{{ html()->select('programlevel_id', $programLevelOptions)->placeholder('Select')->class('form-select choices-select')->required() }}
{{ html()->div('Please select program level')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Living Status')->class('form-label')->for('institution_id') }}
{{ html()->span('*')->class('text-danger') }}
{{ html()->select('living_status_id', $livingStatusOptions)->placeholder('Select')->class('form-select choices-select')->required() }}
{{ html()->div('Please select Living Status')->class('invalid-feedback') }}
</div>
<div class="col-md-12">
{{ html()->label('Program')->class('form-label')->for('program_id') }}
{{ html()->span('*')->class('text-danger') }}
{{ html()->select('program_id', $programOptions)->placeholder('Select')->class('form-select choices-select')->required() }}
{{ html()->div('Please select program')->class('invalid-feedback') }}
</div>
@@ -68,7 +60,7 @@
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
<li class="list-inline-item">
<a class="minimize-card collapsed align-middle" data-bs-toggle="collapse"
href="#collapse-preparation" role="button" aria-expanded="false"
href="#collapse-living-cost" role="button" aria-expanded="false"
aria-controls="collapseExample2">
<i class="mdi mdi-plus plus align-middle"></i>
<i class="mdi mdi-minus minus align-middle"></i>
@@ -78,35 +70,36 @@
</div>
</div>
</div>
<div class="card-body show collapse" id="collapse-preparation">
<div class="card-body show collapse" id="collapse-living-cost">
<div class="table-responsive">
<table class="table-borderless table-nowrap table-sm table" id="livingCostTable">
<thead class="table-primary text-center">
<tr>
<th scope="col" width=30%>Monthly</th>
<th scope="col" width=30%>Yearly</th>
<th scope="col">Status</th>
<th scope="col">Monthly</th>
<th scope="col">Yearly</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@if ($editable)
@if ($program->level)
@if ($cost->living_cost)
@forelse ($program->level as $key => $item)
@include('coursefinder::program.partials.qualification-form', [
@forelse ($program->living_cost as $key => $item)
@include('costcalculator::cost.partials.living-cost', [
'numInc' => $key,
'value' => $item,
])
@empty
@endforelse
@else
@include('coursefinder::program.partials.qualification-form', [
@include('costcalculator::cost.partials.living-cost', [
'numInc' => 0,
])
@endif
@else
@include('coursefinder::program.partials.qualification-form', [
@include('costcalculator::cost.partials.living-cost', [
'numInc' => 0,
])
@endif
@@ -126,7 +119,7 @@
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
<li class="list-inline-item">
<a class="minimize-card collapsed align-middle" data-bs-toggle="collapse"
href="#collapse-proficiency" role="button" aria-expanded="false"
href="#collapse-accomodation" role="button" aria-expanded="false"
aria-controls="collapseExample2">
<i class="mdi mdi-minus minus align-middle"></i>
<i class="mdi mdi-plus plus align-middle"></i>
@@ -136,30 +129,31 @@
</div>
</div>
</div>
<div class="card-body show collapse" id="collapse-proficiency">
<div class="card-body show collapse" id="collapse-accomodation">
<div class="table-responsive">
<table class="table-borderless table-nowrap table-sm table" id="proficiency-table">
<table class="table-borderless table-nowrap table-sm table" id="accomodationCostTable">
<thead class="table-primary text-center">
<tr>
<th scope="col" width=30%>Monthly</th>
<th scope="col" width=30%>Yearly</th>
<th scope="col">Status</th>
<th scope="col">Monthly</th>
<th scope="col">Yearly</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@if ($editable)
@forelse ($program->tests as $key => $item)
@include('coursefinder::program.partials.proficiency-form', [
@forelse ($cost->accomodation_cost as $key => $item)
@include('costcalculator::cost.partials.accomodation-cost', [
'numInc' => $key,
'value' => $item,
])
@empty
@include('coursefinder::program.partials.proficiency-form', [
@include('costcalculator::cost.partials.accomodation-cost', [
'numInc' => 0,
])
@endforelse
@else
@include('coursefinder::program.partials.proficiency-form', [
@include('costcalculator::cost.partials.accomodation-cost', [
'numInc' => 0,
])
@endif
@@ -181,7 +175,7 @@
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
<li class="list-inline-item">
<a class="minimize-card collapsed align-middle" data-bs-toggle="collapse"
href="#collapse-fee-breakdown" role="button" aria-expanded="false"
href="#collapse-onetime" role="button" aria-expanded="false"
aria-controls="collapseExample2">
<i class="mdi mdi-plus plus align-middle"></i>
<i class="mdi mdi-minus minus align-middle"></i>
@@ -191,11 +185,12 @@
</div>
</div>
</div>
<div class="card-body show collapse" id="collapse-fee-breakdown">
<div class="card-body show collapse" id="collapse-onetime">
<div class="table-responsive">
<table class="table-borderless table-nowrap table-sm table" id="feeBreakdown-table">
<table class="table-borderless table-nowrap table-sm table" id="oneTimeCost-table">
<thead class="table-primary text-center">
<tr>
<th scope="col">Status</th>
<th scope="col">Visa</th>
<th scope="col">Biometrics</th>
<th scope="col">Sevis</th>
@@ -205,22 +200,22 @@
</thead>
<tbody>
@if ($editable)
@if ($program->fee_breakdown)
@forelse ($program->fee_breakdown as $key => $item)
@include('coursefinder::program.partials.feeBreakdown', [
@if ($cost->onetime_cost)
@forelse ($cost->onetime_cost as $key => $item)
@include('costcalculator::cost.partials.onetime-cost', [
'numInc' => $key,
'value' => $item,
])
@empty
@endforelse
@else
@include('coursefinder::program.partials.feeBreakdown', [
@include('costcalculator::cost.partials.onetime-cost', [
'numInc' => 0,
])
@endif
@else
@include('coursefinder::program.partials.feeBreakdown', [
@include('costcalculator::cost.partials.onetime-cost', [
'numInc' => 0,
])
@endif
@@ -240,7 +235,7 @@
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
<li class="list-inline-item">
<a class="minimize-card collapsed align-middle" data-bs-toggle="collapse"
href="#collapse-course-module" role="button" aria-expanded="false"
href="#collapse-services" role="button" aria-expanded="false"
aria-controls="collapseExample2">
<i class="mdi mdi-plus plus align-middle"></i>
<i class="mdi mdi-minus minus align-middle"></i>
@@ -250,11 +245,12 @@
</div>
</div>
</div>
<div class="card-body show collapse" id="collapse-course-module">
<div class="card-body show collapse" id="collapse-services">
<div class="table-responsive">
<table class="table-borderless table-nowrap table-sm table" id="courseModule-table">
<thead class="table-primary text-center">
<tr>
<th scope="col">Status</th>
<th scope="col">Flight Ticket</th>
<th scope="col">Health Insurance</th>
<th scope="col">Extra</th>
@@ -263,22 +259,22 @@
</thead>
<tbody>
@if ($editable)
@if ($program->course_module)
@forelse ($program->course_module as $key => $item)
@include('coursefinder::program.partials.courseModule', [
@if ($cost->other_services)
@forelse ($cost->other_services as $key => $item)
@include('costcalculator::cost.partials.service-cost', [
'numInc' => $key,
'value' => $item,
])
@empty
@endforelse
@else
@include('coursefinder::program.partials.courseModule', [
@include('costcalculator::cost.partials.service-cost', [
'numInc' => 0,
])
@endif
@else
@include('coursefinder::program.partials.courseModule', [
@include('costcalculator::cost.partials.service-cost', [
'numInc' => 0,
])
@endif
@@ -289,7 +285,7 @@
</div>
<div class="mb-3 text-end">
<a href="{{ route('program.index') }}" class="btn btn-danger w-sm">Cancel</a>
<a href="{{ route('cost.index') }}" class="btn btn-danger w-sm">Cancel</a>
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>

View File

@@ -0,0 +1,25 @@
<tr class="living-cost">
<td>
{{ html()->select('living_cost[' . $numInc . '][status]', $livingStatusOptions)->class('form-select')->placeholder('-Select-')->value($value->id ?? null)->required() }}
{{ html()->div('Please enter living status')->class('invalid-feedback') }}
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('living_cost[' . $numInc . '][monthly]')->class('form-control')->value($value->monthly ?? null)->placeholder('Monthly') }}
</td>
<td>
{{ html()->text('living_cost[' . $numInc . '][yearly]')->class('form-control')->value($value->yearly ?? null)->placeholder('Yearly') }}
</td>
<td class="align-middle">
<div class="hstack gap-2">
<a href="javascript:void(0)" onclick="cloneRow(this)" class="btn btn-sm btn-secondary fw-medium"><i
class="ri-add-fill align-middle"></i></a>
<a href="javascript:void(0)" class="btn btn-sm btn-danger" onclick="removeRow(this)">
<i class="ri-subtract-line align-middle"></i>
</a>
</div>
</td>
</tr>

View File

@@ -0,0 +1,32 @@
<tr class="onetime-cost">
<td>
{{ html()->select('onetime_cost[' . $numInc . '][status]', $livingStatusOptions)->class('form-select')->placeholder('-Select-')->value($value->id ?? null)->required() }}
{{ html()->div('Please enter living status')->class('invalid-feedback') }}
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('onetime_cost[' . $numInc . '][visa]')->class('form-control')->value($value->visa ?? null)->placeholder('Visa') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][biometrics]')->class('form-control')->value($value->biometrics ?? null)->placeholder('Biometrics') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][sevis]')->class('form-control')->value($value->sevis ?? null)->placeholder('Sevis') }}
</td>
<td>
{{ html()->text('onetime_cost[' . $numInc . '][application]')->class('form-control')->value($value->application ?? null)->placeholder('Application') }}
</td>
<td class="align-middle">
<div class="hstack gap-2">
<a href="javascript:void(0)" onclick="cloneRow(this)" class="btn btn-sm btn-secondary fw-medium"><i
class="ri-add-fill align-middle"></i></a>
<a href="javascript:void(0)" class="btn btn-sm btn-danger" onclick="removeRow(this)">
<i class="ri-subtract-line align-middle"></i>
</a>
</div>
</td>
</tr>

View File

@@ -0,0 +1,29 @@
<tr class="onetime-cost">
<td>
{{ html()->select('other_services[' . $numInc . '][status]', $livingStatusOptions)->class('form-select')->placeholder('-Select-')->value($value->id ?? null)->required() }}
{{ html()->div('Please enter living status')->class('invalid-feedback') }}
</td>
<td class="d-flex flex-column gap-2">
{{ html()->text('other_services[' . $numInc . '][flight_ticket]')->class('form-control')->value($value->flight_ticket ?? null)->placeholder('Flight Ticket') }}
</td>
<td>
{{ html()->text('other_services[' . $numInc . '][insurance]')->class('form-control')->value($value->insurance ?? null)->placeholder('Health Insurance') }}
</td>
<td>
{{ html()->text('other_services[' . $numInc . '][extra]')->class('form-control')->value($value->extra ?? null)->placeholder('Extra') }}
</td>
<td class="align-middle">
<div class="hstack gap-2">
<a href="javascript:void(0)" onclick="cloneRow(this)" class="btn btn-sm btn-secondary fw-medium"><i
class="ri-add-fill align-middle"></i></a>
<a href="javascript:void(0)" class="btn btn-sm btn-danger" onclick="removeRow(this)">
<i class="ri-subtract-line align-middle"></i>
</a>
</div>
</td>
</tr>