perbaikan ekosisitem
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom">
|
||||
<div class="card-header border-bottom">
|
||||
<h5 class="card-title mb-0">Program Transformasi</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body border-bottom pt-4">
|
||||
<form method="GET" action="{{ route('program.index') }}" class="d-flex justify-content-between align-items-center row gap-3 gap-md-0">
|
||||
<div class="col-md-auto">
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom">
|
||||
<div class="card-header border-bottom">
|
||||
<h5 class="card-title mb-0">Kelompok Basis Data</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body border-bottom pt-4">
|
||||
<form method="GET" action="{{ route('tabel.index') }}" class="d-flex justify-content-between align-items-center row gap-3 gap-md-0">
|
||||
<div class="col-md-auto">
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
@@ -34,8 +34,21 @@
|
||||
<option value="date">Date</option>
|
||||
<option value="datetime">Datetime</option>
|
||||
<option value="text">Text</option>
|
||||
<option value="foreign_key">Relasi</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-tabel" style="display: none;">
|
||||
<label class="form-label" for="add-kolom-relasi-tabel">Tabel Relasi<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="add-kolom-relasi-tabel" name="relasi_tabel" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-kolom" style="display: none;">
|
||||
<label class="form-label" for="add-kolom-relasi-kolom-id">Kolom Relasi (ID)<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="add-kolom-relasi-kolom-id" name="relasi_kolom_id" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-kolom-label" style="display: none;">
|
||||
<label class="form-label" for="add-kolom-relasi-kolom-label">Kolom Relasi (Label)<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="add-kolom-relasi-kolom-label" name="relasi_kolom_label" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="add-kolom-validasi">Validasi<span class="text-danger">*</span></label>
|
||||
<textarea class="form-control" id="add-kolom-validasi" name="validasi" value="1" placeholder="Cth: required"></textarea>
|
||||
@@ -55,6 +68,18 @@
|
||||
width: '100%',
|
||||
});
|
||||
|
||||
$('#add-kolom-jenis_data').on('change', function() {
|
||||
if ($(this).val() === 'foreign_key') {
|
||||
$('#relasi-form-tabel').show();
|
||||
$('#relasi-form-kolom').show();
|
||||
$('#relasi-form-kolom-label').show();
|
||||
} else {
|
||||
$('#relasi-form-tabel').hide();
|
||||
$('#relasi-form-kolom').hide();
|
||||
$('#relasi-form-kolom-label').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$.validator.addMethod("snakecase", function(value, element) {
|
||||
return this.optional(element) || /^[a-z0-9]+(_[a-z0-9]+)*$/.test(value);
|
||||
}, "Gunakan format snake_case (huruf kecil dan underscore)");
|
||||
|
||||
@@ -37,8 +37,21 @@
|
||||
<option value="date">Date</option>
|
||||
<option value="datetime">Datetime</option>
|
||||
<option value="text">Text</option>
|
||||
<option value="foreign_key">Relasi</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-tabel-update" style="display: none;">
|
||||
<label class="form-label" for="update-kolom-relasi-tabel">Tabel Relasi<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="update-kolom-relasi-tabel" name="relasi_tabel" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-kolom-update" style="display: none;">
|
||||
<label class="form-label" for="update-kolom-relasi-kolom-id">Kolom Relasi (ID)<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="update-kolom-relasi-kolom-id" name="relasi_kolom_id" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation" id="relasi-form-kolom-label-update" style="display: none;">
|
||||
<label class="form-label" for="update-kolom-relasi-kolom-label">Kolom Relasi (Label)<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="update-kolom-relasi-kolom-label" name="relasi_kolom_label" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="update-kolom-validasi">Validasi<span class="text-danger">*</span></label>
|
||||
<textarea class="form-control" id="update-kolom-validasi" name="validasi" value="1" placeholder="Cth: required"></textarea>
|
||||
@@ -81,6 +94,19 @@
|
||||
$('#update-kolom-label').val(res.data.label);
|
||||
$('#update-kolom-jenis_data').val(res.data.tipe).trigger('change');
|
||||
$('#update-kolom-validasi').val(res.data.required ? 'required' : '');
|
||||
if (res.data.tipe === 'foreign_key') {
|
||||
console.log("Data relasi:", res.data);
|
||||
$('#update-kolom-relasi-tabel').val(res.data.relasi_tabel);
|
||||
$('#update-kolom-relasi-kolom-id').val(res.data.relasi_kolom_id);
|
||||
$('#update-kolom-relasi-kolom-label').val(res.data.relasi_kolom_label);
|
||||
$('#relasi-form-tabel-update').show();
|
||||
$('#relasi-form-kolom-update').show();
|
||||
$('#relasi-form-kolom-label-update').show();
|
||||
} else {
|
||||
$('#relasi-form-tabel-update').hide();
|
||||
$('#relasi-form-kolom-update').hide();
|
||||
$('#relasi-form-kolom-label-update').hide();
|
||||
}
|
||||
offcanvasUpdate.show();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,13 +32,21 @@
|
||||
<input type="date" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) }}" />
|
||||
@elseif($k->tipe == 'datetime')
|
||||
<input type="datetime" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
<input type="datetime-local" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) }}" />
|
||||
@elseif($k->tipe == 'boolean')
|
||||
<select class="form-select tipe-boolean @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
<option value="1" {{ old($k->kolom) == 1 ? 'selected' : '' }}>Ya</option>
|
||||
<option value="0" {{ old($k->kolom) == 0 ? 'selected' : '' }}>Tidak</option>
|
||||
</select>
|
||||
@elseif($k->tipe == 'foreign_key')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@if ($list_relasi->where('kolom_id', $k->id)->first() != null)
|
||||
@foreach($list_relasi->where('kolom_id', $k->id)->first()['options'] as $opsi_relasi)
|
||||
<option value="{{ $opsi_relasi->value }}" {{ old($k->kolom) == $opsi_relasi->value ? 'selected' : '' }}>{{ $opsi_relasi->label }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@else
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) }}" />
|
||||
@@ -63,7 +71,7 @@
|
||||
<script>
|
||||
'use strict';
|
||||
$(document).ready(function () {
|
||||
$('#add-data-program,.tipe-boolean').select2();
|
||||
$('#add-data-program,.tipe-boolean, .tipe-fk').select2();
|
||||
|
||||
$('#addNewDataForm').validate({
|
||||
rules: {
|
||||
|
||||
@@ -49,13 +49,21 @@
|
||||
<input type="date" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@elseif($k->tipe == 'datetime')
|
||||
<input type="datetime" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
<input type="datetime-local" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@elseif($k->tipe == 'boolean')
|
||||
<select class="form-select @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
<select class="form-select tipe-boolean @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
<option value="1" {{ (old($k->kolom) ?? ($value['value_'.$k->tipe] ?? null)) == 1 ? 'selected' : '' }}>Ya</option>
|
||||
<option value="0" {{ (old($k->kolom) ?? ($value['value_'.$k->tipe] ?? null)) == 0 ? 'selected' : '' }}>Tidak</option>
|
||||
</select>
|
||||
@elseif($k->tipe == 'foreign_key')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@if ($list_relasi->where('kolom_id', $k->id)->first() != null)
|
||||
@foreach($list_relasi->where('kolom_id', $k->id)->first()['options'] as $opsi_relasi)
|
||||
<option value="{{ $opsi_relasi->value }}" {{ old($k->kolom) ?? $value['value_'.$k->tipe] == $opsi_relasi->value ? 'selected' : '' }}>{{ $opsi_relasi->label }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@else
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@@ -80,6 +88,7 @@
|
||||
<script>
|
||||
'use strict';
|
||||
$(document).ready(function () {
|
||||
$('#add-data-program,.tipe-boolean, .tipe-fk').select2();
|
||||
|
||||
$('#addNewDataForm').validate({
|
||||
rules: {
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom">
|
||||
<div class="card-header border-bottom">
|
||||
<h5 class="card-title mb-0">Kerangka Kerja Transformasi</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body border-bottom pt-4">
|
||||
<form method="GET" action="{{ route('tabel.index') }}" class="d-flex justify-content-between align-items-center row gap-3 gap-md-0">
|
||||
<div class="col-md-auto">
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-header border-bottom mb-4">
|
||||
<h5 class="card-title mb-0">Edit Kerangka Kerja</h5>
|
||||
<h5 class="card-title mb-0">Lihat Kerangka Kerja</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@@ -57,8 +57,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($framework->transformasi as $transformasi)
|
||||
@foreach($transformasi->aktivitas as $aktivitas)
|
||||
@foreach($aktivitas->target as $target)
|
||||
@forelse($transformasi->aktivitas as $aktivitas)
|
||||
@forelse($aktivitas->target as $target)
|
||||
<tr>
|
||||
<td><span class="text-heading">{{ $transformasi->kode }} {{ $transformasi->nama }}</span></td>
|
||||
<td><span class="{{ $aktivitas->jenis_aktivitas == 'tujuan' ? 'text-heading' : 'text-muted' }}">{{ $aktivitas->nama }}</span></td>
|
||||
@@ -103,13 +103,66 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@empty
|
||||
<tr>
|
||||
<td><span class="text-heading">{{ $transformasi->kode }} {{ $transformasi->nama }}</span></td>
|
||||
<td><span class="{{ $aktivitas->jenis_aktivitas == 'tujuan' ? 'text-heading' : 'text-muted' }}">{{ $aktivitas->nama }}</span></td>
|
||||
<td><span class="text-muted">{{ $aktivitas->deskripsi }}</span></td>
|
||||
<td><span class="text-muted">{{ $aktivitas->indikator }}</span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
|
||||
<i class="icon-base ti tabler-dots-vertical"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item edit-transformasi" href="javascript:void(0);" data-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-edit me-1"></i> Edit Transformasi</a>
|
||||
<a class="dropdown-item delete-transformasi" href="javascript:void(0);" data-id="{{ $transformasi->id }}" data-nama="{{ $transformasi->nama }}"><i class="icon-base ti tabler-trash me-1"></i> Hapus Transformasi</a>
|
||||
<hr/>
|
||||
<a class="dropdown-item add-aktivitas" href="javascript:void(0);" data-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-plus me-1"></i> Tambah Tujuan/Aktivitas</a>
|
||||
<a class="dropdown-item edit-aktivitas" href="javascript:void(0);" data-id="{{ $aktivitas->id }}" data-transformasi-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-edit me-1"></i> Edit Tujuan/Aktivitas</a>
|
||||
<a class="dropdown-item delete-aktivitas" href="javascript:void(0);" data-id="{{ $aktivitas->id }}" data-transformasi-id="{{ $transformasi->id }}" data-nama="{{ $aktivitas->nama }}"><i class="icon-base ti tabler-trash me-1"></i> Hapus Tujuan/Aktivitas</a>
|
||||
<hr/>
|
||||
<a class="dropdown-item add-target" href="javascript:void(0);" data-id="{{ $aktivitas->id }}" data-transformasi-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-plus me-1"></i> Tambah Target</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
<!-- endforelse target -->
|
||||
@empty
|
||||
<tr>
|
||||
<td><span class="text-heading">{{ $transformasi->kode }} {{ $transformasi->nama }}</span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
|
||||
<i class="icon-base ti tabler-dots-vertical"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item edit-transformasi" href="javascript:void(0);" data-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-edit me-1"></i> Edit Transformasi</a>
|
||||
<a class="dropdown-item delete-transformasi" href="javascript:void(0);" data-id="{{ $transformasi->id }}" data-nama="{{ $transformasi->nama }}"><i class="icon-base ti tabler-trash me-1"></i> Hapus Transformasi</a>
|
||||
<hr/>
|
||||
<a class="dropdown-item add-aktivitas" href="javascript:void(0);" data-id="{{ $transformasi->id }}"><i class="icon-base ti tabler-plus me-1"></i> Tambah Tujuan/Aktivitas</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
<!-- endforelse aktivitas -->
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="text-center py-4">Tidak ada data ditemukan.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
<!-- endforelse tranformasi -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user