diff --git a/hesabixCore/src/Controller/BusinessController.php b/hesabixCore/src/Controller/BusinessController.php index 30af69f..4bef51c 100644 --- a/hesabixCore/src/Controller/BusinessController.php +++ b/hesabixCore/src/Controller/BusinessController.php @@ -580,8 +580,9 @@ class BusinessController extends AbstractController } #[Route('/api/business/stat', name: 'api_business_stat')] - public function api_business_stat(Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response + public function api_business_stat(Jdate $jdate,Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response { + $dateNow = $jdate->jdate('Y/m/d',time()); $buss = $entityManager->getRepository(Business::class)->find( $request->headers->get('activeBid') ); @@ -618,6 +619,7 @@ class BusinessController extends AbstractController 'type' => 'buy', ]); $buysTotal = 0; + $buysToday = 0; foreach ($buys as $item) { $canAdd = false; foreach ($item->getHesabdariRows() as $row) { @@ -626,16 +628,19 @@ class BusinessController extends AbstractController } if ($canAdd) { $buysTotal += $item->getAmount(); + if($item->getDate() == $dateNow){ + $buysToday += $item->getAmount(); + } } } - $sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([ 'bid' => $buss, 'year' => $year, 'type' => 'sell', ]); $sellsTotal = 0; + $sellsToday = 0; foreach ($sells as $item) { $canAdd = false; foreach ($item->getHesabdariRows() as $row) { @@ -644,6 +649,9 @@ class BusinessController extends AbstractController } if ($canAdd) { $sellsTotal += $item->getAmount(); + if($item->getDate() == $dateNow){ + $sellsToday += $item->getAmount(); + } } } $response = [ @@ -655,7 +663,9 @@ class BusinessController extends AbstractController 'bid' => $buss ])), 'buys_total' => $buysTotal, + 'buys_today' => $buysToday, 'sells_total' => $sellsTotal, + 'sells_today' => $sellsToday ]; return $this->json($response); } diff --git a/hesabixCore/src/Entity/Business.php b/hesabixCore/src/Entity/Business.php index 1c42b3a..5fc47b7 100644 --- a/hesabixCore/src/Entity/Business.php +++ b/hesabixCore/src/Entity/Business.php @@ -219,6 +219,9 @@ class Business #[ORM\OneToMany(mappedBy: 'bid', targetEntity: Printer::class, orphanRemoval: true)] private Collection $printers; + #[ORM\OneToMany(mappedBy: 'bid', targetEntity: PrintTemplate::class, orphanRemoval: true)] + private Collection $printTemplates; + public function __construct() { $this->logs = new ArrayCollection(); @@ -249,6 +252,7 @@ class Business $this->mostDes = new ArrayCollection(); $this->plugRepserviceOrders = new ArrayCollection(); $this->printers = new ArrayCollection(); + $this->printTemplates = new ArrayCollection(); } public function getId(): ?int @@ -1539,4 +1543,34 @@ class Business return $this; } + + /** + * @return Collection + */ + public function getPrintTemplates(): Collection + { + return $this->printTemplates; + } + + public function addPrintTemplate(PrintTemplate $printTemplate): static + { + if (!$this->printTemplates->contains($printTemplate)) { + $this->printTemplates->add($printTemplate); + $printTemplate->setBid($this); + } + + return $this; + } + + public function removePrintTemplate(PrintTemplate $printTemplate): static + { + if ($this->printTemplates->removeElement($printTemplate)) { + // set the owning side to null (unless already changed) + if ($printTemplate->getBid() === $this) { + $printTemplate->setBid(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Entity/PrintTemplate.php b/hesabixCore/src/Entity/PrintTemplate.php new file mode 100644 index 0000000..6d40b19 --- /dev/null +++ b/hesabixCore/src/Entity/PrintTemplate.php @@ -0,0 +1,67 @@ +id; + } + + public function getBid(): ?Business + { + return $this->bid; + } + + public function setBid(?Business $bid): static + { + $this->bid = $bid; + + return $this; + } + + public function getFastSellInvoice(): ?string + { + return $this->fastSellInvoice; + } + + public function setFastSellInvoice(?string $fastSellInvoice): static + { + $this->fastSellInvoice = $fastSellInvoice; + + return $this; + } + + public function getCashdeskTicket(): ?string + { + return $this->cashdeskTicket; + } + + public function setCashdeskTicket(?string $cashdeskTicket): static + { + $this->cashdeskTicket = $cashdeskTicket; + + return $this; + } +} diff --git a/hesabixCore/src/Form/BlogPostType.php b/hesabixCore/src/Form/BlogPostType.php index bda7497..8b240bb 100644 --- a/hesabixCore/src/Form/BlogPostType.php +++ b/hesabixCore/src/Form/BlogPostType.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints\File; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class BlogPostType extends AbstractType { @@ -22,7 +23,21 @@ class BlogPostType extends AbstractType $builder ->add('title',TextType::class) ->add('intero',TextareaType::class) - ->add('body',CKEditorType::class) + ->add( + 'body', + CKEditorType::class, + [ + 'filebrowsers' => [ + 'VideoUpload', + 'VideoBrowse', + ], + 'config' => array( + 'filebrowserBrowseRoute' => 'my_route', + 'filebrowserBrowseRouteParameters' => array('slug' => 'my-slug'), + 'filebrowserBrowseRouteType' => UrlGeneratorInterface::ABSOLUTE_URL, + ), + ] + ) ->add('img', FileType::class, [ 'label' => 'Img', diff --git a/hesabixCore/src/Repository/PrintTemplateRepository.php b/hesabixCore/src/Repository/PrintTemplateRepository.php new file mode 100644 index 0000000..cbee527 --- /dev/null +++ b/hesabixCore/src/Repository/PrintTemplateRepository.php @@ -0,0 +1,48 @@ + + * + * @method PrintTemplate|null find($id, $lockMode = null, $lockVersion = null) + * @method PrintTemplate|null findOneBy(array $criteria, array $orderBy = null) + * @method PrintTemplate[] findAll() + * @method PrintTemplate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class PrintTemplateRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, PrintTemplate::class); + } + +// /** +// * @return PrintTemplate[] Returns an array of PrintTemplate objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('p') +// ->andWhere('p.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('p.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?PrintTemplate +// { +// return $this->createQueryBuilder('p') +// ->andWhere('p.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +}