fix: update authentication flow
This commit is contained in:
@@ -118,9 +118,12 @@
|
||||
maxlength="100"
|
||||
required
|
||||
>
|
||||
|
||||
@error('first_name')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -144,9 +147,12 @@
|
||||
maxlength="100"
|
||||
required
|
||||
>
|
||||
|
||||
@error('last_name')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -171,9 +177,12 @@
|
||||
inputmode="numeric"
|
||||
required
|
||||
>
|
||||
|
||||
@error('national_code')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -286,9 +295,12 @@
|
||||
placeholder="در صورت تأهل وارد کنید"
|
||||
maxlength="200"
|
||||
>
|
||||
|
||||
@error('spouse_name')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -336,9 +348,12 @@
|
||||
inputmode="numeric"
|
||||
required
|
||||
>
|
||||
|
||||
@error('mobile')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -363,9 +378,12 @@
|
||||
dir="ltr"
|
||||
required
|
||||
>
|
||||
|
||||
@error('email')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -414,6 +432,9 @@
|
||||
pattern="[A-Za-z0-9]+"
|
||||
required
|
||||
>
|
||||
@error('username')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
<small class="form-help">
|
||||
فقط حروف انگلیسی و اعداد مجاز است.
|
||||
@@ -421,6 +442,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -595,6 +617,9 @@
|
||||
class="form-control"
|
||||
accept="image/jpeg,image/png,image/jpg"
|
||||
>
|
||||
@error('image')
|
||||
<span style="color: red">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
<small class="form-help">
|
||||
|
||||
@@ -610,6 +635,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -657,3 +683,90 @@
|
||||
</div>
|
||||
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user