feat(laporan-user): refactor user report to display user data instead of permohonan
- Change data source from Permohonan to User model - Simplify search functionality to only search by name and NIK - Update table columns to show user information (NIK, name, roles) - Remove date range filters and complex search conditions - Add helper function getFilePath to handle storage paths
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
use Modules\Lpj\Models\Penilaian;
|
||||
use Modules\Lpj\Models\TeamsUsers;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
function formatTanggalIndonesia($date, $time = false)
|
||||
{
|
||||
@@ -542,3 +544,37 @@
|
||||
return $notifikasi;
|
||||
}
|
||||
|
||||
/**
|
||||
* get full path to internal storage file or external storage file
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function getFilePath($path)
|
||||
{
|
||||
// define base path external storage (use .env) example: 'F:\path\to\storage' in windows
|
||||
$externalBase = env('EXTERNAL_STORAGE_BASE_PATH', 'F:LPJ/lpj/LPJ Gambar/001/');
|
||||
|
||||
$segments = explode('/', $path);
|
||||
|
||||
if(strtoupper($segments[0]) === 'SURVEYOR'){
|
||||
$year = $segments[1];
|
||||
$month = ucfirst(strtolower($segments[2]));
|
||||
$date = $segments[3];
|
||||
$code = $segments[4];
|
||||
$file = $segments[5] ?? '';
|
||||
|
||||
$extenalFullpath = $externalBase . $year . '/' . $month . '/' . $date . '/' . $code . '/' . $file;
|
||||
|
||||
if(File::exists($extenalFullpath)){
|
||||
return $extenalFullpath;
|
||||
}
|
||||
}
|
||||
|
||||
// if not found in external storage, try to find in internal storage
|
||||
if (Storage::exists($path)) {
|
||||
return Storage::url('app/' . $path);
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user