feat: complete admin panel and backend admin api migration

This commit is contained in:
s.esmaeili
2026-09-13 21:02:25 +03:30
parent 03119cd655
commit 267fc7b7d1
239 changed files with 25431 additions and 935 deletions
@@ -0,0 +1,61 @@
<template>
<!-- Ported from legacy henza_admin/src/views/notify/create.vue. -->
<a-spin :spinning="loading">
<a-card title="ارسال نوتیفیکیشن">
<a-form layout="vertical" @submit.prevent="handleSubmit">
<div class="grid-2">
<a-form-item label="عنوان" :validate-status="err.title ? 'error' : ''" :help="err.title">
<a-input v-model:value="form.title" />
</a-form-item>
<a-form-item label="نوع کاربر">
<a-select v-model:value="form.type">
<a-select-option :value="0">همه مشتریان</a-select-option>
<a-select-option :value="2">مشتریان عمده</a-select-option>
<a-select-option :value="1">کارشناسان فروش</a-select-option>
</a-select>
</a-form-item>
</div>
<a-form-item label="متن پیام" :validate-status="err.text ? 'error' : ''" :help="err.text">
<a-textarea v-model:value="form.text" :auto-size="{ minRows: 4, maxRows: 8 }" />
</a-form-item>
<a-button type="primary" @click="handleSubmit">ارسال</a-button>
</a-form>
</a-card>
</a-spin>
</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>>({ title: '', text: '', type: 0 });
const err = reactive<Record<string, string>>({});
async function handleSubmit() {
Object.keys(err).forEach((k) => delete err[k]);
if (!form.title) err.title = 'عنوان الزامی است';
if (!form.text) err.text = 'متن پیام الزامی است';
if (Object.keys(err).length) return;
try {
loading.value = true;
const { data } = await api.post('notify', form);
message.success('نوتیفیکیشن ارسال شد');
form.title = '';
form.text = '';
} catch (e: any) {
message.error(e?.response?.data?.message ?? 'خطا در ارسال');
} finally {
loading.value = false;
}
}
</script>
<style scoped>
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
</style>