Files
ismailmasseran e29a5891c8 Bugfix/list clickup issue (#5)
Reviewed-on: #5
Co-authored-by: ISMAIL MASSERAN <ismail@koppkb.com>
Co-committed-by: ISMAIL MASSERAN <ismail@koppkb.com>
2026-10-19 13:30:36 +08:00

1326 lines
67 KiB
PHP

@extends('layouts.app')
@push('additional_scripts')
<script src="https://cdn.jsdelivr.net/npm/image-capture@0.4.0/lib/imagecapture.min.js"></script>
<script src="{{ asset('js/marhun-photo-capture.js').'?'.rand(1,1000) }}"></script>
<script src="{{ asset('js/marhun-photo-capture-reload-https.js') }}"></script>
<script src="{{ asset('js/marhun-photo-capture-debugger.js') }}"></script>
<script src="{{ asset('js/marhun-photo-viewer.js') }}"></script>
<script>
var marhun_camera_config = @json(config('marhun_camera.cameras'));
let modalOverallPhotoCapture = new marhunPhotoCapturerFactory('#modaloverallphoto-capture');
let modalOverallPhotoCaptureUpdate = new marhunPhotoCapturerFactory('#modaloverallphoto-capture-update');
let modalOverallPhotoCapturePerMarhun = new marhunPhotoCapturerFactory('#modalpermarhunphoto-capture');
let modalOverallPhotoCapturePerMarhunUpdate = new marhunPhotoCapturerFactory('#modalpermarhunphoto-capture-update');
let marhunPhotoCapturerReloadHttps = new marhunPhotoCapturerReloadHttpsFactory();
let marhunPhotoCapturerDebuggerObj = new marhunPhotoCapturerDebugger();
let marhunPhotoViewerOverall = new marhunPhotoViewerFactory('a.btn-view-overall-marhun-photo');
let marhunPhotoViewerPerMarhun = new marhunPhotoViewerFactory('a.viewPhotoEachMarhunLink');
</script>
@endpush
@push('additional_styles')
<link rel="stylesheet" href="{{ asset('css/marhun-registrations-webcam.css') }}">
<link rel="stylesheet" href="{{ asset('css/viewer.min.css') }}">
<link rel="stylesheet" href="{{ asset('css/fix-page-zoom-when-modal-load.css') }}">
<style>
.marhun-overall-card {
border: 1px solid #dee2e6;
border-radius: 8px;
overflow: hidden;
}
.marhun-overall-card .card-header {
background: #f8f9fa;
font-weight: 600;
}
.marhun-overall-empty {
padding: 1.5rem 1rem;
text-align: center;
}
.marhun-overall-empty .empty-icon {
width: 56px;
height: 56px;
margin: 0 auto 0.75rem;
border-radius: 50%;
background: #e9f2ff;
color: #0d6efd;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.4rem;
}
.marhun-overall-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: center;
margin-top: 1rem;
}
.marhun-overall-photo-btn {
border: 0;
background: transparent;
padding: 0;
width: 100%;
cursor: pointer;
}
.marhun-overall-photo-btn img {
width: 100%;
max-height: 320px;
object-fit: contain;
background: #f8f9fa;
display: block;
}
.marhun-hint {
color: #6c757d;
font-size: 0.875rem;
margin: 0;
}
.marhun-warning-banner {
border-left: 4px solid #dc3545;
background: #fff5f5;
color: #842029;
padding: 0.75rem 1rem;
border-radius: 4px;
margin-bottom: 1rem;
}
.marhun-upload-zone {
border: 2px dashed #adb5bd;
border-radius: 8px;
padding: 1.25rem;
text-align: center;
background: #fafbfc;
transition: border-color 0.15s ease, background-color 0.15s ease;
cursor: pointer;
}
.marhun-upload-zone:hover,
.marhun-upload-zone.is-dragover {
border-color: #0d6efd;
background: #f0f7ff;
}
.marhun-upload-zone.has-error {
border-color: #dc3545;
background: #fff5f5;
}
.marhun-upload-zone.has-file {
border-color: #198754;
background: #f3fff7;
}
.marhun-upload-zone .upload-icon {
font-size: 1.75rem;
color: #6c757d;
margin-bottom: 0.5rem;
}
.marhun-upload-zone.has-file .upload-icon {
color: #198754;
}
.marhun-upload-zone .upload-title {
font-weight: 600;
margin-bottom: 0.25rem;
}
.marhun-upload-zone .upload-meta {
color: #6c757d;
font-size: 0.8rem;
}
.marhun-upload-zone input[type="file"] {
display: none;
}
.marhun-photo-preview {
display: none;
margin-top: 1rem;
}
.marhun-photo-preview.is-visible {
display: block;
}
.marhun-photo-preview img {
max-width: 100%;
max-height: 220px;
border-radius: 6px;
border: 1px solid #dee2e6;
object-fit: contain;
background: #fff;
}
.marhun-photo-preview .file-name {
margin-top: 0.5rem;
font-size: 0.85rem;
word-break: break-all;
}
.marhun-photo-error {
display: none;
margin-top: 0.75rem;
color: #dc3545;
font-size: 0.875rem;
}
.marhun-photo-error.is-visible {
display: block;
}
.marhun-modal-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: center;
}
</style>
@endpush
@section('content')
<div class="container-fluid">
@include('marhun.partials.camera_modals_per_marhun')
@include('marhun.partials.camera_modals')
<div class="row ">
<div class="col mx-auto p-4">
<div class="card">
<div class="card-header header-style">
<a href=" {{ route('marhun.senaraimarhun', ['lelong_id'=>$lelongbid->lelong_id]) }}" class="header-style-icon">
<i class="fas fa-arrow-left"></i>
</a>
<div class="header-style-title">
No Rujukan : {{ $lelongbid->norujukan }}
</div>
</div>
<div class="card-body">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@elseif ($message = Session::get('failed'))
<div class="alert alert-danger">
<p>{{ $message }}</p>
</div>
@endif
@error('gambarMarhun')
<div class="alert alert-danger">
<p>{{ $message }}</p>
</div>
@enderror
<form id="deletePhoto" action="{{route('marhun.deletephotomarhun')}}" method="POST">
@csrf
<input type="hidden" id="filemarhun_id" name="filemarhun_id" value="">
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid['id'] }}">
<input type="hidden" name="lelong_id" value="{{ $lelongbid['lelong_id'] }}">
</form>
<form id="formdelete" action="{{ route('marhun.submitdelete') }}" method="POST">
@csrf
<input type="hidden" name="type" value="User">
<input type="hidden" name="lelongbidmarhun_id" id="lelongbidmarhun_id" >
<input type="hidden" name="lelongbid_id" id="lelongbid_id">
<input type="hidden" name="lelong_id" value="{{ $lelongbid['lelong_id'] }}">
</form>
<form id="formsemak" action="{{ route('marhun.semak', [ $lelongbid, $lelong_id ]) }}" method="GET">
<input type="hidden" name="type" value="User">
<input type="hidden" name="lelongbidmarhun_id" id="lelongbidmarhun_id">
<input type="hidden" name="lelongbid_id" id="lelongbid_id">
</form>
<br>
{{-- <h4> No Rujukan : <td>{{ $lelongbid->norujukan }}</td>
</h4> --}}
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6">
<div class="card card-overall-marhun marhun-overall-card">
<div class="card-header">Keseluruhan Marhun</div>
<div class="card-body">
@if ($lelongbid['filemarhun_filename'] != null)
<p class="marhun-hint text-center mb-2">Klik gambar untuk lihat, tukar atau padam.</p>
<button type="button" class="marhun-overall-photo-btn" data-toggle="modal" onclick="kesulurahanMarhunData(this)" data-lelongid="{{$lelongbid['lelong_id']}}" data-lelongbidid="{{$lelongbid['id']}}" data-lelongbid_status_semak="{{ $lelongbid['status_semak'] }}" data-fileid="{{ $lelongbid['filemarhun_id'] }}" data-target="#modaloverallphoto">
<img src="{{ route('marhun.showphotomarhun', ['norujukan_sag' => $lelongbid['norujukan'], 'filemarhun_id' => $lelongbid['filemarhun_id']]) }}" alt="Gambar keseluruhan marhun">
</button>
@else
<div class="marhun-overall-empty">
<div class="empty-icon"><i class="fas fa-image"></i></div>
<p class="mb-1 font-weight-bold">Belum ada gambar keseluruhan</p>
<p class="marhun-hint mb-0">Ambil gambar kamera atau muat naik fail imej.</p>
<div class="marhun-overall-actions">
<button
type="button"
onclick="modalOverallPhotoCapture.initiateTakeMarhunPhoto()"
class="btn btn-primary"
><i class="fas fa-camera mr-1"></i> Ambil Gambar</button>
<button
type="button"
data-toggle="modal"
data-target="#modaloverallphoto"
class="btn btn-outline-primary"
><i class="fas fa-upload mr-1"></i> Muat Naik</button>
</div>
</div>
@endif
</div>
</div>
</div>
</div>
<br>
<div class="marhun-warning-banner">
<strong>Amaran:</strong> Sila pastikan <em>PERMATA MARHUN</em> telah dibuang sebelum kemaskini (jika ada).
</div>
<table class='table table-bordered table-hover' id="marhun" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th class="text-center">Barang</th>
{{--<th>Gambar</th>--}}
<th>Marhun</th>
<th>Karat</th>
<th>Berat</th>
<th>Harga (RM)</th>
<th>Nilai Marhun</th>
<th>Harga Asas</th>
<th>Nota</th>
<th class="text-center">Tindakan</th>
</tr>
</thead>
<tbody>
@foreach ($marhun as $item)
<tr>
<td class="text-center"> {{ $loop->iteration }} </td>
{{--<td class="p-2 m-2" style="border: 1px solid black; width: 100px; height: 130px">
@if (empty($item->eachmarhun_filename))
<div class="btn-group" role="group" style="width: 100%;">
<span data-toggle="tooltip" data-placement="top" title="Muat naik gambar per marhun">
<button data-toggle="modal" onclick="eachMarhunData(this)"
class="btn btn-lg text-" data-lelongid="{{ $lelongbid['lelong_id'] }}"
data-lelongbidid="{{ $lelongbid['id'] }}"
data-loop="{{ $loop->iteration }}"
data-fileid="{{ $item->eachmarhun_id }}"
data-filename="{{ $item->eachmarhun_filename }}"
data-marhun="{{ $item->marhun }}" data-marhunid="{{ $item->id }}"
data-target="#modaleachphoto"
style="border-radius: 0 !important">
<i class="fas fa-upload"></i>
</button>
</span>
<span data-toggle="tooltip" data-placement="top" title="Ambil gambar per marhun">
<button data-toggle="modal" onclick="eachMarhunDataCapturePhoto(this)"
class="btn btn-lg" data-lelongid="{{ $lelongbid['lelong_id'] }}"
data-lelongbidid="{{ $lelongbid['id'] }}"
data-loop="{{ $loop->iteration }}"
data-fileid="{{ $item->eachmarhun_id }}"
data-filename="{{ $item->eachmarhun_filename }}"
data-marhun="{{ $item->marhun }}" data-marhunid="{{ $item->id }}"
style="border-radius: 0 !important">
<i class="fas fa-camera"></i>
</button>
</span>
</div>
<img src="{{ asset('img/no-image.png') }}" alt="Tambah / Padam Gambar"
style="width:100%; border: 1px solid #dee2e6" />
@else
<button data-toggle="modal" onclick="eachMarhunData(this)"
data-lelongid="{{ $lelongbid['lelong_id'] }}"
data-lelongbidid="{{ $lelongbid['id'] }}" data-loop="{{ $loop->iteration }}"
data-fileid="{{ $item->eachmarhun_id }}"
data-filename="{{ $item->eachmarhun_filename }}"
data-marhun="{{ $item->marhun }}" data-marhunid="{{ $item->id }}"
data-lelongbid_status_semak="{{ $lelongbid['status_semak'] }}"
data-target="#modaleachphoto">
<img src="{{ url($item->eachmarhun_filename) }}" alt="Tambah / Padam Gambar"
style="max-width:100px; border: 1px solid #dee2e6" />
</button>
@endif
</td>--}}
<td>{{ $item->marhun }}</td>
<td>
@if($item->karat != null)
{{ $item->karat }}
@else
{{ $item->old_karat }}
@endif
</td>
<td>
@if($item->berat != null)
{{ $item->berat }}
@else
{{ $item->old_berat }}
@endif
</td>
<td>
@if($item->harga != null)
{{ $item->harga }}
@else
{{ $item->old_harga }}
@endif
</td>
<td>
@if($item->n_marhun != null)
{{ number_format($item->n_marhun, 2, '.', ',') }}
@else
{{ number_format($item->old_nmarhun, 2, '.', ',') }}
@endif
</td>
<td>
@if($item->hargaasas != null)
{{ number_format($item->hargaasas, 2, '.', ',') }}
@else
{{ number_format($item->old_hargaasas, 2, '.', ',') }}
@endif
</td>
<td>{{ $item->nota }}</td>
<td class="text-center">
@if($lelongbid->status_semak == 1)
<span class="badge badge-success">Telah Semak<br></span>
@elseif($lelongbid->status_semak == 0)
@if(isset($item->pengesahan['status']))
@if($item->pengesahan['status_ubah'] == 1 )
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Mutu</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 2)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Tambah Marhun</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 3)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Hapus Marhun</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 4)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Berat</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 5)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Mutu & Berat</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 7)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Marhun</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 8)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Mutu, Berat & Marhun</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 9)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Mutu & Marhun</i></span></a>
@elseif($item->pengesahan['status_ubah'] == 10)
<a href="{{ route('marhun.lihatubahmutumarhun', ['norujukan'=>$lelongbid->norujukan, $lelong_id]) }}"><span class="badge badge-warning">Tunggu Pengesahan<br><i>Ubah Berat & Marhun</i></span></a>
@elseif($item->pengesahan['status'] == 1)
<span class="badge badge-warning">Telah Sah</i></span>
@endif
@else
<a class="btn m-1 btn-primary" onclick="kemaskini(this)" data-idmarhun="{{ $item->id }}" data-marhun="{{ $item->marhun }}" data-karat="{{ $item->karat }}" data-berat="{{ $item->berat }}" data-harga="{{ $item->harga }}" data-nmarhun="{{ $item->n_marhun }}" data-hargaasas="{{ $item->hargaasas }}" data-nota="{{ $item->nota }}" data-toggle="tooltip" data-placement="top" title="Kemaskini Marhun" style="margin-right:30px"><i class="far fa-edit"></i></a>
<a class="confirmdel" id="btndelete" data-lelongbidmarhun="{{ $item->id }}" data-lelongbid="{{ $item->lelongbid_id }}" data-toggle="tooltip" data-placement="top" title="Padam Marhun"><i class="far fa-window-close"></i></a>
@endif
@else
<a class="btn m-1 btn-primary" onclick="kemaskini(this)" data-idmarhun="{{ $item->id }}" data-marhun="{{ $item->marhun }}" data-karat="{{ $item->karat }}" data-berat="{{ $item->berat }}" data-harga="{{ $item->harga }}" data-nmarhun="{{ $item->n_marhun }}" data-hargaasas="{{ $item->hargaasas }}" data-nota="{{ $item->nota }}" data-toggle="tooltip" data-placement="top" title="Kemaskini Marhun" style="margin-right:30px"><i class="far fa-edit"></i></a>
<a class="confirmdel" id="btndelete" data-lelongbidmarhun="{{ $item->id }}" data-lelongbid="{{ $item->lelongbid_id }}" data-toggle="tooltip" data-placement="top" title="Padam Marhun"><i class="far fa-window-close"></i></a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="modal-footer" style="margin-top:2%;">
{{-- {{dump($status['status'])}} --}}
@if($lelongbid->status_semak == 0)
@if(isset($status['status']))
@if($status['status'] == 0)
<button style="width:20%;" class="btn btn-warning">Dalam Proses Pengesahan</button>
@elseif($status['status'] == 1)
<button style="width:7%;" class="btn btn-info" >Telah Sah</button>
@else
<button style="width:7%;" class="btn btn-success button-confirm-marhun" onclick="confirm()" data-is_overall_marhun_photo_uploaded="{{ $lelongbid['filemarhun_filename'] != null }}">Semak/button>
@endif
@else
<button style="width:7%;" class="btn btn-success button-confirm-marhun" onclick="confirm()" data-is_overall_marhun_photo_uploaded="{{ $lelongbid['filemarhun_filename'] != null }}">Semak</button>
@endif
{{-- <button style="width:7%;" class="btn btn-warning">Dalam Proses Pengesahan</button> --}}
@elseif($lelongbid->status_semak == 1)
<button class="btn btn-success btn-sm hovernone-success" disabled>SUDAH DISEMAK</button>
@endif
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="modalkemaskini">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Kemaskini Marhun</h5><br>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('marhun.kemaskiniMarhun') }}" method="POST" id="formkemaskini">
@csrf
<div class="row justify-content-center">
<h4 style="color:rgb(255, 38, 0);" align = 'center'>AMARAN::Sila Pastikan 'PERMATA MARHUN' telah DIBUANG sebelum kemaskini!!(Jika Ada)</h4>
<div class="col-md-8">
<div class="form-group row">
<input type="hidden" name="idmarhun" id="idmarhun">
<div class="col-md-4">No Rujukan</div>
<div class="col-md-8"><input class="form-control" type="text"
name="norujukan_marhun" id="norujukan_marhun"
value="{{ $lelongbid->norujukan }}" readonly></div>
<div class="col-md-4">Marhun</div>
<div class="col-md-8">
<select class="form-control" name="marhun" id="selectmarhun">
<option disabled selected value> -- Pilih Jenis Marhun -- </option>
@foreach ($emasall as $emas)
<option value="{{ $emas->marhun }}"> {{ $emas->descpt }}</option>
@endforeach
</select>
</div>
<div class="col-md-4">Karat</div>
<div class="col-md-8">
<select class="form-control" name="karat" id="selectkarat"
data-karatall="{{ $lelkarat }}" onchange="calc(this,'karat')">
<option disabled selected value> -- Pilih Karat -- </option>
@foreach ($karatall as $karat)
<option value="{{ $karat->karat }}"> {{ $karat->keterangan }}
</option>
@endforeach
</select>
</div>
<div class="col-md-4">Berat</div>
<div class="col-md-8"><input class="form-control" type="text"
name="berat_emas" id="berat_emas" oninput="calc(this,'berat')"></div>
<div class="col-md-4">Harga</div>
<div class="col-md-8"><input class="form-control .harga" type="text"
name="harga" id="harga" readonly></div>
<div class="col-md-4">Nilai Marhun</div>
<div class="col-md-8"><input class="form-control" type="text"
name="nilai_marhun" id="nilai_marhun" readonly></div>
<div class="col-md-4">Harga Asas</div>
<div class="col-md-8"><input class="form-control" type="text"
name="harga_asas" id="harga_asas" readonly></div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text" name="nota"
id="nota" readonly></div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" style="width:15%;"
data-dismiss="modal">Kembali</button>
<button type="button" class="btn btn-primary" style="width:15%;"
onclick="updateform()">Simpan</button>
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="modaltambahmarhun">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Tambah Marhun</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('marhun.tambahmarhun') }}" method="POST" id="formtambahmarhun">
@csrf
<div class="row justify-content-center">
<div class="col-md-8">
<div class="form-group row">
<input type="hidden" name="tambahmarhun" id="tambahmarhun">
<div class="col-md-4">No Rujukan</div>
<div class="col-md-8"><input class="form-control" type="text"
name="norujukan_marhuntambahan" id="norujukan_marhuntambahan"
value="{{ $lelongbid->norujukan }}" readonly></div>
<div class="col-md-4">Marhun</div>
<div class="col-md-8">
<select class="form-control" name="marhuntambahan" id="selectmarhuntambahan">
<option disabled selected value> -- Pilih Jenis Marhun -- </option>
@foreach ($emasall as $emas)
<option value="{{ $emas->marhun }}"> {{ $emas->descpt }}</option>
@endforeach
</select>
</div>
<div class="col-md-4">Karat</div>
<div class="col-md-8">
<select class="form-control" name="karattambahan" id="selectkarattambahan"
data-karatalltambahan="{{ $lelkarat }}"
onchange="calc_tambahan(this,'karattambahan')">
<option disabled selected value> -- Pilih Karat -- </option>
@foreach ($karatall as $karat)
<option value="{{ $karat->karat }}">{{ $karat->keterangan }}</option>
@endforeach
</select>
</div>
<div class="col-md-4">Berat</div>
<div class="col-md-8"><input class="form-control" type="text"
name="berat_emastambahan" id="berat_emastambahan"
oninput="calc_tambahan(this,'berattambahan')" value="0"></div>
<div class="col-md-4">Harga</div>
<div class="col-md-8"><input class="form-control .hargatambahan" type="text"
name="hargatambahan" id="hargatambahan" readonly></div>
<div class="col-md-4">Nilai Marhun</div>
<div class="col-md-8"><input class="form-control" type="text"
name="nilai_marhuntambahan" id="nilai_marhuntambahan" readonly></div>
<div class="col-md-4">Harga Asas</div>
<div class="col-md-8"><input class="form-control" type="text"
name="harga_asastambahan" id="harga_asastambahan" readonly></div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text"
name="notatambahan" id="notatambahan"></div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
@if ($lelongbid->status_semak == 0)
<button type="button" class="btn btn-secondary" style="width:15%;"
data-dismiss="modal">Kembali</button>
<button type="button" class="btn btn-primary" style="width:15%;"
onclick="tambahanmarhun()">Simpan</button>
@elseif($lelongbid->status_semak == 1)
<p class="text-danger font-italic">Marhun telah disemak. Tidak dibenarkan untuk tambah.</p>
@endif
</div>
</div>
</div>
</div>
<div class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" id="modaloverallphoto">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Keseluruhan Marhun</h5>
<button type="button" class="close" onclick="clearData()" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form id="form1" action="{{ route('marhun.addphotomarhun') }}" method="POST"
enctype="multipart/form-data">
@csrf
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid['id'] }}">
<input type="hidden" name="lelong_id" value="{{ $lelongbid['lelong_id'] }}">
<input type="hidden" name="photo_type" value="1">
<div class="modal-body">
@if (!isset($lelongbid->filemarhun_filename))
<label class="marhun-upload-zone d-block mb-0" for="marhunOverallUploadInput">
<div class="upload-icon"><i class="fas fa-cloud-upload-alt"></i></div>
<div class="upload-title">Pilih atau seret gambar ke sini</div>
<div class="upload-meta">JPG, PNG, WEBP, GIF &middot; Maksimum 10MB</div>
<input type="file"
class="marhun-photo-input"
accept=".jpg,.jpeg,.png,.webp,.gif,image/jpeg,image/png,image/webp,image/gif"
name="gambarMarhun"
id="marhunOverallUploadInput" />
</label>
<div class="marhun-photo-preview text-center">
<img src="" alt="Pratonton gambar">
<div class="file-name text-muted"></div>
</div>
<div class="marhun-photo-error"></div>
@else
<div class="marhun-modal-actions py-3">
@php
$imageLink = route('marhun.showphotomarhun', ['norujukan_sag' => $lelongbid['norujukan'], 'filemarhun_id' => $lelongbid['filemarhun_id']]);
@endphp
<a href="{{ $imageLink }}" target="_blank" class="btn btn-outline-primary btn-view-overall-marhun-photo"><i class="fas fa-eye mr-1"></i> Lihat</a>
<button data-dismiss="modal" onclick="updatePhoto(1)" type="button"
data-target="#modalupdatephoto" data-toggle="modal" class="btn btn-warning action-invalid-after-semak"><i class="fas fa-upload mr-1"></i> Muat naik baru</button>
<button data-dismiss="modal"
onclick="modalOverallPhotoCaptureUpdate.initiateTakeMarhunPhoto()" type="button"
class="btn btn-primary action-invalid-after-semak"><i class="fas fa-camera mr-1"></i> Ambil baru</button>
<button data-dismiss="modal" onclick="confirmDeletePhoto()"
class="btn btn-danger action-invalid-after-semak"><i class="fas fa-trash-alt mr-1"></i> Padam</button>
</div>
@endif
</div>
<div class="modal-footer">
@if ($lelongbid->status_semak == 0)
<button type="button" class="btn btn-secondary"
onclick="clearData()" data-dismiss="modal">Kembali</button>
@if (!isset($lelongbid->filemarhun_filename))
<button type="submit" class="btn btn-primary">Simpan</button>
@endif
@elseif($lelongbid->status_semak == 1)
<p class="text-danger font-italic mb-0">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
@endif
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" id="modaleachphoto">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="titleHeader" value="titleHeader"></h5>
<button type="button" onclick="clearData()" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form id="form1" action="{{ route('marhun.addphotomarhun') }}" method="POST"
enctype="multipart/form-data">
@csrf
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid['id'] }}">
<input type="hidden" name="lelong_id" value="{{ $lelongbid['lelong_id'] }}">
<input type="hidden" name="photo_type" value="2">
<input type="hidden" name="lelongbidmarhun_id" id="marhun_id" value="">
<div class="modal-body">
<div id="createPhoto" hidden>
<label class="marhun-upload-zone d-block mb-0" for="marhunEachUploadInput">
<div class="upload-icon"><i class="fas fa-cloud-upload-alt"></i></div>
<div class="upload-title">Pilih atau tarik fail imej ke sini</div>
<div class="upload-meta">JPG, PNG, WEBP, GIF · maksimum 10MB</div>
<input type="file"
class="marhun-photo-input"
accept=".jpg,.jpeg,.png,.webp,.gif,image/jpeg,image/png,image/webp,image/gif"
name="gambarMarhun"
id="marhunEachUploadInput" />
</label>
<div class="marhun-photo-preview text-center">
<img src="" alt="Pratonton gambar">
<div class="file-name text-muted"></div>
</div>
<div class="marhun-photo-error"></div>
</div>
<div id="updateDeletePhoto" hidden>
<div class="marhun-modal-actions py-3">
<a href="" target="_blank" class="btn btn-outline-primary viewPhotoEachMarhunLink"><i class="fas fa-eye mr-1"></i> Lihat</a>
<button data-dismiss="modal" onclick="updatePhoto(2)" type="button"
data-target="#modalupdatephoto" data-toggle="modal" class="btn btn-warning action-invalid-after-semak"><i class="fas fa-upload mr-1"></i> Muat naik baru</button>
<button data-dismiss="modal"
onclick="modalOverallPhotoCapturePerMarhunUpdate.initiateTakeMarhunPhoto()"
type="button" data-toggle="modal" class="btn btn-primary action-invalid-after-semak"><i class="fas fa-camera mr-1"></i> Ambil baru</button>
<button data-dismiss="modal" onclick="confirmDeletePhoto()"
class="btn btn-danger action-invalid-after-semak"><i class="fas fa-trash mr-1"></i> Padam</button>
</div>
</div>
</div>
<div class="modal-footer">
@if ($lelongbid->status_semak == 0)
<button type="button" class="btn btn-secondary" onclick="clearData()"
data-dismiss="modal">Kembali</button>
<button type="submit" class="btn btn-primary" id="marhunEachSaveBtn">Simpan</button>
@elseif($lelongbid->status_semak == 1)
<p class="text-danger font-italic mb-0">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
@endif
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" id="modalupdatephoto">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Tukar Gambar</h5>
<button type="button" onclick="clearData()" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ route('marhun.updatephotomarhun') }}" method="POST" enctype="multipart/form-data">
@csrf
<input type="hidden" id="val1" name="lelongbid_id" value="">
<input type="hidden" id="val2" name="lelongbidmarhun_id" value="">
<input type="hidden" id="val3" name="filemarhun_id" value="">
<input type="hidden" id="val4" name="lelong_id" value="">
<input type="hidden" id="photo_type" name="photo_type" value="">
<div class="modal-body">
<label class="marhun-upload-zone d-block mb-0" for="marhunUpdateUploadInput">
<div class="upload-icon"><i class="fas fa-cloud-upload-alt"></i></div>
<div class="upload-title">Pilih atau tarik fail imej ke sini</div>
<div class="upload-meta">JPG, PNG, WEBP, GIF · maksimum 10MB</div>
<input type="file"
class="marhun-photo-input"
accept=".jpg,.jpeg,.png,.webp,.gif,image/jpeg,image/png,image/webp,image/gif"
name="gambarMarhun"
id="marhunUpdateUploadInput" />
</label>
<div class="marhun-photo-preview text-center">
<img src="" alt="Pratonton gambar">
<div class="file-name text-muted"></div>
</div>
<div class="marhun-photo-error"></div>
</div>
<div class="modal-footer">
@if ($lelongbid->status_semak == 0)
<button type="button" class="btn btn-secondary" onclick="clearData()"
data-dismiss="modal">Kembali</button>
<button type="submit" class="btn btn-primary">Simpan</button>
@elseif($lelongbid->status_semak == 1)
<p class="text-danger font-italic mb-0">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
@endif
</div>
</form>
</div>
</div>
</div>
</div>
<script>
//marhunPhotoCapturerReloadHttps.reload();
const MARHUN_PHOTO_MAX_BYTES = 10 * 1024 * 1024; // 10MB
const MARHUN_PHOTO_ALLOWED_EXT = ['jpg', 'jpeg', 'png', 'webp', 'gif'];
const MARHUN_PHOTO_ALLOWED_MIME = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];
function getMarhunUploadZone(input) {
return input.closest('.modal-body')
? input.closest('.modal-body').querySelector('.marhun-upload-zone')
: input.closest('.marhun-upload-zone');
}
function getMarhunPhotoErrorEl(input) {
const body = input.closest('.modal-body');
return body ? body.querySelector('.marhun-photo-error') : null;
}
function getMarhunPhotoPreviewEls(input) {
const body = input.closest('.modal-body');
if (!body) {
return {};
}
return {
preview: body.querySelector('.marhun-photo-preview'),
image: body.querySelector('.marhun-photo-preview img'),
fileName: body.querySelector('.marhun-photo-preview .file-name'),
};
}
function showMarhunPhotoError(input, message) {
const zone = getMarhunUploadZone(input);
const errorEl = getMarhunPhotoErrorEl(input);
clearMarhunPhotoPreview(input);
if (zone) {
zone.classList.remove('has-file');
zone.classList.add('has-error');
}
if (errorEl) {
errorEl.textContent = message;
errorEl.classList.add('is-visible');
} else if (message) {
alert(message);
}
}
function clearMarhunPhotoError(input) {
const zone = getMarhunUploadZone(input);
const errorEl = getMarhunPhotoErrorEl(input);
if (zone) {
zone.classList.remove('has-error');
}
if (errorEl) {
errorEl.textContent = '';
errorEl.classList.remove('is-visible');
}
}
function clearMarhunPhotoPreview(input) {
const zone = getMarhunUploadZone(input);
const els = getMarhunPhotoPreviewEls(input);
if (zone) {
zone.classList.remove('has-file');
}
if (els.preview) {
els.preview.classList.remove('is-visible');
}
if (els.image) {
if (els.image.dataset.objectUrl) {
URL.revokeObjectURL(els.image.dataset.objectUrl);
delete els.image.dataset.objectUrl;
}
els.image.src = '';
}
if (els.fileName) {
els.fileName.textContent = '';
}
}
function showMarhunPhotoPreview(input, file) {
const zone = getMarhunUploadZone(input);
const els = getMarhunPhotoPreviewEls(input);
const objectUrl = URL.createObjectURL(file);
if (zone) {
zone.classList.add('has-file');
zone.classList.remove('has-error');
}
if (els.image) {
if (els.image.dataset.objectUrl) {
URL.revokeObjectURL(els.image.dataset.objectUrl);
}
els.image.dataset.objectUrl = objectUrl;
els.image.src = objectUrl;
}
if (els.fileName) {
const sizeMb = (file.size / (1024 * 1024)).toFixed(2);
els.fileName.textContent = file.name + ' (' + sizeMb + ' MB)';
}
if (els.preview) {
els.preview.classList.add('is-visible');
}
}
function validateMarhunPhotoInput(input) {
clearMarhunPhotoError(input);
if (!input.files || !input.files.length) {
clearMarhunPhotoPreview(input);
return true;
}
const file = input.files[0];
const extension = (file.name.split('.').pop() || '').toLowerCase();
const isAllowedExt = MARHUN_PHOTO_ALLOWED_EXT.includes(extension);
const isAllowedMime = !file.type || MARHUN_PHOTO_ALLOWED_MIME.includes(file.type);
if (!isAllowedExt || !isAllowedMime) {
input.value = '';
showMarhunPhotoError(input, 'Fail mestilah imej (JPG, PNG, WEBP, GIF) sahaja.');
return false;
}
if (file.size > MARHUN_PHOTO_MAX_BYTES) {
input.value = '';
showMarhunPhotoError(input, 'Saiz fail melebihi 10MB. Sila pilih imej yang lebih kecil.');
return false;
}
showMarhunPhotoPreview(input, file);
return true;
}
function assignFilesToInput(input, files) {
if (!files || !files.length) {
return;
}
const dataTransfer = new DataTransfer();
dataTransfer.items.add(files[0]);
input.files = dataTransfer.files;
validateMarhunPhotoInput(input);
}
document.addEventListener('change', function (event) {
if (event.target && event.target.classList.contains('marhun-photo-input')) {
validateMarhunPhotoInput(event.target);
}
});
document.addEventListener('dragover', function (event) {
const zone = event.target.closest && event.target.closest('.marhun-upload-zone');
if (!zone) {
return;
}
event.preventDefault();
zone.classList.add('is-dragover');
});
document.addEventListener('dragleave', function (event) {
const zone = event.target.closest && event.target.closest('.marhun-upload-zone');
if (!zone) {
return;
}
zone.classList.remove('is-dragover');
});
document.addEventListener('drop', function (event) {
const zone = event.target.closest && event.target.closest('.marhun-upload-zone');
if (!zone) {
return;
}
event.preventDefault();
zone.classList.remove('is-dragover');
const input = zone.querySelector('input.marhun-photo-input');
if (!input || input.classList.contains('d-none')) {
return;
}
assignFilesToInput(input, event.dataTransfer.files);
});
document.addEventListener('submit', function (event) {
const form = event.target;
if (!(form instanceof HTMLFormElement)) {
return;
}
const photoInput = form.querySelector('input.marhun-photo-input[name="gambarMarhun"]');
if (!photoInput) {
return;
}
// Camera capture forms keep a hidden file input; only validate visible upload inputs.
if (photoInput.classList.contains('d-none')) {
return;
}
if (!photoInput.files || !photoInput.files.length) {
showMarhunPhotoError(photoInput, 'Sila pilih fail gambar terlebih dahulu.');
event.preventDefault();
return;
}
if (!validateMarhunPhotoInput(photoInput)) {
event.preventDefault();
}
});
function clearData() {
document.querySelectorAll('input.marhun-photo-input').forEach(function (input) {
input.value = '';
clearMarhunPhotoError(input);
clearMarhunPhotoPreview(input);
});
const marhunId = document.getElementById('marhun_id');
const fileMarhunId = document.getElementById('filemarhun_id');
if (marhunId) {
marhunId.value = '';
}
if (fileMarhunId) {
fileMarhunId.value = '';
}
}
function eachMarhunData(value) {
lelongId = $(value).data('lelongid');
marhunId = $(value).data('marhunid');
lelongBidId = $(value).data('lelongbidid');
marhun = $(value).data('marhun');
loop = $(value).data('loop');
fileId = $(value).data('fileid');
fileName = $(value).data('filename');
let modalTitle = "Bil:" + loop + ", Id Marhun:" + marhunId + ", Marhun:" + marhun;
lelongBidStatusSemak = $(value).data('lelongbid_status_semak');
isAlreadyStatusSemak = lelongBidStatusSemak === 1;
if(isAlreadyStatusSemak){
const modalOverallPhoto = document.querySelector('#modaleachphoto');
modalOverallPhoto.querySelectorAll('button.action-invalid-after-semak')
.forEach(button => button.style.display = 'none');
}
prepareModalUpdateCaptureEachMarhun(modalTitle, marhunId, fileId);
prepareModalUpdateUploadEachMarhun(modalTitle, marhunId, fileId, fileName);
prepareModalViewPhotoEachMarhun(fileName);
}
function prepareModalViewPhotoEachMarhun(fileName)
{
let modal = document.querySelector('#modaleachphoto');
modal.querySelector('a.viewPhotoEachMarhunLink').href = fileName;
}
function prepareModalUpdateCaptureEachMarhun(modalTitle, marhunId, fileId) {
let modal = document.querySelector('#modalpermarhunphoto-capture-update');
modal.querySelector('#marhun_id').value = marhunId;
modal.querySelector('input[name="filemarhun_id"]').value = fileId;
modal.querySelector("h5.modal-title").innerHTML = modalTitle;
}
function prepareModalUpdateUploadEachMarhun(modalTitle, marhunId, fileId, fileName) {
const saveBtn = document.getElementById('marhunEachSaveBtn');
if (fileName == '') {
$("#createPhoto").attr("hidden", false);
$("#updateDeletePhoto").attr("hidden", true);
if (saveBtn) {
saveBtn.style.display = '';
}
} else if (fileName != '') {
$("#createPhoto").attr("hidden", true);
$("#updateDeletePhoto").attr("hidden", false);
if (saveBtn) {
saveBtn.style.display = 'none';
}
}
let modal = document.querySelector('#modaleachphoto');
modal.querySelector('input[name="lelongbidmarhun_id"]').value = marhunId;
document.getElementById('marhun_id').value = marhunId;
document.getElementById('filemarhun_id').value = fileId;
document.getElementById("titleHeader").innerHTML = modalTitle;
}
function eachMarhunDataCapturePhoto(value) {
let lelongId = $(value).data('lelongid');
let marhunId = $(value).data('marhunid');
let lelongBidId = $(value).data('lelongbidid');
let marhun = $(value).data('marhun');
let loop = $(value).data('loop');
let fileId = $(value).data('fileid');
let fileName = $(value).data('filename');
let modal = document.querySelector('#modalpermarhunphoto-capture');
modal.querySelector('#marhun_id').value = marhunId;
modal.querySelector('h5.modal-title').innerHTML = "Bil:" + loop + ", Id Marhun:" + marhunId + ", Marhun:" +
marhun;
modalOverallPhotoCapturePerMarhun.initiateTakeMarhunPhoto();
}
function kesulurahanMarhunData(value) {
lelongBidId = $(value).data('lelongbidid');
marhunId = '';
fileId = $(value).data('fileid');
lelongId = $(value).data('lelongid');
document.getElementById('filemarhun_id').value = fileId;
lelongBidStatusSemak = $(value).data('lelongbid_status_semak');
isAlreadyStatusSemak = lelongBidStatusSemak === 1;
if(isAlreadyStatusSemak){
const modalOverallPhoto = document.querySelector('#modaloverallphoto');
modalOverallPhoto.querySelectorAll('button.action-invalid-after-semak')
.forEach(button => button.style.display = 'none');
}
}
function confirmDeletePhoto() {
$.confirm({
title: 'Perhatian!',
content: 'Padam gambar? Tindakan ini tidak dapat dikembalikan.',
type: 'red',
typeAnimated: true,
buttons: {
Batal: {
btnClass: 'btn-default',
action: function() {}
},
Sahkan: {
btnClass: 'btn-danger',
action: function() {
$("#deletePhoto").submit();
}
}
}
});
}
function updatePhoto(type) {
document.getElementById('val1').value = lelongBidId;
document.getElementById('val2').value = marhunId;
document.getElementById('val3').value = fileId;
document.getElementById('val4').value = lelongId;
document.getElementById('photo_type').value = type;
}
function validateOverallMarhunPhotoTook(){
const button_confirm = document.querySelector('button.button-confirm-marhun');
const is_overall_marhun_photo_uploaded = button_confirm.dataset.is_overall_marhun_photo_uploaded;
if(! is_overall_marhun_photo_uploaded){
return false;
}
return true;
}
function showOverallMarhunPhotoErrorAlert(){
$.alert({
title: 'Perhatian!',
content: 'Sila pastikan gambar keseluruhan marhun lengkap',
type: 'red',
buttons: {
OK: {
btnClass: 'btn-default',
action: function() {
setTimeout(() => {
button_take_marhun_photo = document.querySelector('div.card-overall-marhun');
button_take_marhun_photo.scrollIntoView({ behavior: 'smooth', block: 'start'});
}, 500);
}
},
}
});
}
function confirm() {
const is_pass_validation = validateOverallMarhunPhotoTook();
if (! is_pass_validation) {
showOverallMarhunPhotoErrorAlert();
return;
}
$.confirm({
title: 'Perhatian!',
content: 'Anda pasti telah membuat semakan untuk kesemua marhun?',
type: 'green',
typeAnimated: true,
buttons: {
Batal: {
btnClass: 'btn-default',
action: function() {}
},
Sahkan: {
btnClass: 'btn-success',
action: function() {
$("#formsemak").submit();
}
}
}
});
}
//Enable tooltips everywhere
$(function() {
$('[data-toggle="tooltip"]').tooltip()
})
$('a.confirmdel').confirm({
title: 'Pengesahan',
content: 'Anda pasti?',
type: 'red',
typeAnimated: true,
buttons: {
Ya: {
btnClass: 'btn-danger',
action: function(e) {
// location.href = this.$target.attr('href');
let lelongbidmarhun = $(this)[0].$target[0].dataset.lelongbidmarhun;
let lelongbid = $(this)[0].$target[0].dataset.lelongbid;
$('#lelongbid_id').val(lelongbid);
$('#lelongbidmarhun_id').val(lelongbidmarhun);
$("#formdelete").submit();
}
},
Tidak: {
btnClass: 'btn-default',
action: function() {}
}
}
});
var tablemarhun = $('#marhun').DataTable({
"orderFixed": [0, 'asc'],
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
buttons: [{
className: 'btn btn-outline-success pl-4 pr-4 addsim',
text: 'Tambah Marhun <i class="fas fa-plus" id="test"></i>',
action: function(e, dt, node, config) {
$('#modaltambahmarhun').modal("show");
}
}]
});
$('.addsim').tooltip();
$('.export').tooltip();
// $( '.dt-buttons').addClass('btn-group');
$('.addsim').removeClass('dt-button');
$('.export').removeClass('dt-button');
function selectall(cb) {
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function() {
$(this).prop('checked', cb.checked);
})
}
function tambahanmarhun(e) {
$("#formtambahmarhun").submit();
}
function calc_tambahan(e, type) {
if (type == 'karattambahan') {
var karatalltambahan = $(e).data('karatalltambahan');
karatalltambahan.forEach((item) => {
if (item.karat == $(e).val()) {
console.log(item);
var beratemas = $('#berat_emastambahan').val();
var total_tambahan = item.harga2 * parseFloat(beratemas);
var harga_asastambahan = Math.round(total_tambahan);
$('#hargatambahan').val(parseFloat(item.harga2).toFixed(2));
$('#nilai_marhuntambahan').val(parseFloat(total_tambahan).toFixed(2));
$('#harga_asastambahan').val(parseFloat(harga_asastambahan).toFixed(2));
}
});
} else {
var total_tambahan = $('#hargatambahan').val() * $('#berat_emastambahan').val();
var harga_asastambahan = Math.round(total_tambahan);
$('#nilai_marhuntambahan').val(parseFloat(total_tambahan).toFixed(2));
$('#harga_asastambahan').val(parseFloat(harga_asastambahan).toFixed(2));
}
}
function kemaskini(e) {
$('#modalkemaskini').modal("show");
$('#modalkemaskini').on('shown.bs.modal', function() {
$('#rolename').trigger('focus')
})
let idmarhun = $(e).data('idmarhun');
let marhun = $(e).data('marhun');
let karat = $(e).data('karat');
let berat = $(e).data('berat');
let harga = $(e).data('harga');
let nmarhun = $(e).data('nmarhun');
let hargaasas = $(e).data('hargaasas');
let nota = $(e).data('nota');
$('#idmarhun').val(idmarhun);
$('#selectmarhun').val(marhun);
$('#selectkarat').val(karat);
$('#berat_emas').val(berat);
$('#harga').val(harga);
$('#nilai_marhun').val(nmarhun);
$('#harga_asas').val(hargaasas);
$('#nota').val(nota);
}
function calc(e, type) {
if (type == 'karat') {
var karatall = $(e).data('karatall');
karatall.forEach((item) => {
if (item.karat == $(e).val()) {
var total = item.harga2 * $('#berat_emas').val();
var hargaasas = Math.round(total);
$('#harga').val(parseFloat(item.harga2).toFixed(2));
$('#nilai_marhun').val(parseFloat(total).toFixed(2));
$('#harga_asas').val(parseFloat(hargaasas).toFixed(2));
}
});
} else {
var total = $('#harga').val() * $('#berat_emas').val();
var hargaasas = Math.round(total);
$('#nilai_marhun').val(parseFloat(total).toFixed(2));
$('#harga_asas').val(parseFloat(hargaasas).toFixed(2));
}
}
function updateform() {
$("#formkemaskini").submit();
}
marhunPhotoViewerOverall.attachPhotoViewer();
marhunPhotoViewerPerMarhun.attachPhotoViewer();
</script>
@endsection