complete Complete User Request Submission section RAD-1

This commit is contained in:
2026-01-03 19:14:30 +03:30
commit 7137ec5792
393 changed files with 152602 additions and 0 deletions
+124
View File
@@ -0,0 +1,124 @@
<script setup>
import { ref } from 'vue'
import AuthLayout from '../../layouts/AuthLayout.vue';
import UiInputWithDropdown from '../../components/ui/UiInputWithDropdown.vue'
import UiButton from '../../components/ui/UiButton.vue'
import { countries } from '../../data/countries.js'
import { Inertia } from '@inertiajs/inertia'
import { inject } from 'vue';
import { convertPersianToEnglish } from '../../utils/numberUtils.js'
import { toast } from 'vue3-toastify'
const route = inject('route');
const selectedCountry = ref(countries[0])
const phoneNumber = ref('')
const isLoading = ref(false)
const handlePrefixChange = (country) => {
selectedCountry.value = country
}
const validatePhone = (phone) => {
const phoneRegex = /^[0-9۰-۹]{10,15}$/
return phoneRegex.test(phone.replace(/\s/g, ''))
}
const handleLogin = async () => {
if (!phoneNumber.value) {
toast.error('لطفاً شماره موبایل را وارد کنید', {
position: 'top-right',
rtl: true,
theme: 'colored',
autoClose: 3000,
})
return
}
if (!validatePhone(phoneNumber.value)) {
toast.error('لطفاً شماره موبایل معتبر وارد کنید', {
position: 'top-right',
rtl: true,
theme: 'colored',
autoClose: 3000,
})
return
}
isLoading.value = true
try {
let processedPhone = convertPersianToEnglish(phoneNumber.value)
if (processedPhone.startsWith('0')) {
processedPhone = processedPhone.substring(1)
}
Inertia.post(route('checkPhone'), {
prefix: selectedCountry.value.prefix,
phone: processedPhone
}, {
onSuccess: (page) => {
},
onError: (errors) => {
},
onFinish: () => {
isLoading.value = false
}
})
} catch (error) {
isLoading.value = false
}
}
</script>
<template>
<AuthLayout>
<main class="p-9 h-auto w-[450px] max-sm:w-[90%] m-auto bg-white rounded-xl">
<div class="grid grid-cols-a justify-start">
<h1 class="text-[16px] font-semibold !text-dominant-800">
{{ $t('auth.phone.title') }}
</h1>
<p class="!text-dominant-800 text-[11px] font-normal">
{{ $t('auth.phone.subtitle') }}
</p>
</div>
<div class="my-6">
<UiInputWithDropdown
search-placeholder="Search Country Name or Phone Code ..."
dropdown-search-input-class="!text-dominant-200 !bg-dominant-50 !border-0 !pt-3 !font-normal !text-sm"
type="tel"
v-model="phoneNumber"
prefix-end="شماره موبایل"
dropdown-direction="ltr"
:prefix-options="countries"
:default-prefix-value="selectedCountry.value"
direction="ltr"
@prefix-change="handlePrefixChange"
/>
</div>
<UiButton
severity="dominant"
:label="isLoading ? 'در حال بررسی...' : 'ورود و ثبت‌نام'"
size="large"
class="!mt-4"
full-width
outlined
height="40px"
icon-position="start"
icon-class="!text-sm mt-1"
:loading="isLoading"
@click="handleLogin"
/>
</main>
<template #footer>
<p class="text-center text-[13px] font-normal text-dominant-500 mt-6">
Change Language to English
</p>
</template>
</AuthLayout>
</template>