update akses pasar

This commit is contained in:
2026-07-30 11:14:31 +07:00
parent 3bcaa3ea50
commit cf0f4b47b4
4 changed files with 88 additions and 0 deletions
@@ -0,0 +1,26 @@
<?php
namespace App\Enums\AksesPasar;
enum TingkatKepercayaanPembeli: int
{
case SANGAT_PERCAYA = 1;
case CUKUP_PERCAYA = 2;
case RAGU_RAGU = 3;
case TIDAK_PERCAYA = 4;
public static function options(): array
{
return [
['value' => self::SANGAT_PERCAYA->value, 'label' => 'Sangat percaya, berani langsung coba'],
['value' => self::CUKUP_PERCAYA->value, 'label' => 'Cukup percaya, tapi hati hati'],
['value' => self::RAGU_RAGU->value, 'label' => 'Ragu ragu'],
['value' => self::TIDAK_PERCAYA->value, 'label' => 'Tidak percaya, enggan mencoba'],
];
}
public static function values(): array
{
return array_column(self::cases(), 'value');
}
}
@@ -16,6 +16,7 @@ use App\Enums\AksesPasar\SkorPengalaman;
use App\Enums\AksesPasar\SaluranTerdahulu;
use App\Enums\AksesPasar\PraktikFermentasi;
use App\Enums\AksesPasar\SkorKesadaranPremium;
use App\Enums\AksesPasar\TingkatKepercayaanPembeli;
class AksesPasarController extends Controller
{
@@ -113,6 +114,7 @@ class AksesPasarController extends Controller
'praktikFermentasiOptions' => PraktikFermentasi::options(),
'praktikBelumPernahValue' => PraktikFermentasi::BELUM_PERNAH->value,
'skorKesadaranPremiumOptions' => SkorKesadaranPremium::options(),
'tingkatKepercayaanOptions' => TingkatKepercayaanPembeli::options(),
'skorPengalamanBerhentiValues' => [
SkorPengalaman::PERNAH_BERHENTI_TIDAK_ADA_AKSES->value,
SkorPengalaman::PERNAH_BERHENTI_MUNGKIN_KEMBALI->value
@@ -154,6 +156,9 @@ class AksesPasarController extends Controller
'skor_kesadaran_premium' => ['nullable', 'integer', Rule::in(SkorKesadaranPremium::values())],
'sumber_info_premium' => ['nullable', 'string', 'max:255'],
'tingkat_kepercayaan_pembeli_baru' => ['nullable', 'integer', Rule::in(TingkatKepercayaanPembeli::values())],
'alasan_kepercayaan_pembeli_baru' => ['nullable', 'string'],
'harga_jual' => ['nullable', 'array'],
'harga_jual.*.bentuk_produk' => ['nullable', 'string'],
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('akses_pasar', function (Blueprint $table) {
$table->tinyInteger('tingkat_kepercayaan_pembeli_baru')->nullable()->after('sumber_info_premium');
$table->text('alasan_kepercayaan_pembeli_baru')->nullable()->after('tingkat_kepercayaan_pembeli_baru');
});
}
public function down(): void
{
Schema::table('akses_pasar', function (Blueprint $table) {
$table->dropColumn(['tingkat_kepercayaan_pembeli_baru', 'alasan_kepercayaan_pembeli_baru']);
});
}
};
@@ -207,6 +207,37 @@
</div>
</div>
<h5 class="pb-3 border-bottom mb-4 mt-4">KEPERCAYAAN & PERSEPSI RISIKO</h5>
<div class="row">
<div class="col-md-6 mb-4 form-control-validation">
<label class="form-label d-block mb-2" for="tingkat-kepercayaan">Seberapa percaya Bapak/Ibu untuk menjual ke pembeli atau pasar baru, di luar pembeli yang biasa?</label>
@foreach($tingkatKepercayaanOptions as $option)
<div class="form-check mb-2">
<input class="form-check-input @error('tingkat_kepercayaan_pembeli_baru') is-invalid @enderror"
type="radio"
id="tingkat-kepercayaan-{{ $option['value'] }}"
name="tingkat_kepercayaan_pembeli_baru"
value="{{ $option['value'] }}"
{{ (string) old('tingkat_kepercayaan_pembeli_baru', $aksesPasar?->tingkat_kepercayaan_pembeli_baru) === (string) $option['value'] ? 'checked' : '' }}>
<label class="form-check-label" for="tingkat-kepercayaan-{{ $option['value'] }}">
{{ $option['label'] }}
</label>
</div>
@endforeach
@error('tingkat_kepercayaan_pembeli_baru')<div class="invalid-feedback d-block">{{ $message }}</div>@enderror
</div>
<div class="col-md-6 mb-4 form-control-validation">
<label class="form-label mb-2" for="alasan-kepercayaan">Apa yang membuat Bapak/Ibu ragu atau yakin untuk mencoba pembeli baru?</label>
<textarea class="form-control @error('alasan_kepercayaan_pembeli_baru') is-invalid @enderror"
id="alasan-kepercayaan"
name="alasan_kepercayaan_pembeli_baru"
rows="4"
placeholder="Tuliskan alasannya di sini...">{{ old('alasan_kepercayaan_pembeli_baru', $aksesPasar?->alasan_kepercayaan_pembeli_baru) }}</textarea>
@error('alasan_kepercayaan_pembeli_baru')<div class="invalid-feedback">{{ $message }}</div>@enderror
</div>
</div>
<div class="mt-4 text-end">
<button type="submit" class="btn btn-success">
<i class="icon-base ti tabler-device-floppy me-1_5 icon-sm"></i>Simpan Akses Pasar