This commit is contained in:
babak alizadeh 2023-12-10 11:10:00 +03:30
commit 52fe96e7f7
4 changed files with 43 additions and 3 deletions

View file

@ -184,6 +184,8 @@ class AdminController extends AbstractController
$resp = [];
$resp['keywords'] = $item->getSiteKeywords();
$resp['description'] = $item->getDiscription();
$resp['scripts'] = $item->getScripts();
$resp['zarinpal'] = $item->getZarinpalMerchant();
return $this->json($resp);
}
@ -198,6 +200,8 @@ class AdminController extends AbstractController
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
$item->setSiteKeywords($params['keywords']);
$item->setDiscription($params['description']);
$item->setScripts($params['scripts']);
$item->setZarinpalMerchant($params['zarinpal']);
$entityManager->persist($item);
$entityManager->flush();
return $this->json(['result' => 1]);

View file

@ -97,6 +97,8 @@ class CommodityController extends AbstractController
]);
$data->setUnit($data->getUnit()->getName());
$res = $provider->Entity2ArrayJustIncludes($data,['isSpeedAccess','isCommodityCountCheck','getName','getUnit','getPriceBuy','getPriceSell','getCat','getOrderPoint','getdes','getId','getDayLoading','isKhadamat','getCode','getMinOrderCount','getLabel'],1);
$res['cat'] = '';
if($data->getCat())
$res['cat'] = $data->getCat()->getId();
return $this->json($res);
}
@ -153,8 +155,11 @@ class CommodityController extends AbstractController
$data->setOrderPoint($params['orderPoint']);
//set cat
if(array_key_exists('cat',$params)){
if($params['cat'] != null){
if($params['cat'] != ''){
if(is_int($params['cat']))
$cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']);
else
$cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']['id']);
if($cat){
if($cat->getBid() == $acc['bid']){
$data->setCat($cat);
@ -248,6 +253,21 @@ class CommodityController extends AbstractController
]);
return $this->json($provider->Entity2Array($data,0));
}
#[Route('/api/commodity/cat/get/line', name: 'app_commodity_cat_get_line')]
public function app_commodity_cat_get_line(Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
{
$acc = $access->hasRole('commodity');
if(!$acc)
throw $this->createAccessDeniedException();
$temp =[];
$nodes = $entityManager->getRepository(CommodityCat::class)->findBy([
'bid'=>$acc['bid'],
]);
if(count($nodes) == 0)
$nodes = $this->createDefaultCat($acc['bid'],$entityManager);
return $this->json($provider->ArrayEntity2Array($nodes,0));
}
#[Route('/api/commodity/cat/get', name: 'app_commodity_cat_get')]
public function app_commodity_cat_get(Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse

View file

@ -41,6 +41,9 @@ class Settings
#[ORM\Column(length: 255, nullable: true)]
private ?string $discription = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $scripts = null;
public function getId(): ?int
{
return $this->id;
@ -153,4 +156,16 @@ class Settings
return $this;
}
public function getScripts(): ?string
{
return $this->scripts;
}
public function setScripts(?string $scripts): static
{
$this->scripts = $scripts;
return $this;
}
}

View file

@ -285,5 +285,6 @@
</main>
</div>
<script src="{{ asset("assets/js/dashmix.app.min.js") }}"></script>
{{ settings.scripts | raw }}
</body>
</html>