Commit a1399ef8 by fezrul

testing ajax

parent b263f010
<label>Staff Name</label>
<div class="ui fluid multiple search selection">
<input type="hidden" name="staffId">
<i class="dropdown icon"></i>
<div class="default text">Staff Name</div>
<div class="menu" id="selectBox">
@foreach($staffs as $key => $staff)
<div class="item" data-value="{{$staff->id}}" data-text="{{$staff->fullname}}">
{{$staff->fullname}}
</div>
@endforeach
</div>
</div>
\ No newline at end of file
......@@ -19,7 +19,7 @@
@endforeach
</select>
</div>
<div class="field">
<div class="field" id="divstaff" nama="divstaff">
<label>Staff Name</label>
<div class="ui fluid multiple search selection dropdown">
<input type="hidden" name="staffId">
......@@ -52,13 +52,34 @@
@push('script')
<script>
function myDepartment() {
alert('{{ $project->p_project_description }}');
}
</script>
<script>
function selectDepartment(i) {
alert(i);
// alert(i);
$.ajax({
url: "{{ URL::to('ajax/stafflist')}}"+"/"+i,
type: "get",
beforeSend: function ()
{
// $("#exampleModalCenter").modal('show');
},
success: function(html)
{
// document.getElementById('nhtml2').style.display = 'none';
// $("#exampleModalCenter").modal('hide');
$('#divstaff').html(html);
// window.location.replace("{{ URL::to('ad/index')}}");
}
});
}
</script>
......
......@@ -49,6 +49,10 @@ Route::group(
Route::get('pengurusan',['uses' => 'DashboardController@pengurusan', 'as' => 'dashboard.pengurusan']);
Route::get('perkhidmatan',['uses' => 'DashboardController@perkhidmatan', 'as' => 'dashboard.perkhidmatan']);
//php_sqlsrv_80_ts_x86.dll
Route::get('ajax/stafflist/{dept}',['uses' => 'DashboardController@loadstaff', 'as' => 'dashboard.loadstaff']);
}
);
......
......@@ -84,6 +84,9 @@ class DashboardController extends Controller
// nanti project code query dari table project:
if(count($project) > 0)
{
foreach ($project as $key => $value) {
$projectlist[] = [
......@@ -96,6 +99,13 @@ class DashboardController extends Controller
];
}
}
else
{
$projectlist = null;
}
// dd($projectlist);
return view('timesheet::dashboard.senaraiProject',compact('projectlist'));
}
......@@ -856,6 +866,13 @@ class DashboardController extends Controller
{
return view('timesheet::dashboard.timesheetViewer');
}
public function loadstaff($dept)
{
$staffs = Staff_info::where('fk_lkp_department',$dept)->get();
return view('timesheet::ajax.senaraistaff', compact('staffs'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment