Browse Source

Merge branch 'Dev-Fuad' of https://git.oslog.id/ordo/surveyor_indonesia_backend into dev-wahyun

pull/5/head
SitiAfridaFitriyani 4 months ago
parent
commit
084a4112f3
  1. 102
      app/Http/Controllers/ActivityController.php
  2. 4
      app/Http/Controllers/DivisiController.php
  3. 7
      app/Http/Controllers/FolderDocumentProyekController.php
  4. 1
      app/Http/Controllers/ProductTransactionController.php
  5. 150
      app/Http/Controllers/ProjectDokumenController.php
  6. 1
      app/Http/Controllers/ProjectExpenditureController.php
  7. 1
      app/Http/Controllers/ProjectFinancialHealthController.php
  8. 1
      app/Http/Controllers/ProjectInvoiceController.php
  9. 2
      app/Http/Controllers/ProjectRoleController.php
  10. 1
      app/Http/Controllers/ProjectScheduleHealthController.php
  11. 4
      app/Http/Controllers/RoleController.php
  12. 25
      app/Http/Controllers/UserToProyekController.php
  13. 14
      routes/web.php

102
app/Http/Controllers/ActivityController.php

@ -631,46 +631,42 @@ class ActivityController extends Controller
public function delete($id) public function delete($id)
{ {
DB::beginTransaction(); DB::beginTransaction();
$activity_id = (int)$id; $activity_id = (int)$id;
$data = Activity::query() $data = Activity::query()
->from('m_activity as ma') ->from('m_activity as ma')
->select('mp.company_id') ->select('ma.id')
->join('m_proyek as mp','ma.proyek_id','mp.id') ->join('m_proyek as mp', 'ma.proyek_id', 'mp.id')
->where('ma.id', $activity_id); ->where('ma.id', $activity_id);
$cloneQuery = clone $data;
if (!$data->exists()) { if (!$data->exists()) {
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data not found!', 'code' => 404], 404); return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data not found!', 'code' => 404], 404);
} }
$this->deleteRelative($activity_id, $cloneQuery->first()->company_id); $this->deleteRelative($activity_id);
if (!$data->delete()) { if (!$data->delete()) {
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data activity failed deleted!', 'code' => 500], 500); return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data activity failed deleted!', 'code' => 500], 500);
} }
DB::commit(); DB::rollBack();
return response()->json(['status' => 'success', "action" => "deleted", 'message' => 'Data activity successfully deleted!', 'code' => 200], 200); return response()->json(['status' => 'success', "action" => "deleted", 'message' => 'Data activity successfully deleted!', 'code' => 200], 200);
} }
private function deleteRelative($activity_id, $company_id) private function deleteRelative($activity_id)
{ {
DB::transaction(function() use($activity_id, $company_id) { DB::transaction(function () use ($activity_id) {
UserToActivity::where('activity_id', $activity_id)->delete(); UserToActivity::where('activity_id', $activity_id)->delete();
AssignMaterial::where('activity_id', $activity_id)->delete(); AssignMaterial::where('activity_id', $activity_id)->delete();
$dataAd = ActivityDokumen::where("activity_id", $activity_id)->get(); $dataAd = ActivityDokumen::where("activity_id", $activity_id)->get();
$company = Company::find($company_id); $destinationPath = $this->setCustomeDirectoryUpload();
if($company) { foreach ($dataAd as $ad) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); if (file_exists($destinationPath['pathActivityDocument'] . $ad->file)) {
foreach ($dataAd as $ad) { unlink($destinationPath['pathActivityDocument'] . $ad->file);
if (file_exists($destinationPath['pathActivityDocument'] . $ad->file)) { }
unlink($destinationPath['pathActivityDocument'] . $ad->file); }
} ActivityDokumen::where("activity_id", $activity_id)->delete();
} });
ActivityDokumen::where("activity_id", $activity_id)->delete();
}
});
} }
public function getUpdate($id) public function getUpdate($id)
@ -1143,28 +1139,28 @@ class ActivityController extends Controller
public function uploadTmpImport(Request $request) public function uploadTmpImport(Request $request)
{ {
DB::beginTransaction(); DB::beginTransaction();
if ($request->hasFile('dokumen')) { if ($request->hasFile('dokumen')) {
$document = $request->file('dokumen'); $document = $request->file('dokumen');
$gantt_id = $request->gantt_id; $gantt_id = $request->gantt_id;
$timeNow = Carbon::now(); $timeNow = Carbon::now();
$originalFilename = $document->getClientOriginalName(); $originalFilename = $document->getClientOriginalName();
$extension = pathinfo($originalFilename, PATHINFO_EXTENSION); $extension = pathinfo($originalFilename, PATHINFO_EXTENSION);
$filename = pathinfo($originalFilename, PATHINFO_FILENAME); $filename = pathinfo($originalFilename, PATHINFO_FILENAME);
$name = $filename . '_' . $timeNow->format('d-m-y-His') . '.' . $extension; $name = $filename . '_' . $timeNow->format('d-m-y-His') . '.' . $extension;
// Limited Storage // Limited Storage
$company = Company::where('company_name', $request->company_name)->first(); $company = Company::where('company_name', $request->company_name)->first();
if($company) { if ($company) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); $destinationPath = $this->setCustomeDirectoryUpload($company['company_name']);
$getLimitStorage = $this->setLimitsStorage($company, $document, $destinationPath['pathTmpImport'], $destinationPath); $getLimitStorage = $this->setLimitsStorage($company, $document, $destinationPath['pathTmpImport'], $destinationPath);
} }
if (isset($getLimitStorage)) { if (isset($getLimitStorage)) {
if($getLimitStorage === false) { if ($getLimitStorage === false) {
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'message' => 'Limited storage maximum!', 'code' => 500], 500); return response()->json(['status' => 'failed', 'message' => 'Limited storage maximum!', 'code' => 500], 500);
} }
$data = [ $data = [
'gantt_id' => (int) $gantt_id, 'gantt_id' => (int) $gantt_id,
@ -1175,17 +1171,17 @@ class ActivityController extends Controller
$result = TmpImport::create($data); $result = TmpImport::create($data);
if (!$document->move($destinationPath['pathTmpImport'], $name) && $result) { if (!$document->move($destinationPath['pathTmpImport'], $name) && $result) {
unlink($destinationPath['pathTmpImport'].$name); unlink($destinationPath['pathTmpImport'] . $name);
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500); return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500);
} }
DB::commit(); DB::commit();
return response()->json(['status' => 'success', 'message' => 'Upload successful!', 'code' => 200], 200); return response()->json(['status' => 'success', 'message' => 'Upload successful!', 'code' => 200], 200);
} }
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500); return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500);
} }
DB::rollBack(); DB::rollBack();
return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400);
} }

4
app/Http/Controllers/DivisiController.php

@ -22,7 +22,7 @@ class DivisiController extends Controller
public function add(Request $request) public function add(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'name' => 'string|required|unique:m_divisi,name,NULL,id,company_id,' . $request->input('company_id'), 'name' => 'string|required|unique:m_divisi,name,NULL,id',
'description' => 'nullable|string', 'description' => 'nullable|string',
'parent' => 'nullable|integer', 'parent' => 'nullable|integer',
'color' => 'nullable|string|max:10' 'color' => 'nullable|string|max:10'
@ -32,7 +32,6 @@ class DivisiController extends Controller
$data['created_by'] = $this->currentName; $data['created_by'] = $this->currentName;
$result = Divisi::create($data); $result = Divisi::create($data);
if (!$result) if (!$result)
return response()->json(['status' => 'failed', 'message' => 'Failed to add data', 'code' => 500]); return response()->json(['status' => 'failed', 'message' => 'Failed to add data', 'code' => 500]);
@ -86,7 +85,6 @@ class DivisiController extends Controller
{ {
$companyId = $request->input('columns.0.value'); $companyId = $request->input('columns.0.value');
$parentDivisi = Divisi::whereNull('parent') $parentDivisi = Divisi::whereNull('parent')
->where('company_id', $companyId)
->with('children') ->with('children')
->get(); ->get();
$divisions = []; $divisions = [];

7
app/Http/Controllers/FolderDocumentProyekController.php

@ -47,13 +47,12 @@ class FolderDocumentProyekController extends Controller
} }
} }
public function delete($id, $company_id) public function delete($id)
{ {
DB::beginTransaction(); DB::beginTransaction();
$data = FolderDocumentProyek::find($id); $data = FolderDocumentProyek::find($id);
$company = Company::find($company_id); if($data) {
if($data && $company) { $destinationPath = $this->setCustomeDirectoryUpload();
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']);
$dir = $destinationPath['pathDocument']; $dir = $destinationPath['pathDocument'];
$dataFile = DokumenProject::where([['type_dokumen', 'project-document-in-folder'],['ref_id', $data['id']]])->orderByRaw('id ASC')->get(); $dataFile = DokumenProject::where([['type_dokumen', 'project-document-in-folder'],['ref_id', $data['id']]])->orderByRaw('id ASC')->get();
if (is_dir($dir)) { if (is_dir($dir)) {

1
app/Http/Controllers/ProductTransactionController.php

@ -10,7 +10,6 @@ class ProductTransactionController extends Controller
public function add(Request $request) public function add(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'company_id' => 'required|integer',
'type_paket' => 'required|string', 'type_paket' => 'required|string',
'amount' => 'required', 'amount' => 'required',
'exp_ospro' => 'required' 'exp_ospro' => 'required'

150
app/Http/Controllers/ProjectDokumenController.php

@ -3,93 +3,79 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\{DokumenProject,Company}; use App\Models\{DokumenProject, Company};
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ProjectDokumenController extends Controller class ProjectDokumenController extends Controller
{ {
public function dokumenByProyekId($id){ public function dokumenByProyekId($id)
if(empty($id) || !is_int((int)$id)) { {
return response()->json(['status'=>'failed','message'=>'project id is required!','code'=>400], 400); if (empty($id) || !is_int((int)$id)) {
return response()->json(['status' => 'failed', 'message' => 'project id is required!', 'code' => 400], 400);
} }
$document = DokumenProject::where("ref_id", $id)->get(); $document = DokumenProject::where("ref_id", $id)->get();
if(count($document) == 0) if (count($document) == 0)
return response()->json(['status'=>'','message'=>'Data not found!' ,'code'=>404], 404); return response()->json(['status' => '', 'message' => 'Data not found!', 'code' => 404], 404);
return response()->json(['status'=>'success','data'=> $document ,'code'=>200], 200); return response()->json(['status' => 'success', 'data' => $document, 'code' => 200], 200);
} }
public function delete($id, $company_id) public function delete($id)
{ {
if(empty($id) || !is_int((int)$id)) { if (empty($id) || !is_int((int)$id)) {
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
} }
$document = DokumenProject::find($id); $document = DokumenProject::find($id);
if(!$document){ if (!$document) {
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=>400], 400); return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 400], 400);
}
$destinationPath = $this->setCustomeDirectoryUpload();
if (file_exists($destinationPath['pathDocument'] . $document['file'])) {
unlink($destinationPath['pathDocument'] . $document['file']);
} }
$company = Company::find($company_id);
if($company) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']);
if(file_exists($destinationPath['pathDocument'].$document['file'])){
unlink($destinationPath['pathDocument'].$document['file']);
}
}
$document->delete(); $document->delete();
return response()->json(['status'=>'success','message'=>'Data deleted!','code'=>200], 200); return response()->json(['status' => 'success', 'message' => 'Data deleted!', 'code' => 200], 200);
} }
public function uploadProjectDokumen(Request $request) public function uploadProjectDokumen(Request $request)
{ {
DB::beginTransaction(); DB::beginTransaction();
$timeNow = Carbon::now(); $timeNow = Carbon::now();
if($request->hasFile('dokumen')){ if ($request->hasFile('dokumen')) {
$document = $request->file('dokumen'); $document = $request->file('dokumen');
$ref_id = $request->ref_id; $ref_id = $request->ref_id;
$originalFilename = $document->getClientOriginalName(); $originalFilename = $document->getClientOriginalName();
$extension = pathinfo($originalFilename, PATHINFO_EXTENSION); $extension = pathinfo($originalFilename, PATHINFO_EXTENSION);
$filename = pathinfo($originalFilename, PATHINFO_FILENAME); $filename = pathinfo($originalFilename, PATHINFO_FILENAME);
$name = $filename . '_' . $timeNow->format('d-m-y-His') . '.' . $extension; $name = $filename . '_' . $timeNow->format('d-m-y-His') . '.' . $extension;
// Limited Storage
$company = Company::whereId($request->company_id)->first(); $destinationPath = $this->setCustomeDirectoryUpload();
if($company) { $data = [
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); 'ref_id' => (int)$ref_id,
$getLimitStorage = $this->setLimitsStorage($company, $document, $destinationPath['pathDocument'],$destinationPath); 'file' => $name,
} 'type_dokumen' => isset($request->type_dokumen) ? $request->type_dokumen : 'project-document'
if(isset($getLimitStorage)) { ];
if($getLimitStorage === false) {
DB::rollBack(); $result = DokumenProject::create($data);
return response()->json(['status' => 'failed', 'message' => 'Limited storage maximum!', 'code' => 500], 500); if (!$document->move($destinationPath['pathDocument'], $name) && $result) {
} unlink($destinationPath['pathDocument'] . $name);
$data = [ DB::rollBack();
'ref_id' => (int)$ref_id, return response()->json(['status' => 'failed', 'message' => 'Dokumen project gagal diupload!', 'code' => 500], 500);
'file' => $name,
'type_dokumen' => isset($request->type_dokumen) ? $request->type_dokumen : 'project-document'
];
$result = DokumenProject::create($data);
if(!$document->move($destinationPath['pathDocument'], $name) && $result) {
unlink($destinationPath['pathDocument'].$name);
DB::rollBack();
return response()->json(['status'=>'failed','message'=>'Dokumen project gagal diupload!','code'=> 500], 500);
}
DB::commit();
return response()->json(['status'=>'success','message'=>'Dokumen project berhasil diupload!','code'=>200], 200);
} }
DB::rollBack(); DB::commit();
return response()->json(['status'=>'failed','message'=>'Dokumen project gagal diupload!','code'=> 500], 500); return response()->json(['status' => 'success', 'message' => 'Dokumen project berhasil diupload!', 'code' => 200], 200);
} }
DB::rollBack(); DB::rollBack();
return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400);
} }
public function searchDocProject(Request $request){ public function searchDocProject(Request $request)
{
$payload = $request->all(); $payload = $request->all();
$dataBuilder = $this->setUpPayload($payload, 'document_project'); $dataBuilder = $this->setUpPayload($payload, 'document_project');
@ -98,34 +84,32 @@ class ProjectDokumenController extends Controller
$dataGet = $builder->get(); $dataGet = $builder->get();
$totalRecord = $countBuilder->count(); $totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200);
} }
public function downloadDokumen($id, $company_id) public function downloadDokumen($id)
{ {
if(empty($id) || !is_int((int)$id)) { if (empty($id) || !is_int((int)$id)) {
return response()->json(['status'=>'failed','message'=>'Id is required!','code'=>400], 400); return response()->json(['status' => 'failed', 'message' => 'Id is required!', 'code' => 400], 400);
} }
$document = DokumenProject::find($id); $document = DokumenProject::find($id);
$company = Company::find($company_id);
if (!$document) {
if(!$document || !$company) { return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 404], 404);
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); }
}
$destinationPath = $this->setCustomeDirectoryUpload();
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); $pathToFile = $destinationPath['pathDocument'] . $document['file'];
$pathToFile = $destinationPath['pathDocument'].$document['file']; if (!file_exists($pathToFile)) {
return response()->json(['status' => 'failed', 'message' => 'Directory not found!', 'code' => 404], 404);
if(!file_exists($pathToFile)) { }
return response()->json(['status'=>'failed','message'=>'Directory not found!','code'=> 404], 404);
} $name = pathinfo($pathToFile, PATHINFO_FILENAME) . "." . pathinfo($pathToFile, PATHINFO_EXTENSION);
if($company) {
$name = pathinfo($pathToFile, PATHINFO_FILENAME) . "." . pathinfo($pathToFile, PATHINFO_EXTENSION); $headers = [
} 'Content-Disposition' => 'attachment; filename="' . $name . '"'
$headers = [ ];
'Content-Disposition' => 'attachment; filename="'.$name.'"'
]; return response()->download($pathToFile, $name, $headers);
return response()->download($pathToFile, $name, $headers);
} }
} }

1
app/Http/Controllers/ProjectExpenditureController.php

@ -16,7 +16,6 @@ class ProjectExpenditureController extends Controller
// Set Unique // Set Unique
$result = ProjectExpenditure::query() $result = ProjectExpenditure::query()
->where([ ->where([
['company_id',$data['company_id']],
['name', $data['name']] ['name', $data['name']]
])->first(); ])->first();
if($result) { if($result) {

1
app/Http/Controllers/ProjectFinancialHealthController.php

@ -16,7 +16,6 @@ class ProjectFinancialHealthController extends Controller
// Set Unique // Set Unique
$result = ProjectFinancialHealth::query() $result = ProjectFinancialHealth::query()
->where([ ->where([
['company_id',$data['company_id']],
['name', $data['name']] ['name', $data['name']]
])->first(); ])->first();
if($result) { if($result) {

1
app/Http/Controllers/ProjectInvoiceController.php

@ -16,7 +16,6 @@ class ProjectInvoiceController extends Controller
// Set Unique // Set Unique
$result = ProjectInvoice::query() $result = ProjectInvoice::query()
->where([ ->where([
['company_id',$data['company_id']],
['name', $data['name']] ['name', $data['name']]
])->first(); ])->first();
if($result) { if($result) {

2
app/Http/Controllers/ProjectRoleController.php

@ -12,7 +12,6 @@ class ProjectRoleController extends Controller
$this->validate($request, [ $this->validate($request, [
'name' => 'required', 'name' => 'required',
'description' => 'required', 'description' => 'required',
'company_id' => 'required'
]); ]);
$data = $request->all(); $data = $request->all();
@ -20,7 +19,6 @@ class ProjectRoleController extends Controller
$data['created_by'] = $this->currentName; $data['created_by'] = $this->currentName;
$result = ProjectRole::create($data); $result = ProjectRole::create($data);
if($result){ if($result){
return response()->json(['status'=>'success','message'=>'add data project role successfully!','code'=>200], 200); return response()->json(['status'=>'success','message'=>'add data project role successfully!','code'=>200], 200);
}else{ }else{

1
app/Http/Controllers/ProjectScheduleHealthController.php

@ -16,7 +16,6 @@ class ProjectScheduleHealthController extends Controller
// Set Unique // Set Unique
$result = ProjectScheduleHealth::query() $result = ProjectScheduleHealth::query()
->where([ ->where([
['company_id',$data['company_id']],
['name', $data['name']] ['name', $data['name']]
])->first(); ])->first();
if($result) { if($result) {

4
app/Http/Controllers/RoleController.php

@ -11,9 +11,8 @@ class RoleController extends Controller
public function add(Request $request) public function add(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'name' => 'string|required|unique:m_roles,name,NULL,id,company_id,' . $request->input('company_id'), 'name' => 'string|required|unique:m_roles,name,NULL,id',
'description' => 'required', 'description' => 'required',
'company_id' => 'required'
]); ]);
$data = $request->all(); $data = $request->all();
@ -24,7 +23,6 @@ class RoleController extends Controller
} }
$result = Role::create($data); $result = Role::create($data);
if (!$result) if (!$result)
return response()->json(['status' => 'failed', 'message' => 'Failed to add data!', 'code' => 500], 500); return response()->json(['status' => 'failed', 'message' => 'Failed to add data!', 'code' => 500], 500);

25
app/Http/Controllers/UserToProyekController.php

@ -113,7 +113,7 @@ class UserToProyekController extends Controller
} }
} }
public function delete($id, $company_id) public function delete($id)
{ {
$data = UserToProyek::find($id); $data = UserToProyek::find($id);
if ($data) { if ($data) {
@ -121,7 +121,7 @@ class UserToProyekController extends Controller
$proyekId = $data->proyek_id; $proyekId = $data->proyek_id;
$delete = $data->delete(); $delete = $data->delete();
if ($delete) { if ($delete) {
$this->deleteRelative($proyekId, $userId, $company_id); $this->deleteRelative($proyekId, $userId);
} }
} else { } else {
return response()->json(['status' => 'failed', 'message' => 'data assign hr to proyek not found!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'data assign hr to proyek not found!', 'code' => 400], 400);
@ -136,25 +136,22 @@ class UserToProyekController extends Controller
} }
} }
private function deleteRelative($proyekId, $userId, $company_id) private function deleteRelative($proyekId, $userId)
{ {
$uta = UserToActivity::where("proyek_id", $proyekId)->where("user_id", $userId)->get(); $uta = UserToActivity::where("proyek_id", $proyekId)->where("user_id", $userId)->get();
foreach ($uta as $value) { foreach ($uta as $value) {
$dataRa = ReportActivity::where("activity_id", $value->activity_id)->where("user_id", $value->user_id)->get(); $dataRa = ReportActivity::where("activity_id", $value->activity_id)->where("user_id", $value->user_id)->get();
$company = Company::find($company_id); $destinationPath = $this->setCustomeDirectoryUpload();
if ($company) { foreach ($dataRa as $ra) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); $images = Image::where("ref_id", $ra->id)->where("category", "report_activity")->get();
foreach ($dataRa as $ra) { foreach ($images as $image) {
$images = Image::where("ref_id", $ra->id)->where("category", "report_activity")->get(); if (file_exists($destinationPath['pathImage'] . $image->image)) {
foreach ($images as $image) { unlink($destinationPath['pathImage'] . $image->image);
if (file_exists($destinationPath['pathImage'] . $image->image)) {
unlink($destinationPath['pathImage'] . $image->image);
}
} }
Image::where("ref_id", $ra->id)->where("category", "report_activity")->delete();
} }
ReportActivity::where("activity_id", $value->activity_id)->where("user_id", $value->user_id)->delete(); Image::where("ref_id", $ra->id)->where("category", "report_activity")->delete();
} }
ReportActivity::where("activity_id", $value->activity_id)->where("user_id", $value->user_id)->delete();
} }
UserToActivity::where("proyek_id", $proyekId)->where("user_id", $userId)->delete(); UserToActivity::where("proyek_id", $proyekId)->where("user_id", $userId)->delete();
} }

14
routes/web.php

@ -66,9 +66,9 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/document-project/upload', 'ProjectDokumenController@uploadProjectDokumen'); $router->post('/document-project/upload', 'ProjectDokumenController@uploadProjectDokumen');
$router->get('/document-project/get/{id}', 'ProjectDokumenController@dokumenByProyekId'); $router->get('/document-project/get/{id}', 'ProjectDokumenController@dokumenByProyekId');
$router->delete('/document-project/delete/{id}/{company_id}', 'ProjectDokumenController@delete'); $router->delete('/document-project/delete/{id}', 'ProjectDokumenController@delete');
$router->post('/document-project/search', 'ProjectDokumenController@searchDocProject'); $router->post('/document-project/search', 'ProjectDokumenController@searchDocProject');
$router->get('/document-project/download/{id}/{company_id}', 'ProjectDokumenController@downloadDokumen'); $router->get('/document-project/download/{id}', 'ProjectDokumenController@downloadDokumen');
$router->post('/document-activity/upload', 'ActivityDokumenController@uploadProjectDokumen'); $router->post('/document-activity/upload', 'ActivityDokumenController@uploadProjectDokumen');
$router->get('/document-activity/get/{id}', 'ActivityDokumenController@dokumenByActivityId'); $router->get('/document-activity/get/{id}', 'ActivityDokumenController@dokumenByActivityId');
@ -82,7 +82,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->put('/project/update/{id}', 'ProjectController@update'); $router->put('/project/update/{id}', 'ProjectController@update');
$router->get('/project/edit/{id}', 'ProjectController@edit'); $router->get('/project/edit/{id}', 'ProjectController@edit');
$router->get('/project/detail/{id}[/{gantt_id}[/{s_curve}]]', 'ProjectController@detail'); $router->get('/project/detail/{id}[/{gantt_id}[/{s_curve}]]', 'ProjectController@detail');
$router->delete('/project/delete/{id}/{company_id}', 'ProjectController@delete'); $router->delete('/project/delete/{id}', 'ProjectController@delete');
$router->get('/project/list', 'ProjectController@list'); $router->get('/project/list', 'ProjectController@list');
$router->get('/project/set-baseline/{gantt_id}', 'ProjectController@setBaseline'); $router->get('/project/set-baseline/{gantt_id}', 'ProjectController@setBaseline');
$router->get('/project/set-baseline-activity/{activity_id}/{gantt_id}', 'ProjectController@setBaselineActivity'); $router->get('/project/set-baseline-activity/{activity_id}/{gantt_id}', 'ProjectController@setBaselineActivity');
@ -333,8 +333,8 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/image/search', 'ImageController@search'); $router->post('/image/search', 'ImageController@search');
$router->delete('/image/delete/{id}', 'ImageController@delete'); $router->delete('/image/delete/{id}', 'ImageController@delete');
$router->delete('/image/delete/{id}/{category}/{company_id}', 'ImageController@deleteByRef'); $router->delete('/image/delete/{id}/{category}', 'ImageController@deleteByRef');
$router->delete('/image/multiple-delete/{id}/{category}/{company_id}', 'ImageController@deleteByRefMultiple'); $router->delete('/image/multiple-delete/{id}/{category}', 'ImageController@deleteByRefMultiple');
$router->post('/image/upload', 'ImageController@uploadImage'); $router->post('/image/upload', 'ImageController@uploadImage');
$router->post('/image/multiple-upload', 'ImageController@uploadMultipleImage'); $router->post('/image/multiple-upload', 'ImageController@uploadMultipleImage');
$router->get('/image/{id}/{category}', 'ImageController@getByRefId'); $router->get('/image/{id}/{category}', 'ImageController@getByRefId');
@ -485,7 +485,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->get('/user-to-proyek/edit/{id}', 'UserToProyekController@edit'); $router->get('/user-to-proyek/edit/{id}', 'UserToProyekController@edit');
$router->put('/user-to-proyek/update/{id}', 'UserToProyekController@update'); $router->put('/user-to-proyek/update/{id}', 'UserToProyekController@update');
$router->post('/user-to-proyek/search', 'UserToProyekController@search'); $router->post('/user-to-proyek/search', 'UserToProyekController@search');
$router->delete('/user-to-proyek/delete/{id}/{company_id}', 'UserToProyekController@delete'); $router->delete('/user-to-proyek/delete/{id}', 'UserToProyekController@delete');
$router->get('/user-to-proyek/list', 'UserToProyekController@list'); $router->get('/user-to-proyek/list', 'UserToProyekController@list');
$router->get('/user-to-proyek/select', 'UserToProyekController@select'); $router->get('/user-to-proyek/select', 'UserToProyekController@select');
$router->get('/user-to-proyek/get-employee-integration', 'UserToProyekController@getEmployeeIntegration'); $router->get('/user-to-proyek/get-employee-integration', 'UserToProyekController@getEmployeeIntegration');
@ -494,7 +494,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->get('/folder-document-proyek/edit/{id}', 'FolderDocumentProyekController@edit'); $router->get('/folder-document-proyek/edit/{id}', 'FolderDocumentProyekController@edit');
$router->put('/folder-document-proyek/update/{id}', 'FolderDocumentProyekController@update'); $router->put('/folder-document-proyek/update/{id}', 'FolderDocumentProyekController@update');
$router->post('/folder-document-proyek/search', 'FolderDocumentProyekController@search'); $router->post('/folder-document-proyek/search', 'FolderDocumentProyekController@search');
$router->delete('/folder-document-proyek/delete/{id}/{company_id}', 'FolderDocumentProyekController@delete'); $router->delete('/folder-document-proyek/delete/{id}', 'FolderDocumentProyekController@delete');
$router->get('/folder-document-proyek/list', 'FolderDocumentProyekController@list'); $router->get('/folder-document-proyek/list', 'FolderDocumentProyekController@list');
$router->get('/folder-document-proyek/get-tree/{id}', 'FolderDocumentProyekController@getTree'); $router->get('/folder-document-proyek/get-tree/{id}', 'FolderDocumentProyekController@getTree');

Loading…
Cancel
Save