diff --git a/README.md b/README.md
index af186a5..0e88fe1 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,6 @@ For install hesabixCore you need this tools
* Copy or clone project in web server directory . if you use shared hosting panels like cpanel or directadmin copy files in root directory and public_html folder will be rewrited.
* create database in your DBMS and edit .env file in root of project
-
* Install dependencies with run this command
```
@@ -26,22 +25,28 @@ composer install
```
* edit .env file and set database connection string with your username and password and name of database
-
* create local env file with run this command
```
-composer dump-end prod
+composer dump-env prod
```
* login to your database managment like phpmyadmin and import file located in hesabixBackup/databaseFiles/hesabix-db-default.sql
-
* go to hesabixCore folder in cli and update database with this command
```
-php bin/console doctrine:schema:update --force
+php bin/console doctrine:schema:update --force --complete
```
+
open root domain address in browser you should see hesabix api main page.
+## Connect to email service
+
+For connect hesabix to your email service edit .env.local.php file located in hesabixCore folder and set your email server connection string in MAILER_DSN parameter. for more information about connection strings see symfony mailer documents. [Click Here](https://symfony.com/doc/current/mailer.html#transport-setup)
+
+after set connection string edit mailer.yaml located in configs folder and set header for send emails.
+
## Donation
+
for help developers please use this link
-[https://zarinp.al/hesabix.ir](https://zarinp.al/hesabix.ir)
\ No newline at end of file
+[https://zarinp.al/hesabix.ir](https://zarinp.al/hesabix.ir)
diff --git a/hesabixCore/.gitignore b/hesabixCore/.gitignore
index cc1b591..3e7b04d 100644
--- a/hesabixCore/.gitignore
+++ b/hesabixCore/.gitignore
@@ -6,7 +6,6 @@
/../public_html/bundles/
/../public_html/cdn/
/var/
-/templates/
/vendor/
/../hesabixArchive/
###< symfony/framework-bundle ###
diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php
index 944b306..107a090 100644
--- a/hesabixCore/src/Controller/AdminController.php
+++ b/hesabixCore/src/Controller/AdminController.php
@@ -69,8 +69,7 @@ class AdminController extends AbstractController
#[Route('/api/admin/has/role/{role}', name: 'app_admin_has_role')]
public function app_admin_has_role($role): JsonResponse
{
- if(!is_bool(array_search($role,$this->getUser()->getRoles())))
- {
+ if (!is_bool(array_search($role, $this->getUser()->getRoles()))) {
return $this->json([
'result' => true,
]);
@@ -81,44 +80,44 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/users/list', name: 'admin_users_list')]
- public function admin_users_list(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_users_list(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
- $users = $entityManager->getRepository(User::class)->findBy([],['id'=>'DESC']);
+ $users = $entityManager->getRepository(User::class)->findBy([], ['id' => 'DESC']);
$resp = [];
foreach ($users as $user) {
- $temp =[];
+ $temp = [];
$temp['id'] = $user->getId();
$temp['email'] = $user->getEmail();
$temp['mobile'] = $user->getMobile();
$temp['fullname'] = $user->getFullName();
$temp['status'] = $user->isActive();
- $temp['dateRegister'] = $jdate->jdate('Y/n/d',$user->getDateRegister());
- $temp['bidCount'] = count($entityManager->getRepository(Business::class)->findBy(['owner'=>$user]));
+ $temp['dateRegister'] = $jdate->jdate('Y/n/d', $user->getDateRegister());
+ $temp['bidCount'] = count($entityManager->getRepository(Business::class)->findBy(['owner' => $user]));
$resp[] = $temp;
}
return $this->json($resp);
}
#[Route('/api/admin/user/info/{id}', name: 'admin_user_info')]
- public function admin_user_info(string $id, Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_user_info(string $id, Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$user = $entityManager->getRepository(User::class)->find($id);
- $temp =[];
+ $temp = [];
$temp['id'] = $user->getId();
$temp['email'] = $user->getEmail();
$temp['mobile'] = $user->getMobile();
$temp['fullname'] = $user->getFullName();
$temp['status'] = $user->isActive();
- $temp['dateRegister'] = $jdate->jdate('Y/n/d',$user->getDateRegister());
- $temp['bidCount'] = count($entityManager->getRepository(Business::class)->findBy(['owner'=>$user]));
+ $temp['dateRegister'] = $jdate->jdate('Y/n/d', $user->getDateRegister());
+ $temp['bidCount'] = count($entityManager->getRepository(Business::class)->findBy(['owner' => $user]));
return $this->json($temp);
}
#[Route('/api/admin/business/info/{id}', name: 'admin_business_info')]
- public function admin_business_info(string $id,Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_business_info(string $id, Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$bid = $entityManager->getRepository(Business::class)->find($id);
- if(!$bid)
+ if (!$bid)
throw $this->createNotFoundException();
$resp = [];
$resp['id'] = $bid->getId();
@@ -127,21 +126,21 @@ class AdminController extends AbstractController
return $this->json($resp);
}
#[Route('/api/admin/business/list', name: 'admin_business_list')]
- public function admin_business_list(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_business_list(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
- $items = $entityManager->getRepository(Business::class)->findBy([],['id'=>'DESC']);
+ $items = $entityManager->getRepository(Business::class)->findBy([], ['id' => 'DESC']);
$resp = [];
foreach ($items as $item) {
- $temp =[];
+ $temp = [];
$temp['id'] = $item->getId();
$temp['name'] = $item->getName();
$temp['owner'] = $item->getOwner()->getFullName();
$temp['ownerMobile'] = $item->getOwner()->getMobile();
- $temp['dateRegister'] = $jdate->jdate('Y/n/d',$item->getDateSubmit());
- $temp['commodityCount'] = count($entityManager->getRepository(Commodity::class)->findBy(['bid'=>$item]));
- $temp['personsCount'] = count($entityManager->getRepository(Person::class)->findBy(['bid'=>$item]));
- $temp['hesabdariDocsCount'] = count($entityManager->getRepository(HesabdariDoc::class)->findBy(['bid'=>$item]));
- $temp['StoreroomDocsCount'] = count($entityManager->getRepository(StoreroomTicket::class)->findBy(['bid'=>$item]));
+ $temp['dateRegister'] = $jdate->jdate('Y/n/d', $item->getDateSubmit());
+ $temp['commodityCount'] = count($entityManager->getRepository(Commodity::class)->findBy(['bid' => $item]));
+ $temp['personsCount'] = count($entityManager->getRepository(Person::class)->findBy(['bid' => $item]));
+ $temp['hesabdariDocsCount'] = count($entityManager->getRepository(HesabdariDoc::class)->findBy(['bid' => $item]));
+ $temp['StoreroomDocsCount'] = count($entityManager->getRepository(StoreroomTicket::class)->findBy(['bid' => $item]));
$resp[] = $temp;
}
@@ -149,7 +148,7 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/settings/sms/info', name: 'admin_settings_sms_info')]
- public function admin_settings_sms_info(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_settings_sms_info(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
$resp = [];
@@ -158,9 +157,13 @@ class AdminController extends AbstractController
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER,
- array('Content-Type: application/json',
- 'Content-Length: 0')
+ curl_setopt(
+ $ch,
+ CURLOPT_HTTPHEADER,
+ array(
+ 'Content-Type: application/json',
+ 'Content-Length: 0'
+ )
);
$result = curl_exec($ch);
$err = curl_error($ch);
@@ -177,13 +180,13 @@ class AdminController extends AbstractController
return $this->json($resp);
}
#[Route('/api/admin/settings/sms/info/save', name: 'admin_settings_sms_info_save')]
- public function admin_settings_sms_info_save(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_settings_sms_info_save(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
- if(array_key_exists('username',$params) && array_key_exists('password',$params) && array_key_exists('token',$params)){
+ if (array_key_exists('username', $params) && array_key_exists('password', $params) && array_key_exists('token', $params)) {
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
$item->setPayamakPassword($params['password']);
$item->setPayamakUsername($params['username']);
@@ -196,64 +199,82 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/sms/plan/info', name: 'admin_sms_plan_info')]
- public function admin_sms_plan_info(registryMGR $registryMGR,Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_sms_plan_info(registryMGR $registryMGR, Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$resp = [];
- $resp['username'] = $registryMGR->get('sms','username');
- $resp['password'] = $registryMGR->get('sms','password');
- $resp['token'] = $registryMGR->get('sms','token');
- $resp['walletpay'] = $registryMGR->get('sms','walletPay');
- $resp['changePassword'] = $registryMGR->get('sms','changePassword');
- $resp['recPassword'] = $registryMGR->get('sms','recPassword');
- $resp['f2a'] = $registryMGR->get('sms','f2a');
- $resp['ticketReplay'] = $registryMGR->get('sms','ticketReplay');
- $resp['ticketRec'] = $registryMGR->get('sms','ticketRec');
- $resp['fromNum'] = $registryMGR->get('sms','fromNum');
- $resp['sharefaktor'] = $registryMGR->get('sms','sharefaktor');
- $resp['plan'] = $registryMGR->get('sms','plan');
+ $resp['username'] = $registryMGR->get('sms', 'username');
+ $resp['password'] = $registryMGR->get('sms', 'password');
+ $resp['token'] = $registryMGR->get('sms', 'token');
+ $resp['walletpay'] = $registryMGR->get('sms', 'walletPay');
+ $resp['changePassword'] = $registryMGR->get('sms', 'changePassword');
+ $resp['recPassword'] = $registryMGR->get('sms', 'recPassword');
+ $resp['f2a'] = $registryMGR->get('sms', 'f2a');
+ $resp['ticketReplay'] = $registryMGR->get('sms', 'ticketReplay');
+ $resp['ticketRec'] = $registryMGR->get('sms', 'ticketRec');
+ $resp['fromNum'] = $registryMGR->get('sms', 'fromNum');
+ $resp['sharefaktor'] = $registryMGR->get('sms', 'sharefaktor');
+ $resp['plan'] = $registryMGR->get('sms', 'plan');
+ $resp['plugRepservice'] = [
+ 'get' => $registryMGR->get('sms', 'plugRepserviceStateGet'),
+ 'getback' => $registryMGR->get('sms', 'plugRepserviceStateGetback'),
+ 'repired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'),
+ 'unrepired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired')
+ ];
return $this->json($resp);
}
#[Route('/api/admin/sms/plan/info/save', name: 'admin_sms_plan_info_save')]
- public function admin_sms_plan_info_save(registryMGR $registryMGR,Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_sms_plan_info_save(registryMGR $registryMGR, Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
- if(array_key_exists('username',$params))
- $registryMGR->update('sms','username',$params['username']);
- if(array_key_exists('password',$params))
- $registryMGR->update('sms','password',$params['password']);
- if(array_key_exists('token',$params))
- $registryMGR->update('sms','token',$params['token']);
+ if (array_key_exists('username', $params))
+ $registryMGR->update('sms', 'username', $params['username']);
+ if (array_key_exists('password', $params))
+ $registryMGR->update('sms', 'password', $params['password']);
+ if (array_key_exists('token', $params))
+ $registryMGR->update('sms', 'token', $params['token']);
+
+ if (array_key_exists('walletpay', $params))
+ $registryMGR->update('sms', 'walletpay', $params['walletpay']);
+ if (array_key_exists('changePassword', $params))
+ $registryMGR->update('sms', 'changePassword', $params['changePassword']);
+ if (array_key_exists('recPassword', $params))
+ $registryMGR->update('sms', 'recPassword', $params['recPassword']);
+ if (array_key_exists('f2a', $params))
+ $registryMGR->update('sms', 'f2a', $params['f2a']);
+ if (array_key_exists('ticketReplay', $params))
+ $registryMGR->update('sms', 'ticketReplay', $params['ticketReplay']);
+ if (array_key_exists('ticketRec', $params))
+ $registryMGR->update('sms', 'ticketRec', $params['ticketRec']);
+ if (array_key_exists('fromNum', $params))
+ $registryMGR->update('sms', 'fromNum', $params['fromNum']);
+ if (array_key_exists('sharefaktor', $params))
+ $registryMGR->update('sms', 'sharefaktor', $params['sharefaktor']);
+ if (array_key_exists('plan', $params))
+ $registryMGR->update('sms', 'plan', $params['plan']);
+
+ if (array_key_exists('plugRepservice', $params)) {
+ if (array_key_exists('get', $params['plugRepservice']))
+ $registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['plugRepserviceStateGet']);
+ if (array_key_exists('repired', $params['plugRepservice']))
+ $registryMGR->update('sms', 'plugRepserviceStateRepaired', $params['plugRepservice']['repired']);
+ if (array_key_exists('plugRepserviceStateGet', $params['plugRepservice']))
+ $registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['plugRepserviceStateGet']);
+ if (array_key_exists('plugRepserviceStateGet', $params['plugRepservice']))
+ $registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['plugRepserviceStateGet']);
+ }
+
- if(array_key_exists('walletpay',$params))
- $registryMGR->update('sms','walletpay',$params['walletpay']);
- if(array_key_exists('changePassword',$params))
- $registryMGR->update('sms','changePassword',$params['changePassword']);
- if(array_key_exists('recPassword',$params))
- $registryMGR->update('sms','recPassword',$params['recPassword']);
- if(array_key_exists('f2a',$params))
- $registryMGR->update('sms','f2a',$params['f2a']);
- if(array_key_exists('ticketReplay',$params))
- $registryMGR->update('sms','ticketReplay',$params['ticketReplay']);
- if(array_key_exists('ticketRec',$params))
- $registryMGR->update('sms','ticketRec',$params['ticketRec']);
- if(array_key_exists('fromNum',$params))
- $registryMGR->update('sms','fromNum',$params['fromNum']);
- if(array_key_exists('sharefaktor',$params))
- $registryMGR->update('sms','sharefaktor',$params['sharefaktor']);
- if(array_key_exists('plan',$params))
- $registryMGR->update('sms','plan',$params['plan']);
-
return $this->json(JsonResp::success());
}
#[Route('/api/admin/settings/system/info', name: 'admin_settings_system_info')]
- public function admin_settings_system_info(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_settings_system_info(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
$resp = [];
@@ -269,13 +290,13 @@ class AdminController extends AbstractController
#[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')]
- public function admin_settings_system_info_save(Registry $registry, EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_settings_system_info_save(Registry $registry, EntityManagerInterface $entityManager, Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
- if(array_key_exists('keywords',$params) && array_key_exists('description',$params)){
+ if (array_key_exists('keywords', $params) && array_key_exists('description', $params)) {
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
$item->setSiteKeywords($params['keywords']);
$item->setDiscription($params['description']);
@@ -292,81 +313,79 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/reportchange/lists', name: 'app_admin_reportchange_list')]
- public function app_admin_reportchange_list(Jdate $jdate,Provider $provider,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_reportchange_list(Jdate $jdate, Provider $provider, EntityManagerInterface $entityManager): JsonResponse
{
- $rows = $entityManager->getRepository(ChangeReport::class)->findBy([],['id'=>'DESC']);
- foreach ($rows as $row){
- $row->setDateSubmit($jdate->jdate('Y/n/d',$row->getDateSubmit()));
+ $rows = $entityManager->getRepository(ChangeReport::class)->findBy([], ['id' => 'DESC']);
+ foreach ($rows as $row) {
+ $row->setDateSubmit($jdate->jdate('Y/n/d', $row->getDateSubmit()));
}
- return $this->json($provider->ArrayEntity2ArrayJustIncludes($rows,['getDateSubmit','getVersion','getId']));
+ return $this->json($provider->ArrayEntity2ArrayJustIncludes($rows, ['getDateSubmit', 'getVersion', 'getId']));
}
#[Route('/api/admin/reportchange/delete/{id}', name: 'app_admin_reportchange_delete')]
- public function app_admin_reportchange_delete(string $id,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_reportchange_delete(string $id, EntityManagerInterface $entityManager): JsonResponse
{
$item = $entityManager->getRepository(ChangeReport::class)->find($id);
- if($item){
+ if ($item) {
$entityManager->remove($item);
$entityManager->flush();
}
- return $this->json(['result'=>1]);
+ return $this->json(['result' => 1]);
}
#[Route('/api/admin/reportchange/get/{id}', name: 'app_admin_reportchange_get')]
- public function app_admin_reportchange_get(string $id,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_reportchange_get(string $id, EntityManagerInterface $entityManager): JsonResponse
{
$item = $entityManager->getRepository(ChangeReport::class)->find($id);
- if(!$item)
+ if (!$item)
throw $this->createNotFoundException();
return $this->json($item);
}
#[Route('/api/admin/reportchange/mod/{id}', name: 'app_admin_reportchange_mod')]
- public function app_admin_reportchange_mod(Request $request,EntityManagerInterface $entityManager, int $id = 0): JsonResponse
+ public function app_admin_reportchange_mod(Request $request, EntityManagerInterface $entityManager, int $id = 0): JsonResponse
{
$item = new ChangeReport();
$item->setDateSubmit(time());
- if($id != 0){
+ if ($id != 0) {
$item = $entityManager->getRepository(ChangeReport::class)->find($id);
- if(!$item)
+ if (!$item)
throw $this->createNotFoundException();
else
$item->setDateSubmit(time());
-
}
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
- if(array_key_exists('version',$params) && array_key_exists('body',$params)){
+ if (array_key_exists('version', $params) && array_key_exists('body', $params)) {
$item->setBody($params['body']);
$item->setVersion($params['version']);
- }
- else
+ } else
throw $this->createNotFoundException();
$entityManager->persist($item);
$entityManager->flush();
- return $this->json(['result'=>1]);
+ return $this->json(['result' => 1]);
}
#[Route('/api/admin/wallets/list', name: 'app_admin_wallets_list')]
- public function app_admin_wallets_list(Jdate $jdate,Provider $provider,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_wallets_list(Jdate $jdate, Provider $provider, EntityManagerInterface $entityManager): JsonResponse
{
- $bids = $entityManager->getRepository(Business::class)->findBy(['walletEnable'=>true]);
+ $bids = $entityManager->getRepository(Business::class)->findBy(['walletEnable' => true]);
$resp = [];
- foreach ($bids as $bid){
+ foreach ($bids as $bid) {
$temp = [];
- $walletPays = $entityManager->getRepository(WalletTransaction::class)->findBy(['bid'=>$bid,'type'=>'pay']);
+ $walletPays = $entityManager->getRepository(WalletTransaction::class)->findBy(['bid' => $bid, 'type' => 'pay']);
$totalPays = 0;
- foreach ($walletPays as $walletPay){
+ foreach ($walletPays as $walletPay) {
$totalPays += $walletPay->getAmount();
}
$temp['totalPays'] = $totalPays;
$walletIncomes = $entityManager->getRepository(WalletTransaction::class)->findAllIncome($bid);
$totalIcome = 0;
- foreach ($walletIncomes as $walletIncome){
+ foreach ($walletIncomes as $walletIncome) {
$totalIcome += $walletIncome->getAmount();
}
$temp['totalIncome'] = $totalIcome;
@@ -374,7 +393,7 @@ class AdminController extends AbstractController
$temp['id'] = $bid->getId();
$temp['bidName'] = $bid->getName();
$temp['walletEnabled'] = $bid->isWalletEnable();
- if($bid->isWalletEnable()){
+ if ($bid->isWalletEnable()) {
$temp['bankAcName'] = $bid->getWalletMatchBank()->getName();
$temp['bankAcShaba'] = $bid->getWalletMatchBank()->getShaba();
$temp['bankAcOwner'] = $bid->getWalletMatchBank()->getOwner();
@@ -387,11 +406,11 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/wallets/transactions/list', name: 'app_admin_wallets_transactions_list')]
- public function app_admin_wallets_transactions_list(Jdate $jdate,Provider $provider,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_wallets_transactions_list(Jdate $jdate, Provider $provider, EntityManagerInterface $entityManager): JsonResponse
{
$items = $entityManager->getRepository(WalletTransaction::class)->findAll();
$resp = [];
- foreach ($items as $item){
+ foreach ($items as $item) {
$temp = [];
$temp['id'] = $item->getId();
$temp['bidName'] = $item->getBid()->getName();
@@ -404,7 +423,7 @@ class AdminController extends AbstractController
$temp['cardPan'] = $item->getCardPan();
$temp['refID'] = $item->getRefID();
$temp['shaba'] = $item->getShaba();
- $temp['dateSubmit'] = $jdate->jdate('Y/n/d H:i',$item->getDateSubmit());
+ $temp['dateSubmit'] = $jdate->jdate('Y/n/d H:i', $item->getDateSubmit());
$temp['gatePay'] = $item->getGatePay();
$resp[] = $temp;
}
@@ -412,15 +431,15 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/wallets/transactions/insert', name: 'app_admin_wallets_transactions_insert')]
- public function app_admin_wallets_transactions_insert(registryMGR $registryMGR, SMS $SMS,Jdate $jdate,Notification $notification,Request $request,EntityManagerInterface $entityManager): JsonResponse
+ public function app_admin_wallets_transactions_insert(registryMGR $registryMGR, SMS $SMS, Jdate $jdate, Notification $notification, Request $request, EntityManagerInterface $entityManager): JsonResponse
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
- if(array_key_exists('bank',$params) && array_key_exists('refID',$params) && array_key_exists('bid',$params) && array_key_exists('amount',$params) && array_key_exists('shaba',$params) && array_key_exists('card',$params)){
+ if (array_key_exists('bank', $params) && array_key_exists('refID', $params) && array_key_exists('bid', $params) && array_key_exists('amount', $params) && array_key_exists('shaba', $params) && array_key_exists('card', $params)) {
$bid = $entityManager->getRepository(Business::class)->find($params['bid']['id']);
- if(!$bid)
+ if (!$bid)
throw $this->createNotFoundException();
$item = new WalletTransaction();
$item->setBid($bid);
@@ -435,14 +454,13 @@ class AdminController extends AbstractController
$item->setBank($bid->getWalletMatchBank()->getName());
$entityManager->persist($item);
$entityManager->flush();
- $notification->insert('تسویه کیف پول انجام شد.','/acc/wallet/view',$bid,$bid->getOwner());
+ $notification->insert('تسویه کیف پول انجام شد.', '/acc/wallet/view', $bid, $bid->getOwner());
$SMS->send(
[$bid->getName()],
- $registryMGR->get('sms','walletpay'),
+ $registryMGR->get('sms', 'walletpay'),
$bid->getOwner()->getMobile()
);
return $this->json(['result' => 1]);
-
}
throw $this->createNotFoundException();
}
@@ -451,7 +469,7 @@ class AdminController extends AbstractController
* @throws Exception
*/
#[Route('/api/admin/database/backup/create', name: 'app_admin_database_backup_create')]
- public function app_admin_database_backup_create(KernelInterface $kernel):JsonResponse
+ public function app_admin_database_backup_create(KernelInterface $kernel): JsonResponse
{
$application = new Application($kernel);
$application->setAutoExit(false);
@@ -468,12 +486,12 @@ class AdminController extends AbstractController
// return the output, don't use if you used NullOutput()
$content = $output->fetch();
$time = time();
- $file = fopen(dirname(__DIR__, 3) . '/hesabixBackup/versions/Hesabix-'. $time . '.sql' ,'w');
- fwrite($file,$content);
+ $file = fopen(dirname(__DIR__, 3) . '/hesabixBackup/versions/Hesabix-' . $time . '.sql', 'w');
+ fwrite($file, $content);
fclose($file);
return $this->json([
'result' => 0,
- 'filename'=>'Hesabix-' . $time . '.sql',
+ 'filename' => 'Hesabix-' . $time . '.sql',
]);
}
}
diff --git a/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php b/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php
index 0a0e5e5..a262d86 100644
--- a/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php
+++ b/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php
@@ -12,6 +12,7 @@ use App\Service\Extractor;
use App\Service\registryMGR;
use App\Entity\PlugRepserviceOrder;
use App\Entity\PlugRepserviceOrderState;
+use App\Service\Explore;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -37,6 +38,7 @@ class PlugRepserviceController extends AbstractController
!array_key_exists('pelak', $params) ||
!array_key_exists('person', $params) ||
!array_key_exists('serial', $params) ||
+ !array_key_exists('motaleghat', $params) ||
!array_key_exists('date', $params)
)
return $this->json($extractor->paramsNotSend());
@@ -72,6 +74,7 @@ class PlugRepserviceController extends AbstractController
$order->setPerson($person);
$order->setDate($params['date']);
$order->setDes($params['des']);
+ $order->setMotaleghat($params['motaleghat']);
$order->setPelak($params['pelak']);
$order->setSerial($params['serial']);
$order->setState($entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findOneBy(['code' => 'get']));
@@ -107,4 +110,157 @@ class PlugRepserviceController extends AbstractController
return $this->json($extractor->operationSuccess());
}
+
+ #[Route('/api/plug/repservice/order/state/change', name: 'app_plug_repservice_order_state_change')]
+ public function app_plug_repservice_order_state_change(Provider $provider, registryMGR $registryMGR, SMS $sms, Log $log, EntityManagerInterface $entityManagerInterface, Access $access, Request $request, Extractor $extractor): JsonResponse
+ {
+ $acc = $access->hasRole('plugRepservice');
+ if (!$acc)
+ throw $this->createAccessDeniedException();
+ $params = [];
+ if ($content = $request->getContent()) {
+ $params = json_decode($content, true);
+ }
+ if (
+ !array_key_exists('code', $params) ||
+ !array_key_exists('state', $params) ||
+ !array_key_exists('sms', $params)
+ )
+ return $this->json($extractor->paramsNotSend());
+
+ $order = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findOneBy([
+ 'bid' => $acc['bid'],
+ 'code' => $params['code']
+ ]);
+ if (!$order) {
+ return $this->json($extractor->notFound());
+ }
+
+ //find state
+ $state = $entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findOneBy([
+ 'code' => $params['state']['code']
+ ]);
+ if (!$state) {
+ return $this->json($extractor->notFound());
+ }
+ $order->setState($state);
+ $entityManagerInterface->persist($order);
+ $entityManagerInterface->flush();
+ $log->insert('افزونه تعمیرکاران', ' وضعیت کالا با کد ' . $order->getCode() . ' به ' . $state->getLabel() . 'تغییر یافت.', $this->getUser(), $acc['bid']->getId());
+
+ if (array_key_exists('sms', $params)) {
+ //get state sms code
+ if($params['state']['code'] == 'get') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGet');
+ elseif($params['state']['code'] == 'repaired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateRepaired');
+ elseif($params['state']['code'] == 'unrepired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateUnrepired');
+ else $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGetback');
+ if ($params['sms'] == true) {
+ //going to send sms
+ $smsres = $sms->sendByBalance(
+ [
+ $order->getPerson()->getNikename(),
+ $order->getCode(),
+ $acc['bid']->getName(),
+ $acc['bid']->getId() . '/' . $order->getShortlink()
+ ],
+ $smsPattern,
+ $order->getPerson()->getMobile(),
+ $acc['bid'],
+ $this->getUser(),
+ 1
+ );
+ if ($smsres == 2) {
+ return $this->json([
+ 'code' => 11,
+ 'data' => '',
+ 'message' => 'operation success but sms not send'
+ ]);
+ }
+ }
+ }
+
+ return $this->json($extractor->operationSuccess());
+ }
+
+ #[Route('/api/plug/repservice/order/list', name: 'app_plug_repservice_order_list')]
+ public function app_plug_repservice_order_list(Provider $provider, registryMGR $registryMGR, SMS $sms, Log $log, EntityManagerInterface $entityManagerInterface, Access $access, Request $request, Extractor $extractor): JsonResponse
+ {
+ $acc = $access->hasRole('plugRepservice');
+ if (!$acc)
+ throw $this->createAccessDeniedException();
+ $params = [];
+ if ($content = $request->getContent()) {
+ $params = json_decode($content, true);
+ }
+
+ $orders = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findBy([
+ 'bid' => $acc['bid']
+ ]);
+ return $this->json($this->ExploreOrders($orders));
+ }
+
+ #[Route('/api/plug/repservice/order/state/list', name: 'app_plug_repservice_order_state_list')]
+ public function app_plug_repservice_order_state_list(Provider $provider, registryMGR $registryMGR, SMS $sms, Log $log, EntityManagerInterface $entityManagerInterface, Access $access, Request $request, Extractor $extractor): JsonResponse
+ {
+ $acc = $access->hasRole('plugRepservice');
+ if (!$acc)
+ throw $this->createAccessDeniedException();
+ $items = $entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findAll();
+ $res = [];
+ foreach ($items as $item) {
+ $res[] = [
+ 'code' => $item->getCode(),
+ 'label' => $item->getLabel()
+ ];
+ }
+ return $this->json($res);
+ }
+
+ #[Route('/api/repservice/order/remove/{code}', name: 'app_plug_repservice_order_remove')]
+ public function app_plug_repservice_order_remove(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse
+ {
+ $acc = $access->hasRole('plugRepservice');
+ if (!$acc)
+ throw $this->createAccessDeniedException();
+
+ $item = $entityManager->getRepository(PlugRepserviceOrder::class)->findOneBy(['bid' => $acc['bid'], 'code' => $code]);
+ if (!$item)
+ throw $this->createNotFoundException();
+ $code = $item->getCode();
+ $entityManager->remove($item);
+ $log->insert('افزونه تعمیرکاران', 'درخواست با شماره قبض' . $code . 'حذف شد.', $this->getUser(), $acc['bid']->getId());
+ return $this->json(['result' => 1]);
+ }
+
+ private function ExploreOrder(PlugRepserviceOrder $item)
+ {
+ $temp = [
+ 'id' => $item->getId(),
+ 'code' => $item->getCode(),
+ 'person' => Explore::ExplorePerson($item->getPerson()),
+ 'commodity' => Explore::ExploreCommodity($item->getCommodity()),
+ 'des' => $item->getDes(),
+ 'pelak' => $item->getPelak(),
+ 'serial' => $item->getSerial(),
+ 'motaleghat' => $item->getMotaleghat(),
+ 'date' => $item->getDate(),
+ 'shortLink' => $item->getShortlink(),
+ 'state' => [
+ 'code' => $item->getState()->getCode(),
+ 'label' => $item->getState()->getLabel()
+ ],
+ 'sms' => true
+ ];
+
+ return $temp;
+ }
+
+ private function ExploreOrders(array $items)
+ {
+ $res = [];
+ foreach ($items as $item) {
+ $res[] = $this->ExploreOrder($item);
+ }
+ return $res;
+ }
}
diff --git a/hesabixCore/src/Entity/PlugRepserviceOrder.php b/hesabixCore/src/Entity/PlugRepserviceOrder.php
index 13b2a13..1629a0c 100644
--- a/hesabixCore/src/Entity/PlugRepserviceOrder.php
+++ b/hesabixCore/src/Entity/PlugRepserviceOrder.php
@@ -54,6 +54,9 @@ class PlugRepserviceOrder
#[ORM\Column(length: 50)]
private ?string $shortlink = null;
+ #[ORM\Column(length: 255, nullable: true)]
+ private ?string $motaleghat = null;
+
public function getId(): ?int
{
return $this->id;
@@ -202,4 +205,16 @@ class PlugRepserviceOrder
return $this;
}
+
+ public function getMotaleghat(): ?string
+ {
+ return $this->motaleghat;
+ }
+
+ public function setMotaleghat(?string $motaleghat): static
+ {
+ $this->motaleghat = $motaleghat;
+
+ return $this;
+ }
}
diff --git a/hesabixCore/templates/app/base.html.twig b/hesabixCore/templates/app/base.html.twig
index d35a3d5..a1bfae2 100644
--- a/hesabixCore/templates/app/base.html.twig
+++ b/hesabixCore/templates/app/base.html.twig
@@ -4,7 +4,7 @@
-
+
{% block title %}{% endblock %}
@@ -51,7 +51,7 @@
- (مدیریت) حسابکس
+ (مدیریت) حسابیکس
diff --git a/hesabixCore/templates/base-new.html.twig b/hesabixCore/templates/base-new.html.twig
index bd406a1..31d090c 100644
--- a/hesabixCore/templates/base-new.html.twig
+++ b/hesabixCore/templates/base-new.html.twig
@@ -4,10 +4,10 @@
-
+
- حسابکس - {% block title %}{% endblock %}
+ حسابیکس - {% block title %}{% endblock %}
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
@@ -40,15 +40,15 @@