git add .

git commit "fix: city selection, comment user display, and back button bug"
This commit is contained in:
2026-08-22 09:13:09 +03:30
parent 669dd7cfff
commit 947d2425d9
16 changed files with 114 additions and 63 deletions
+37
View File
@@ -570,5 +570,42 @@
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const provinceSelect = document.getElementById('province_id');
const citySelect = document.getElementById('city_id');
provinceSelect.addEventListener('change', function () {
const provinceId = this.value;
citySelect.innerHTML = '<option value="">در حال بارگذاری...</option>';
citySelect.disabled = true;
if (!provinceId) {
citySelect.innerHTML = '<option value="">ابتدا استان را انتخاب کنید</option>';
return;
}
fetch(`{{ url('/cities') }}/${provinceId}`)
.then(response => response.json())
.then(cities => {
citySelect.innerHTML = '<option value="">انتخاب شهرستان</option>';
cities.forEach(city => {
const option = document.createElement('option');
option.value = city.id;
option.textContent = city.name;
citySelect.appendChild(option);
});
citySelect.disabled = false;
})
.catch(() => {
citySelect.innerHTML = '<option value="">خطا در دریافت شهرها</option>';
citySelect.disabled = false;
});
});
});
</script>
@endsection