farhantock
11 months ago
10 changed files with 566 additions and 2 deletions
@ -0,0 +1,93 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Http\Controllers; |
||||||
|
|
||||||
|
use Illuminate\Http\Request; |
||||||
|
use App\Models\ProjectExpenditure; |
||||||
|
|
||||||
|
class ProjectExpenditureController extends Controller |
||||||
|
{ |
||||||
|
public function add(Request $request) |
||||||
|
{ |
||||||
|
$this->validate($request, [ |
||||||
|
'name' => 'required' |
||||||
|
]); |
||||||
|
$data = $request->all(); |
||||||
|
// Set Unique |
||||||
|
$result = ProjectExpenditure::query() |
||||||
|
->where([ |
||||||
|
['company_id',$data['company_id']], |
||||||
|
['name', $data['name']] |
||||||
|
])->first(); |
||||||
|
if($result) { |
||||||
|
return response()->json(['status'=>'failed','message'=>'Name is already exists!','code'=> 500], 500); |
||||||
|
die; |
||||||
|
} |
||||||
|
|
||||||
|
$data['created_by'] = $this->currentName; |
||||||
|
|
||||||
|
if(!ProjectExpenditure::create($data)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to add data','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'data added!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function edit($id){ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$result = ProjectExpenditure::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to get data!','code'=> 404], 404); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function update(Request $request, $id) |
||||||
|
{ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data = ProjectExpenditure::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project expenditure not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->update($request->all())) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project expenditure failed updated!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil disimpan!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function delete($id) |
||||||
|
{ |
||||||
|
|
||||||
|
if(!$data = ProjectExpenditure::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project expenditure not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->delete()) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Data gagal dihapus!','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil dihapus!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function search(Request $request) |
||||||
|
{ |
||||||
|
$payload = $request->all(); |
||||||
|
$dataBuilder = $this->setUpPayload($payload, 'm_proyek_expenditure'); |
||||||
|
$builder = $dataBuilder['builder']; |
||||||
|
$countBuilder = $dataBuilder['count']; |
||||||
|
$dataGet = $builder->get(); |
||||||
|
$totalRecord = $countBuilder->count(); |
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function list() |
||||||
|
{ |
||||||
|
$data = ProjectExpenditure::all(); |
||||||
|
$countData = $data->count(); |
||||||
|
|
||||||
|
if(!$data) |
||||||
|
return response()->json(['status'=>'failed','message'=>'failed get list project expenditure, please try again later!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Http\Controllers; |
||||||
|
|
||||||
|
use Illuminate\Http\Request; |
||||||
|
use App\Models\ProjectFinancialHealth; |
||||||
|
|
||||||
|
class ProjectFinancialHealthController extends Controller |
||||||
|
{ |
||||||
|
public function add(Request $request) |
||||||
|
{ |
||||||
|
$this->validate($request, [ |
||||||
|
'name' => 'required' |
||||||
|
]); |
||||||
|
$data = $request->all(); |
||||||
|
// Set Unique |
||||||
|
$result = ProjectFinancialHealth::query() |
||||||
|
->where([ |
||||||
|
['company_id',$data['company_id']], |
||||||
|
['name', $data['name']] |
||||||
|
])->first(); |
||||||
|
if($result) { |
||||||
|
return response()->json(['status'=>'failed','message'=>'Name is already exists!','code'=> 500], 500); |
||||||
|
die; |
||||||
|
} |
||||||
|
|
||||||
|
$data['created_by'] = $this->currentName; |
||||||
|
|
||||||
|
if(!ProjectFinancialHealth::create($data)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to add data','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'data added!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function edit($id){ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$result = ProjectFinancialHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to get data!','code'=> 404], 404); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function update(Request $request, $id) |
||||||
|
{ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data = ProjectFinancialHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data financial health not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->update($request->all())) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Data financial health failed updated!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil disimpan!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function delete($id) |
||||||
|
{ |
||||||
|
|
||||||
|
if(!$data = ProjectFinancialHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data financial health not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->delete()) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Data gagal dihapus!','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil dihapus!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function search(Request $request) |
||||||
|
{ |
||||||
|
$payload = $request->all(); |
||||||
|
$dataBuilder = $this->setUpPayload($payload, 'm_proyek_financial_health'); |
||||||
|
$builder = $dataBuilder['builder']; |
||||||
|
$countBuilder = $dataBuilder['count']; |
||||||
|
$dataGet = $builder->get(); |
||||||
|
$totalRecord = $countBuilder->count(); |
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function list() |
||||||
|
{ |
||||||
|
$data = ProjectFinancialHealth::all(); |
||||||
|
$countData = $data->count(); |
||||||
|
|
||||||
|
if(!$data) |
||||||
|
return response()->json(['status'=>'failed','message'=>'failed get list financial health, please try again later!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Http\Controllers; |
||||||
|
|
||||||
|
use Illuminate\Http\Request; |
||||||
|
use App\Models\ProjectInvoice; |
||||||
|
|
||||||
|
class ProjectInvoiceController extends Controller |
||||||
|
{ |
||||||
|
public function add(Request $request) |
||||||
|
{ |
||||||
|
$this->validate($request, [ |
||||||
|
'name' => 'required' |
||||||
|
]); |
||||||
|
$data = $request->all(); |
||||||
|
// Set Unique |
||||||
|
$result = ProjectInvoice::query() |
||||||
|
->where([ |
||||||
|
['company_id',$data['company_id']], |
||||||
|
['name', $data['name']] |
||||||
|
])->first(); |
||||||
|
if($result) { |
||||||
|
return response()->json(['status'=>'failed','message'=>'Name is already exists!','code'=> 500], 500); |
||||||
|
die; |
||||||
|
} |
||||||
|
|
||||||
|
$data['created_by'] = $this->currentName; |
||||||
|
|
||||||
|
if(!ProjectInvoice::create($data)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to add data','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'data added!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function edit($id){ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$result = ProjectInvoice::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to get data!','code'=> 404], 404); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function update(Request $request, $id) |
||||||
|
{ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data = ProjectInvoice::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project invoice not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->update($request->all())) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project invoice failed updated!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil disimpan!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function delete($id) |
||||||
|
{ |
||||||
|
|
||||||
|
if(!$data = ProjectInvoice::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data project invoice not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->delete()) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Data gagal dihapus!','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil dihapus!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function search(Request $request) |
||||||
|
{ |
||||||
|
$payload = $request->all(); |
||||||
|
$dataBuilder = $this->setUpPayload($payload, 'm_proyek_invoice'); |
||||||
|
$builder = $dataBuilder['builder']; |
||||||
|
$countBuilder = $dataBuilder['count']; |
||||||
|
$dataGet = $builder->get(); |
||||||
|
$totalRecord = $countBuilder->count(); |
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function list() |
||||||
|
{ |
||||||
|
$data = ProjectInvoice::all(); |
||||||
|
$countData = $data->count(); |
||||||
|
|
||||||
|
if(!$data) |
||||||
|
return response()->json(['status'=>'failed','message'=>'failed get list project invoice, please try again later!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Http\Controllers; |
||||||
|
|
||||||
|
use Illuminate\Http\Request; |
||||||
|
use App\Models\ProjectScheduleHealth; |
||||||
|
|
||||||
|
class ProjectScheduleHealthController extends Controller |
||||||
|
{ |
||||||
|
public function add(Request $request) |
||||||
|
{ |
||||||
|
$this->validate($request, [ |
||||||
|
'name' => 'required' |
||||||
|
]); |
||||||
|
$data = $request->all(); |
||||||
|
// Set Unique |
||||||
|
$result = ProjectScheduleHealth::query() |
||||||
|
->where([ |
||||||
|
['company_id',$data['company_id']], |
||||||
|
['name', $data['name']] |
||||||
|
])->first(); |
||||||
|
if($result) { |
||||||
|
return response()->json(['status'=>'failed','message'=>'Name is already exists!','code'=> 500], 500); |
||||||
|
die; |
||||||
|
} |
||||||
|
|
||||||
|
$data['created_by'] = $this->currentName; |
||||||
|
|
||||||
|
if(!ProjectScheduleHealth::create($data)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to add data','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'data added!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function edit($id){ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$result = ProjectScheduleHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Failed to get data!','code'=> 404], 404); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function update(Request $request, $id) |
||||||
|
{ |
||||||
|
if(!$id || (int) $id < 0 || $id=="") |
||||||
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data = ProjectScheduleHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data schedule health not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->update($request->all())) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data schedule health failed updated!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil disimpan!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function delete($id) |
||||||
|
{ |
||||||
|
|
||||||
|
if(!$data = ProjectScheduleHealth::find($id)) |
||||||
|
return response()->json(['status'=>'failed','message'=>'data schedule health not found!','code'=>400], 400); |
||||||
|
|
||||||
|
if(!$data->delete()) |
||||||
|
return response()->json(['status'=>'failed','message'=>'Data gagal dihapus!','code'=> 500], 500); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','message'=>'Data berhasil dihapus!','code'=>200], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function search(Request $request) |
||||||
|
{ |
||||||
|
$payload = $request->all(); |
||||||
|
$dataBuilder = $this->setUpPayload($payload, 'm_proyek_schedule_health'); |
||||||
|
$builder = $dataBuilder['builder']; |
||||||
|
$countBuilder = $dataBuilder['count']; |
||||||
|
$dataGet = $builder->get(); |
||||||
|
$totalRecord = $countBuilder->count(); |
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
||||||
|
} |
||||||
|
|
||||||
|
public function list() |
||||||
|
{ |
||||||
|
$data = ProjectScheduleHealth::all(); |
||||||
|
$countData = $data->count(); |
||||||
|
|
||||||
|
if(!$data) |
||||||
|
return response()->json(['status'=>'failed','message'=>'failed get list schedule health, please try again later!','code'=>400], 400); |
||||||
|
|
||||||
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Models; |
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model; |
||||||
|
|
||||||
|
class ProjectExpenditure extends Model |
||||||
|
{ |
||||||
|
protected $table = 'm_proyek_expenditure'; |
||||||
|
|
||||||
|
const CREATED_AT = 'created_at'; |
||||||
|
const UPDATED_AT = 'updated_at'; |
||||||
|
|
||||||
|
protected $fillable = [ |
||||||
|
'name', 'color', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' |
||||||
|
]; |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Models; |
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model; |
||||||
|
|
||||||
|
class ProjectFinancialHealth extends Model |
||||||
|
{ |
||||||
|
protected $table = 'm_proyek_financial_health'; |
||||||
|
|
||||||
|
const CREATED_AT = 'created_at'; |
||||||
|
const UPDATED_AT = 'updated_at'; |
||||||
|
|
||||||
|
protected $fillable = [ |
||||||
|
'name', 'color', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' |
||||||
|
]; |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Models; |
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model; |
||||||
|
|
||||||
|
class ProjectInvoice extends Model |
||||||
|
{ |
||||||
|
protected $table = 'm_proyek_invoice'; |
||||||
|
|
||||||
|
const CREATED_AT = 'created_at'; |
||||||
|
const UPDATED_AT = 'updated_at'; |
||||||
|
|
||||||
|
protected $fillable = [ |
||||||
|
'name', 'color', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' |
||||||
|
]; |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Models; |
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model; |
||||||
|
|
||||||
|
class ProjectScheduleHealth extends Model |
||||||
|
{ |
||||||
|
protected $table = 'm_proyek_schedule_health'; |
||||||
|
|
||||||
|
const CREATED_AT = 'created_at'; |
||||||
|
const UPDATED_AT = 'updated_at'; |
||||||
|
|
||||||
|
protected $fillable = [ |
||||||
|
'name', 'color', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' |
||||||
|
]; |
||||||
|
} |
Loading…
Reference in new issue