form tabel
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasAddColumn"
|
||||
aria-labelledby="offcanvasAddColumnLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasAddColumnLabel" class="offcanvas-title">Tambah Kolom</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="add-new-column pt-0" id="addColumnForm" action="{{ route('tabel.formulir.store', $tabel->id) }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" id="add-column-tipe" name="tipe" value="form-column" />
|
||||
<input type="hidden" id="add-column-parent" name="parent_id" value="" />
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="add-column-width">Lebar Kolom (1-12)</label>
|
||||
<input type="number" min="1" max="12" step="1" value="3"
|
||||
class="form-control" id="add-column-width" name="column_width" placeholder="Cth: 3" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasAddColumn = new bootstrap.Offcanvas(document.getElementById('offcanvasAddColumn'));
|
||||
$('#addColumnForm').validate({
|
||||
rules: {
|
||||
column_width: { required: true, number: true },
|
||||
},
|
||||
messages: {
|
||||
column_width: { required: "Lebar kolom wajib diisi" },
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
url: $(form).attr('action'),
|
||||
type: 'POST',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasAddColumn.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-column').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#add-column-parent').val($(this).data('parent'));
|
||||
offcanvasAddColumn.show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,27 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
function addForm(tipe) {
|
||||
$.ajax({
|
||||
url: '{{ route('tabel.formulir.store', [$tabel->id]) }}',
|
||||
type: 'POST',
|
||||
data: {
|
||||
tipe: tipe,
|
||||
_token: '{{ csrf_token() }}',
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".add-hr-line").click(function (e) {
|
||||
e.preventDefault();
|
||||
addForm('form-hr-line');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,27 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
function addForm(tipe) {
|
||||
$.ajax({
|
||||
url: '{{ route('tabel.formulir.store', [$tabel->id]) }}',
|
||||
type: 'POST',
|
||||
data: {
|
||||
tipe: tipe,
|
||||
_token: '{{ csrf_token() }}',
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".add-row").click(function (e) {
|
||||
e.preventDefault();
|
||||
addForm('form-row');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,77 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasAddSection"
|
||||
aria-labelledby="offcanvasAddSectionLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasAddSectionLabel" class="offcanvas-title">Tambah Section</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="add-new-section pt-0" id="addSectionForm" action="{{ route('tabel.formulir.store', $tabel->id) }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" id="add-section-tipe" name="tipe" value="form-section" />
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="add-section-label">Label Section</label>
|
||||
<input type="text" class="form-control" id="add-section-label" name="section_label" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasAddSection = new bootstrap.Offcanvas(document.getElementById('offcanvasAddSection'));
|
||||
$('#addSectionForm').validate({
|
||||
rules: {
|
||||
section_label: { required: true }
|
||||
},
|
||||
messages: {
|
||||
section_label: { required: "Label wajib diisi" }
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
url: $(form).attr('action'),
|
||||
type: 'POST',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasAddSection.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-section').click(function(e) {
|
||||
e.preventDefault();
|
||||
offcanvasAddSection.show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,85 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasAddValue"
|
||||
aria-labelledby="offcanvasAddValueLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasAddValueLabel" class="offcanvas-title">Tambah Formulir Nilai</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="add-new-value pt-0" id="addValueForm" action="{{ route('tabel.formulir.store', $tabel->id) }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" id="add-value-tipe" name="tipe" value="form-value" />
|
||||
<input type="hidden" id="add-value-parent" name="parent_id" value="" />
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="add-value-kolom">Kolom</label>
|
||||
<select class="form-select" id="add-value-kolom" name="kolom_id">
|
||||
<option value="">Pilih Kolom</option>
|
||||
@foreach ($tabel->kolom as $kolom)
|
||||
<option value="{{ $kolom->id }}">{{ $kolom->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasAddValue = new bootstrap.Offcanvas(document.getElementById('offcanvasAddValue'));
|
||||
$('#addValueForm').validate({
|
||||
rules: {
|
||||
kolom_id: { required: true },
|
||||
},
|
||||
messages: {
|
||||
kolom_id: { required: "Kolom wajib dipilih" },
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
url: $(form).attr('action'),
|
||||
type: 'POST',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasAddValue.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-value').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#add-value-parent').val($(this).data('parent'));
|
||||
offcanvasAddValue.show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,94 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasEditColumn"
|
||||
aria-labelledby="offcanvasEditColumnLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasEditColumnLabel" class="offcanvas-title">Edit Kolom</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="pt-0" id="editColumnForm" action="{{ route('tabel.formulir.update', [$tabel->id, ':id']) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<input type="hidden" id="edit-column-id" name="id" />
|
||||
<input type="hidden" id="edit-column-tipe" name="tipe" value="form-column" />
|
||||
<input type="hidden" id="edit-column-parent" name="parent_id" value="" />
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="edit-column-width">Lebar Kolom (1-12)</label>
|
||||
<input type="number" min="1" max="12" step="1" value="3"
|
||||
class="form-control" id="edit-column-width" name="column_width" placeholder="Cth: 3" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasEditColumn = new bootstrap.Offcanvas(document.getElementById('offcanvasEditColumn'));
|
||||
$('.edit-column').click(function(e) {
|
||||
console.log('edit column');
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
$.get("{{ route('tabel.formulir.show', [$tabel->id, ':id']) }}".replace(':id', id), function (res) {
|
||||
if (res.status !== 'success') {
|
||||
return;
|
||||
}
|
||||
$('#edit-column-id').val(res.data.id);
|
||||
$('#edit-column-parent').val(res.data.parent_id);
|
||||
$('#edit-column-width').val(res.data.column_width);
|
||||
offcanvasEditColumn.show();
|
||||
}).fail(function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
});
|
||||
});
|
||||
$('#editColumnForm').validate({
|
||||
rules: {
|
||||
column_width: { required: true, number: true },
|
||||
},
|
||||
messages: {
|
||||
column_width: { required: "Lebar kolom wajib diisi" },
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
console.log($('#edit-column-id').val());
|
||||
$.ajax({
|
||||
url: $(form).attr('action').replace(':id', $('#edit-column-id').val()),
|
||||
type: 'PUT',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasEditColumn.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,89 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasEditSection"
|
||||
aria-labelledby="offcanvasEditSectionLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasEditSectionLabel" class="offcanvas-title">Edit Section</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="pt-0" id="editSectionForm" action="{{ route('tabel.formulir.update', [$tabel->id, ':id']) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<input type="hidden" id="edit-section-id" name="id" />
|
||||
<input type="hidden" id="edit-section-tipe" name="tipe" value="form-section" />
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="edit-section-label">Label Section</label>
|
||||
<input type="text" class="form-control" id="edit-section-label" name="section_label" placeholder="Cth: Nama Petani" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasEditSection = new bootstrap.Offcanvas(document.getElementById('offcanvasEditSection'));
|
||||
$('.edit-section').click(function(e) {
|
||||
console.log('edit section');
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
$.get("{{ route('tabel.formulir.show', [$tabel->id, ':id']) }}".replace(':id', id), function (res) {
|
||||
if (res.status !== 'success') {
|
||||
return;
|
||||
}
|
||||
$('#edit-section-id').val(res.data.id);
|
||||
$('#edit-section-label').val(res.data.section_label);
|
||||
offcanvasEditSection.show();
|
||||
}).fail(function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
});
|
||||
});
|
||||
$('#editSectionForm').validate({
|
||||
rules: {
|
||||
section_label: { required: true }
|
||||
},
|
||||
messages: {
|
||||
section_label: { required: "Label wajib diisi" }
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
url: $(form).attr('action').replace(':id', $('#edit-section-id').val()),
|
||||
type: 'PUT',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasEditSection.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,97 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasEditValue"
|
||||
aria-labelledby="offcanvasEditValueLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasEditValueLabel" class="offcanvas-title">Edit Formulir Nilai</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="pt-0" id="editValueForm" action="{{ route('tabel.formulir.update', [$tabel->id, ':id']) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<input type="hidden" id="edit-value-id" name="id" />
|
||||
<input type="hidden" id="edit-value-tipe" name="tipe" value="form-value" />
|
||||
<input type="hidden" id="edit-value-parent" name="parent_id" value="" />
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="edit-value-kolom">Kolom</label>
|
||||
<select class="form-select" id="edit-value-kolom" name="kolom_id">
|
||||
<option value="">Pilih Kolom</option>
|
||||
@foreach ($tabel->kolom as $kolom)
|
||||
<option value="{{ $kolom->id }}">{{ $kolom->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasEditValue = new bootstrap.Offcanvas(document.getElementById('offcanvasEditValue'));
|
||||
$('.edit-value').click(function(e) {
|
||||
console.log('edit value');
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
$.get("{{ route('tabel.formulir.show', [$tabel->id, ':id']) }}".replace(':id', id), function (res) {
|
||||
if (res.status !== 'success') {
|
||||
return;
|
||||
}
|
||||
$('#edit-value-id').val(res.data.id);
|
||||
$('#edit-value-parent').val(res.data.parent_id);
|
||||
$('#edit-value-kolom').val(res.data.kolom_id);
|
||||
offcanvasEditValue.show();
|
||||
}).fail(function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
});
|
||||
});
|
||||
$('#editValueForm').validate({
|
||||
rules: {
|
||||
kolom_id: { required: true },
|
||||
},
|
||||
messages: {
|
||||
kolom_id: { required: "Kolom wajib dipilih" },
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
url: $(form).attr('action').replace(':id', $('#edit-value-id').val()),
|
||||
type: 'PUT',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasEditValue.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,283 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-header border-bottom d-flex justify-content-between align-items-center">
|
||||
<h5 class="card-title mb-0">Formulir untuk Tabel Basis Data Ekosistem: {{ $tabel->label }}</h5>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<form action="{{ route('tabel.formulir.generate', $tabel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm btn-label-primary" type="submit">
|
||||
<i class="ti tabler-automation me-1"></i> Generate Formulir
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="nav-align-top pt-4">
|
||||
<ul class="nav nav-pills" role="tablist">
|
||||
<li class="nav-item">
|
||||
<button
|
||||
type="button"
|
||||
class="nav-link active"
|
||||
role="tab"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#navs-pills-form"
|
||||
aria-controls="navs-pills-form"
|
||||
aria-selected="true">
|
||||
<i class="ti tabler-forms me-1"></i> Rancangan
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button
|
||||
type="button"
|
||||
class="nav-link"
|
||||
role="tab"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#navs-pills-preview"
|
||||
aria-controls="navs-pills-preview"
|
||||
aria-selected="false">
|
||||
<i class="ti tabler-eye me-1"></i> Pratinjau
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-content p-0">
|
||||
<div class="tab-pane fade show active" id="navs-pills-form" role="tabpanel">
|
||||
<div class="row pt-4">
|
||||
<div class="col-6 mb-4">
|
||||
<h6>Rancangan Form</h6>
|
||||
<ul class="list-group list-group-flush" id="list-form">
|
||||
<li class="list-group-item drag-item cursor-move ">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="lead"><strong>Formulir: {{ $tabel->label }}</strong></span>
|
||||
<div class="align-text-bottom">
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill add-row"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Tambah Baris">
|
||||
<i class="ti tabler-row-insert-bottom ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill add-section"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Tambah Section">
|
||||
<i class="ti tabler-new-section ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill add-hr-line"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Tambah Garis Pembatas">
|
||||
<i class="ti tabler-separator ti-md"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@foreach($tabel->form as $form)
|
||||
<li class="list-group-item drag-item cursor-move pl-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span>{{ $form->tipe->label() }}
|
||||
@if($form->tipe->value == 'form-section')
|
||||
: {{ $form->section_label }}
|
||||
@endif
|
||||
</span>
|
||||
<div class="align-text-bottom">
|
||||
@if (!$loop->first)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-up"
|
||||
data-id="{{ $form->id }}" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Pindah ke Urutan Sebelumnya">
|
||||
<i class="ti tabler-arrow-up"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if (!$loop->last)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-down"
|
||||
data-id="{{ $form->id }}" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Pindah ke Urutan Selanjutnya">
|
||||
<i class="ti tabler-arrow-down"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($form->tipe->value == 'form-row')
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill add-column"
|
||||
data-parent="{{ $form->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Tambah Kolom">
|
||||
<i class="ti tabler-column-insert-right ti-md"></i></a>
|
||||
@elseif($form->tipe->value == 'form-section')
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill edit-section" data-id="{{ $form->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Edit Section">
|
||||
<i class="ti tabler-section ti-md"></i></a>
|
||||
@endif
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-danger rounded-pill delete-record"
|
||||
data-id="{{ $form->id }}" data-nama="{{ $form->tipe->label() }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Hapus">
|
||||
<i class="ti tabler-trash ti-md"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
@if($form->tipe->value == 'form-row')
|
||||
<ul class="list-group list-group-flush nested-list">
|
||||
@foreach($form->form as $childForm)
|
||||
<li class="list-group-item drag-item cursor-move">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span>{{ $childForm->tipe->label() }}
|
||||
@if($childForm->tipe->value == 'form-column')
|
||||
: col-{{ $childForm->column_width }}
|
||||
@endif
|
||||
</span>
|
||||
<div class="align-text-bottom">
|
||||
@if (!$loop->first)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-up"
|
||||
data-id="{{ $childForm->id }}" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Pindah ke Urutan Sebelumnya">
|
||||
<i class="ti tabler-arrow-up"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if (!$loop->last)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-down"
|
||||
data-id="{{ $childForm->id }}" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Pindah ke Urutan Selanjutnya">
|
||||
<i class="ti tabler-arrow-down"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($childForm->tipe->value == 'form-column')
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill edit-column"
|
||||
data-parent="{{ $form->id }}" data-id="{{ $childForm->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Edit Kolom">
|
||||
<i class="ti tabler-columns ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill move-column"
|
||||
data-parent="{{ $form->id }}" data-id="{{ $childForm->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Pindah Kolom ke Row Berbeda">
|
||||
<i class="ti tabler-transition-top ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill add-value"
|
||||
data-parent="{{ $childForm->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Tambah Form Nilai">
|
||||
<i class="ti tabler-file-plus ti-md"></i></a>
|
||||
@endif
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-danger rounded-pill delete-record"
|
||||
data-id="{{ $childForm->id }}" data-nama="{{ $childForm->tipe->label() }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Hapus">
|
||||
<i class="ti tabler-trash ti-md"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
@if($childForm->tipe->value == 'form-column')
|
||||
<ul class="list-group list-group-flush nested-list">
|
||||
@foreach($childForm->form as $grandchildForm)
|
||||
<li class="list-group-item drag-item cursor-move">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span>{{ $grandchildForm->tipe->label() }}
|
||||
@if($grandchildForm->tipe->value == 'form-value')
|
||||
: {{ $grandchildForm->kolom->label }}
|
||||
@endif
|
||||
</span>
|
||||
<div class="align-text-bottom">
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-primary rounded-pill edit-value"
|
||||
data-parent="{{ $childForm->id }}" data-id="{{ $grandchildForm->id }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Edit Form Nilai">
|
||||
<i class="ti tabler-file-text ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-danger rounded-pill delete-record"
|
||||
data-id="{{ $grandchildForm->id }}" data-nama="{{ $grandchildForm->tipe->label() }}"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Hapus">
|
||||
<i class="ti tabler-trash ti-md"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="navs-pills-preview" role="tabpanel">
|
||||
<div class="row pt-4">
|
||||
<div class="col-12 mb-4">
|
||||
<h6>Pratinjau Formulir</h6>
|
||||
{!! $tabel->renderHtml('preview') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.show', $tabel->id) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('ekosistem.form-basis-data.add-row')
|
||||
@include('ekosistem.form-basis-data.add-section')
|
||||
@include('ekosistem.form-basis-data.edit-section')
|
||||
@include('ekosistem.form-basis-data.add-hr-line')
|
||||
@include('ekosistem.form-basis-data.add-column')
|
||||
@include('ekosistem.form-basis-data.edit-column')
|
||||
@include('ekosistem.form-basis-data.move-column')
|
||||
@include('ekosistem.form-basis-data.add-value')
|
||||
@include('ekosistem.form-basis-data.edit-value')
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.7/Sortable.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".move-up").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.formulir.move-up', [$tabel->id, ':id']) }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".move-down").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.formulir.move-down', [$tabel->id, ':id']) }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".delete-record").click(function (e) {
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
const name = $(this).data('nama');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Hapus?',
|
||||
text: `Form ${name} akan dihapus!`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
customClass: { confirmButton: 'btn btn-danger me-3', cancelButton: 'btn btn-label-secondary' },
|
||||
buttonsStyling: false
|
||||
}).then(function (result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: "{{ route('tabel.formulir.destroy', [$tabel->id, ':id']) }}".replace(':id', id),
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Terhapus!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => location.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,98 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasMoveColumn"
|
||||
aria-labelledby="offcanvasMoveColumnLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasMoveColumnLabel" class="offcanvas-title">Edit Kolom</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="pt-0" id="moveColumnForm" action="{{ route('tabel.formulir.update', [$tabel->id, ':id']) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<input type="hidden" id="move-column-id" name="id" />
|
||||
<input type="hidden" id="move-column-tipe" name="tipe" value="form-column" />
|
||||
<input type="hidden" id="move-column-width" name="column_width" value="" />
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="move-column-parent">Row Induk</label>
|
||||
<select class="form-select" id="move-column-parent" name="parent_id">
|
||||
<option value="">Pilih Row Induk</option>
|
||||
@foreach ($tabel->form->where('tipe', \App\Enums\LayoutForm::ROW) as $row)
|
||||
<option value="{{ $row->id }}">Row: {{ $row->urutan }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success me-3 data-submit">Simpan</button>
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Batal</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
const offcanvasMoveColumn = new bootstrap.Offcanvas(document.getElementById('offcanvasMoveColumn'));
|
||||
$('.move-column').click(function(e) {
|
||||
console.log('move column');
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
$.get("{{ route('tabel.formulir.show', [$tabel->id, ':id']) }}".replace(':id', id), function (res) {
|
||||
if (res.status !== 'success') {
|
||||
return;
|
||||
}
|
||||
$('#move-column-id').val(res.data.id);
|
||||
$('#move-column-parent').val(res.data.parent_id);
|
||||
$('#move-column-width').val(res.data.column_width);
|
||||
offcanvasMoveColumn.show();
|
||||
}).fail(function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
});
|
||||
});
|
||||
$('#moveColumnForm').validate({
|
||||
rules: {
|
||||
parent_id: { required: true },
|
||||
},
|
||||
messages: {
|
||||
parent_id: { required: "Row induk wajib diisi" },
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
console.log($('#move-column-id').val());
|
||||
$.ajax({
|
||||
url: $(form).attr('action').replace(':id', $('#move-column-id').val()),
|
||||
type: 'PUT',
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
offcanvasMoveColumn.hide();
|
||||
form.reset();
|
||||
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
},
|
||||
error: function (xhr) {
|
||||
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -159,6 +159,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h6 class="mb-3">Informasi Formulir Tabel</h6>
|
||||
|
||||
<hr class="my-4 mx-n4" />
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-auto d-flex gap-2">
|
||||
<a href="{{ route('tabel.formulir.index', ['tabel' => $tabel->id]) }}" class="btn btn-sm btn-primary" >
|
||||
<i class="ti tabler-edit me-1"></i> Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
<h6>Pratinjau Formulir</h6>
|
||||
{!! $tabel->renderHtml('preview') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.index') }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@section('content')
|
||||
<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">Tambah Data {{ $tabel->label }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form id="addNewDataForm" action="{{ route('tabel.data.store', [$tabel->id, 'program_id' => $program->id]) }}" method="POST" >
|
||||
@csrf
|
||||
|
||||
<h6 class="mb-3">Informasi {{ $tabel->label }}</h6>
|
||||
<div class="row">
|
||||
@foreach($kolom as $k)
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-{{ $k->kolom }}">{{ $k->label }}<span class="text-danger">*</span></label>
|
||||
@if($k->tipe == 'varchar')
|
||||
<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) }}" />
|
||||
@elseif($k->tipe == 'text')
|
||||
<textarea class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}">{{ old($k->kolom) }}</textarea>
|
||||
@elseif($k->tipe == 'integer')
|
||||
<input type="number" 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) }}" step="1" />
|
||||
@elseif($k->tipe == 'float')
|
||||
<input type="number" 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) }}" step="any" />
|
||||
@elseif($k->tipe == 'date')
|
||||
<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-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>
|
||||
@elseif($k->tipe == 'enum')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@foreach($k->enum_opsi as $opsi)
|
||||
<option value="{{ $opsi['value'] }}" {{ old($k->kolom) == $opsi['value'] ? 'selected' : '' }}>{{ $opsi['label'] }}</option>
|
||||
@endforeach
|
||||
</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) }}" />
|
||||
@endif
|
||||
@error($k->kolom)<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.data.index', [$tabel->id, 'program_id' => $program->id]) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
<button type="submit" class="btn btn-success data-submit">Simpan Data</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
'use strict';
|
||||
$(document).ready(function () {
|
||||
$('#add-data-program,.tipe-boolean, .tipe-fk').select2();
|
||||
|
||||
$('#addNewDataForm').validate({
|
||||
rules: {
|
||||
tabel: { required: true, snakecase: true },
|
||||
label: { required: true },
|
||||
menu: { required: true }
|
||||
},
|
||||
messages: {
|
||||
tabel: { required: "Nama tabel wajib diisi", snakecase: "Gunakan format snake_case (huruf kecil dan underscore)" },
|
||||
label: { required: "Label wajib diisi" },
|
||||
menu: { required: "Judul menu wajib diisi" }
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -10,58 +10,8 @@
|
||||
<div class="card-body">
|
||||
<form id="addNewDataForm" action="{{ route('tabel.data.store', [$tabel->id, 'program_id' => $program->id]) }}" method="POST" >
|
||||
@csrf
|
||||
|
||||
<h6 class="mb-3">Informasi {{ $tabel->label }}</h6>
|
||||
<div class="row">
|
||||
@foreach($kolom as $k)
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-{{ $k->kolom }}">{{ $k->label }}<span class="text-danger">*</span></label>
|
||||
@if($k->tipe == 'varchar')
|
||||
<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) }}" />
|
||||
@elseif($k->tipe == 'text')
|
||||
<textarea class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}">{{ old($k->kolom) }}</textarea>
|
||||
@elseif($k->tipe == 'integer')
|
||||
<input type="number" 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) }}" step="1" />
|
||||
@elseif($k->tipe == 'float')
|
||||
<input type="number" 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) }}" step="any" />
|
||||
@elseif($k->tipe == 'date')
|
||||
<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-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>
|
||||
@elseif($k->tipe == 'enum')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@foreach($k->enum_opsi as $opsi)
|
||||
<option value="{{ $opsi['value'] }}" {{ old($k->kolom) == $opsi['value'] ? 'selected' : '' }}>{{ $opsi['label'] }}</option>
|
||||
@endforeach
|
||||
</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) }}" />
|
||||
@endif
|
||||
@error($k->kolom)<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
{!! $tabel->renderHtml('add', $errors, $list_relasi) !!}
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.data.index', [$tabel->id, 'program_id' => $program->id]) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@section('content')
|
||||
<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">Tambah Data {{ $tabel->label }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form id="addUpdateDataForm" action="{{ route('tabel.data.update', [$tabel->id, $value_id, 'program_id' => $program->id]) }}" method="POST" >
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<h6 class="mb-3">Informasi {{ $tabel->label }}</h6>
|
||||
@if (!$program)
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-program">Program<span class="text-danger">*</span></label>
|
||||
<select name="program_id" class="form-select form-select-sm w-auto" onchange="this.form.submit()">
|
||||
<option value="">Pilih Program</option>
|
||||
@foreach($programList as $prog)
|
||||
<option value="{{ $prog->id }}" {{ request('program_id') == $prog->id ? 'selected' : '' }}>{{ $prog->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
@foreach($kolom as $k)
|
||||
<?php
|
||||
$value = $values->where('kolom_id', $k->id)->first();
|
||||
?>
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-{{ $k->kolom }}">{{ $k->label }}<span class="text-danger">*</span></label>
|
||||
@if($k->tipe == 'varchar')
|
||||
<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] }}" />
|
||||
@elseif($k->tipe == 'text')
|
||||
<textarea class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}">{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}</textarea>
|
||||
@elseif($k->tipe == 'integer')
|
||||
<input type="number" 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] }}" step="1" />
|
||||
@elseif($k->tipe == 'float')
|
||||
<input type="number" 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] }}" step="any" />
|
||||
@elseif($k->tipe == 'date')
|
||||
<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-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 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>
|
||||
@elseif($k->tipe == 'enum')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@foreach($k->enum_opsi as $opsi)
|
||||
<option value="{{ $opsi['value'] }}" {{ old($k->kolom) ?? $value['value_'.$k->tipe] == $opsi['value'] ? 'selected' : '' }}>{{ $opsi['label'] }}</option>
|
||||
@endforeach
|
||||
</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] }}" />
|
||||
@endif
|
||||
@error($k->kolom)<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.data.index', [$tabel->id, 'program_id' => $program->id]) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
<button type="submit" class="btn btn-success data-submit">Simpan Data</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
'use strict';
|
||||
$(document).ready(function () {
|
||||
$('#add-data-program,.tipe-boolean, .tipe-fk').select2();
|
||||
|
||||
$('#addNewDataForm').validate({
|
||||
rules: {
|
||||
tabel: { required: true, snakecase: true },
|
||||
label: { required: true },
|
||||
menu: { required: true }
|
||||
},
|
||||
messages: {
|
||||
tabel: { required: "Nama tabel wajib diisi", snakecase: "Gunakan format snake_case (huruf kecil dan underscore)" },
|
||||
label: { required: "Label wajib diisi" },
|
||||
menu: { required: "Judul menu wajib diisi" }
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function (error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
element.closest('.mb-6, .form-control-validation').append(error);
|
||||
},
|
||||
highlight: function (element) {
|
||||
$(element).addClass('is-invalid');
|
||||
},
|
||||
unhighlight: function (element) {
|
||||
$(element).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -10,76 +10,10 @@
|
||||
<div class="card-body">
|
||||
<form id="addUpdateDataForm" action="{{ route('tabel.data.update', [$tabel->id, $value_id, 'program_id' => $program->id]) }}" method="POST" >
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@method('PUT')
|
||||
|
||||
<h6 class="mb-3">Informasi {{ $tabel->label }}</h6>
|
||||
@if (!$program)
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-program">Program<span class="text-danger">*</span></label>
|
||||
<select name="program_id" class="form-select form-select-sm w-auto" onchange="this.form.submit()">
|
||||
<option value="">Pilih Program</option>
|
||||
@foreach($programList as $prog)
|
||||
<option value="{{ $prog->id }}" {{ request('program_id') == $prog->id ? 'selected' : '' }}>{{ $prog->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
@foreach($kolom as $k)
|
||||
<?php
|
||||
$value = $values->where('kolom_id', $k->id)->first();
|
||||
?>
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-{{ $k->kolom }}">{{ $k->label }}<span class="text-danger">*</span></label>
|
||||
@if($k->tipe == 'varchar')
|
||||
<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] }}" />
|
||||
@elseif($k->tipe == 'text')
|
||||
<textarea class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}"
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}">{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}</textarea>
|
||||
@elseif($k->tipe == 'integer')
|
||||
<input type="number" 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] }}" step="1" />
|
||||
@elseif($k->tipe == 'float')
|
||||
<input type="number" 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] }}" step="any" />
|
||||
@elseif($k->tipe == 'date')
|
||||
<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-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 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>
|
||||
@elseif($k->tipe == 'enum')
|
||||
<select class="form-select tipe-fk @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" name="{{ $k->kolom }}">
|
||||
@foreach($k->enum_opsi as $opsi)
|
||||
<option value="{{ $opsi['value'] }}" {{ old($k->kolom) ?? $value['value_'.$k->tipe] == $opsi['value'] ? 'selected' : '' }}>{{ $opsi['label'] }}</option>
|
||||
@endforeach
|
||||
</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] }}" />
|
||||
@endif
|
||||
@error($k->kolom)<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
{!! $tabel->renderHtml('edit', $errors, $list_relasi, $values) !!}
|
||||
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.data.index', [$tabel->id, 'program_id' => $program->id]) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
<button type="submit" class="btn btn-success data-submit">Simpan Data</button>
|
||||
|
||||
@@ -12,63 +12,7 @@
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<h6 class="mb-3">Informasi {{ $tabel->label }}</h6>
|
||||
@if (!$program)
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-program">Program<span class="text-danger">*</span></label>
|
||||
<select name="program_id" class="form-select form-select-sm w-auto" onchange="this.form.submit()">
|
||||
<option value="">Pilih Program</option>
|
||||
@foreach($programList as $prog)
|
||||
<option value="{{ $prog->id }}" {{ request('program_id') == $prog->id ? 'selected' : '' }}>{{ $prog->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
@foreach($kolom as $k)
|
||||
<?php
|
||||
$value = $values->where('kolom_id', $k->id)->first();
|
||||
?>
|
||||
<div class="col-md-3 mb-4 form-control-validation">
|
||||
<label class="form-label" for="add-data-{{ $k->kolom }}">{{ $k->label }}<span class="text-danger">*</span></label>
|
||||
@if($k->tipe == 'varchar')
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@elseif($k->tipe == 'text')
|
||||
<textarea class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}">{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}</textarea>
|
||||
@elseif($k->tipe == 'integer')
|
||||
<input type="number" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" step="1" />
|
||||
@elseif($k->tipe == 'float')
|
||||
<input type="number" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" step="any" />
|
||||
@elseif($k->tipe == 'date')
|
||||
<input type="date" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@elseif($k->tipe == 'datetime')
|
||||
<input type="datetime-local" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@elseif($k->tipe == 'boolean')
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ (old($k->kolom) ?? $value['value_'.$k->tipe]) == 1 ? 'Ya' : 'Tidak' }}" />
|
||||
@elseif($k->tipe == 'foreign_key')
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ (old($k->kolom) ?? $value['value_relasi_label']) }}" />
|
||||
@elseif($k->tipe == 'enum')
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ (old($k->kolom) ?? $value['value_enum_label']) }}" />
|
||||
@else
|
||||
<input type="text" class="form-control @error($k->kolom) is-invalid @enderror" id="add-data-{{ $k->kolom }}" readonly
|
||||
name="{{ $k->kolom }}" placeholder="Cth: {{ $k->label }}" value="{{ old($k->kolom) ?? $value['value_'.$k->tipe] }}" />
|
||||
@endif
|
||||
@error($k->kolom)<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{!! $tabel->renderHtml('view', $errors, null, $values) !!}
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.data.index', [$tabel->id, 'program_id' => $program->id]) }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
|
||||
Reference in New Issue
Block a user