Skip to content

Commit

Permalink
Varios cambios menores Cosmeticos y bug asantibanez#22
Browse files Browse the repository at this point in the history
  • Loading branch information
nohumans committed Sep 19, 2022
1 parent b6f4ad1 commit dd6841d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 34 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docs
vendor
coverage
.idea/
.history/
2 changes: 1 addition & 1 deletion resources/views/calendar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>

<div class="flex">
<div class="overflow-x-auto w-full">
<div class="overflow-x-auto scroll-smooth scroll-pl-6 snap-x w-full">
<div class="inline-block min-w-full overflow-hidden">

<div class="w-full flex flex-row">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/day-of-week.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="flex-1 h-12 border -mt-px -ml-px flex items-center justify-center bg-indigo-100 text-gray-900"
style="min-width: 10rem;">

<p class="text-sm">
<p class="text-lg">
{{ $day->format('l') }}
</p>

Expand Down
6 changes: 4 additions & 2 deletions resources/views/day.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ class="w-full h-full"
@if($dayClickEnabled)
wire:click="onDayClick({{ $day->year }}, {{ $day->month }}, {{ $day->day }})"
@endif
class="w-full h-full p-2 {{ $dayInMonth ? $isToday ? 'bg-yellow-100' : ' bg-white ' : 'bg-gray-100' }} flex flex-col">
class="w-full h-full p-2 {{ $dayInMonth ? $isToday ? 'bg-yellow-100 dark:bg-secondary-400' : ' bg-gray-100 dark:bg-gray-500' : 'bg-gray-100 dark:bg-gray-600' }} flex flex-col">

{{-- Number of Day --}}
<div class="flex items-center">
<p class="text-sm {{ $dayInMonth ? ' font-medium ' : '' }}">
<p class="text-sm {{ $dayInMonth ? ' font-extrabold ' : '' }}">
{{ $day->format('j') }}
</p>
{{--
<p class="text-xs text-gray-600 ml-4">
@if($events->isNotEmpty())
{{ $events->count() }} {{ Str::plural('event', $events->count()) }}
@endif
</p>
--}}
</div>

{{-- Events --}}
Expand Down
63 changes: 33 additions & 30 deletions src/LivewireCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,24 @@ class LivewireCalendar extends Component
'gridEndsAt' => 'date',
];

public function mount($initialYear = null,
$initialMonth = null,
$weekStartsAt = null,
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$dragAndDropClasses = null,
$beforeCalendarView = null,
$afterCalendarView = null,
$pollMillis = null,
$pollAction = null,
$dragAndDropEnabled = true,
$dayClickEnabled = true,
$eventClickEnabled = true,
$extras = [])
{
public function mount(
$initialYear = null,
$initialMonth = null,
$weekStartsAt = null,
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$dragAndDropClasses = null,
$beforeCalendarView = null,
$afterCalendarView = null,
$pollMillis = null,
$pollAction = null,
$dragAndDropEnabled = true,
$dayClickEnabled = true,
$eventClickEnabled = true,
$extras = []
) {
$this->weekStartsAt = $weekStartsAt ?? Carbon::SUNDAY;
$this->weekEndsAt = $this->weekStartsAt == Carbon::SUNDAY
? Carbon::SATURDAY
Expand Down Expand Up @@ -115,13 +116,14 @@ public function afterMount($extras = [])
//
}

public function setupViews($calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$beforeCalendarView = null,
$afterCalendarView = null)
{
public function setupViews(
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$beforeCalendarView = null,
$afterCalendarView = null
) {
$this->calendarView = $calendarView ?? 'livewire-calendar::calendar';
$this->dayView = $dayView ?? 'livewire-calendar::day';
$this->eventView = $eventView ?? 'livewire-calendar::event';
Expand All @@ -140,24 +142,25 @@ public function setupPoll($pollMillis, $pollAction)
public function goToPreviousMonth()
{
$this->startsAt->subMonthNoOverflow();
$this->endsAt->subMonthNoOverflow();

//$this->endsAt->subMonthNoOverflow();
$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();

$this->calculateGridStartsEnds();
}

public function goToNextMonth()
{
$this->startsAt->addMonthNoOverflow();
$this->endsAt->addMonthNoOverflow();

//$this->endsAt->addMonthNoOverflow();
$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();
$this->calculateGridStartsEnds();
}

public function goToCurrentMonth()
{
$this->startsAt = Carbon::today()->startOfMonth()->startOfDay();
//$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();
$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();

$this->calculateGridStartsEnds();
}

Expand Down Expand Up @@ -185,7 +188,7 @@ public function monthGrid()
$monthGrid = collect();
$currentDay = $firstDayOfGrid->clone();

while(!$currentDay->greaterThan($lastDayOfGrid)) {
while (!$currentDay->greaterThan($lastDayOfGrid)) {
$monthGrid->push($currentDay->clone());
$currentDay->addDay();
}
Expand Down

0 comments on commit dd6841d

Please sign in to comment.