Membuat Sub Menu Data Penawaran dari Menu Tender part 4
This commit is contained in:
@@ -55,9 +55,12 @@ class TenderController extends Controller
|
||||
|
||||
$validated['nomor_registrasi'] = $penawaran->nomor_registrasi;
|
||||
|
||||
$validated['nama_kjpp_sebelumnya'] = json_encode($request->input('nama_kjpp_sebelumnya'));
|
||||
// Mengatasi null untuk nama_kjpp_sebelumnya, biaya_kjpp_sebelumnya, dan tanggal_penilaian_sebelumnya
|
||||
$validated['nama_kjpp_sebelumnya'] = json_encode($request->input('nama_kjpp_sebelumnya') ?? []);
|
||||
$validated['biaya_kjpp_sebelumnya'] = $request->input('biaya_kjpp_sebelumnya') ?? '';
|
||||
$validated['tanggal_penilaian_sebelumnya'] = $request->input('tanggal_penilaian_sebelumnya') ?? '';
|
||||
|
||||
dd($validated);
|
||||
// dd($validated);
|
||||
|
||||
PenawaranTender::create($validated);
|
||||
|
||||
@@ -77,7 +80,9 @@ class TenderController extends Controller
|
||||
public function penawaran_show($id)
|
||||
{
|
||||
$penawaran = PenawaranTender::find($id);
|
||||
return view('lpj::penawaran.show', compact('id', 'penawaran'));
|
||||
$kjpps = KJPP::find($id);
|
||||
|
||||
return view('lpj::penawaran.show', compact('id', 'penawaran', 'kjpps'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +116,7 @@ class TenderController extends Controller
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = PenawaranTender::query();
|
||||
$query = PenawaranTender::query()->where('status', '=', 'Registered');
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
|
||||
@@ -12,10 +12,10 @@ class TenderPenawaranRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'nama_kjpp_sebelumnya' => 'required|array',
|
||||
'nama_kjpp_sebelumnya' => 'nullable|array',
|
||||
'nama_kjpp_sebelumnya.*' => 'exists:kjpp,name',
|
||||
'biaya_kjpp_sebelumnya' => 'required|numeric',
|
||||
'tanggal_penilaian_sebelumnya' => 'required',
|
||||
'biaya_kjpp_sebelumnya' => 'nullable|numeric',
|
||||
'tanggal_penilaian_sebelumnya' => 'nullable',
|
||||
'nomor_registrasi' => 'required',
|
||||
'tujuan_penilaian_kjpp_id' => 'required',
|
||||
'jenis_laporan_id' => 'required',
|
||||
@@ -48,10 +48,6 @@ class TenderPenawaranRequest extends FormRequest
|
||||
'code.required' => 'Kode Penawaran Wajib diisi!',
|
||||
'code.max' => 'Kode Penawaran maksimal 255 huruf!',
|
||||
'code.unique' => 'Kode Penawaran tidak boleh sama!',
|
||||
'nama_kjpp_sebelumnya.required' => 'Nama KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.required' => 'Biaya KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.numeric' => 'Biaya KJPP Sebelumnya harus berupa angka!',
|
||||
'tanggal_penilaian_sebelumnya.required' => 'Tanggal Penilaian Sebelumnya Wajib diisi!',
|
||||
'nomor_registrasi.required' => 'Nomor Registrasi Wajib diisi!',
|
||||
'tujuan_penilaian_kjpp_id.required' => 'Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'jenis_laporan_id.required' => 'Jenis Laporan Wajib diisi!',
|
||||
@@ -70,6 +66,14 @@ class TenderPenawaranRequest extends FormRequest
|
||||
if ($endDate < $startDate) {
|
||||
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
|
||||
}
|
||||
|
||||
// Validasi minimal 3 pilihan pada nama_kjpp_sebelumnya
|
||||
$namaKjppSebelumnya = $this->input('nama_kjpp_sebelumnya', []);
|
||||
|
||||
// Abaikan jika array kosong, tetapi validasi jika terisi kurang dari 3 item
|
||||
if (!empty($namaKjppSebelumnya) && is_array($namaKjppSebelumnya) && count($namaKjppSebelumnya) < 3) {
|
||||
$validator->errors()->add('nama_kjpp_sebelumnya', 'Nama KJPP Sebelumnya harus memiliki minimal 3 pilihan jika diisi.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('penawaran', function (Blueprint $table) {
|
||||
$table->string('nama_kjpp_sebelumnya')->nullable()->change();
|
||||
$table->string('biaya_kjpp_sebelumnya')->nullable()->change();
|
||||
$table->datetime('tanggal_penilaian_sebelumnya')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('penawaran', function (Blueprint $table) {
|
||||
$table->string('nama_kjpp_sebelumnya')->change();
|
||||
$table->string('biaya_kjpp_sebelumnya')->change();
|
||||
$table->datetime('tanggal_penilaian_sebelumnya')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('penawaran', function (Blueprint $table) {
|
||||
$table->text('catatan')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('penawaran', function (Blueprint $table) {
|
||||
$table->text('catatan')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
52
module.json
52
module.json
@@ -5,9 +5,7 @@
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Lpj\\Providers\\LpjServiceProvider"
|
||||
],
|
||||
"providers": ["Modules\\Lpj\\Providers\\LpjServiceProvider"],
|
||||
"files": [],
|
||||
"menu": {
|
||||
"main": [
|
||||
@@ -18,9 +16,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Tender",
|
||||
@@ -29,9 +25,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
],
|
||||
"roles": ["administrator"],
|
||||
"sub": [
|
||||
{
|
||||
"title": "Data Penawaran",
|
||||
@@ -66,9 +60,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Data Debitur",
|
||||
@@ -77,9 +69,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Authorization",
|
||||
@@ -88,9 +78,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Registrasi",
|
||||
@@ -99,9 +87,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"Administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Assignment",
|
||||
@@ -110,9 +96,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"Administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Activity",
|
||||
@@ -121,9 +105,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"Administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
},
|
||||
{
|
||||
"title": "Laporan",
|
||||
@@ -132,9 +114,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator"
|
||||
]
|
||||
"roles": ["administrator"]
|
||||
}
|
||||
],
|
||||
"master": [
|
||||
@@ -145,9 +125,7 @@
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"Administrator"
|
||||
],
|
||||
"roles": ["administrator"],
|
||||
"sub": [
|
||||
{
|
||||
"title": "Cabang",
|
||||
@@ -197,6 +175,14 @@
|
||||
"permission": "",
|
||||
"roles": []
|
||||
},
|
||||
{
|
||||
"title": "Jenis Laporan",
|
||||
"path": "basicdata.jenis_laporan",
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": []
|
||||
},
|
||||
{
|
||||
"title": "Tujuan Penilaian",
|
||||
"path": "basicdata.tujuan-penilaian",
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" value="{{ $penawaran->nomor_registrasi ?? '-' }}" name="nomor_registrasi"
|
||||
class="flex w-full text-gray-600 font-medium text-sm" readonly>
|
||||
class="flex w-full text-gray-600 font-medium text-sm input-custom" readonly>
|
||||
@error('nomor_registrasi')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
@@ -170,8 +170,8 @@
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Status</label>
|
||||
<select id="status" class="select w-full @error('status') border-danger @enderror"
|
||||
name="status">
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select class="select w-full @error('status') border-danger @enderror" name="status">
|
||||
<option value="">Pilih Status</option>
|
||||
@if (isset($status))
|
||||
@foreach ($status as $s)
|
||||
@@ -182,6 +182,10 @@
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@error('status')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
@@ -193,3 +197,12 @@
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
input.input-custom:focus {
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@@ -90,38 +90,6 @@
|
||||
1];
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function deleteData(data) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax(`tender/penawaran/${data}`, {
|
||||
type: 'DELETE'
|
||||
}).then((response) => {
|
||||
swal.fire('Deleted!', 'User has been deleted.', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Error!', 'An error occurred while deleting the file.', 'error');
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
const element = document.querySelector('#penawaran-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
@@ -146,10 +114,26 @@
|
||||
},
|
||||
nama_kjpp_sebelumnya: {
|
||||
title: 'Nama KJPP Sebelumnya',
|
||||
render: (item, data) => {
|
||||
let nama = data.nama_kjpp_sebelumnya;
|
||||
if (typeof nama === 'string') {
|
||||
nama = JSON.parse(nama);
|
||||
}
|
||||
if (nama.length === 0) {
|
||||
return `<span class="badge badge-danger badge-xs">Tidak Ada</span>`;
|
||||
}
|
||||
return nama.map(n => `<span class="badge badge-primary badge-xs">${n}</span>`).join(' ');
|
||||
}
|
||||
},
|
||||
tanggal_penilaian_sebelumnya: {
|
||||
title: 'Tanggal Penilaian Sebelumnya',
|
||||
render: (item, data) => formatDate(new Date(data.tanggal_penilaian_sebelumnya))
|
||||
render: (item, data) => {
|
||||
const tanggal = data.tanggal_penilaian_sebelumnya;
|
||||
if (!tanggal) {
|
||||
return 'Tidak ada';
|
||||
}
|
||||
return formatDate(new Date(tanggal));
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
title: 'Action',
|
||||
|
||||
@@ -28,8 +28,60 @@
|
||||
{{ $penawaran->nomor_registrasi }}
|
||||
</p>
|
||||
</div>
|
||||
<label class="form-label max-w-56">
|
||||
No. Penawaran
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||
{{ $penawaran->code }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama KJPP Sebelumnya
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@if (isset($penawaran->nama_kjpp_sebelumnya) && !empty(json_decode($penawaran->nama_kjpp_sebelumnya, true)))
|
||||
<div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm gap-1">
|
||||
@foreach (json_decode($penawaran->nama_kjpp_sebelumnya, true) as $penawaran_code)
|
||||
@php
|
||||
$kjpp = $kjpps->firstWhere('name', $penawaran_code);
|
||||
@endphp
|
||||
@if ($kjpp)
|
||||
<div
|
||||
class="flex flex-row space-x-4 text-white font-medium text-sm badge badge-dark dark-mode:badge dark-mode:text-gray-600 badge-xs">
|
||||
{{ $kjpp->name }}
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm">
|
||||
Tidak ada
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<label class="form-label max-w-56">
|
||||
Biaya KJPP Sebelumnya
|
||||
</label>
|
||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||
@php
|
||||
function formatRupiah($number)
|
||||
{
|
||||
// Convert to float if the input is a string
|
||||
$number = (float) $number;
|
||||
|
||||
return 'Rp ' . number_format($number, 2, ',', '.');
|
||||
}
|
||||
@endphp
|
||||
@if (isset($penawaran->biaya_kjpp_sebelumnya))
|
||||
{{ formatRupiah($penawaran->biaya_kjpp_sebelumnya) }}
|
||||
@else
|
||||
{{ formatRupiah(0) }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -201,9 +201,6 @@
|
||||
],
|
||||
]);
|
||||
|
||||
Route::resource('region', RegionController::class);
|
||||
|
||||
|
||||
Route::name('teams.')->prefix('teams')->group(function () {
|
||||
Route::get('restore/{id}', [TeamsController::class, 'restore'])->name('restore');
|
||||
Route::get('datatables', [TeamsController::class, 'dataForDatatables'])->name('datatables');
|
||||
|
||||
Reference in New Issue
Block a user