forked from morrning/hesabixCore
update for Moadian plugin
This commit is contained in:
parent
62375ab997
commit
9b0dc60627
|
@ -23,7 +23,7 @@ class TaxSettingsController extends AbstractController
|
|||
private function getMoadianBaseUrl(registryMGR $registryMGR): string
|
||||
{
|
||||
$sandboxMode = filter_var($registryMGR->get('system_settings', 'tax_system_sandbox_mode'), FILTER_VALIDATE_BOOLEAN);
|
||||
return $sandboxMode ? 'https://sandboxrc.tax.gov.ir/' : 'https://rc.tax.gov.ir/';
|
||||
return $sandboxMode ? 'https://sandboxrc.tax.gov.ir/' : 'https://tp.tax.gov.ir/';
|
||||
}
|
||||
|
||||
#[Route('/api/plugins/tax/settings/get', name: 'plugin_tax_settings_get', methods: ['GET'])]
|
||||
|
|
|
@ -528,6 +528,12 @@ const router = createRouter({
|
|||
component: () =>
|
||||
import('../views/acc/plugins/taxsettings/intro.vue'),
|
||||
},
|
||||
{
|
||||
path: 'plugins/taxsettings/doc',
|
||||
name: 'taxsettings_doc',
|
||||
component: () =>
|
||||
import('../views/acc/plugins/taxsettings/doc.vue'),
|
||||
},
|
||||
{
|
||||
path: 'business/logs',
|
||||
name: 'business_logs',
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
</v-tooltip>
|
||||
</template>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn variant="flat" color="info" prepend-icon="mdi-book-open-page-variant" @click="$router.push('/acc/plugins/taxsettings/doc')" class="me-2">
|
||||
راهنمای کامل
|
||||
</v-btn>
|
||||
<v-btn :loading="loading" @click="saveSettings()" icon="" color="green">
|
||||
<v-tooltip activator="parent" text="ذخیره تنظیمات" location="bottom" />
|
||||
<v-icon icon="mdi-content-save"></v-icon>
|
||||
|
@ -32,7 +35,7 @@
|
|||
|
||||
<v-row class="mt-4">
|
||||
<v-col cols="12">
|
||||
<v-card variant="elevated" class="pa-6" color="surface">
|
||||
<v-card variant="elevated" class="pa-6" color="surface" style="box-shadow: none !important;">
|
||||
<div class="d-flex align-center mb-4">
|
||||
<v-icon color="primary" class="me-3" size="large">mdi-key</v-icon>
|
||||
<h3 class="text-h5 mb-0 text-primary-darken-2">کلید خصوصی</h3>
|
||||
|
@ -59,25 +62,18 @@
|
|||
<v-card variant="flat" class="pa-3 pa-md-4" color="transparent">
|
||||
<div class="d-flex align-center mb-3">
|
||||
<v-icon color="green" class="me-2">mdi-upload</v-icon>
|
||||
<span class="text-subtitle-2 text-md-subtitle-1 font-weight-medium text-black">بارگذاری فایل</span>
|
||||
<span class="text-subtitle-2 text-md-subtitle-1 font-weight-medium text-black">بارگذاری
|
||||
فایل</span>
|
||||
</div>
|
||||
|
||||
<div v-if="!settings.privateKey">
|
||||
<v-row>
|
||||
<v-col cols="12" md="8">
|
||||
<v-file-input
|
||||
v-model="privateKeyFile"
|
||||
label="انتخاب فایل کلید خصوصی"
|
||||
accept=".key,.pem,.txt"
|
||||
:error-messages="fileErrors.privateKey"
|
||||
@change="validatePrivateKeyFile"
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
placeholder="فایل کلید خصوصی خود را انتخاب کنید"
|
||||
:rules="privateKeyFileRules"
|
||||
color="green"
|
||||
hide-details="auto"
|
||||
>
|
||||
<v-file-input v-model="privateKeyFile" label="انتخاب فایل کلید خصوصی"
|
||||
accept=".key,.pem,.txt" :error-messages="fileErrors.privateKey"
|
||||
@change="validatePrivateKeyFile" variant="outlined" density="comfortable"
|
||||
placeholder="فایل کلید خصوصی خود را انتخاب کنید" :rules="privateKeyFileRules"
|
||||
color="green" hide-details="auto">
|
||||
<template v-slot:selection="{ fileNames }">
|
||||
<template v-for="fileName in fileNames" :key="fileName">
|
||||
<v-chip size="small" label color="green" class="me-1 me-md-2">
|
||||
|
@ -88,32 +84,16 @@
|
|||
</v-file-input>
|
||||
</v-col>
|
||||
<v-col cols="12" md="4">
|
||||
<v-btn
|
||||
color="blue"
|
||||
variant="outlined"
|
||||
prepend-icon="mdi-clipboard-text"
|
||||
@click="pasteFromClipboard"
|
||||
block
|
||||
size="small"
|
||||
:loading="pastingFromClipboard"
|
||||
class="h-100"
|
||||
style="min-height: 50px; font-size: 14px;"
|
||||
>
|
||||
<v-btn color="blue" variant="outlined" prepend-icon="mdi-clipboard-text"
|
||||
@click="pasteFromClipboard" block size="small" :loading="pastingFromClipboard"
|
||||
class="h-100" style="min-height: 50px; font-size: 14px;">
|
||||
الصاق از کلیپ بورد
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-btn
|
||||
color="green"
|
||||
variant="flat"
|
||||
prepend-icon="mdi-key-plus"
|
||||
@click="showCSRDialog = true"
|
||||
block
|
||||
class="mt-3"
|
||||
size="small"
|
||||
style="min-height: 40px; font-size: 14px;"
|
||||
>
|
||||
<v-btn color="green" variant="flat" prepend-icon="mdi-key-plus" @click="showCSRDialog = true"
|
||||
block class="mt-3" size="small" style="min-height: 40px; font-size: 14px;">
|
||||
ساخت کلید جدید
|
||||
</v-btn>
|
||||
</div>
|
||||
|
@ -123,20 +103,17 @@
|
|||
<template v-slot:prepend>
|
||||
<v-icon color="green">mdi-check-circle</v-icon>
|
||||
</template>
|
||||
<div class="d-flex flex-column flex-sm-row align-start align-sm-center justify-space-between">
|
||||
<div
|
||||
class="d-flex flex-column flex-sm-row align-start align-sm-center justify-space-between">
|
||||
<div class="mb-2 mb-sm-0">
|
||||
<strong class="text-green-darken-2 text-body-2 text-sm-body-1">کلید خصوصی بارگذاری شده</strong>
|
||||
<strong class="text-green-darken-2 text-body-2 text-sm-body-1">کلید خصوصی بارگذاری
|
||||
شده</strong>
|
||||
<div class="text-caption mt-1 text-green-darken-1">
|
||||
فایل آماده استفاده است
|
||||
</div>
|
||||
</div>
|
||||
<v-btn
|
||||
size="small"
|
||||
color="error"
|
||||
variant="text"
|
||||
@click="clearFiles"
|
||||
prepend-icon="mdi-delete"
|
||||
>
|
||||
<v-btn size="small" color="error" variant="text" @click="clearFiles"
|
||||
prepend-icon="mdi-delete">
|
||||
حذف
|
||||
</v-btn>
|
||||
</div>
|
||||
|
@ -150,26 +127,24 @@
|
|||
<v-card variant="flat" class="pa-3 pa-md-4" color="info-lighten-5">
|
||||
<div class="d-flex align-center mb-3">
|
||||
<v-icon size="small" color="info" class="me-2">mdi-file-document</v-icon>
|
||||
<span class="text-subtitle-2 text-md-subtitle-1 font-weight-medium text-info-darken-2">محتوای فایل کلید خصوصی</span>
|
||||
<span
|
||||
class="text-subtitle-2 text-md-subtitle-1 font-weight-medium text-info-darken-2">محتوای
|
||||
فایل
|
||||
کلید خصوصی</span>
|
||||
</div>
|
||||
<v-textarea
|
||||
:value="getPrivateKeyPreview()"
|
||||
readonly
|
||||
:rows="$vuetify.display.smAndDown ? 8 : 12"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
class="font-family-monospace private-key-textarea"
|
||||
bg-color="white"
|
||||
color="info-darken-2"
|
||||
hide-details="auto"
|
||||
></v-textarea>
|
||||
<v-textarea :value="getPrivateKeyPreview()" readonly
|
||||
:rows="$vuetify.display.smAndDown ? 8 : 12" variant="outlined" density="compact"
|
||||
class="font-family-monospace private-key-textarea" bg-color="white" color="info-darken-2"
|
||||
hide-details="auto"></v-textarea>
|
||||
</v-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<v-card variant="outlined" class="pa-4 pa-md-6 text-center" color="grey-lighten-4">
|
||||
<v-icon size="48" size-md="64" color="grey-lighten-1" class="mb-3">mdi-file-document-outline</v-icon>
|
||||
<v-icon size="48" size-md="64" color="grey-lighten-1"
|
||||
class="mb-3">mdi-file-document-outline</v-icon>
|
||||
<div class="text-h6 text-md-h6 text-grey-darken-1 mb-2">فایل کلید خصوصی بارگذاری نشده</div>
|
||||
<div class="text-body-2 text-grey-darken-2">برای مشاهده محتوای فایل، ابتدا فایل کلید خصوصی را بارگذاری کنید</div>
|
||||
<div class="text-body-2 text-grey-darken-2">برای مشاهده محتوای فایل، ابتدا فایل کلید خصوصی را
|
||||
بارگذاری کنید</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</v-col>
|
||||
|
@ -181,10 +156,10 @@
|
|||
</v-card>
|
||||
</v-container>
|
||||
|
||||
<v-dialog v-model="showCSRDialog" max-width="600px">
|
||||
<v-dialog v-model="showCSRDialog" max-width="400px">
|
||||
<v-card>
|
||||
<v-card-title class="text-h6">
|
||||
ساخت کلید و CSR
|
||||
<v-card-title class="text-h6" icon="mdi-key-plus">
|
||||
ساخت کلید جدید
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="csrForm" v-model="csrFormValid">
|
||||
|
@ -192,7 +167,8 @@
|
|||
<div class="text-subtitle-2 mb-2">شخص</div>
|
||||
<v-radio-group v-model="csrData.personType" inline :error-messages="csrErrors.personType"
|
||||
@update:model-value="validatePersonType">
|
||||
<v-radio v-for="type in personTypes" :key="type.value" :label="type.title" :value="type.value"></v-radio>
|
||||
<v-radio v-for="type in personTypes" :key="type.value" :label="type.title"
|
||||
:value="type.value"></v-radio>
|
||||
</v-radio-group>
|
||||
</div>
|
||||
|
||||
|
@ -224,9 +200,9 @@
|
|||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-dialog v-model="showResultDialog" max-width="900px">
|
||||
<v-dialog v-model="showResultDialog" max-width="1000px">
|
||||
<v-card>
|
||||
<v-card-title class="text-h6 pb-0">ساخت کلید و CSR</v-card-title>
|
||||
<v-card-title class="text-h6 pb-0">ساخت کلید جدید</v-card-title>
|
||||
<v-card-text>
|
||||
<v-alert type="info" color="blue" class="mb-4" icon="mdi-alert">
|
||||
<span class="font-weight-bold">توجه: لطفا این اطلاعات را دانلود کنید و در یک جای امن نگهداری کنید. به
|
||||
|
@ -240,11 +216,11 @@
|
|||
<v-textarea readonly rows="10" :value="resultData.csr" variant="outlined"></v-textarea>
|
||||
<v-row class="mt-2">
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="copyToClipboard(resultData.csr)"><v-icon
|
||||
<v-btn color="green" block @click="copyToClipboard(resultData.csr)"><v-icon
|
||||
start>mdi-content-copy</v-icon>کپی</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="downloadFile(resultData.csr, 'csr.txt')"><v-icon
|
||||
<v-btn color="green" block @click="downloadFile(resultData.csr, 'csr.txt')"><v-icon
|
||||
start>mdi-download</v-icon>دانلود</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
@ -254,11 +230,11 @@
|
|||
<v-textarea readonly rows="10" :value="resultData.publicKey" variant="outlined"></v-textarea>
|
||||
<v-row class="mt-2">
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="copyToClipboard(resultData.publicKey)"><v-icon
|
||||
<v-btn color="green" block @click="copyToClipboard(resultData.publicKey)"><v-icon
|
||||
start>mdi-content-copy</v-icon>کپی</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="downloadFile(resultData.publicKey, 'public_key.txt')"><v-icon
|
||||
<v-btn color="green" block @click="downloadFile(resultData.publicKey, 'public_key.txt')"><v-icon
|
||||
start>mdi-download</v-icon>دانلود</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
@ -268,11 +244,11 @@
|
|||
<v-textarea readonly rows="10" :value="resultData.privateKey" variant="outlined"></v-textarea>
|
||||
<v-row class="mt-2">
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="copyToClipboard(resultData.privateKey)"><v-icon
|
||||
<v-btn color="green" block @click="copyToClipboard(resultData.privateKey)"><v-icon
|
||||
start>mdi-content-copy</v-icon>کپی</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-btn color="success" block @click="downloadFile(resultData.privateKey, 'private_key.txt')"><v-icon
|
||||
<v-btn color="green" block @click="downloadFile(resultData.privateKey, 'private_key.txt')"><v-icon
|
||||
start>mdi-download</v-icon>دانلود</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
@ -304,11 +280,11 @@ import Swal from 'sweetalert2';
|
|||
export default {
|
||||
name: 'TaxSettings',
|
||||
data: () => ({
|
||||
loading: false,
|
||||
csrLoading: false,
|
||||
pastingFromClipboard: false,
|
||||
showCSRDialog: false,
|
||||
showResultDialog: false,
|
||||
loading: false,
|
||||
csrLoading: false,
|
||||
pastingFromClipboard: false,
|
||||
showCSRDialog: false,
|
||||
showResultDialog: false,
|
||||
settings: {
|
||||
taxMemoryId: '',
|
||||
economicCode: '',
|
||||
|
@ -532,7 +508,7 @@ export default {
|
|||
validateAllFields() {
|
||||
this.validatePersonType();
|
||||
this.validateNationalId();
|
||||
|
||||
|
||||
if (this.csrData.personType === 'legal') {
|
||||
this.validateNameFa();
|
||||
this.validateNameEn();
|
||||
|
@ -568,39 +544,39 @@ export default {
|
|||
reader.readAsText(this.privateKeyFile);
|
||||
},
|
||||
|
||||
clearFiles() {
|
||||
this.privateKeyFile = null;
|
||||
this.settings.privateKey = '';
|
||||
this.fileErrors = {
|
||||
privateKey: [],
|
||||
};
|
||||
},
|
||||
async pasteFromClipboard() {
|
||||
this.pastingFromClipboard = true;
|
||||
try {
|
||||
const clipboardText = await navigator.clipboard.readText();
|
||||
|
||||
if (!clipboardText || clipboardText.trim() === '') {
|
||||
this.showSnackbar('کلیپ بورد خالی است', 'warning');
|
||||
return;
|
||||
}
|
||||
clearFiles() {
|
||||
this.privateKeyFile = null;
|
||||
this.settings.privateKey = '';
|
||||
this.fileErrors = {
|
||||
privateKey: [],
|
||||
};
|
||||
},
|
||||
async pasteFromClipboard() {
|
||||
this.pastingFromClipboard = true;
|
||||
try {
|
||||
const clipboardText = await navigator.clipboard.readText();
|
||||
|
||||
if (clipboardText.includes('-----BEGIN PRIVATE KEY-----') ||
|
||||
clipboardText.includes('-----BEGIN RSA PRIVATE KEY-----') ||
|
||||
clipboardText.includes('-----BEGIN OPENSSH PRIVATE KEY-----')) {
|
||||
|
||||
this.settings.privateKey = clipboardText.trim();
|
||||
this.showSnackbar('کلید خصوصی با موفقیت از کلیپ بورد الصاق شد', 'success');
|
||||
} else {
|
||||
this.showSnackbar('متن کلیپ بورد شامل کلید خصوصی معتبر نیست', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('خطا در خواندن کلیپبورد:', error);
|
||||
this.showSnackbar('خطا در دسترسی به کلیپ بورد. لطفا مجدداً تلاش کنید', 'error');
|
||||
} finally {
|
||||
this.pastingFromClipboard = false;
|
||||
}
|
||||
},
|
||||
if (!clipboardText || clipboardText.trim() === '') {
|
||||
this.showSnackbar('کلیپ بورد خالی است', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (clipboardText.includes('-----BEGIN PRIVATE KEY-----') ||
|
||||
clipboardText.includes('-----BEGIN RSA PRIVATE KEY-----') ||
|
||||
clipboardText.includes('-----BEGIN OPENSSH PRIVATE KEY-----')) {
|
||||
|
||||
this.settings.privateKey = clipboardText.trim();
|
||||
this.showSnackbar('کلید خصوصی با موفقیت از کلیپ بورد الصاق شد', 'success');
|
||||
} else {
|
||||
this.showSnackbar('متن کلیپ بورد شامل کلید خصوصی معتبر نیست', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('خطا در خواندن کلیپبورد:', error);
|
||||
this.showSnackbar('خطا در دسترسی به کلیپ بورد. لطفا مجدداً تلاش کنید', 'error');
|
||||
} finally {
|
||||
this.pastingFromClipboard = false;
|
||||
}
|
||||
},
|
||||
getPrivateKeyPreview() {
|
||||
if (!this.settings.privateKey) return '';
|
||||
return this.settings.privateKey;
|
||||
|
@ -622,4 +598,14 @@ export default {
|
|||
text-align: left !important;
|
||||
direction: ltr !important;
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
background: #17a2b8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-info:hover {
|
||||
background: #138496;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
</style>
|
|
@ -207,6 +207,10 @@
|
|||
|
||||
<div v-if="isPluginActive('taxsettings')" class="intro-footer">
|
||||
<div class="action-buttons">
|
||||
<router-link to="/acc/plugins/taxsettings/doc" class="btn btn-info">
|
||||
<i class="fas fa-book"></i>
|
||||
راهنمای کامل
|
||||
</router-link>
|
||||
<router-link to="/acc/plugins/tax/settings" class="btn btn-primary">
|
||||
<i class="fas fa-cog"></i>
|
||||
تنظیمات افزونه
|
||||
|
@ -578,6 +582,16 @@ export default {
|
|||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
background: #17a2b8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-info:hover {
|
||||
background: #138496;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.plugin-intro {
|
||||
padding: 15px;
|
||||
|
|
Loading…
Reference in a new issue