feat: Implement Cost Calculator module with CRUD operations and DataTables integration
This commit is contained in:
@@ -13,8 +13,9 @@ use Modules\CourseFinder\Models\ProgramLevel;
|
||||
use Modules\CostCalculator\Models\CostCalculator;
|
||||
use Modules\CostCalculator\Services\CostCalculatorService;
|
||||
use Modules\CourseFinder\Models\Program;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class ProgramController extends Controller
|
||||
class CostCalculatorController extends Controller
|
||||
{
|
||||
protected $costCalculatorService;
|
||||
|
||||
@@ -22,19 +23,39 @@ class ProgramController extends Controller
|
||||
{
|
||||
$this->costCalculatorService = $costCalculatorService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data['title'] = 'Cost Calculator List';
|
||||
$data['costs'] = $this->costCalculatorService->findAll($request);
|
||||
$data['countryOptions'] = Country::where('status', 1)->pluck('title', 'id');
|
||||
$data['programLevelOptions'] = ProgramLevel::where('status', 1)->pluck('title', 'id');
|
||||
$data['programOptions'] = Program::where('status', 1)->pluck('title', 'id');
|
||||
$data['livingStatusOptions'] = config('constants.living_status');
|
||||
// $data['title'] = 'Cost Calculator List';
|
||||
// $data['costs'] = $this->costCalculatorService->findAll($request);
|
||||
// $data['countryOptions'] = Country::where('status', 1)->pluck('title', 'id');
|
||||
// $data['programLevelOptions'] = ProgramLevel::where('status', 1)->pluck('title', 'id');
|
||||
// $data['programOptions'] = Program::where('status', 1)->pluck('title', 'id');
|
||||
// $data['livingStatusOptions'] = config('constants.living_status');
|
||||
|
||||
return view('costCalculator::cost.index', $data);
|
||||
// return view('costcalculator::cost.index', $data);
|
||||
|
||||
if (request()->ajax()) {
|
||||
$model = CostCalculator::query()->orderBy('order');
|
||||
return DataTables::eloquent($model)
|
||||
->addIndexColumn()
|
||||
->setRowClass('tableRow')
|
||||
->editColumn('image', function (CostCalculator $cost) {
|
||||
return $cost->getRawOriginal('image') ? "<img src='{$cost->country->image}' alt='{$cost->country->image}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||
})
|
||||
->editColumn('status', function (CostCalculator $cost) {
|
||||
$status = $cost->status ? 'Published' : 'Draft';
|
||||
$color = $cost->status ? 'text-success' : 'text-danger';
|
||||
return "<p class='{$color}'>{$status}</p>";
|
||||
})
|
||||
->addColumn('action', 'costcalculator::cost.datatable.action')
|
||||
->rawColumns(['image', 'status', 'action'])
|
||||
->toJson();
|
||||
}
|
||||
|
||||
return view('costcalculator::cost.index', [
|
||||
'title' => 'Cost Calculator List',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,14 +63,14 @@ class ProgramController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Program Create';
|
||||
$data['title'] = 'Create Cost Calculator';
|
||||
$data['editable'] = false;
|
||||
$data['intakeOptions'] = Program::INTAKE;
|
||||
$data['institutionOptions'] = Institution::where('status', 1)->pluck('title', 'id');
|
||||
$data['countryOptions'] = Country::where('status', 1)->pluck('title', 'id');
|
||||
$data['programLevelOptions'] = ProgramLevel::where('status', 1)->pluck('title', 'id');
|
||||
$data['testOptions'] = Test::where('status', 1)->where('parent_id', null)->pluck('title', 'id');
|
||||
$data['programOptions'] = Program::where('status', 1)->pluck('title', 'id');
|
||||
$data['livingStatusOptions'] = config('constants.living_status');
|
||||
|
||||
return view('coursefinder::program.create', $data);
|
||||
return view('costcalculator::cost.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,30 +80,21 @@ class ProgramController extends Controller
|
||||
{
|
||||
|
||||
$request->validate([
|
||||
'title' => 'required',
|
||||
'country_id' => 'required',
|
||||
'programlevel_id' => 'required',
|
||||
'living_status_id' => 'required',
|
||||
]);
|
||||
|
||||
$input = $request->except(['prof_test_accepted']);
|
||||
$input = $request->all();
|
||||
|
||||
DB::transaction(function () use ($input, $request) {
|
||||
|
||||
$program = Program::create($input);
|
||||
CostCalculator::create($input);
|
||||
|
||||
$attachData = [];
|
||||
|
||||
foreach ($request->prof_test_accepted as $item) {
|
||||
$attachData[$item['test_id']] = [
|
||||
'min_score' => $item['min_score'],
|
||||
'band_score' => $item['band_score'],
|
||||
];
|
||||
}
|
||||
|
||||
$program->tests()->sync($attachData);
|
||||
|
||||
flash()->success('Program has been created!');
|
||||
flash()->success('Cost Calculation has been created!');
|
||||
});
|
||||
|
||||
return redirect()->route('program.index');
|
||||
return redirect()->route('costCalculator.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,10 +102,10 @@ class ProgramController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'View Program';
|
||||
$data['program'] = Program::findOrFail($id);
|
||||
$data['title'] = 'View Cost Calculation';
|
||||
$data['program'] = CostCalculator::findOrFail($id);
|
||||
$data['intakeOptions'] = Program::INTAKE;
|
||||
return view('coursefinder::program.show', $data);
|
||||
return view('costcalculator::cost.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,16 +113,14 @@ class ProgramController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Program';
|
||||
$data['title'] = 'Edit Cost Calculator';
|
||||
$data['editable'] = true;
|
||||
$data['program'] = Program::findOrFail($id);
|
||||
$data['intakeOptions'] = Program::INTAKE;
|
||||
$data['institutionOptions'] = Institution::where('status', 1)->pluck('title', 'id');
|
||||
$data['cost'] = CostCalculator::findOrFail($id);
|
||||
$data['countryOptions'] = Country::where('status', 1)->pluck('title', 'id');
|
||||
$data['programLevelOptions'] = ProgramLevel::where('status', 1)->pluck('title', 'id');
|
||||
$data['testOptions'] = Test::where('status', 1)->where('parent_id', null)->pluck('title', 'id');
|
||||
$data['coopOptions'] = Coop::where('status', 1)->pluck('title', 'id');
|
||||
$data['requiredDocumentOptions'] = RequiredDocument::where('status', 1)->pluck('title', 'id');
|
||||
return view('coursefinder::program.edit', $data);
|
||||
$data['programOptions'] = Program::where('status', 1)->pluck('title', 'id');
|
||||
$data['livingStatusOptions'] = config('constants.living_status');
|
||||
return view('costcalculator::cost.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,27 +128,16 @@ class ProgramController extends Controller
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$input = $request->except(['prof_test_accepted']);
|
||||
$input = $request->all();
|
||||
|
||||
DB::transaction(function () use ($input, $request, $id) {
|
||||
$program = Program::findOrFail($id);
|
||||
$program = CostCalculator::findOrFail($id);
|
||||
$program->update($input);
|
||||
|
||||
$attachData = [];
|
||||
|
||||
foreach ($request->prof_test_accepted as $item) {
|
||||
$attachData[$item['test_id']] = [
|
||||
'min_score' => $item['min_score'],
|
||||
'band_score' => $item['band_score'],
|
||||
];
|
||||
}
|
||||
|
||||
$program->tests()->sync($attachData);
|
||||
flash()->success('Cost Calculation has been updated!');
|
||||
});
|
||||
|
||||
flash()->success('program has been updated!');
|
||||
|
||||
return redirect()->route('program.index')->withSuccess('Program has been updated!');
|
||||
return redirect()->route('costCalculator.index')->withSuccess('Program has been updated!');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,100 +146,14 @@ class ProgramController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$program = Program::findOrFail($id);
|
||||
$program = CostCalculator::findOrFail($id);
|
||||
$program->delete();
|
||||
|
||||
flash()->success('Program has been deleted!');
|
||||
flash()->success('Cost Calculator has been deleted!');
|
||||
} catch (\Throwable $th) {
|
||||
flash()->error($th->getMessage());
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Program has been deleted!'], 200);
|
||||
return response()->json(['status' => 200, 'message' => 'Cost Calculator has been deleted!'], 200);
|
||||
}
|
||||
|
||||
public function getProgramByInstitution(Request $request)
|
||||
{
|
||||
try {
|
||||
$program = Program::where(['institution_id' => $request->institution_id])
|
||||
->select('id', 'title')
|
||||
->get();
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'data' => $program,
|
||||
'msg' => 'Fetch',
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'msg' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function import(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
Excel::import(new ProgramImport(), $request->file('file')->store('temp'));
|
||||
DB::commit();
|
||||
return redirect()->back()->with('success', "Upload Succesfully");
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return redirect()->back()->with('error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getCoursesList(Request $request)
|
||||
{
|
||||
$data['intakes'] = Program::INTAKE;
|
||||
|
||||
$query = Program::query();
|
||||
|
||||
if ($request->filled('countries_id')) {
|
||||
$query->whereRelation('institution', 'countries_id', $request->countries_id);
|
||||
}
|
||||
|
||||
if ($request->filled('institution_id')) {
|
||||
$query->where('institutions_id', $request->institution_id);
|
||||
}
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$query->where('title', 'like', "%{$request->search}%");
|
||||
}
|
||||
|
||||
if ($request->filled('programlevels_id')) {
|
||||
$query->where('programlevels_id', $request->programlevels_id);
|
||||
}
|
||||
|
||||
if ($request->filled('intake_id')) {
|
||||
$query->whereJsonContains('intakes', $request->intake_id);
|
||||
}
|
||||
|
||||
if ($request->filled('preffered_location')) {
|
||||
$query->where('location', 'like', "%{$request->preffered_location}%");
|
||||
}
|
||||
|
||||
if ($request->filled('service_id')) {
|
||||
$query->whereRelation('services', 'service_id', '=', $request->service_id);
|
||||
|
||||
if ($request->filled('min_score')) {
|
||||
$query->whereRelation('services', 'min_score', '<=', $request->min_score);
|
||||
}
|
||||
|
||||
if ($request->filled('max_score')) {
|
||||
$query->whereRelation('services', 'band_score', '<=', $request->max_score);
|
||||
}
|
||||
}
|
||||
|
||||
$data['courses'] = $query
|
||||
->orderBy('title', 'asc')
|
||||
->paginate(10)
|
||||
->withQueryString();
|
||||
|
||||
$queryCount = $data['courses']->total();
|
||||
|
||||
if ($request->ajax()) {
|
||||
$view = view('client.raffles.pages.course.list', $data)->render();
|
||||
return response()->json(['html' => $view, 'queryCount' => $queryCount]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,35 +10,25 @@ class CostCalculatorService
|
||||
{
|
||||
return CostCalculator::when($request, function ($query) use ($request) {
|
||||
if ($request->filled('country_id')) {
|
||||
$query->whereRelation('institution', 'country_id', $request->country_id);
|
||||
}
|
||||
|
||||
if ($request->filled('institution_id')) {
|
||||
$query->where("institution_id", $request->institution_id);
|
||||
$query->where('country_id', $request->country_id);
|
||||
}
|
||||
|
||||
if ($request->filled('programlevel_id')) {
|
||||
$query->where("programlevel_id", $request->programlevel_id);
|
||||
}
|
||||
|
||||
if ($request->filled('intake_id')) {
|
||||
$intakeId = $request->intake_id;
|
||||
$query->whereJsonContains('intakes', $intakeId);
|
||||
if ($request->filled('program_id')) {
|
||||
$query->where("program_id", $request->program_id);
|
||||
}
|
||||
|
||||
if ($request->filled('living_status_id')) {
|
||||
$query->where("living_status_id", $request->living_status_id);
|
||||
}
|
||||
|
||||
if ($request->filled('status')) {
|
||||
$query->where('status', $request->status);
|
||||
}
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$query->where('title', 'like', "%{$search}%");
|
||||
}
|
||||
|
||||
if ($request->filled('location')) {
|
||||
$location = $request->location;
|
||||
$query->where('location', 'like', "%{$location}%");
|
||||
}
|
||||
})->latest()->paginate(10)->withQueryString();
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
{{ html()->form('POST')->route('costCalculator.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data', 'onkeydown' => "return event.key != 'Enter';"])->open() }}
|
||||
@include('costCalculator::cost.partials.form')
|
||||
{{ html()->form('POST')->route('cost.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data', 'onkeydown' => "return event.key != 'Enter';"])->open() }}
|
||||
@include('costcalculator::cost.partials.form')
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
@endsection
|
||||
|
@@ -0,0 +1,12 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<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 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>
|
||||
|
||||
<a href="javascript:void(0);" data-link="{{ route('cost.destroy', $id) }}" class="link-danger fs-15 remove-item"
|
||||
data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Delete"><i class="ri-delete-bin-6-line"></i>
|
||||
</a>
|
||||
</div>
|
@@ -0,0 +1,46 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
@if ($errors->any())
|
||||
<x-flash-message type="danger" :messages="$errors->all()" />
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="card-title mb-0">{{ $title }}</h5>
|
||||
<a href="{{ route('cost.create') }}" class="btn btn-primary waves-effect waves-light text-white"><i class="ri-add-line align-middle"></i> Create</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'S.N',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
],
|
||||
['title' => 'Image', 'data' => 'image', 'name' => 'image'],
|
||||
['title' => 'Program Level', 'data' => 'program_level', 'name' => 'title'],
|
||||
['title' => 'Slug', 'data' => 'slug', 'name' => 'slug'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
[
|
||||
'title' => 'Action',
|
||||
'data' => 'action',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
<x-data-table-script :route="route('service.index')" :reorder="route('service.reorder')" :columns="$columns" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@@ -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>
|
@@ -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>
|
||||
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -14,6 +14,6 @@ use Modules\CostCalculator\Http\Controllers\CostCalculatorController;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group([], function () {
|
||||
Route::resource('costcalculator', CostCalculatorController::class)->names('costcalculator');
|
||||
Route::group(['middleware' => ['web', 'auth', 'permission'], 'prefix' => 'admin/'], function () {
|
||||
Route::resource('cost-calculator', CostCalculatorController::class)->names('cost');
|
||||
});
|
||||
|
Reference in New Issue
Block a user