some progress

This commit is contained in:
Hesabix 2023-12-06 01:13:48 -05:00
parent ea899a2022
commit ee27a76c1b
2 changed files with 24 additions and 2 deletions

View file

@ -185,6 +185,7 @@ class AdminController extends AbstractController
$resp['keywords'] = $item->getSiteKeywords(); $resp['keywords'] = $item->getSiteKeywords();
$resp['description'] = $item->getDiscription(); $resp['description'] = $item->getDiscription();
$resp['scripts'] = $item->getScripts(); $resp['scripts'] = $item->getScripts();
$resp['zarinpal'] = $item->getZarinpalMerchant();
return $this->json($resp); return $this->json($resp);
} }
@ -200,6 +201,7 @@ class AdminController extends AbstractController
$item->setSiteKeywords($params['keywords']); $item->setSiteKeywords($params['keywords']);
$item->setDiscription($params['description']); $item->setDiscription($params['description']);
$item->setScripts($params['scripts']); $item->setScripts($params['scripts']);
$item->setZarinpalMerchant($params['zarinpal']);
$entityManager->persist($item); $entityManager->persist($item);
$entityManager->flush(); $entityManager->flush();
return $this->json(['result' => 1]); return $this->json(['result' => 1]);

View file

@ -97,6 +97,8 @@ class CommodityController extends AbstractController
]); ]);
$data->setUnit($data->getUnit()->getName()); $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 = $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(); $res['cat'] = $data->getCat()->getId();
return $this->json($res); return $this->json($res);
} }
@ -154,7 +156,10 @@ class CommodityController extends AbstractController
//set cat //set cat
if(array_key_exists('cat',$params)){ if(array_key_exists('cat',$params)){
if($params['cat'] != ''){ if($params['cat'] != ''){
if(is_int($params['cat']))
$cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']); $cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']);
else
$cat = $entityManager->getRepository(CommodityCat::class)->find($params['cat']['id']);
if($cat){ if($cat){
if($cat->getBid() == $acc['bid']){ if($cat->getBid() == $acc['bid']){
$data->setCat($cat); $data->setCat($cat);
@ -248,6 +253,21 @@ class CommodityController extends AbstractController
]); ]);
return $this->json($provider->Entity2Array($data,0)); 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')] #[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 public function app_commodity_cat_get(Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse