Commit 559d7f38 by Azhan Hannan

delete draft function in screen filter chargeable

parent a0d64f28
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Draft Delete Confirmation</a>
<br>
<!-- <p style="color: red">This page is still in maintenance.. TQ</p> -->
<div class="ui segment">
<div class="ui form">
<div class="content text-center">
<p>
Are you sure you want to delete this draft ?
</p>
<!-- date('F', mktime(0, 0, 0, $monthNum, 10)) -->
<strong>
Timesheet : @if(data_get($tm,'tm_phase') == 1) 1st Halfmonth @else 2nd Halfmonth @endif - {{ date('F', mktime(0, 0, 0, data_get($tm,'tm_month'), 10 )) }} - {{data_get($tm,'tm_year')}}
</strong>
<br><br>
<button type="button" class="ui red button" onclick="window.location.href='{{ route('timesheet::form.draftdeleted', ['tmid'=>data_get($tm,'id')]) }}';">Yes</button>
<!-- <button class="ui red button" type="submit">Yes</button> -->
<button type="button" class="ui blue button" onclick="window.location.href=' {{route('timesheet::form.filterChargeable')}} ';">No</button>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div class="ui segment"> <div class="ui segment">
<a class="ui purple left ribbon label">Edit Timesheet</a> <a class="ui purple left ribbon label">Edit Timesheet</a>
<br> <br>
<table class="ui unstackable celled striped table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th class="text-center">No</th> <th class="text-center">No</th>
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
<button class="ui purple compact icon button" type="button" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => data_get($draft,'tm_phase'), 'month' =>data_get($draft,'tm_month')] ) }}';"> <button class="ui purple compact icon button" type="button" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => data_get($draft,'tm_phase'), 'month' =>data_get($draft,'tm_month')] ) }}';">
<i class="edit outline icon"></i> <i class="edit outline icon"></i>
</button> </button>
<button class="ui red compact icon button" type="button" onclick="window.location.href='{{ route('timesheet::form.deletedraft', ['tmid'=>data_get($draft,'id')]) }}';">
<i class="trash alternate outline icon"></i>
</button>
</td> </td>
</tr> </tr>
@endforeach @endforeach
......
...@@ -105,6 +105,8 @@ Route::group( ...@@ -105,6 +105,8 @@ Route::group(
Route::post('resubmit',['uses' => 'FormController@resubmit', 'as' => 'form.resubmit']); Route::post('resubmit',['uses' => 'FormController@resubmit', 'as' => 'form.resubmit']);
Route::post('resubmitoverhead',['uses' => 'FormController@resubmitoverhead', 'as' => 'form.resubmitoverhead']); Route::post('resubmitoverhead',['uses' => 'FormController@resubmitoverhead', 'as' => 'form.resubmitoverhead']);
Route::get('resubmitconfirm',['uses' => 'FormController@resubmitconfirm', 'as' => 'form.resubmitconfirm']); Route::get('resubmitconfirm',['uses' => 'FormController@resubmitconfirm', 'as' => 'form.resubmitconfirm']);
Route::get('deletedraft',['uses' => 'FormController@deletedraft', 'as' => 'form.deletedraft']);
Route::get('draftdeleted',['uses' => 'FormController@draftdeleted', 'as' => 'form.draftdeleted']);
// nonChargeableForm // nonChargeableForm
......
...@@ -1318,7 +1318,6 @@ class DashboardController extends Controller ...@@ -1318,7 +1318,6 @@ class DashboardController extends Controller
if($check) if($check)
{ {
$chargehour = Ts_detail::where('fk_tm_id',$check->id) $chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable) ->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0) // ->where('td_hours', '!=', 0)
......
...@@ -47,6 +47,9 @@ class FormController extends Controller ...@@ -47,6 +47,9 @@ class FormController extends Controller
$checkdraft = Ts_master::where('tm_staff_id', $user->staff_id) $checkdraft = Ts_master::where('tm_staff_id', $user->staff_id)
->where('tm_timesheet_master_sts', 1) ->where('tm_timesheet_master_sts', 1)
->orderby('tm_year', 'desc')
->orderby('tm_month', 'desc')
->orderby('tm_phase', 'desc')
->get(); ->get();
// dd($checkdraft); // dd($checkdraft);
...@@ -2111,4 +2114,28 @@ class FormController extends Controller ...@@ -2111,4 +2114,28 @@ class FormController extends Controller
return redirect()->route('timesheet::dashboard.index')->withSuccess('Rejected overhead has been resubmit 😊'); return redirect()->route('timesheet::dashboard.index')->withSuccess('Rejected overhead has been resubmit 😊');
} }
public function deletedraft(Request $request)
{
$tmasterid = data_get($request,'tmid');
$tm = Ts_master::where('id', $tmasterid)->first();
// dd("tmid = ".$tmasterid);
return view('timesheet::form.deletedraftconfirmation', compact('tm'));
}
public function draftdeleted(Request $request)
{
// dd($request);
$tmid = data_get($request, 'tmid');
Ts_master::where('id', $tmid)->delete();
Ts_detail::where('fk_tm_id', $tmid)->delete();
Tproject::where('fk_tm_id', $tmid)->delete();
// dd($checktp);
return redirect()->route('timesheet::form.filterChargeable')->withSuccess('Draft Successfully Deleted');
}
} }
\ No newline at end of file
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