@extends('layouts.app') @section('header')

Teams setup — {{ $company->name }}

Yesterday's timesheet, posted to the Teams groups you pick.
@endsection @section('content') @foreach (['success' => true, 'warning' => false] as $key => $good) @if (session($key))
{{ session($key) }}
@endif @endforeach @unless ($connected)
No sending account is connected. The digest is posted by a Microsoft account, and one has to sign in before any group can be listed or written to. That is done in Companies → Microsoft integration.
@endunless
@csrf @method('PUT')

Groups

@if ($chatError)
Could not list the groups: {{ $chatError }}
@elseif ($connected && empty($chats))

{{ $company->ms_bot_email }} is not in any Teams group chat yet. Add that account to the groups you want the digest in, then reload this page — only chats it already belongs to can be posted to.

@else

The group chats {{ $company->ms_bot_email }} is already in. Nothing can be posted to a group that account is not a member of.

@foreach ($chats as $chat) @endforeach
@endif
{{-- Fixed, and shown rather than editable: it is a constant on the command the scheduler runs. --}}

When it sends

Every day at
{{ $sendAt }} {{ \App\Support\DisplayTimezone::short($sendZone) }}
Covers
{{ $coversDate->format('D, d M Y') }} (last working day)
Today
@if ($quietToday) Sunday or holiday — nothing sends @else A working day — the digest sends @endif
Day boundary
{{ \App\Services\Reports\TimesheetService::DAY_MODES[$dayMode] }}
Timezone
{{ \App\Support\DisplayTimezone::label($timezone) }}

Sundays and holidays are skipped in both directions: nothing is posted on one, and the digest steps back over them to the last day people were in. So Monday reports Saturday, and the morning after a holiday reports the day before it. Holidays come from Keka.

The time is set in the scheduler, not here. The day boundary and timezone are this company's defaults, so the digest and the report agree on which 24 hours "yesterday" was — change them in Companies → Edit.

{{-- A real send, to one person, so the card can be seen without putting a trial run in front of a whole group. --}}

Send a test

@csrf
Goes to that person's 1:1 chat, not to the groups. @error('test_email')
{{ $message }}
@enderror
Blank uses yesterday, as the schedule does. @error('test_date')
{{ $message }}
@enderror

What it will say

{{ $coversDate->format('D, d M Y') }}
@if ($preview->isEmpty())
Nobody worked that day, so nothing would be posted. The digest stays quiet on empty days rather than posting a "no shifts" card every weekend.
@else {{-- Scrolls rather than truncates: the digest lists everyone, so a preview that stopped at eight would not be a preview of it. --}}
@foreach ($preview as $row) @endforeach {{-- The same last row the message signs off with. --}}
Employee Total Working Total Active Hours Idle/free Time
{{ $row['name'] }} @if (($row['leave'] ?? null) === \App\Models\KekaLeaveDay::FULL) (on leave) @elseif ($row['leave'] ?? null) (half day) @endif {{ \App\Support\Duration::hhmmOrDash((int) $row['working_sec']) }} {{ \App\Support\Duration::hhmmOrDash((int) $row['active_sec']) }} {{ \App\Support\FreeTime::label((int) $row['free_sec']) }}
Total Active Hours: {{ \App\Support\Duration::hhmmOrDash((int) $preview->sum('active_sec')) }} Total Idle Hours: {{ \App\Support\FreeTime::label((int) $preview->sum('free_sec')) }}
@endif
@endsection