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 @@ ...@@ -19,7 +19,7 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<div class="field"> <div class="field" id="divstaff" nama="divstaff">
<label>Staff Name</label> <label>Staff Name</label>
<div class="ui fluid multiple search selection dropdown"> <div class="ui fluid multiple search selection dropdown">
<input type="hidden" name="staffId"> <input type="hidden" name="staffId">
...@@ -52,13 +52,34 @@ ...@@ -52,13 +52,34 @@
@push('script') @push('script')
<script> <script>
function myDepartment() { function myDepartment() {
alert('{{ $project->p_project_description }}'); alert('{{ $project->p_project_description }}');
} }
</script> </script>
<script> <script>
function selectDepartment(i) { 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> </script>
......
...@@ -49,6 +49,10 @@ Route::group( ...@@ -49,6 +49,10 @@ Route::group(
Route::get('pengurusan',['uses' => 'DashboardController@pengurusan', 'as' => 'dashboard.pengurusan']); Route::get('pengurusan',['uses' => 'DashboardController@pengurusan', 'as' => 'dashboard.pengurusan']);
Route::get('perkhidmatan',['uses' => 'DashboardController@perkhidmatan', 'as' => 'dashboard.perkhidmatan']); 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,19 +84,29 @@ class DashboardController extends Controller ...@@ -84,19 +84,29 @@ class DashboardController extends Controller
// nanti project code query dari table project: // nanti project code query dari table project:
foreach ($project as $key => $value) { if(count($project) > 0)
{
$projectlist[] = [ foreach ($project as $key => $value) {
'id' => $value->id, $projectlist[] = [
'projectcode' => $value->p_project_code,
'projectname' => $value->p_project_description, 'id' => $value->id,
'projectmanager' => $value->projectManager->fullname, 'projectcode' => $value->p_project_code,
'status' => $value->p_project_sts, 'projectname' => $value->p_project_description,
]; 'projectmanager' => $value->projectManager->fullname,
'status' => $value->p_project_sts,
];
}
}
else
{
$projectlist = null;
} }
// dd($projectlist);
return view('timesheet::dashboard.senaraiProject',compact('projectlist')); return view('timesheet::dashboard.senaraiProject',compact('projectlist'));
} }
...@@ -856,6 +866,13 @@ class DashboardController extends Controller ...@@ -856,6 +866,13 @@ class DashboardController extends Controller
{ {
return view('timesheet::dashboard.timesheetViewer'); 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