Files
tehran_taj/apps/admin-panel/src/views/reg.vue
T
s.esmaeiliandClaude Sonnet 5 f0de478940 admin-panel: fix CSS bugs and dedupe scoped grid utilities
Approved departure from the port's byte-faithful rule (docs/ADMIN-PORT-PLAN.md
bug rows 4-6), fixed and logged rather than silently changed:
- farsi.less: bold/700 @font-face blocks now load iran-yekan-700.woff2
  instead of the 400 file, so bold text actually renders bold. No source
  file exists for weight 300, so that face is dropped rather than faked.
- format("woff") corrected to format("woff2") on all faces.
- Removed 'font-weight: inherit' from the body,* reset, which was flattening
  every heading's weight.

Also deduped 24 view files that each redeclared .grid-2/.grid-3/.grid-4 in
a scoped <style> block with drifted minmax values, though utilities.less
already defines all three globally. Removed the scoped copies; kept
PromotionForm's genuinely different 0.5rem gap as a small .grid-4--tight
modifier instead of a full redeclaration.

Verified: pnpm build passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 15:09:11 +03:30

121 lines
3.7 KiB
Vue

<template>
<!--
Ported from legacy henza_admin/src/views/reg.vue — a PUBLIC self-registration
form for new wholesale customers ("ثبت مشتری جدید (اطلاعات فروشنده)").
It sits on the full-page layout outside the authenticated shell, which is why
it carries no permission gate: legacy routed it at /reg alongside the login
page. Preserved.
-->
<div class="reg-page">
<a-spin :spinning="loading">
<a-card title="ثبت مشتری جدید (اطلاعات فروشنده)" class="reg-card">
<a-form layout="vertical" @submit.prevent="handleSubmit">
<div class="grid-3">
<a-form-item label="نام " :validate-status="err.fname ? 'error' : ''" :help="err.fname">
<a-input v-model:value="form.fname" />
</a-form-item>
<a-form-item
label="نام خانوادگی"
:validate-status="err.lname ? 'error' : ''"
:help="err.lname"
>
<a-input v-model:value="form.lname" />
</a-form-item>
<a-form-item
label="شماره تلفن همراه"
:validate-status="err.mobile ? 'error' : ''"
:help="err.mobile"
>
<a-input v-model:value="form.mobile" />
</a-form-item>
<a-form-item label="نام مغازه">
<a-input v-model:value="form.store_name" />
</a-form-item>
<a-form-item label="تلفن">
<a-input v-model:value="form.phone" />
</a-form-item>
<a-form-item label="نام پاساژ">
<a-input v-model:value="form.pasazh_name" />
</a-form-item>
<a-form-item label="منطقه">
<a-input v-model:value="form.zone" />
</a-form-item>
</div>
<a-form-item label="آدرس">
<a-textarea v-model:value="form.address" :auto-size="{ minRows: 2, maxRows: 4 }" />
</a-form-item>
<a-button type="primary" size="large" :loading="loading" @click="handleSubmit">
ثبت
</a-button>
</a-form>
</a-card>
</a-spin>
</div>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import api from '../api/client';
const loading = ref(false);
const form = reactive<Record<string, any>>({
fname: '',
lname: '',
mobile: '',
store_name: '',
phone: '',
pasazh_name: '',
zone: '',
address: '',
});
const err = reactive<Record<string, string>>({});
async function handleSubmit() {
Object.keys(err).forEach((k) => delete err[k]);
if (!form.fname) err.fname = 'لطفا نام را وارد کنید';
if (!form.lname) err.lname = 'لطفا نام خانوادگی را وارد کنید';
if (!form.mobile) err.mobile = 'لطفا شماره تلفن همراه را وارد کنید';
if (Object.keys(err).length) return;
try {
loading.value = true;
await api.post('customer/create', {
...form,
name: `${form.fname} ${form.lname}`.trim(),
});
message.success('اطلاعات با موفقیت ثبت شد.');
Object.keys(form).forEach((k) => (form[k] = ''));
} catch (e: any) {
const mobileErr = e?.response?.data?.errors?.mobile?.[0];
message.error(mobileErr ?? e?.response?.data?.message ?? 'خطا در ثبت اطلاعات.');
} finally {
loading.value = false;
}
}
</script>
<style scoped>
.reg-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 1.5rem;
}
.reg-card {
width: 100%;
max-width: 900px;
}
/* .grid-3 now comes from the global utilities.less (dedup) */
</style>