Hi all I have some issue with my code ..
The idea is that I have multi room's which I retrieve from database every room have multi booking date my idea is to show when open room page all page if the room have current reservation mark it red or future reservation marked blue I can't know how to make this happen my room.blade is:
#section('content')
<div class="row text-right ">
#foreach ($room_typ as $a )
<div class="col-12 col-lg-2">
<div class="card radius-15">
<div class="card-body text-center radius-15">
<h4 title="{{ $a->r_det }}" class="mb-0 font-weight-bold mt-0 text-white">{{ $a->r_name }}
</h4>-<h6>{{ $a->f_name }}</h6>
<span class="mt-1 mb-1 acupp"></span>
<i class="bx bx-plus"></i>
<i class="fadeIn animated bx bx-trash-alt mr-md-3"></i>
<i class="bx bx-info-square mr-md-3"></i>
{{ $rr }} // should show the count for reservation with room number
</div>
</div>
</div>
#endforeach
</div>
#endsection
the controller is :
public function allrom()
{
$room_typ = addroom::all();
foreach ($room_typ as $dd) {
$rom = $dd->r_name;
$rr = res_c::where('rno', '=', $rom)->get();
}
echo view('room', compact('room_typ', 'rr'));
}
Try this please change the checkin and checkout fields with the one in your database let me know if it work
#section('content')
<div class="row text-right ">
#foreach ($room_typ as $a )
<div class="col-12 col-lg-2">
<div class="card radius-15" style="{{ date("Y-m-d") >= date("Y-m-d",strtotime($a->r_date_checkin)) && date("Y-m-d") < date("Y-m-d",strtotime($a->r_date_checkout)) ? "background-color:red" : ( date("Y-m-d") > date("Y-m-d",strtotime($a->r_date_checkin) ) ) ? "background-color:blue" : "" }}">
<div class="card-body text-center radius-15">
<h4 title="{{ $a->r_det }}" class="mb-0 font-weight-bold mt-0 text-white">{{ $a->r_name }}
</h4>-<h6>{{ $a->f_name }}</h6>
<span class="mt-1 mb-1 acupp"></span>
<i class="bx bx-plus"></i>
<i class="fadeIn animated bx bx-trash-alt mr-md-3"></i>
<i class="bx bx-info-square mr-md-3"></i>
{{ $rr }} // should show the count for reservation with room number
</div>
</div>
</div>
#endforeach
</div>
Related
user_id doesn't have a default value that's is the error I'm getting when I clicked on the clone button and also user_id is fillable livewire movie show components
public function clone(Movie $movie)
{
$cloneMovie = $movie->replicate();
$cloneMovie->cloned_movie_id = $movie->id;
$cloneMovie->save();
}
livewire movie show blade view
<div>
<div class="">
<div class="p-1 bg-white rounded-md">
<div class="flex justify-between p-2 mb-2 text-white bg-gray-400 rounded-md">
<h3 class="font-bold text-white text-md">{{ $movie->title }}</h3>
<span class="text-xs">100 views</span>
</div>
<img src="{{ asset('/assets/images/blog/img-1.jpg') }}" alt="" class="w-auto rounded-md">
<p class="p-2">{{ $movie->body }}</p>
<button wire:click="clone({{ $movie->id }})">clone</button>
</div>
</div>
</div>
$cloneMovie->push();
Is what you’re looking for.
<div class="container mt-4 mb-4">
<div class="row">
<div class="col-lg-12">
<div id="blogCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
#foreach($reviews as $items)
<div class="carousel-item #if($loop->first) active #endif">
<div class="row">
#foreach($reviews as $review)
<div class="col-lg-4 ">
<a>
<div class="home1-img mt-3">
<?php
for($i=1;$i<6;$i++){
$check = '';
if($review->number_of_stars >= $i){
$check = 'checked';
}
echo '<span class="fa fa-star '.$check.'"></span>';
}
?>
<div class="home1-text mt-1" style="margin-bottom:30px;">
<p>{!! Illuminate\Support\Str::limit($review->customer_review,100) !!}</p>
<h5 class="text-color font-weight-bold">{{ $review->customer_name }}</h5>
</div>
</div>
</a>
</div>
#endforeach
</div>
</div>
#endforeach
</div>
</div>
</div>
</div>
</div>
I am getting all the records in all sides but I want 3 records in 1st slide then 3 records in 2nd slide and so on. I have tried many times but I am not able to fix it.
I would like to be able to select a vehicle type and use the price associated with that selection to add it to the base price of the services in the cards. I know there are many examples to change the options in a second drop-down menu, the classic country and state example, but I can't seem to find anything that uses the selected menu item in a way where I can add it to the service price. Here is the code I have so far:
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Select vehicle type
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
#foreach($vehicles as $vehicle)
<a class="dropdown-item" href="#">{{ $vehicle->type }}</a>
#endforeach
</div>
</div>
</div>
#foreach($services as $service)
<div class="card mt-3">
<div class="card-body">
<div class="d-flex justify-content-between">
<h4 class="card-title">{{ $service->nom }}</h4>
{{--this is where I'd like to use the selected vehicle type to simply add it to
the service price. If i do: {{ $service->price + $vehicle->price }} it chooses
the last one that went through the foreach loop --}}
<h3>{{ $service->price }}$</h3>
</div>
<p class="card-text">{{ $service->description }}</p>
</div>
</div>
#endforeach
I'm aware this is not very fancy (or good) programming but I've been stuck on this for hours. I also know I'll need a script to make it actually dynamic and most probably use form to select the vehicle type.
<script>
function updateServicePrice(vehicle) {
const vehiclePrice = Number(vehicle.dataset.price);
const services = Array.from(document.getElementsByClassName('service-price'));
services.forEach(service => {
service.innerHTML = Number(service.dataset.price) + vehiclePrice;
});
}
</script>
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Select vehicle type
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
#foreach($vehicles as $vehicle)
<a onclick="updateServicePrice(this)" data-price="{{ $vehicle->price }}" class="dropdown-item" href="#">{{ $vehicle->type }}</a>
#endforeach
</div>
</div>
</div>
#foreach($services as $service)
<div class="card mt-3">
<div class="card-body">
<div class="d-flex justify-content-between">
<h4 class="card-title">{{ $service->nom }}</h4>
{{--this is where I'd like to use the selected vehicle type to simply add it to
the service price. If i do: {{ $service->price + $vehicle->price }} it chooses
the last one that went through the foreach loop --}}
<h3 class="service-price" data-price="{{ $service->price }}">{{ $service->price }}$</h3>
</div>
<p class="card-text">{{ $service->description }}</p>
</div>
</div>
#endforeach
Using Laravel-5.8, I have this code:
public function manager_employee_list(Request $request)
{
$employees = HrEmployee::paginate(6);
return view('appraisal.appraisal_goals.manager_employee_list')->with('employees', $employees);
}
And it render this view: manager_employee_list
<div class="row d-flex align-items-stretch">
#if (count($employees))
#foreach($employees as $key => $employee)
<div class="col-12 col-sm-6 col-md-4 d-flex align-items-stretch">
<div class="card bg-light">
<div class="card-header text-muted border-bottom-0">
{{isset($employee->designation) ? $employee->designation->designation_name : ''}}
</div>
<div class="card-body pt-0">
<div class="row">
<div class="col-7">
<h2 class="lead"><b>Staff ID: {{$employee->employee_code}}</b></h2>
<h2 class="lead"><b>{{$employee->first_name}} {{$employee->last_name}}</b></h2>
<h6 class="lead"><b>Employee Department: </b>{{isset($employee->department) ? $employee->department->dept_name : ''}}</h6>
</div>
<div class="col-5 text-center">
#if($employee->emp_image != '')
<img src="{{ URL::to('/') }}/public/storage/employees/image/{{ $employee->emp_image }}" class="img-circle img-fluid" />
#else
<img class="profile-user-img img-fluid img-circle" src="{{asset('theme/adminlte3/dist/img/default.png')}}" alt="" class="img-circle img-fluid">
#endif
</div>
</div>
</div>
<div class="card-footer">
<div class="text-right">
<a href="{{ route('appraisal.appraisal_goals.manager_employee_goal', ['id'=>$employee->id]) }}" class="btn btn-sm btn-primary">
<i class="fas fa-user"></i> View Goal
</a>
</div>
</div>
</div>
</div>
#endforeach
#else
<h4 style="text-align:center;">No matching records found</h4>
#endif
</div>
I want to pass the parameter
['id'=>$employee->id]
from above to another controller action:
public function manager_employee_goal($id)
{
$goals = AppraisalGoal::where('employee_id', $id)->get();
return view('appraisal.appraisal_goals.manager_employee_goal')->with('goals', $goals);
}
It utilizes it here:
$goals = AppraisalGoal::where('employee_id', $id)->get();
When I clicked on
<a href="{{ route('appraisal.appraisal_goals.manager_employee_goal', ['id'=>$employee->id]) }}" class="btn btn-sm btn-primary">
<i class="fas fa-user"></i> View Goal
</a>
I got this error:
Too few arguments to function App\Http\Controllers\Appraisal\AppraisalGoalsController::manager_employee_goal(), 0 passed and exactly 1 expected
and this is underlined:
public function manager_employee_goal($id)
route/web.php
Route::get('appraisal_goals/manager_employee_list', 'Appraisal\AppraisalGoalsController#manager_employee_list')->name('appraisal.appraisal_goals.manager_employee_list');
Route::get('appraisal_goals/manager_employee_goal', 'Appraisal\AppraisalGoalsController#manager_employee_goal')->name('appraisal.appraisal_goals.manager_employee_goal');
How do I resolve it?
Thank you.
You need to change in your web.php file. add {id} in URL.
otherwise, all are fine as now your get method will be like 'appraisal_goals/manager_employee_goal/{id}'
Route::get('appraisal_goals/manager_employee_goal/{id}','Appraisal\AppraisalGoalsController#manager_employee_goal')->name('appraisal.appraisal_goals.manager_employee_goal');
I believe your route need to be updated to
Route::get('appraisal_goals/manager_employee_goal/{id}','Appraisal\AppraisalGoalsController#manager_employee_goal')->name('appraisal.appraisal_goals.manager_employee_goal');
This code need to display all "subcategory" for each "subcategories"
But the view result is the first subcategory only.
Where i missed please ?
View 1 :
#foreach($treeView as $category)
<div class="collapse multi-collapse collapse in " id="8" >
<div class="col-md-2"> {{ $category->account_name}}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $category->id}}8" aria-expanded="false" aria-controls="{{ $category->id}}8" #click="getSubaccount(); getNumberrawaccount();">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
<br>
<div class="list-group">
#if(count($category->subcategories))
#include('tree2',['subcategories'=>$category->subcategories])
#endif
</div>
#endforeach
View 2 : tree2
<div class='list-group'>
<br>
#foreach($subcategories as $subcategory)
<div class="list-group col-md-12">
<div class="collapse multi-collapse" id="{{ $category->id}}8" >
<div class="col-md-4"> {{ $subcategory->subaccount_name }}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $subcategory->id}}" aria-expanded="false" aria-controls="collapseExample2">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
</div>
</div>
#endforeach
</div>
Thank you