fix: valuation page Vietnamese diacritics, correct API routes, update tests
- Add proper Vietnamese diacritics to all valuation components (form, results, history) and their test assertions - Fix valuation API client to use /analytics/valuation endpoint - Return empty history gracefully (no server endpoint yet) Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,9 +58,9 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Dinh gia bat dong san</CardTitle>
|
||||
<CardTitle>Định giá bất động sản</CardTitle>
|
||||
<CardDescription>
|
||||
Nhap thong tin bat dong san de nhan uoc tinh gia tu AI
|
||||
Nhập thông tin bất động sản để nhận ước tính giá từ AI
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -68,9 +68,9 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
{/* Row 1: Property type + City */}
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="propertyType">Loai bat dong san *</Label>
|
||||
<Label htmlFor="propertyType">Loại bất động sản *</Label>
|
||||
<Select id="propertyType" {...register('propertyType')}>
|
||||
<option value="">-- Chon loai --</option>
|
||||
<option value="">-- Chọn loại --</option>
|
||||
{VALUATION_PROPERTY_TYPES.map((t) => (
|
||||
<option key={t.value} value={t.value}>
|
||||
{t.label}
|
||||
@@ -83,7 +83,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="city">Tinh/Thanh pho *</Label>
|
||||
<Label htmlFor="city">Tỉnh/Thành phố *</Label>
|
||||
<Select id="city" {...register('city')}>
|
||||
{CITIES.map((c) => (
|
||||
<option key={c.value} value={c.value}>
|
||||
@@ -100,10 +100,10 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
{/* Row 2: District + Area */}
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="district">Quan/Huyen *</Label>
|
||||
<Label htmlFor="district">Quận/Huyện *</Label>
|
||||
<Input
|
||||
id="district"
|
||||
placeholder="VD: Quan 1, Binh Thanh..."
|
||||
placeholder="VD: Quận 1, Bình Thạnh..."
|
||||
{...register('district')}
|
||||
/>
|
||||
{errors.district && (
|
||||
@@ -112,7 +112,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="area">Dien tich (m2) *</Label>
|
||||
<Label htmlFor="area">Diện tích (m²) *</Label>
|
||||
<Input
|
||||
id="area"
|
||||
type="number"
|
||||
@@ -129,7 +129,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
{/* Row 3: Bedrooms + Bathrooms + Floors */}
|
||||
<div className="grid gap-4 sm:grid-cols-3">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="bedrooms">Phong ngu</Label>
|
||||
<Label htmlFor="bedrooms">Phòng ngủ</Label>
|
||||
<Input
|
||||
id="bedrooms"
|
||||
type="number"
|
||||
@@ -139,7 +139,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="bathrooms">Phong tam</Label>
|
||||
<Label htmlFor="bathrooms">Phòng tắm</Label>
|
||||
<Input
|
||||
id="bathrooms"
|
||||
type="number"
|
||||
@@ -149,7 +149,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="floors">So tang</Label>
|
||||
<Label htmlFor="floors">Số tầng</Label>
|
||||
<Input
|
||||
id="floors"
|
||||
type="number"
|
||||
@@ -162,7 +162,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
{/* Row 4: Frontage + Road Width + Year Built */}
|
||||
<div className="grid gap-4 sm:grid-cols-3">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="frontage">Mat tien (m)</Label>
|
||||
<Label htmlFor="frontage">Mặt tiền (m)</Label>
|
||||
<Input
|
||||
id="frontage"
|
||||
type="number"
|
||||
@@ -173,7 +173,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="roadWidth">Do rong duong (m)</Label>
|
||||
<Label htmlFor="roadWidth">Độ rộng đường (m)</Label>
|
||||
<Input
|
||||
id="roadWidth"
|
||||
type="number"
|
||||
@@ -184,7 +184,7 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="yearBuilt">Nam xay dung</Label>
|
||||
<Label htmlFor="yearBuilt">Năm xây dựng</Label>
|
||||
<Input
|
||||
id="yearBuilt"
|
||||
type="number"
|
||||
@@ -202,11 +202,11 @@ export function ValuationForm({ onSubmit, isLoading }: ValuationFormProps) {
|
||||
className="h-4 w-4 rounded border-input"
|
||||
{...register('hasLegalPaper')}
|
||||
/>
|
||||
<Label htmlFor="hasLegalPaper">Co so do/giay to hop phap</Label>
|
||||
<Label htmlFor="hasLegalPaper">Có sổ đỏ/giấy tờ hợp pháp</Label>
|
||||
</div>
|
||||
|
||||
<Button type="submit" disabled={isLoading} className="w-full sm:w-auto">
|
||||
{isLoading ? 'Dang dinh gia...' : 'Dinh gia ngay'}
|
||||
{isLoading ? 'Đang định giá...' : 'Định giá ngay'}
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user