diff --git a/hesabixArchive/temp/140050100014298555-0-655d1b5c85662.pdf b/hesabixArchive/temp/140050100014298555-0-655d1b5c85662.pdf new file mode 100644 index 0000000..91b648a Binary files /dev/null and b/hesabixArchive/temp/140050100014298555-0-655d1b5c85662.pdf differ diff --git a/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d170fc445c.png b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d170fc445c.png new file mode 100644 index 0000000..9dd5448 Binary files /dev/null and b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d170fc445c.png differ diff --git a/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d28811b118.png b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d28811b118.png new file mode 100644 index 0000000..9dd5448 Binary files /dev/null and b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-45-29-655d28811b118.png differ diff --git a/hesabixArchive/temp/Screenshot-from-2023-10-20-03-46-15-655d1ae67e815.png b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-46-15-655d1ae67e815.png new file mode 100644 index 0000000..cd7eea5 Binary files /dev/null and b/hesabixArchive/temp/Screenshot-from-2023-10-20-03-46-15-655d1ae67e815.png differ diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php index 36f42e1..f78da2b 100644 --- a/hesabixCore/src/Controller/AdminController.php +++ b/hesabixCore/src/Controller/AdminController.php @@ -176,6 +176,35 @@ class AdminController extends AbstractController } throw $this->createNotFoundException(); } + + #[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 + { + $item = $entityManager->getRepository(Settings::class)->findAll()[0]; + $resp = []; + $resp['keywords'] = $item->getSiteKeywords(); + $resp['description'] = $item->getDiscription(); + return $this->json($resp); + } + + #[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')] + public function admin_settings_system_info_save(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)){ + $item = $entityManager->getRepository(Settings::class)->findAll()[0]; + $item->setSiteKeywords($params['keywords']); + $item->setDiscription($params['description']); + $entityManager->persist($item); + $entityManager->flush(); + return $this->json(['result' => 1]); + } + throw $this->createNotFoundException(); + } + #[Route('/api/admin/reportchange/lists', name: 'app_admin_reportchange_list')] public function app_admin_reportchange_list(Jdate $jdate,Provider $provider,EntityManagerInterface $entityManager): JsonResponse { diff --git a/hesabixCore/src/Controller/ArchiveController.php b/hesabixCore/src/Controller/ArchiveController.php index 086cf0d..7792956 100644 --- a/hesabixCore/src/Controller/ArchiveController.php +++ b/hesabixCore/src/Controller/ArchiveController.php @@ -232,7 +232,7 @@ class ArchiveController extends AbstractController } #[Route('/api/archive/file/upload', name: 'app_archive_file_upload')] - public function app_archive_file_upload(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): Response + public function app_archive_file_upload(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse { $acc = $access->hasRole('archiveUpload'); if (!$acc) @@ -247,21 +247,30 @@ class ArchiveController extends AbstractController $newFilename = $safeFilename.'-'.uniqid().'.'.$uploadedFile->guessExtension(); // Move the file to the directory where brochures are stored - + try { $uploadedFile->move( $this->getParameter('archiveTempMediaDir'), $newFilename - ); - try {} catch (FileException $e) { + );} catch (FileException $e) { // ... handle exception if something happens during file upload } // updates the 'brochureFilename' property to store the PDF file name // instead of its contents //$product->setBrochureFilename($newFilename); - return new Response('ali.jpg'); + return $this->json(['name'=>$newFilename]); } } + } + #[Route('/api/archive/file/save', name: 'app_archive_file_save')] + public function app_archive_file_save(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse + { + $acc = $access->hasRole('archiveUpload'); + if (!$acc) + throw $this->createAccessDeniedException(); + return $this->json([ + 'ok'=>$request->get('doctype') + ]); } } diff --git a/hesabixCore/src/Controller/Front/BlogController.php b/hesabixCore/src/Controller/Front/BlogController.php index 56b3f78..b9b977f 100644 --- a/hesabixCore/src/Controller/Front/BlogController.php +++ b/hesabixCore/src/Controller/Front/BlogController.php @@ -44,14 +44,14 @@ class BlogController extends AbstractController $comment = new BlogComment(); $form = $this->createForm(CommentType::class,$comment); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid() && $this->getUser()){ + if($form->isSubmitted() && $form->isValid()){ + echo 11; $oldComments = $entityManager->getRepository(BlogComment::class)->findBy([ - 'submitter'=>$this->getUser() + 'email'=>$comment->getEmail() ],['id'=>'DESC']); if(count($oldComments) == 0){ $comment->setDateSubmit(time()); $comment->setPost($item); - $comment->setSubmitter($this->getUser()); $entityManager->persist($comment); $entityManager->flush(); $comment->setBody(''); diff --git a/hesabixCore/src/Entity/BlogComment.php b/hesabixCore/src/Entity/BlogComment.php index 8f4212d..646e735 100644 --- a/hesabixCore/src/Entity/BlogComment.php +++ b/hesabixCore/src/Entity/BlogComment.php @@ -14,10 +14,6 @@ class BlogComment #[ORM\Column] private ?int $id = null; - #[ORM\ManyToOne(inversedBy: 'blogComments')] - #[ORM\JoinColumn(nullable: false)] - private ?User $submitter = null; - #[ORM\Column(length: 255)] private ?string $dateSubmit = null; @@ -45,18 +41,6 @@ class BlogComment return $this->id; } - public function getSubmitter(): ?User - { - return $this->submitter; - } - - public function setSubmitter(?User $submitter): self - { - $this->submitter = $submitter; - - return $this; - } - public function getDateSubmit(): ?string { return $this->dateSubmit; diff --git a/hesabixCore/src/Entity/Settings.php b/hesabixCore/src/Entity/Settings.php index 5e01804..5fb2648 100644 --- a/hesabixCore/src/Entity/Settings.php +++ b/hesabixCore/src/Entity/Settings.php @@ -3,6 +3,7 @@ namespace App\Entity; use App\Repository\SettingsRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: SettingsRepository::class)] @@ -34,6 +35,12 @@ class Settings #[ORM\Column(length: 255, nullable: true)] private ?string $melipayamakToken = null; + #[ORM\Column(type: Types::TEXT, nullable: true)] + private ?string $siteKeywords = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $discription = null; + public function getId(): ?int { return $this->id; @@ -122,4 +129,28 @@ class Settings return $this; } + + public function getSiteKeywords(): ?string + { + return $this->siteKeywords; + } + + public function setSiteKeywords(?string $siteKeywords): static + { + $this->siteKeywords = $siteKeywords; + + return $this; + } + + public function getDiscription(): ?string + { + return $this->discription; + } + + public function setDiscription(?string $discription): static + { + $this->discription = $discription; + + return $this; + } } diff --git a/hesabixCore/src/Form/CommentType.php b/hesabixCore/src/Form/CommentType.php index b47591b..5842823 100644 --- a/hesabixCore/src/Form/CommentType.php +++ b/hesabixCore/src/Form/CommentType.php @@ -21,7 +21,7 @@ class CommentType extends AbstractType ->add('email',EmailType::class) ->add('website',UrlType::class) ->add('body',TextareaType::class,['attr'=>['autocomplete'=>'off','rows'=>5]]) - ->add('submit',SubmitType::class) + ->add('submit',SubmitType::class,['label'=>'SubmitComment']) ; } diff --git a/hesabixCore/src/Repository/BlogCommentRepository.php b/hesabixCore/src/Repository/BlogCommentRepository.php index 96a72c3..62ddbb7 100644 --- a/hesabixCore/src/Repository/BlogCommentRepository.php +++ b/hesabixCore/src/Repository/BlogCommentRepository.php @@ -45,6 +45,7 @@ class BlogCommentRepository extends ServiceEntityRepository public function findLastComments(): array { return $this->createQueryBuilder('b') + ->where('b.publish = true') ->orderBy('b.id', 'DESC') ->setMaxResults(10) ->getQuery() diff --git a/hesabixCore/src/Service/twigFunctions.php b/hesabixCore/src/Service/twigFunctions.php index d3bcca1..6385879 100644 --- a/hesabixCore/src/Service/twigFunctions.php +++ b/hesabixCore/src/Service/twigFunctions.php @@ -7,17 +7,24 @@ namespace App\Service; use App\Entity\ChangeReport; use App\Entity\Settings; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class twigFunctions { private EntityManagerInterface $em; - /** - * @param EntityManagerInterface $em - */ - public function __construct(EntityManagerInterface $em) + protected Request $request; + protected RequestStack $requestStack; + + function __construct( + EntityManagerInterface $entityManager, + RequestStack $request + ) { - $this->em = $em; + $this->request = $request->getCurrentRequest(); + $this->em = $entityManager; } @@ -89,4 +96,8 @@ class twigFunctions return $this->em->getRepository(Settings::class)->findAll()[0]; } + public function getCurrentUrl(){ + return $this->request->getUri(); + } + } \ No newline at end of file diff --git a/hesabixCore/templates/app/blog/comments.html.twig b/hesabixCore/templates/app/blog/comments.html.twig index 187a1f2..1bd9c27 100644 --- a/hesabixCore/templates/app/blog/comments.html.twig +++ b/hesabixCore/templates/app/blog/comments.html.twig @@ -33,7 +33,7 @@ {{ item.body }} - {{ item.submitter.fullname }} + {{ item.name }} {{ item.post.title }} diff --git a/hesabixCore/templates/base.html.twig b/hesabixCore/templates/base.html.twig index 227a04f..8aca6cb 100644 --- a/hesabixCore/templates/base.html.twig +++ b/hesabixCore/templates/base.html.twig @@ -1,20 +1,22 @@ +{% set settings = twigFunctions.systemSettings() %} - + - + حسابیکس - {% block title %}{% endblock %} - {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} - {% block stylesheets %} - {% endblock %} - - {% block javascripts %} - {% endblock %} + + + + + + + @@ -23,12 +25,20 @@ - + + {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} + {% block stylesheets %} + {% endblock %} + + {% block javascripts %} + {% endblock %} + +
diff --git a/hesabixCore/templates/blog/base.html.twig b/hesabixCore/templates/blog/base.html.twig index 09d3012..d6e927d 100644 --- a/hesabixCore/templates/blog/base.html.twig +++ b/hesabixCore/templates/blog/base.html.twig @@ -15,7 +15,7 @@ {% set comments = Blog.getLastComments() %} {% for comment in comments %}
- {{ comment.submitter.fullname }} در {{ comment.post.title }} + {{ comment.name }} در {{ comment.post.title }}

{{ comment.body }}

{% endfor %} diff --git a/hesabixCore/templates/blog/list.html.twig b/hesabixCore/templates/blog/list.html.twig index 12a4ac1..9f0d703 100644 --- a/hesabixCore/templates/blog/list.html.twig +++ b/hesabixCore/templates/blog/list.html.twig @@ -1,4 +1,5 @@ {% extends "blog/base.html.twig" %} +{% block description %}تازه‌های حسابداری با وبلاگ حسابیکس{% endblock %} {% block title %}وبلاگ{% endblock %} {% block content %} {% for item in items %} diff --git a/hesabixCore/templates/blog/post.html.twig b/hesabixCore/templates/blog/post.html.twig index fe95d5a..fc339cf 100644 --- a/hesabixCore/templates/blog/post.html.twig +++ b/hesabixCore/templates/blog/post.html.twig @@ -1,5 +1,7 @@ {% extends "blog/base.html.twig" %} {% block title %}{{ item.title }}{% endblock %} +{% block description %}{{ item.title }}{% endblock %} +{% block keywords %}{{ item.keywords }}{% endblock %} {% block content %}
@@ -48,46 +50,38 @@
- {% if not app.user %} -
- برای ارسال دیدگاه به حساب خود وارد شوید. -
- ورود | عضویت -
- {% else %} -
-
ارسال دیدگاه
- {{ form_start(form) }} - {{ form_errors(form) }} -
-
-
- {{ form_row(form.name) }} -
-
- {{ form_row(form.email) }} -
-
- {{ form_row(form.website) }} -
-
- {{ form_row(form.body) }} -
+
+
ارسال دیدگاه
+ {{ form_start(form) }} + {{ form_errors(form) }} +
+
+
+ {{ form_row(form.name,{'attr':{'class':'required'}}) }} +
+
+ {{ form_row(form.email) }} +
+
+ {{ form_row(form.website) }} +
+
+ {{ form_row(form.body) }}
- {{ form_end(form) }}
- {% endif %} + {{ form_end(form) }} +

دیدگاه‌ها

{% for comment in comments %}
- + diff --git a/hesabixCore/translations/messages.fa.yaml b/hesabixCore/translations/messages.fa.yaml index 0f92a0e..4a27705 100644 --- a/hesabixCore/translations/messages.fa.yaml +++ b/hesabixCore/translations/messages.fa.yaml @@ -10,6 +10,7 @@ Forget Password: بازیابی گذرواژه Name: نام و نام خانوادگی Full name: نام و نام خانوادگی Submit: ثبت +SubmitComment : ثبت دیدگاه Keshvar: کشور Intero: خلاصه Img: تصویر شاخص