feat: final updates

This commit is contained in:
2026-08-22 11:11:28 -07:00
parent 618a3d4cd9
commit d4bb1b9414
43 changed files with 1136 additions and 375 deletions
+62 -1
View File
@@ -63,6 +63,41 @@
<span style="color: red">{{ $message }}</span>
@enderror
</div>
<div class="col-xl-6">
<label class="form-label">استان</label>
<select name="province_id" id="province_id" class="form-control">
<option value="">استان را انتخاب کنید</option>
@foreach($provinces as $province)
<option
value="{{ $province->id }}"
@selected(old('province_id', $user->province_id) == $province->id)
>
{{ $province->name }}
</option>
@endforeach
</select>
@error('province_id')
<span style="color: red">{{ $message }}</span>
@enderror
</div>
<div class="col-xl-6">
<label class="form-label">شهرستان</label>
<select name="city_id" id="city_id" class="form-control">
@if($user->city)
<option value="{{ $user->city->id }}" selected>
{{ $user->city->name }}
</option>
@else
<option value="">ابتدا استان را انتخاب کنید</option>
@endif
</select>
@error('city_id')
<span style="color: red">{{ $message }}</span>
@enderror
</div>
<div class="col-xl-6">
<label class="form-label">رمز عبور (در صورت تغییر)</label>
<input type="text" class="form-control" name="password"
@@ -84,5 +119,31 @@
</div>
</div>
@endsection
<script>
document.getElementById('province_id').addEventListener('change', function () {
const provinceId = this.value;
const citySelect = document.getElementById('city_id');
citySelect.innerHTML = '<option value="">در حال بارگذاری...</option>';
if (!provinceId) {
citySelect.innerHTML = '<option value="">ابتدا استان را انتخاب کنید</option>';
return;
}
fetch(`/admin/users/cities-by-province/${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);
});
});
});
</script>
@endsection