This commit is contained in:
Nur Izzati Zulkifli
2023-10-30 10:31:30 +08:00
14 changed files with 679 additions and 3 deletions
+2
View File
@@ -432,6 +432,8 @@ class HomeController extends Controller
return view('homeoperasikpi');
} else if ($user->hasRole('hr')) {
return view('homehr');
} else if ($user->hasRole('pemasaran')) {
return view('homepemasaran');
} else if ($user->hasRole('admin')) {
return view('homeadmin');
} else if ($user->hasRole('account')) {
@@ -1472,6 +1472,7 @@ class LelongController extends Controller
}
public function senaraimarhun($lelongid, $cawid){
$user = Auth::user();
$total_berat = 0;
$total_pinjaman = 0;
$total_upah = 0;
@@ -1547,6 +1548,7 @@ class LelongController extends Controller
'total_nilaimarhun',
'lelonglel',
'cawanganDetail',
'user',
'total_cazlelong'));
}
+67 -3
View File
@@ -32,6 +32,7 @@ use Illuminate\Support\Facades\Request as FacadesRequest;
use App\Models\TempPengesahan;
use DateTime;
use App\Models\LogUser;
use Illuminate\Support\Facades\Storage;
class MarhunController extends Controller
{
@@ -2598,14 +2599,77 @@ class MarhunController extends Controller
public function pengurusanGambarMarhun()
{
return view('pengurusangambar.index');
$lelong_all = Lelong::select('id', 'tarikh_lelong', 'fasa')->get();
foreach($lelong_all as $index => $lelong)
{
$date_convert = strtotime($lelong->tarikh_lelong);
$lelong_all[$index]['tarikh_lelong'] = date("d-m-Y", $date_convert);
}
return view('pengurusangambar.operasi', compact('lelong_all'));
}
public function galeriMarhun()
{
$user = Auth::user();
$kodcaw = Cawangan::select('id')->where('caw_code', $user->kodcaw)->first();
return view('pengurusangambar.galerimarhun', compact('kodcaw'));
$cawangan = Cawangan::with('lelong')->where('caw_code', $user->kodcaw)->first();
$caw_id = $cawangan->id;
$lelong_all = $cawangan->lelong;
foreach($lelong_all as $index => $lelong)
{
$date_convert = strtotime($lelong->tarikh_lelong);
$lelong_all[$index]['tarikh_lelong'] = date("d-m-Y", $date_convert);
$lelong_all[$index]['new_id'] = str_pad($lelong->id, 3, "0", STR_PAD_LEFT);
}
return view('pengurusangambar.cawangan', compact('caw_id', 'lelong_all'));
}
public function listCawangan(Request $request)
{
$cawangan_all = CawanganLelong::join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
->where('lelong_id', $request->lelong_id)
->select('cawangan_lelong.caw_id', 'cawangan.caw_name')->get();
return response()->json($cawangan_all);
}
public function listLelongBid(Request $request)
{
$lelong_bid_all = LelongBid::with('fileMarhunMain')
->where('caw_id', $request->caw_id)
->where('lelong_id', $request->lelong_id)
->select(['id','norujukan', 'marhun', 'nilaimarhun', 'status_semak', 'berat', 'hargaasas'])
->get();
foreach ($lelong_bid_all as $index => $lelong_bid) {
$lelong_bid_all[$index]['nilaimarhun'] = number_format($lelong_bid->nilaimarhun, 2, '.', ',');
$lelong_bid_all[$index]['hargaasas'] = number_format($lelong_bid->hargaasas, 2, '.', ',');
if ($lelong_bid->fileMarhunMain != null) {
$directory = "/{$lelong_bid->norujukan}/overall_photo/";
$imageExtension = $lelong_bid->fileMarhunMain->file_type;
$marhunImageFileName = "overall.{$imageExtension}";
if (Storage::disk('marhun')->exists("{$directory}${marhunImageFileName}")) {
$marhun_photo = Storage::disk('marhun')->get("{$directory}${marhunImageFileName}");
$lelong_bid_all[$index]['fileMarhunMain']['gambar'] = base64_encode($marhun_photo);
} else {
$lelong_bid_all[$index]['fileMarhunMain']['gambar'] = 0;
}
}
}
$belum_semak = $lelong_bid_all->where('status_semak', 0)->count();
return response()->json([
"jumlah_surat" => $lelong_bid_all->count(),
"belum_semak" => $belum_semak,
"lelong_bid" => $lelong_bid_all,
]);
}
}