fix: update authentication flow

This commit is contained in:
2026-08-20 08:28:45 +03:30
parent 2a980ecc55
commit 7c0bc5b08b
+119 -6
View File
@@ -118,9 +118,12 @@
maxlength="100" maxlength="100"
required required
> >
@error('first_name')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -144,9 +147,12 @@
maxlength="100" maxlength="100"
required required
> >
@error('last_name')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -171,9 +177,12 @@
inputmode="numeric" inputmode="numeric"
required required
> >
@error('national_code')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -286,9 +295,12 @@
placeholder="در صورت تأهل وارد کنید" placeholder="در صورت تأهل وارد کنید"
maxlength="200" maxlength="200"
> >
@error('spouse_name')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -336,9 +348,12 @@
inputmode="numeric" inputmode="numeric"
required required
> >
@error('mobile')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -363,9 +378,12 @@
dir="ltr" dir="ltr"
required required
> >
@error('email')
<span style="color: red">{{ $message }}</span>
@enderror
</div> </div>
</div> </div>
@@ -414,6 +432,9 @@
pattern="[A-Za-z0-9]+" pattern="[A-Za-z0-9]+"
required required
> >
@error('username')
<span style="color: red">{{ $message }}</span>
@enderror
<small class="form-help"> <small class="form-help">
فقط حروف انگلیسی و اعداد مجاز است. فقط حروف انگلیسی و اعداد مجاز است.
@@ -421,6 +442,7 @@
</div> </div>
</div> </div>
@@ -595,6 +617,9 @@
class="form-control" class="form-control"
accept="image/jpeg,image/png,image/jpg" accept="image/jpeg,image/png,image/jpg"
> >
@error('image')
<span style="color: red">{{ $message }}</span>
@enderror
<small class="form-help"> <small class="form-help">
@@ -610,6 +635,7 @@
</div> </div>
</div> </div>
@@ -657,3 +683,90 @@
</div> </div>
@endsection @endsection
@push('scripts')
<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>
`;
if (!provinceId) {
citySelect.innerHTML = `
<option value="">
ابتدا استان را انتخاب کنید
</option>
`;
return;
}
fetch(`/auth/register/provinces/${provinceId}/cities`)
.then(response => {
if (!response.ok) {
throw new Error('خطا در دریافت شهرستان‌ها');
}
return response.json();
})
.then(cities => {
citySelect.innerHTML = `
<option value="">
انتخاب شهرستان
</option>
`;
if (cities.length === 0) {
citySelect.innerHTML = `
<option value="">
شهرستانی برای این استان پیدا نشد
</option>
`;
return;
}
cities.forEach(city => {
const option = document.createElement('option');
option.value = city.id;
option.textContent = city.name;
citySelect.appendChild(option);
});
})
.catch(error => {
console.error(error);
citySelect.innerHTML = `
<option value="">
خطا در دریافت شهرستان‌ها
</option>
`;
});
});
});
</script>
@endpush