progress in inquery plugin

This commit is contained in:
Hesabix 2025-07-13 23:52:24 +00:00
parent 90f5a5b338
commit 7762613814
4 changed files with 88 additions and 4 deletions

View file

@ -430,7 +430,7 @@ class AdminController extends AbstractController
if (array_key_exists('rejectChequeInput', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproRejectChequeInput', $params['plugAccpro']['rejectChequeInput']);
}
return $this->json(JsonResp::success());
}
@ -450,6 +450,10 @@ class AdminController extends AbstractController
$resp['parsianGatewayAPI'] = $registryMGR->get('system', key: 'parsianGatewayAPI');
$resp['paypingKey'] = $registryMGR->get('system', key: 'paypingKey');
$resp['bitpayKey'] = $registryMGR->get('system', key: 'bitpayKey');
$resp['inquiryPanel'] = $registryMGR->get('system', key: 'inquiryPanel');
$resp['inquiryZohalAPIKey'] = $registryMGR->get('system', key: 'inquiryZohalAPIKey');
$resp['enablePostalCodeToAddress'] = $registryMGR->get('system', key: 'enablePostalCodeToAddress');
$resp['inquiryPanelEnable'] = $registryMGR->get('system', key: 'inquiryPanelEnable');
return $this->json($resp);
}
@ -474,6 +478,10 @@ class AdminController extends AbstractController
$registryMGR->update('system', 'parsianGatewayAPI', $params['parsianGatewayAPI']);
$registryMGR->update('system', 'paypingKey', $params['paypingKey']);
$registryMGR->update('system', 'bitpayKey', $params['bitpayKey']);
$registryMGR->update('system', 'inquiryPanel', $params['inquiryPanel']);
$registryMGR->update('system', 'inquiryZohalAPIKey', $params['inquiryZohalAPIKey']);
$registryMGR->update('system', 'enablePostalCodeToAddress', $params['enablePostalCodeToAddress']);
$registryMGR->update('system', 'inquiryPanelEnable', $params['inquiryPanelEnable']);
$entityManager->persist($item);
$entityManager->flush();
return $this->json(['result' => 1]);

View file

@ -1,6 +1,6 @@
<?php
namespace App\Controller\Plugins;
namespace App\Controller\Plugins\inquiry;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -31,6 +31,7 @@ class PlugInquiryMainController extends AbstractController
public function plugin_inquiry_settings_get(EntityManagerInterface $entityManager, Access $access) : JsonResponse
{
return $this->json([]);
}
}

View file

@ -812,6 +812,14 @@ const fa_lang = {
sms_settings_plug_accpro_pass_cheque_input: "واگذاری چک",
sms_settings_reject_cheque_input: "برگشت چک",
sms_settings_plug_accpro_reject_cheque_input: "برگشت چک",
inquiry_zohal_api_key: "کلید API زحل",
inquiry_zohal_api_key_des: "کلید API زحل برای دریافت اطلاعات از سامانه زحل",
inquiry_zohal_api_key_placeholder: "کلید API زحل",
inquiry_zohal_api_key_label: "کلید API زحل",
enable_postalcode_to_address: "تبدیل کد پستی به آدرس",
inquiry_panel_enable: "فعال سازی پنل سامانه استعلامات",
inquiry_panel: "پنل سامانه استعلامات",
inquiry_panel_zohal: "زحل",
app_site: "آدرس اینترفیس(رابط کاربری)",
keywords: "کلیدواژه‌ها با کاما (,) از هم جدا شوند",
zarinpal_api: "کد API زرین‌پال",

View file

@ -29,6 +29,13 @@ export default defineComponent({
props: { subtitle: 'bitpay.ir' },
},
],
inquiryPanel: [
{
title: 'پنل زحل',
value: 'zohal',
props: { subtitle: 'zohal.ir' },
},
],
systemInfo: {
keywords: '',
description: '',
@ -38,6 +45,10 @@ export default defineComponent({
parsianGatewayAPI: '',
paypingKey: '',
bitpayKey: '',
inquiryPanel: '',
inquiryZohalAPIKey: '',
enablePostalCodeToAddress: false,
inquiryPanelEnable: false,
},
loading: true,
}
@ -47,12 +58,32 @@ export default defineComponent({
this.loading = true;
axios.post('/api/admin/settings/system/info')
.then((response) => {
this.systemInfo = response.data;
// Convert string values to proper types for switches and selects
const data = response.data;
this.systemInfo = {
...data,
enablePostalCodeToAddress: data.enablePostalCodeToAddress === '1' || data.enablePostalCodeToAddress === true,
inquiryPanelEnable: data.inquiryPanelEnable === '1' || data.inquiryPanelEnable === true,
activeGateway: data.activeGateway || 'zarinpal',
inquiryPanel: data.inquiryPanel || 'zohal'
};
this.loading = false;
})
},
submit() {
this.loading = true;
// Validation: if inquiry panel is enabled, a panel must be selected
if (this.systemInfo.inquiryPanelEnable && !this.systemInfo.inquiryPanel) {
Swal.fire({
text: 'در صورت فعال بودن پنل سامانه استعلامات، حتماً باید یک پنل انتخاب شود.',
icon: 'error',
confirmButtonText: 'قبول',
});
this.loading = false;
return;
}
axios.post('/api/admin/settings/system/info/save', this.systemInfo).then((resp) => {
this.loading = false;
if (resp.data.result == 1) {
@ -77,7 +108,7 @@ export default defineComponent({
<v-spacer></v-spacer>
</v-toolbar>
<v-container class="pa-0">
<v-card :loading="loading ? 'red' : null" :disabled="loading">
<v-card :loading="loading" :disabled="loading">
<v-card-text class="">
<v-row class="mb-2">
<v-col cols="12" sm="12" md="12">
@ -106,6 +137,42 @@ export default defineComponent({
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.bitpay_api')"
v-model="systemInfo.bitpayKey" type="text" prepend-inner-icon="mdi-text"></v-text-field>
</v-col>
</v-row>
<v-row class="mb-2">
<v-col cols="12" sm="12" md="12">
<v-subheader>{{ $t('pages.manager.inquiry_panel') }}</v-subheader>
</v-col>
<v-col cols="12" sm="12" md="6">
<v-select v-model="systemInfo.inquiryPanel" hide-details="auto" prepend-inner-icon="mdi-signal" :items="inquiryPanel" item-title="title"
item-value="value" label="Select" single-line>
</v-select>
</v-col>
<v-col cols="12" sm="12" md="6">
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.inquiry_zohal_api_key')"
v-model="systemInfo.inquiryZohalAPIKey" type="text" prepend-inner-icon="mdi-text"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4">
<v-switch
v-model="systemInfo.inquiryPanelEnable"
:label="$t('pages.manager.inquiry_panel_enable')"
color="primary"
hide-details="auto"
inset
></v-switch>
</v-col>
<v-col cols="12" sm="12" md="4">
<v-switch
v-model="systemInfo.enablePostalCodeToAddress"
:label="$t('pages.manager.enable_postalcode_to_address')"
color="primary"
hide-details="auto"
inset
></v-switch>
</v-col>
</v-row>
<v-row class="mb-2">
<v-col cols="12" sm="12" md="12">
<v-btn type="submit" @click="submit()" color="primary" prepend-icon="mdi-content-save" :loading="loading">
{{ $t('dialog.save') }}