Update Profil Detail Petani
This commit is contained in:
@@ -0,0 +1,651 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="{{ asset('assets/vendor/libs/apex-charts/apex-charts.css') }}" />
|
||||
<style>
|
||||
@media (min-width: 992px) {
|
||||
.border-start-lg {
|
||||
border-left: 1px solid var(--bs-border-color);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991.98px) {
|
||||
.border-start-lg {
|
||||
border-top: 1px solid var(--bs-border-color);
|
||||
padding-top: 1.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-6">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gy-5">
|
||||
<div class="col-lg-7">
|
||||
<div class="d-flex flex-column flex-sm-row align-items-center align-items-sm-start gap-4">
|
||||
<div class="flex-shrink-0 position-relative">
|
||||
<img id="fotoPreview" src="{{ asset('assets/img/avatars/3.jpg') }}"
|
||||
alt="Foto profil petani"
|
||||
class="rounded-circle shadow-sm border border-2 border-primary-subtle"
|
||||
style="width: 96px; height: 96px; object-fit: cover; display: block;"/>
|
||||
<a href="javascript:void(0)" class="btn btn-sm btn-icon btn-primary rounded-circle position-absolute bottom-0 end-0" style="width: 28px; height: 28px;">
|
||||
<i class="icon-base ti tabler-settings icon-xs"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-grow-1 text-center text-sm-start">
|
||||
<div class="d-flex align-items-center justify-content-center justify-content-sm-start flex-wrap gap-2 mb-1">
|
||||
<h4 class="mb-0">{{ $petani->nama }}</h4>
|
||||
<span class="badge bg-label-secondary">NIK: {{ $ktpMasked }}</span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center justify-content-center justify-content-sm-start flex-wrap gap-2 mb-3">
|
||||
<span class="text-body-secondary">{{ \Carbon\Carbon::parse($petani->tanggal_lahir)->age }} tahun</span>
|
||||
<span class="text-body-secondary">•</span>
|
||||
<span class="badge bg-label-secondary">{{ $petani->pendidikan_terakhir }}</span>
|
||||
<span class="badge bg-label-secondary">{{ $petani->status_perkawinan }}</span>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap justify-content-center justify-content-sm-start gap-2 mb-3">
|
||||
<span class="badge bg-label-secondary d-flex align-items-center gap-1">
|
||||
<i class="icon-base ti tabler-map-pin icon-xs"></i>
|
||||
{{ $desaKelurahan->nama }}, {{ $desaKelurahan->kecamatan->nama }}
|
||||
</span>
|
||||
<span class="badge bg-label-secondary d-flex align-items-center gap-1">
|
||||
<i class="icon-base ti tabler-chocolate icon-xs"></i>
|
||||
{{ $komoditas->first()->nama }}
|
||||
</span>
|
||||
@if($petani->sertifikat === 1)
|
||||
<span class="badge bg-label-secondary d-flex align-items-center gap-1">
|
||||
<i class="icon-base ti tabler-file-certificate icon-xs"></i>
|
||||
Hak Milik (SHM)
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="ps-lg-5 border-start-lg">
|
||||
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||
<div>
|
||||
<div class="text-uppercase text-body-secondary small fw-medium mb-1">
|
||||
Skor Kesiapan Adopsi
|
||||
</div>
|
||||
<div class="d-flex align-items-baseline gap-1">
|
||||
<h2 class="mb-0 text-primary">
|
||||
{{ number_format($skorPetani->skor_kesiapan_adopsi, 1) }}
|
||||
</h2>
|
||||
<span class="text-body-secondary"> / 5.0 </span>
|
||||
<div class="d-flex flex-wrap justify-content-center justify-content-sm-start gap-2">
|
||||
<span class="badge bg-label-info d-flex align-items-center gap-1">
|
||||
@if($skorPetani->skor_kesiapan_adopsi < 2.0)
|
||||
Pemula
|
||||
@elseif($skorPetani->skor_kesiapan_adopsi >= 2.0 && $skorPetani->skor_kesiapan_adopsi < 3.0)
|
||||
Pemerhati
|
||||
@elseif($skorPetani->skor_kesiapan_adopsi >= 3.0 && $skorPetani->skor_kesiapan_adopsi < 4.0)
|
||||
Perintis
|
||||
@elseif($skorPetani->skor_kesiapan_adopsi >= 4.0)
|
||||
Penggerak
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary">
|
||||
<i class="icon-base ti tabler-file-type-pdf icon-sm me-1"></i>
|
||||
Export PDF
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<div class="progress mb-2" style="height: 7px;">
|
||||
<div class="progress-bar" role="progressbar" style="width: {{ ($skorPetani->skor_kesiapan_adopsi / 5.0) * 100 }}%;" aria-valuenow="{{ $skorPetani->skor_kesiapan_adopsi }}" aria-valuemin="0" aria-valuemax="5.0"></div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-4">
|
||||
<small class="text-warning">
|
||||
{{ number_format(4.0 - $skorPetani->skor_kesiapan_adopsi, 1) }} poin lagi menuju batas Segmen Penggerak
|
||||
</small>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap gap-3 text-body-secondary small">
|
||||
<span class="d-flex align-items-center gap-1">
|
||||
<i class="icon-base ti tabler-user-search icon-xs"></i>
|
||||
Enu: {{ $enumerator->nama ?? 'N/A' }}
|
||||
</span>
|
||||
<span class="d-flex align-items-center gap-1">
|
||||
<i class="icon-base ti tabler-calendar-event icon-xs"></i>
|
||||
Terakhir Update: {{ \Carbon\Carbon::parse($petani->updated_at)->format('d M Y : H:i' ) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-6">
|
||||
<div class="col-md-6 col-12">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-1">Profil Dimensi</h5>
|
||||
<p class="card-subtitle text-body-secondary mb-0">Profil berdasarkan 6 dimensi penilaian</p>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div id="dimensionChart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-12">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-1">Skor per Komponen</h5>
|
||||
<p class="card-subtitle text-body-secondary mb-0">Nilai masing-masing komponen penilaian petani</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="skorKomponenBarChart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if($profiling)
|
||||
<div class="row mt-6">
|
||||
<div class="col-12">
|
||||
<div class="card border-start border-4 border-primary">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between gap-3 mb-4">
|
||||
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
|
||||
<span class="avatar-initial rounded bg-label-info p-2">
|
||||
<i class="icon-base ti tabler-chart-arrows icon-md"></i>
|
||||
</span>
|
||||
|
||||
<div>
|
||||
<h5 class="card-title mb-1">
|
||||
Profil Hambatan & Rekomendasi Intervensi
|
||||
</h5>
|
||||
|
||||
<p class="text-body-secondary mb-0">
|
||||
Pembacaan multidimensi berdasarkan profil petani
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Nama Profil --}}
|
||||
<span class="badge bg-label-primary fs-6">
|
||||
{{ $profiling['title'] }}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Narasi --}}
|
||||
<p class="text-body mb-4 lh-lg">
|
||||
{{ $profiling['narrative'] }}
|
||||
</p>
|
||||
|
||||
|
||||
{{-- Kekuatan & Hambatan --}}
|
||||
<div class="row g-4 mb-4">
|
||||
|
||||
{{-- Kekuatan --}}
|
||||
<div class="col-lg-6">
|
||||
|
||||
<div class="mb-2">
|
||||
<small class="text-body-secondary fw-medium">
|
||||
Kekuatan Relatif
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
|
||||
@forelse($profiling['strengths'] as $strength)
|
||||
|
||||
<span class="badge bg-label-success d-flex align-items-center gap-1">
|
||||
|
||||
<i class="icon-base ti {{ $strength['icon'] }} icon-xs"></i>
|
||||
|
||||
{{ $strength['short'] }}
|
||||
|
||||
<span class="fw-semibold ms-1">
|
||||
{{ number_format($strength['skor'], 1) }}
|
||||
</span>
|
||||
|
||||
</span>
|
||||
|
||||
@empty
|
||||
|
||||
<span class="text-body-secondary small">
|
||||
Belum ada data yang cukup.
|
||||
</span>
|
||||
|
||||
@endforelse
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Hambatan --}}
|
||||
<div class="col-lg-6">
|
||||
|
||||
<div class="mb-2">
|
||||
<small class="text-body-secondary fw-medium">
|
||||
Area Prioritas
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
|
||||
@forelse($profiling['barriers'] as $barrier)
|
||||
|
||||
<span class="badge bg-label-warning d-flex align-items-center gap-1">
|
||||
|
||||
<i class="icon-base ti {{ $barrier['icon'] }} icon-xs"></i>
|
||||
|
||||
{{ $barrier['short'] }}
|
||||
|
||||
<span class="fw-semibold ms-1">
|
||||
{{ number_format($barrier['skor'], 1) }}
|
||||
</span>
|
||||
|
||||
</span>
|
||||
|
||||
@empty
|
||||
|
||||
<span class="badge bg-label-success">
|
||||
<i class="icon-base ti tabler-circle-check icon-xs me-1"></i>
|
||||
Tidak ada hambatan utama yang menonjol
|
||||
</span>
|
||||
|
||||
@endforelse
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Rekomendasi --}}
|
||||
@if(!empty($profiling['recommendations']))
|
||||
|
||||
<div class="border-top pt-4">
|
||||
|
||||
<div class="d-flex align-items-center gap-2 mb-3">
|
||||
|
||||
<i class="icon-base ti tabler-bulb text-warning icon-md"></i>
|
||||
|
||||
<h6 class="mb-0">
|
||||
Rekomendasi Intervensi
|
||||
</h6>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
@foreach($profiling['recommendations'] as $recommendation)
|
||||
|
||||
<div class="col-lg-6">
|
||||
|
||||
<div class="d-flex align-items-start gap-3">
|
||||
|
||||
<span class="badge rounded-pill bg-label-primary">
|
||||
{{ $loop->iteration }}
|
||||
</span>
|
||||
|
||||
<span class="text-body">
|
||||
{{ $recommendation }}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('assets/vendor/libs/apex-charts/apexcharts.js') }}"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const dimensionScores = [
|
||||
@json((float) ($skorPetani->skor_komp_1_d4_k3_motivasi_kapasitas_adopsi ?? 0)),
|
||||
@json((float) ($skorPetani->skor_komp_2_d4_k2_ekonomi_rumah_tangga ?? 0)),
|
||||
@json((float) ($skorPetani->skor_komp_3_d2_praktik_budidaya_gap ?? 0)),
|
||||
@json((float) ($skorPetani->skor_komp_4_d4_k4_keterlibatan_kelembagaan ?? 0)),
|
||||
@json((float) ($skorPetani->skor_komp_5_d4_k5_k6_akses_kebebasan_keuangan ?? 0)),
|
||||
@json((float) ($skorPetani->skor_komp_6_d6_k1_k4_k5_rantai_nilai_akses_pasar ?? 0))
|
||||
];
|
||||
|
||||
const dimensionLabels = [
|
||||
'Motivasi',
|
||||
'Ekonomi',
|
||||
'GAP',
|
||||
'Kelembagaan',
|
||||
'Keuangan',
|
||||
'Akses Pasar'
|
||||
];
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| VUEXY THEME COLORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const primaryColor = config.colors.primary;
|
||||
const secondaryColor = config.colors.secondary;
|
||||
const successColor = config.colors.success;
|
||||
const infoColor = config.colors.info;
|
||||
const warningColor = config.colors.warning;
|
||||
const dangerColor = config.colors.danger;
|
||||
|
||||
const bodyColor = config.colors.bodyColor;
|
||||
const borderColor = config.colors.borderColor;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
console.log('Skor Petani:', dimensionScores);
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RADAR CHART
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const dimensionChartEl = document.querySelector('#dimensionChart');
|
||||
|
||||
if (dimensionChartEl && typeof ApexCharts !== 'undefined') {
|
||||
|
||||
const dimensionChartConfig = {
|
||||
|
||||
chart: {
|
||||
height: 360,
|
||||
type: 'radar',
|
||||
toolbar: {
|
||||
show: false
|
||||
},
|
||||
parentHeightOffset: 0
|
||||
},
|
||||
|
||||
series: [
|
||||
{
|
||||
name: 'Skor',
|
||||
data: dimensionScores
|
||||
}
|
||||
],
|
||||
|
||||
labels: dimensionLabels,
|
||||
|
||||
colors: [
|
||||
primaryColor
|
||||
],
|
||||
|
||||
stroke: {
|
||||
width: 2
|
||||
},
|
||||
|
||||
fill: {
|
||||
opacity: 0.18
|
||||
},
|
||||
|
||||
markers: {
|
||||
size: 4,
|
||||
strokeWidth: 0,
|
||||
hover: {
|
||||
size: 6
|
||||
}
|
||||
},
|
||||
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
|
||||
plotOptions: {
|
||||
radar: {
|
||||
size: 125,
|
||||
|
||||
polygons: {
|
||||
strokeColors: borderColor,
|
||||
connectorColors: borderColor,
|
||||
|
||||
fill: {
|
||||
colors: [
|
||||
'transparent'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
xaxis: {
|
||||
labels: {
|
||||
style: {
|
||||
colors: [
|
||||
bodyColor,
|
||||
bodyColor,
|
||||
bodyColor,
|
||||
bodyColor,
|
||||
bodyColor,
|
||||
bodyColor
|
||||
],
|
||||
fontSize: '12px',
|
||||
fontWeight: 500
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
yaxis: {
|
||||
min: 0,
|
||||
max: 5,
|
||||
tickAmount: 5,
|
||||
|
||||
labels: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
y: {
|
||||
formatter: function (value) {
|
||||
return Number(value).toFixed(1) + ' / 5.0';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
const dimensionChart = new ApexCharts(
|
||||
dimensionChartEl,
|
||||
dimensionChartConfig
|
||||
);
|
||||
|
||||
dimensionChart.render();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| BAR CHART
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const skorKomponenBarChartEl =
|
||||
document.querySelector('#skorKomponenBarChart');
|
||||
|
||||
if (skorKomponenBarChartEl && typeof ApexCharts !== 'undefined') {
|
||||
|
||||
const skorKomponenBarChartConfig = {
|
||||
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 380,
|
||||
toolbar: {
|
||||
show: false
|
||||
},
|
||||
parentHeightOffset: 0
|
||||
},
|
||||
|
||||
series: [
|
||||
{
|
||||
name: 'Skor',
|
||||
data: dimensionScores
|
||||
}
|
||||
],
|
||||
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: true,
|
||||
borderRadius: 4,
|
||||
barHeight: '45%',
|
||||
|
||||
dataLabels: {
|
||||
position: 'top'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
colors: [
|
||||
primaryColor
|
||||
],
|
||||
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
|
||||
formatter: function (value) {
|
||||
return Number(value).toFixed(1);
|
||||
},
|
||||
|
||||
offsetX: 25,
|
||||
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
fontWeight: 600,
|
||||
colors: [bodyColor]
|
||||
}
|
||||
},
|
||||
|
||||
xaxis: {
|
||||
categories: [
|
||||
'Motivasi',
|
||||
'Sosial Ekonomi',
|
||||
'Budidaya / GAP',
|
||||
'Kelembagaan',
|
||||
'Akses Keuangan',
|
||||
'Akses Pasar'
|
||||
],
|
||||
|
||||
min: 0,
|
||||
max: 5,
|
||||
tickAmount: 5,
|
||||
|
||||
labels: {
|
||||
formatter: function (value) {
|
||||
return Number(value).toFixed(0);
|
||||
},
|
||||
|
||||
style: {
|
||||
colors: bodyColor,
|
||||
fontSize: '11px'
|
||||
}
|
||||
},
|
||||
|
||||
axisBorder: {
|
||||
show: false
|
||||
},
|
||||
|
||||
axisTicks: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: {
|
||||
colors: bodyColor,
|
||||
fontSize: '12px',
|
||||
fontWeight: 500
|
||||
},
|
||||
|
||||
maxWidth: 150
|
||||
}
|
||||
},
|
||||
|
||||
grid: {
|
||||
borderColor: borderColor,
|
||||
strokeDashArray: 4,
|
||||
|
||||
xaxis: {
|
||||
lines: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
|
||||
yaxis: {
|
||||
lines: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
padding: {
|
||||
right: 30,
|
||||
left: 5
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
y: {
|
||||
formatter: function (value) {
|
||||
return Number(value).toFixed(1) + ' / 5.0';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
const skorKomponenBarChart = new ApexCharts(
|
||||
skorKomponenBarChartEl,
|
||||
skorKomponenBarChartConfig
|
||||
);
|
||||
|
||||
skorKomponenBarChart.render();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user