add infowindow method for mapping, convert datetime creation to use company timezone
This commit is contained in:
parent
e1e4c12801
commit
351cc7c3ac
@ -5,6 +5,7 @@ namespace App\Entity;
|
||||
use App\Enums\County;
|
||||
use App\Enums\ResourceType;
|
||||
use App\Enums\State;
|
||||
use App\Libs\Libs;
|
||||
use App\Repository\CommunityResourceRepository;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
@ -258,7 +259,7 @@ class CommunityResource
|
||||
|
||||
public function getContactCard(): ?string
|
||||
{
|
||||
$formattedPhone = ($this->phone ? '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6) : '');
|
||||
$formattedPhone = ($this->phone ? Libs::formatPhone($this->phone) : '');
|
||||
return ($this->email ? "<a href='mailto:$this->email'>$this->email</a><br/>" : '') .
|
||||
($this->phone ? "<a href='tel:$this->phone'>$formattedPhone</a>" : '');
|
||||
}
|
||||
@ -309,8 +310,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -347,8 +348,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -385,9 +386,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
|
||||
if ($closeAt <= new DateTime("now", new DateTimeZone('America/Indiana/Indianapolis'))) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -424,8 +424,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -462,8 +462,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -500,8 +500,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -538,8 +538,8 @@ class CommunityResource
|
||||
return 'C';
|
||||
}
|
||||
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
if ($closeAt <= new DateTime()) {
|
||||
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
|
||||
return 'C';
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ class CommunityResource
|
||||
|
||||
public function getHours(): ?string
|
||||
{
|
||||
$this->today = new DateTime('now', new DateTimeZone('America/Indiana/Indianapolis'));
|
||||
$this->today = new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
|
||||
switch ($this->today->format('w')) {
|
||||
case 0:
|
||||
return $this->sun();
|
||||
@ -672,4 +672,15 @@ class CommunityResource
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function _toInfoWindow(): string
|
||||
{
|
||||
return <<<EOL
|
||||
{$this->name}<br/>
|
||||
<a href='http://maps.google.com/?q={$this->lat},{$this->lon}'>{$this->address}<br/>
|
||||
{$this->city}, {$this->state->value} {$this->zip}</a><br/>
|
||||
{$this->servicesAvailable}<br/>
|
||||
{$this->getContactCard()}
|
||||
EOL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user