You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 line
1.5KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Solver\PointSale;
  3. use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
  4. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  5. class PointSaleSolver
  6. {
  7. public function labelAdminChoice(PointSaleInterface $pointSale): string
  8. {
  9. if ($pointSale->getIsPublic()) {
  10. return '[Public] ' . $pointSale->getTitle();
  11. } else {
  12. return '[Privée] ' . $pointSale->getTitle();
  13. }
  14. }
  15. public function getSummary(PointSaleInterface $pointSale): string
  16. {
  17. $html = '';
  18. if ($pointSale->getTitle()) {
  19. $html .= $pointSale->getTitle() . '<br />';
  20. }
  21. if ($pointSale->getAddress()) {
  22. $html .= $pointSale->getAddress()->getAddress() . '<br />';
  23. }
  24. if ($pointSale->getAddress()->getZip() || $pointSale->getAddress()->getCity()) {
  25. $html .= $pointSale->getAddress()->getZip() . ' ' . $pointSale->getAddress()->getCity() . '<br />';
  26. }
  27. return $html;
  28. }
  29. public function getOrderAmountMin(PointSaleInterface $pointSale, SectionInterface $section)
  30. {
  31. foreach($pointSale->getPointSaleSections() as $pointSaleSection) {
  32. if($pointSaleSection->getSection()->getId() == $section->getId()) {
  33. $orderAmountMin = $pointSaleSection->getOrderAmountMin();
  34. if(!is_null($orderAmountMin)) {
  35. return $orderAmountMin;
  36. }
  37. }
  38. }
  39. return $pointSale->getOrderAmountMin();
  40. }
  41. }