fast sell

This commit is contained in:
Hesabix 2023-11-27 03:14:05 -05:00
parent 4685d89739
commit 1cd2176f33
18 changed files with 76 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -204,6 +204,7 @@ class ArchiveController extends AbstractController
$resp = [];
foreach ($files as $file){
$temp = [];
$temp['id']=$file->getId();
$temp['filename']=$file->getFilename();
$temp['fileType']=$file->getFileType();
$temp['submitter']=$file->getSubmitter()->getFullName();
@ -240,7 +241,6 @@ class ArchiveController extends AbstractController
if (!$acc)
throw $this->createAccessDeniedException();
$info = $this->getArchiveInfo($entityManager,$acc);
if($info['remain'] > 0){
$uploadedFile = $request->files->get('image');
if ($uploadedFile) {
$originalFilename = pathinfo($uploadedFile->getClientOriginalName(), PATHINFO_FILENAME);
@ -263,7 +263,6 @@ class ArchiveController extends AbstractController
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
{
@ -272,6 +271,10 @@ class ArchiveController extends AbstractController
throw $this->createAccessDeniedException();
foreach ($request->get('added_media') as $item){
if (file_exists(__DIR__ . '/../../../hesabixArchive/temp/'.$item) ){
$size = ceil(filesize(__DIR__ . '/../../../hesabixArchive/temp/'.$item)/(1024*1024));
$info = $this->getArchiveInfo($entityManager,$acc);
if($info['size'] < ($info['used'] + $size))
return $this->json(['result'=>'nem']);
$file = new ArchiveFile();
$file->setBid($acc['bid']);
$file->setDateSubmit(time());
@ -287,9 +290,10 @@ class ArchiveController extends AbstractController
rename(__DIR__ . '/../../../hesabixArchive/temp/'.$item,__DIR__ . '/../../../hesabixArchive/'.$item);
$file->setRelatedDocType($request->get('doctype'));
$file->setRelatedDocCode($request->get('docid'));
$entityManager->persist($file);
$entityManager->flush();
$log->insert('آرشیو','فایل با نام ' . $file->getFilename() . ' افزوده شد.',$this->getUser(),$acc['bid']);
}
}

View file

@ -25,9 +25,21 @@ class CommodityController extends AbstractController
{
if(!$access->hasRole('commodity'))
throw $this->createAccessDeniedException();
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
if(array_key_exists('speedAccess',$params)){
$items = $entityManager->getRepository(Commodity::class)->findBy([
'bid'=>$request->headers->get('activeBid'),
'speedAccess'=>true
]);
}
else{
$items = $entityManager->getRepository(Commodity::class)->findBy([
'bid'=>$request->headers->get('activeBid')
]);
}
$res = [];
foreach ($items as $item){
$temp = [];
@ -36,6 +48,7 @@ class CommodityController extends AbstractController
$temp['unit'] = $item->getUnit()->getName();
$temp['des'] = $item->getDes();
$temp['priceBuy'] = $item->getPriceBuy();
$temp['speedAccess'] = $item->isSpeedAccess();
$temp['priceSell'] = $item->getPriceSell();
$temp['code'] = $item->getCode();
$temp['cat'] = null;
@ -83,7 +96,7 @@ class CommodityController extends AbstractController
'code'=>$code
]);
$data->setUnit($data->getUnit()->getName());
$res = $provider->Entity2ArrayJustIncludes($data,['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'] = $data->getCat()->getId();
return $this->json($res);
}
@ -135,6 +148,7 @@ class CommodityController extends AbstractController
$data->setCommodityCountCheck($params['commodityCountCheck']);
}
$data->setMinOrderCount($params['minOrderCount']);
$data->setSpeedAccess($params['speedAccess']);
$data->setDayLoading($params['dayLoading']);
$data->setOrderPoint($params['orderPoint']);
//set cat

View file

@ -90,6 +90,8 @@ class PersonsController extends AbstractController
$person->setBirthday($params['birthday']);
if(array_key_exists('tel',$params))
$person->setTel($params['tel']);
if(array_key_exists('speedAccess',$params))
$person->setSpeedAccess($params['speedAccess']);
if(array_key_exists('address',$params))
$person->setAddress($params['address']);
if(array_key_exists('des',$params))

View file

@ -70,6 +70,9 @@ class Commodity
#[ORM\Column(length: 255, nullable: true)]
private ?string $dayLoading = null;
#[ORM\Column(nullable: true)]
private ?bool $speedAccess = null;
public function __construct()
{
$this->setPriceBuy(0);
@ -329,4 +332,16 @@ class Commodity
return $this;
}
public function isSpeedAccess(): ?bool
{
return $this->speedAccess;
}
public function setSpeedAccess(?bool $speedAccess): static
{
$this->speedAccess = $speedAccess;
return $this;
}
}

View file

@ -113,6 +113,9 @@ class Person
#[ORM\OneToMany(mappedBy: 'person', targetEntity: Shareholder::class, orphanRemoval: true)]
private Collection $shareholders;
#[ORM\Column(nullable: true)]
private ?bool $speedAccess = null;
public function __construct()
{
$this->hesabdariRows = new ArrayCollection();
@ -576,4 +579,16 @@ class Person
return $this;
}
public function isSpeedAccess(): ?bool
{
return $this->speedAccess;
}
public function setSpeedAccess(?bool $speedAccess): static
{
$this->speedAccess = $speedAccess;
return $this;
}
}

View file

@ -15,7 +15,7 @@ class twigFunctions
{
private EntityManagerInterface $em;
protected Request $request;
protected $request;
protected RequestStack $requestStack;
function __construct(