Merge branch 'master' of https://github.com/morrning/hesabixCore
This commit is contained in:
commit
52fe96e7f7
|
@ -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]);
|
||||
|
|
|
@ -97,7 +97,9 @@ 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'] = $data->getCat()->getId();
|
||||
$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){
|
||||
$cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']);
|
||||
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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,5 +285,6 @@
|
|||
</main>
|
||||
</div>
|
||||
<script src="{{ asset("assets/js/dashmix.app.min.js") }}"></script>
|
||||
{{ settings.scripts | raw }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue