Plugin Directory

Changeset 3739496


Ignore:
Timestamp:
10/11/2026 12:45:58 PM (7 weeks ago)
Author:
fredawd
Message:

New in 1.2: Planning. A built-in calendar for notes, appointments, deadlines and time off, right next to your hours.

Location:
freelancer-time-log-pro/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • freelancer-time-log-pro/trunk/assets/admin.css

    r3626378 r3739496  
    77        --tg-navy: #16233f;
    88        --tg-navy-soft: #1e2b4d;
    9         --tg-blue: #2f6bff;
    10         --tg-blue-soft: #e9f0ff;
     9        --tg-blue: #2563eb;
     10        --tg-blue-strong: #1d4ed8;
     11        --tg-blue-soft: #eaf1fe;
     12        --tg-blue-softer: #f3f7fe;
    1113        --tg-green: #12a150;
    1214        --tg-green-soft: #e4f6ec;
    … …  
    2628        --tg-radius-sm: 12px;
    2729        --tg-shadow: 0 1px 2px rgba(15, 27, 51, .04), 0 10px 30px rgba(15, 27, 51, .05);
     30        --tg-shadow-lg: 0 18px 48px rgba(21, 44, 105, .12);
    2831        --tg-shadow-sm: 0 1px 2px rgba(15, 27, 51, .05), 0 4px 14px rgba(15, 27, 51, .05);
    2932}
    … …  
    111114}
    112115
    113 /* ---------- Buttons ---------- */
     116/* ---------- Buttons — Guard UI kit §3 ----------
     117 * Colour carries meaning, the same in every Guard plugin:
     118 *   primary (blue)    = the safe / main action (Save, New, Download)
     119 *   secondary (white) = a neutral side action (Cancel, Export CSV)
     120 *   danger (red)      = irreversible delete
     121 *   dark (navy)       = heavy, unusual action
     122 */
    114123
    115124.tg-btn {
    116125        display: inline-flex;
    117126        align-items: center;
    118         gap: 6px;
     127        justify-content: center;
     128        gap: 8px;
     129        padding: 10px 18px;
    119130        border: 1px solid transparent;
    120         border-radius: 10px;
    121         padding: 8px 14px;
    122         font-size: 13px;
    123         font-weight: 600;
     131        border-radius: 11px;
     132        font-size: 13.5px;
     133        font-weight: 700;
    124134        line-height: 1.2;
    125135        cursor: pointer;
    126136        text-decoration: none;
    127         transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
     137        white-space: nowrap;
     138        box-sizing: border-box;
     139        transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease, color .15s ease;
     140}
     141
     142.tg-btn:active {
     143        transform: translateY(1px);
     144}
     145
     146.tg-btn:focus-visible {
     147        outline: none;
     148        box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
    128149}
    129150
    … …  
    136157
    137158.tg-btn-primary {
    138         background: var(--tg-blue);
     159        background: linear-gradient(180deg, #3b82f6, var(--tg-blue));
     160        border-color: var(--tg-blue-strong);
    139161        color: #fff;
    140         box-shadow: 0 1px 2px rgba(47, 107, 255, .25), 0 6px 16px rgba(47, 107, 255, .22);
     162        box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .85);
    141163}
    142164
    143165.tg-btn-primary:hover,
    144166.tg-btn-primary:focus {
    145         background: #1f5aee;
     167        background: linear-gradient(180deg, var(--tg-blue), var(--tg-blue-strong));
    146168        color: #fff;
    147 }
    148 
     169        box-shadow: 0 10px 22px -8px rgba(37, 99, 235, .95);
     170}
     171
     172/* .tg-btn-ghost stays as an alias so older markup keeps the family look. */
     173.tg-btn-secondary,
    149174.tg-btn-ghost {
    150175        background: #fff;
    151         color: var(--tg-ink);
    152         border-color: var(--tg-line);
    153 }
    154 
     176        color: var(--tg-blue-strong);
     177        border-color: #cddcf7;
     178        box-shadow: none;
     179}
     180
     181.tg-btn-secondary:hover,
     182.tg-btn-secondary:focus,
    155183.tg-btn-ghost:hover,
    156184.tg-btn-ghost:focus {
    157         background: #f8fafc;
    158         color: var(--tg-ink);
    159 }
    160 
     185        background: var(--tg-blue-softer);
     186        border-color: #b9cdf3;
     187        color: var(--tg-blue-strong);
     188}
     189
     190.tg-btn-danger {
     191        background: linear-gradient(180deg, #ef4444, #dc2626);
     192        border-color: #b91c1c;
     193        color: #fff;
     194        box-shadow: 0 8px 18px -8px rgba(220, 38, 38, .75);
     195}
     196
     197.tg-btn-danger:hover,
     198.tg-btn-danger:focus {
     199        background: linear-gradient(180deg, #dc2626, #b91c1c);
     200        color: #fff;
     201        box-shadow: 0 10px 22px -8px rgba(220, 38, 38, .85);
     202}
     203
     204.tg-btn-danger:focus-visible {
     205        box-shadow: 0 0 0 3px rgba(220, 38, 38, .25);
     206}
     207
     208.tg-btn-dark {
     209        background: var(--tg-navy);
     210        border-color: var(--tg-navy);
     211        color: #fff;
     212}
     213
     214.tg-btn-dark:hover,
     215.tg-btn-dark:focus {
     216        background: #0d1a3d;
     217        color: #fff;
     218}
     219
     220/* Legacy text-style delete link (no longer used in core markup). */
    161221.tg-btn-danger-link {
    162222        background: transparent;
    … …  
    171231
    172232.tg-btn-lg {
    173         padding: 11px 20px;
     233        padding: 12px 22px;
    174234        font-size: 14px;
     235        border-radius: 12px;
    175236}
    176237
    177238.tg-btn-sm {
    178         padding: 5px 10px;
    179         font-size: 12px;
     239        padding: 6px 12px;
     240        font-size: 12.5px;
     241        border-radius: 9px;
     242}
     243
     244.tg-btn-sm .dashicons {
     245        font-size: 14px;
     246        width: 14px;
     247        height: 14px;
     248        line-height: 14px;
    180249}
    181250
    … …  
    247316}
    248317
    249 /* ---------- Stat cards ---------- */
    250 
    251 .tg-stats {
     318/* ---------- Status cards — 1:1 with HelpGuard / WarpGuard ----------
     319 * Four tiles: icon disc + caps title (+ chevron when linked), the value,
     320 * a label, a status pill with a pulsing dot and one line of plain
     321 * explanation, over a soft accent hill and a faint outline watermark.
     322 */
     323
     324.tg-statgrid {
    252325        display: grid;
    253326        grid-template-columns: repeat(4, minmax(0, 1fr));
    254         gap: 16px;
    255         margin-bottom: 18px;
    256 }
    257 
    258 @media (max-width: 1200px) {
    259         .tg-stats {
    260                 grid-template-columns: repeat(2, minmax(0, 1fr));
    261         }
    262 }
    263 
    264 @media (max-width: 640px) {
    265         .tg-stats {
    266                 grid-template-columns: 1fr;
    267         }
     327        gap: 18px;
     328        margin: 0 0 20px;
    268329}
    269330
    270331.tg-stat {
     332        position: relative;
     333        overflow: hidden;
    271334        display: flex;
    272335        flex-direction: column;
     336        min-height: 190px;
     337        padding: 18px 18px 16px;
    273338        background: #fff;
    274         border: 1px solid var(--tg-line);
    275         border-radius: var(--tg-radius);
    276         padding: 20px 22px;
    277         box-shadow: var(--tg-shadow);
    278 }
    279 
    280 .tg-stat-label {
    281         font-size: 11px;
    282         color: var(--tg-muted);
    283         font-weight: 700;
    284         letter-spacing: .06em;
    285         text-transform: uppercase;
    286 }
    287 
    288 .tg-stat-value {
    289         font-size: 30px;
    290         font-weight: 800;
    291         letter-spacing: -.03em;
    292         color: var(--tg-navy);
    293         line-height: 1.15;
    294         margin: 8px 0 16px;
    295 }
    296 
    297 .tg-stat-foot {
    298         display: flex;
    299         align-items: center;
    300         gap: 12px;
    301         margin-top: auto;
    302 }
    303 
    304 .tg-stat-icon {
     339        border: 1px solid #d7e1f2;
     340        border-radius: 20px;
     341        box-shadow: 0 10px 30px rgba(21, 44, 105, .10);
     342        animation: tg-stat-in .45s cubic-bezier(.2, .7, .2, 1) both;
     343        transition: transform .28s cubic-bezier(.2, .7, .2, 1), box-shadow .28s ease, border-color .28s ease;
     344}
     345
     346.tg-stat:nth-child(2) { animation-delay: .09s; }
     347.tg-stat:nth-child(3) { animation-delay: .18s; }
     348.tg-stat:nth-child(4) { animation-delay: .27s; }
     349
     350@keyframes tg-stat-in {
     351        from { opacity: 0; transform: translateY(16px); }
     352        to   { opacity: 1; transform: none; }
     353}
     354
     355.tg-stat:hover {
     356        transform: translateY(-4px);
     357        box-shadow: var(--tg-shadow-lg);
     358        border-color: #c3d6f5;
     359}
     360
     361/* Soft accent glow at the foot of each card (stays inside the card). */
     362.tg-stat-hill {
     363        position: absolute;
     364        left: -12%;
     365        right: -12%;
     366        bottom: -40px;
     367        height: 84px;
     368        background: var(--acc, rgba(37, 99, 235, .12));
     369        border-radius: 50%;
     370        filter: blur(4px);
     371        opacity: .5;
     372        pointer-events: none;
     373}
     374
     375.tg-stat-ghost {
     376        position: absolute;
     377        right: -10px;
     378        bottom: -8px;
     379        opacity: .06;
     380        pointer-events: none;
     381        transform: rotate(-8deg);
     382        line-height: 0;
     383}
     384
     385.tg-stat-ghost svg {
     386        width: 120px;
     387        height: 120px;
     388        stroke-width: 1.6;
     389}
     390
     391.tg-ghost-blue { color: var(--tg-blue); }
     392.tg-ghost-green { color: var(--tg-green); }
     393.tg-ghost-amber { color: var(--tg-amber); }
     394.tg-ghost-purple { color: var(--tg-purple); }
     395
     396.tg-stat-head {
     397        position: relative;
     398        z-index: 2;
     399        display: flex;
     400        align-items: center;
     401        gap: 11px;
     402}
     403
     404.tg-stat-disc {
     405        flex: 0 0 auto;
    305406        width: 44px;
    306407        height: 44px;
    307         border-radius: 12px;
    308         font-size: 23px;
    309         line-height: 44px;
    310         text-align: center;
     408        border-radius: 13px;
     409        display: flex;
     410        align-items: center;
     411        justify-content: center;
     412        transition: transform .28s cubic-bezier(.2, .7, .2, 1);
     413}
     414
     415.tg-stat:hover .tg-stat-disc {
     416        transform: scale(1.07) rotate(-3deg);
     417}
     418
     419.tg-stat-title {
     420        font-size: 11px;
     421        font-weight: 700;
     422        text-transform: uppercase;
     423        letter-spacing: .07em;
     424        color: var(--tg-muted);
     425}
     426
     427.tg-stat-chev {
     428        margin-left: auto;
     429        width: 26px;
     430        height: 26px;
     431        border-radius: 50%;
     432        display: flex;
     433        align-items: center;
     434        justify-content: center;
     435        color: #9fb2d4;
     436        transition: all .2s ease;
     437}
     438
     439.tg-stat:hover .tg-stat-chev {
     440        background: var(--tg-blue-soft);
     441        color: var(--tg-blue);
     442        transform: translateX(2px);
     443}
     444
     445.tg-stat-overlay {
     446        position: absolute;
     447        inset: 0;
     448        z-index: 5;
     449        border-radius: inherit;
     450        font-size: 0;
     451}
     452
     453.tg-stat-overlay:focus-visible {
     454        outline: 2px solid var(--tg-blue);
     455        outline-offset: -2px;
     456}
     457
     458.tg-stat-body {
     459        position: relative;
     460        z-index: 2;
     461        display: flex;
     462        flex-direction: column;
     463        gap: 2px;
     464        margin-top: 12px;
     465}
     466
     467.tg-stat-num {
     468        font-size: 32px;
     469        font-weight: 800;
     470        line-height: 1;
     471        letter-spacing: -.02em;
     472        font-variant-numeric: tabular-nums;
     473        color: var(--tg-ink);
     474        white-space: nowrap;
     475        overflow: hidden;
     476        text-overflow: ellipsis;
     477}
     478
     479.tg-stat-lbl {
     480        margin-top: 3px;
     481        font-size: 12.5px;
     482        color: var(--tg-muted);
     483}
     484
     485/* The pill — Guard UI kit §5: one status in a few words + coloured dot. */
     486.tg-stat-pill {
     487        align-self: flex-start;
     488        display: inline-flex;
     489        align-items: center;
     490        gap: 7px;
     491        max-width: 100%;
     492        margin-top: 12px;
     493        padding: 5px 11px;
     494        border-radius: 999px;
     495        font-size: 12px;
     496        font-weight: 600;
     497        line-height: 1.3;
     498}
     499
     500.tg-stat-pill .d {
     501        position: relative;
    311502        flex: 0 0 auto;
     503        width: 7px;
     504        height: 7px;
     505        border-radius: 50%;
     506}
     507
     508.tg-stat-pill .d::after {
     509        content: "";
     510        position: absolute;
     511        inset: 0;
     512        border-radius: 50%;
     513        background: inherit;
     514        animation: tg-pulse 2.4s ease-out infinite;
     515}
     516
     517.tg-stat-pill.green { background: #e7f8ee; color: #137a3a; }
     518.tg-stat-pill.green .d { background: #16a34a; }
     519.tg-stat-pill.blue { background: var(--tg-blue-soft); color: var(--tg-blue-strong); }
     520.tg-stat-pill.blue .d { background: var(--tg-blue); }
     521.tg-stat-pill.orange { background: #fef4e2; color: #9a4a08; }
     522.tg-stat-pill.orange .d { background: #b45309; }
     523.tg-stat-pill.red { background: #feecec; color: #dc2626; }
     524.tg-stat-pill.red .d { background: #dc2626; }
     525.tg-stat-pill.off { background: #eef2f7; color: #475569; }
     526.tg-stat-pill.off .d { background: #94a3b8; }
     527.tg-stat-pill.off .d::after { animation: none; }
     528
     529@keyframes tg-pulse {
     530        0% { transform: scale(1); opacity: .6; }
     531        70% { transform: scale(2.6); opacity: 0; }
     532        100% { opacity: 0; }
    312533}
    313534
    314535.tg-stat-sub {
     536        margin-top: 8px;
     537        font-size: 12px;
     538        line-height: 1.45;
     539        color: var(--tg-muted);
     540}
     541
     542@media (max-width: 1280px) {
     543        .tg-statgrid {
     544                grid-template-columns: repeat(2, minmax(0, 1fr));
     545        }
     546}
     547
     548@media (max-width: 560px) {
     549        .tg-statgrid {
     550                grid-template-columns: 1fr;
     551        }
     552}
     553
     554/* ---------- Status strip — the four pills in one line ----------
     555 * On every tab but Entries. Deliberately ~34px and not a card: it sits
     556 * above a screen someone came to read, so it reports and gets out of
     557 * the way. The whole strip links back to Entries.
     558 */
     559
     560.tg-strip {
     561        display: flex;
     562        align-items: center;
     563        gap: 2px;
     564        flex-wrap: wrap;
     565        width: fit-content;
     566        max-width: 100%;
     567        margin: 12px 0 0;
     568        padding: 6px 7px 6px 8px;
     569        background: linear-gradient(180deg, #fff, #f7faff);
     570        border: 1px solid #dde7f7;
     571        border-radius: 999px;
     572        box-shadow: 0 4px 14px rgba(21, 44, 105, .06);
     573        font-size: 12.5px;
     574        color: var(--tg-muted);
     575        text-decoration: none;
     576        transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
     577}
     578
     579.tg-strip:hover,
     580.tg-strip:focus {
     581        color: var(--tg-muted);
     582        border-color: #c3d6f5;
     583        box-shadow: 0 8px 22px rgba(21, 44, 105, .10);
     584        transform: translateY(-1px);
     585}
     586
     587.tg-strip:focus-visible {
     588        outline: 2px solid var(--tg-blue);
     589        outline-offset: 2px;
     590}
     591
     592.tg-strip-period {
    315593        display: inline-flex;
    316594        align-items: center;
     595        gap: 6px;
     596        margin-right: 4px;
     597        padding: 4px 11px;
     598        border-radius: 999px;
     599        background: var(--tg-blue-soft);
     600        color: var(--tg-blue-strong);
     601        font-size: 11.5px;
     602        font-weight: 700;
     603        white-space: nowrap;
     604}
     605
     606.tg-strip-item {
     607        display: inline-flex;
     608        align-items: baseline;
     609        gap: 5px;
     610        padding: 0 10px;
     611        white-space: nowrap;
     612}
     613
     614.tg-strip-item b {
     615        font-size: 14px;
     616        font-weight: 800;
     617        letter-spacing: -.01em;
     618        font-variant-numeric: tabular-nums;
     619        color: var(--tg-ink);
     620}
     621
     622.tg-strip-dot {
     623        position: relative;
     624        align-self: center;
     625        flex: 0 0 auto;
     626        width: 7px;
     627        height: 7px;
     628        margin-right: 1px;
     629        border-radius: 50%;
     630        background: #94a3b8;
     631}
     632
     633.tg-strip-item.is-green .tg-strip-dot { background: #16a34a; }
     634.tg-strip-item.is-green b { color: #137a3a; }
     635.tg-strip-item.is-blue .tg-strip-dot { background: var(--tg-blue); }
     636.tg-strip-item.is-blue b { color: var(--tg-blue-strong); }
     637.tg-strip-item.is-orange .tg-strip-dot { background: #b45309; }
     638.tg-strip-item.is-orange b { color: #9a4a08; }
     639.tg-strip-item.is-muted b { color: #94a3b8; }
     640
     641/* Only the green and orange dots pulse: those are the ones saying
     642   "something is happening" or "look at me". */
     643.tg-strip-item.is-green .tg-strip-dot::after,
     644.tg-strip-item.is-orange .tg-strip-dot::after {
     645        content: "";
     646        position: absolute;
     647        inset: 0;
     648        border-radius: 50%;
     649        background: inherit;
     650        animation: tg-pulse 2.4s ease-out infinite;
     651}
     652
     653.tg-strip-sep {
     654        flex: 0 0 auto;
     655        width: 1px;
     656        height: 16px;
     657        background: #e3ebf8;
     658}
     659
     660.tg-strip-tail {
     661        display: inline-flex;
     662        align-items: center;
    317663        gap: 7px;
    318         font-size: 12px;
    319         color: var(--tg-muted);
    320         font-weight: 500;
     664        margin-left: 6px;
     665        padding: 4px 12px;
     666        border-radius: 999px;
     667        font-size: 11.5px;
     668        font-weight: 600;
     669        white-space: nowrap;
     670}
     671
     672.tg-strip-tail.is-green { background: #e7f8ee; color: #137a3a; }
     673.tg-strip-tail.is-orange { background: #fef4e2; color: #9a4a08; }
     674.tg-strip-tail.is-muted { background: #eef2f7; color: #475569; }
     675
     676/* Three bars that keep time while the timer runs. */
     677.tg-strip-bars {
     678        display: inline-flex;
     679        align-items: flex-end;
     680        gap: 2px;
     681        height: 11px;
     682}
     683
     684.tg-strip-bars i {
     685        width: 3px;
     686        height: 4px;
     687        border-radius: 1px;
     688        background: currentColor;
     689        animation: tg-bars 1.1s ease-in-out infinite;
     690}
     691
     692.tg-strip-bars i:nth-child(2) { animation-delay: .18s; }
     693.tg-strip-bars i:nth-child(3) { animation-delay: .36s; }
     694
     695@keyframes tg-bars {
     696        0%, 100% { height: 4px; opacity: .55; }
     697        50% { height: 11px; opacity: 1; }
     698}
     699
     700@media (max-width: 782px) {
     701        .tg-strip {
     702                width: 100%;
     703                justify-content: center;
     704                border-radius: 14px;
     705                row-gap: 6px;
     706        }
     707}
     708
     709@media (prefers-reduced-motion: reduce) {
     710        .tg-stat,
     711        .tg-stat:hover,
     712        .tg-strip,
     713        .tg-strip:hover {
     714                animation: none;
     715                transform: none;
     716                transition: none;
     717        }
     718        .tg-stat:hover .tg-stat-disc {
     719                transform: none;
     720        }
     721        .tg-stat-pill .d::after,
     722        .tg-strip-dot::after,
     723        .tg-strip-bars i {
     724                animation: none;
     725        }
     726        .tg-strip-bars i {
     727                height: 8px;
     728        }
    321729}
    322730
    … …  
    8451253
    8461254#awd-ttt-modal-backdrop,
    847 #tg-manual-backdrop {
     1255#tg-manual-backdrop,
     1256#tg-plan-backdrop {
    8481257        position: fixed;
    8491258        inset: 0;
    … …  
    8531262
    8541263#awd-ttt-modal,
    855 #tg-manual-modal {
     1264#tg-manual-modal,
     1265#tg-plan-modal {
    8561266        position: fixed;
    8571267        inset: 0;
    … …  
    12241634
    12251635/* ==================================================================
    1226    Metric cards — daneGuard structure (icon disc + value + dot foot)
     1636   Planning — month calendar + agenda panel (Guard UI kit §8)
     1637   Days are cells, items are pills with a coloured accent; periods run
     1638   as one bar across the days they cover. "Today" carries the brand
     1639   gradient + ring, weekends are lightly tinted.
    12271640   ================================================================== */
    12281641
    1229 .tg-metric-grid {
     1642.tg-plan {
     1643        margin-bottom: 24px;
     1644}
     1645
     1646.tg-plan .tg-card {
     1647        margin-bottom: 0;
     1648}
     1649
     1650.tg-plan-main {
     1651        padding: 16px 18px 12px;
     1652        overflow: visible;
     1653}
     1654
     1655/* Toolbar: ‹ Month › Today  ·  type filter chips */
     1656.tg-plan-toolbar {
     1657        display: flex;
     1658        align-items: center;
     1659        justify-content: space-between;
     1660        gap: 12px;
     1661        flex-wrap: wrap;
     1662        padding-bottom: 14px;
     1663        margin-bottom: 10px;
     1664        border-bottom: 1px solid #eef2fa;
     1665}
     1666
     1667.tg-plan-nav {
     1668        display: flex;
     1669        align-items: center;
     1670        gap: 6px;
     1671}
     1672
     1673.tg-plan-month {
     1674        margin: 0 6px;
     1675        min-width: 150px;
     1676        text-align: center;
     1677        font-size: 17px;
     1678        font-weight: 800;
     1679        letter-spacing: -.01em;
     1680        color: var(--tg-navy);
     1681        text-transform: capitalize;
     1682}
     1683
     1684.tg-plan-arrow {
     1685        display: inline-flex;
     1686        align-items: center;
     1687        justify-content: center;
     1688        width: 34px;
     1689        height: 34px;
     1690        padding: 0;
     1691        border: 1px solid #cddcf7;
     1692        border-radius: 10px;
     1693        background: #fff;
     1694        color: var(--tg-blue-strong);
     1695        cursor: pointer;
     1696        transition: background .15s ease, border-color .15s ease;
     1697}
     1698
     1699.tg-plan-arrow:hover {
     1700        background: var(--tg-blue-softer);
     1701        border-color: #b9cdf3;
     1702}
     1703
     1704.tg-plan-arrow:focus-visible,
     1705.tg-plan-chip:focus-visible,
     1706.tg-plan-num:focus-visible,
     1707.tg-plan-ev:focus-visible,
     1708.tg-plan-more:focus-visible,
     1709.tg-plan-row:focus-visible {
     1710        outline: 2px solid var(--tg-blue);
     1711        outline-offset: 2px;
     1712}
     1713
     1714.tg-plan-nav .tg-btn-sm {
     1715        margin-left: 6px;
     1716}
     1717
     1718.tg-plan-legend {
     1719        display: flex;
     1720        flex-wrap: wrap;
     1721        gap: 6px;
     1722}
     1723
     1724.tg-plan-chip {
     1725        display: inline-flex;
     1726        align-items: center;
     1727        gap: 7px;
     1728        padding: 5px 11px;
     1729        border: 1px solid transparent;
     1730        border-radius: 999px;
     1731        background: color-mix(in srgb, var(--kc) 10%, #fff);
     1732        color: color-mix(in srgb, var(--kc) 82%, #0f172a);
     1733        font-size: 12px;
     1734        font-weight: 600;
     1735        cursor: pointer;
     1736        transition: opacity .15s ease, background .15s ease;
     1737}
     1738
     1739.tg-plan-chip i {
     1740        width: 8px;
     1741        height: 8px;
     1742        border-radius: 50%;
     1743        background: var(--kc);
     1744}
     1745
     1746.tg-plan-chip.is-off {
     1747        background: #fff;
     1748        border-color: #e3ebf8;
     1749        color: #94a3b8;
     1750        text-decoration: line-through;
     1751}
     1752
     1753.tg-plan-chip.is-off i {
     1754        background: #cbd5e1;
     1755}
     1756
     1757/* Weekday header */
     1758.tg-plan-head {
    12301759        display: grid;
    1231         grid-template-columns: repeat(4, minmax(0, 1fr));
    1232         gap: 16px;
    1233         margin-bottom: 20px;
    1234 }
    1235 
    1236 @media (max-width: 1400px) {
    1237         .tg-metric-grid {
    1238                 grid-template-columns: repeat(2, minmax(0, 1fr));
    1239         }
    1240 }
    1241 
     1760        grid-template-columns: repeat(7, minmax(0, 1fr));
     1761        padding: 0 0 6px;
     1762}
     1763
     1764.tg-plan-wd {
     1765        padding: 0 8px;
     1766        font-size: 11px;
     1767        font-weight: 700;
     1768        letter-spacing: .07em;
     1769        text-transform: uppercase;
     1770        color: var(--tg-muted);
     1771}
     1772
     1773.tg-plan-wd.is-weekend {
     1774        color: #94a3b8;
     1775}
     1776
     1777/* Grid: six week rows, each its own 7-column grid so a period can span
     1778   the days it covers as one bar. */
     1779.tg-plan-grid {
     1780        border: 1px solid #e6edf9;
     1781        border-radius: 14px;
     1782        overflow: hidden;
     1783        user-select: none;
     1784        transition: opacity .15s ease;
     1785}
     1786
     1787.tg-plan-grid.is-loading {
     1788        opacity: .55;
     1789        pointer-events: none;
     1790}
     1791
     1792.tg-plan-week {
     1793        position: relative;
     1794        display: grid;
     1795        grid-template-columns: repeat(7, minmax(0, 1fr));
     1796        grid-template-rows: 30px repeat(var(--lanes, 3), 24px) 20px;
     1797        row-gap: 3px;
     1798        min-height: 118px;
     1799        padding-bottom: 4px;
     1800        border-top: 1px solid #eef2fa;
     1801}
     1802
     1803.tg-plan-week:first-child {
     1804        border-top: 0;
     1805}
     1806
     1807.tg-plan-day {
     1808        grid-row: 1 / -1;
     1809        position: relative;
     1810        z-index: 0;
     1811        padding: 5px 6px;
     1812        border-left: 1px solid #eef2fa;
     1813        background: #fff;
     1814        cursor: cell;
     1815        transition: background .12s ease;
     1816}
     1817
     1818.tg-plan-day:nth-child(1) {
     1819        border-left: 0;
     1820}
     1821
     1822.tg-plan-day:hover {
     1823        background: var(--tg-blue-softer);
     1824}
     1825
     1826.tg-plan-day.is-weekend {
     1827        background: #fafbfe;
     1828}
     1829
     1830.tg-plan-day.is-out {
     1831        background: #f7f9fc;
     1832}
     1833
     1834.tg-plan-day.is-out .tg-plan-num {
     1835        color: #b6c2d4;
     1836}
     1837
     1838.tg-plan-day.is-range {
     1839        background: color-mix(in srgb, var(--tg-blue) 12%, #fff);
     1840        box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .35);
     1841}
     1842
     1843.tg-plan-day.is-selected {
     1844        box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .45);
     1845}
     1846
     1847.tg-plan-num {
     1848        display: inline-flex;
     1849        align-items: center;
     1850        justify-content: center;
     1851        min-width: 26px;
     1852        height: 26px;
     1853        padding: 0 6px;
     1854        border: 0;
     1855        border-radius: 999px;
     1856        background: transparent;
     1857        color: var(--tg-ink);
     1858        font-size: 12.5px;
     1859        font-weight: 700;
     1860        font-variant-numeric: tabular-nums;
     1861        cursor: pointer;
     1862}
     1863
     1864.tg-plan-num:hover {
     1865        background: #e9eefb;
     1866}
     1867
     1868.tg-plan-day.is-today .tg-plan-num {
     1869        background: linear-gradient(180deg, #3b82f6, var(--tg-blue));
     1870        color: #fff;
     1871        box-shadow: 0 0 0 3px rgba(37, 99, 235, .18), 0 6px 14px -6px rgba(37, 99, 235, .8);
     1872}
     1873
     1874.tg-plan-day.is-today {
     1875        background: linear-gradient(180deg, #f3f7fe, #fff 60%);
     1876}
     1877
     1878/* Items: a pill with a coloured accent stripe; periods become a bar. */
     1879.tg-plan-ev {
     1880        position: relative;
     1881        z-index: 1;
     1882        display: flex;
     1883        align-items: center;
     1884        gap: 5px;
     1885        min-width: 0;
     1886        height: 22px;
     1887        margin: 0 3px;
     1888        padding: 0 7px;
     1889        border: 0;
     1890        border-radius: 0;
     1891        font-size: 11.5px;
     1892        font-weight: 600;
     1893        line-height: 22px;
     1894        text-align: left;
     1895        cursor: pointer;
     1896        overflow: hidden;
     1897        transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
     1898}
     1899
     1900.tg-plan-ev:hover {
     1901        transform: translateY(-1px);
     1902        box-shadow: 0 6px 14px -8px rgba(15, 23, 42, .45);
     1903        z-index: 2;
     1904}
     1905
     1906.tg-plan-ev.is-single {
     1907        background: color-mix(in srgb, var(--kc) 9%, #fff);
     1908        color: color-mix(in srgb, var(--kc) 70%, #0f172a);
     1909        border-left: 3px solid var(--kc);
     1910        border-radius: 6px;
     1911}
     1912
     1913.tg-plan-ev.is-multi {
     1914        background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 88%, #fff), var(--kc));
     1915        color: var(--kt, #fff);
     1916        margin-left: 0;
     1917        margin-right: 0;
     1918}
     1919
     1920.tg-plan-ev.is-multi.is-start {
     1921        margin-left: 3px;
     1922        border-top-left-radius: 7px;
     1923        border-bottom-left-radius: 7px;
     1924}
     1925
     1926.tg-plan-ev.is-multi.is-end {
     1927        margin-right: 3px;
     1928        border-top-right-radius: 7px;
     1929        border-bottom-right-radius: 7px;
     1930}
     1931
     1932.tg-plan-ev.is-past {
     1933        opacity: .55;
     1934}
     1935
     1936.tg-plan-ev-dot {
     1937        flex: 0 0 auto;
     1938        width: 6px;
     1939        height: 6px;
     1940        border-radius: 50%;
     1941        background: var(--kc);
     1942        display: none;
     1943}
     1944
     1945.tg-plan-ev-time {
     1946        flex: 0 0 auto;
     1947        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
     1948        font-size: 10.5px;
     1949        font-weight: 700;
     1950        opacity: .85;
     1951}
     1952
     1953.tg-plan-ev-title {
     1954        min-width: 0;
     1955        overflow: hidden;
     1956        white-space: nowrap;
     1957        text-overflow: ellipsis;
     1958}
     1959
     1960.tg-plan-more {
     1961        position: relative;
     1962        z-index: 1;
     1963        justify-self: start;
     1964        margin: 0 6px;
     1965        padding: 0 6px;
     1966        border: 0;
     1967        border-radius: 6px;
     1968        background: transparent;
     1969        color: var(--tg-blue-strong);
     1970        font-size: 11px;
     1971        font-weight: 700;
     1972        line-height: 20px;
     1973        cursor: pointer;
     1974}
     1975
     1976.tg-plan-more:hover {
     1977        background: var(--tg-blue-soft);
     1978}
     1979
     1980.tg-plan-hint {
     1981        margin: 10px 2px 0;
     1982        font-size: 12px;
     1983        color: var(--tg-muted);
     1984}
     1985
     1986/* Agenda panel: a floating window of its own (wide screens) */
     1987.tg-plan-side {
     1988        position: fixed;
     1989        right: 24px;
     1990        bottom: 24px;
     1991        z-index: 9990;
     1992        display: flex;
     1993        flex-direction: column;
     1994        width: 340px;
     1995        max-height: min(60vh, 560px);
     1996        background: #fff;
     1997        border: 1px solid #d7e1f2;
     1998        border-radius: 18px;
     1999        box-shadow: 0 1px 2px rgba(16, 36, 94, .06), 0 24px 56px -12px rgba(21, 44, 105, .32);
     2000        overflow: hidden;
     2001        animation: tg-float-in .25s cubic-bezier(.2, .7, .2, 1) both;
     2002}
     2003
     2004@keyframes tg-float-in {
     2005        from { opacity: 0; transform: translateY(12px) scale(.98); }
     2006        to   { opacity: 1; transform: none; }
     2007}
     2008
     2009.tg-plan-side.is-hidden {
     2010        display: none;
     2011}
     2012
     2013.tg-plan-side.is-dragging {
     2014        box-shadow: 0 1px 2px rgba(16, 36, 94, .06), 0 32px 70px -12px rgba(21, 44, 105, .45);
     2015        transition: none;
     2016}
     2017
     2018.tg-plan-side-bar {
     2019        display: flex;
     2020        align-items: center;
     2021        gap: 10px;
     2022        flex: 0 0 auto;
     2023        padding: 11px 10px 11px 10px;
     2024        background: linear-gradient(180deg, #fff, #f6f9ff);
     2025        border-bottom: 1px solid #eef2fa;
     2026        cursor: grab;
     2027        user-select: none;
     2028        touch-action: none;
     2029}
     2030
     2031.tg-plan-side.is-dragging .tg-plan-side-bar {
     2032        cursor: grabbing;
     2033}
     2034
     2035.tg-plan-side.is-min .tg-plan-side-bar {
     2036        border-bottom: 0;
     2037}
     2038
     2039.tg-plan-side.is-min .tg-plan-side-body {
     2040        display: none;
     2041}
     2042
     2043.tg-plan-side.is-min #tg-plan-side-min svg {
     2044        transform: rotate(180deg);
     2045}
     2046
     2047.tg-plan-side-grip {
     2048        display: grid;
     2049        grid-template-columns: repeat(2, 3px);
     2050        gap: 3px;
     2051        padding: 0 2px;
     2052        opacity: .45;
     2053}
     2054
     2055.tg-plan-side-grip i {
     2056        width: 3px;
     2057        height: 3px;
     2058        border-radius: 50%;
     2059        background: var(--tg-muted);
     2060}
     2061
     2062.tg-plan-side-icon {
     2063        flex: 0 0 auto;
     2064        width: 34px;
     2065        height: 34px;
     2066        border-radius: 11px;
     2067        display: flex;
     2068        align-items: center;
     2069        justify-content: center;
     2070        color: #0d9488;
     2071        background: linear-gradient(160deg, #e6f6f4, #ccebe7);
     2072        box-shadow: inset 0 0 0 1px rgba(13, 148, 136, .18), 0 6px 14px -6px rgba(13, 148, 136, .42);
     2073}
     2074
     2075.tg-plan-side-titles {
     2076        display: flex;
     2077        flex-direction: column;
     2078        min-width: 0;
     2079        flex: 1 1 auto;
     2080}
     2081
     2082.tg-plan-side-titles strong {
     2083        font-size: 14px;
     2084        font-weight: 800;
     2085        letter-spacing: -.01em;
     2086        color: var(--tg-navy);
     2087        white-space: nowrap;
     2088        overflow: hidden;
     2089        text-overflow: ellipsis;
     2090        text-transform: capitalize;
     2091}
     2092
     2093.tg-plan-side-titles span {
     2094        font-size: 12px;
     2095        color: var(--tg-muted);
     2096        white-space: nowrap;
     2097        overflow: hidden;
     2098        text-overflow: ellipsis;
     2099}
     2100
     2101.tg-plan-side-btn {
     2102        flex: 0 0 auto;
     2103        display: inline-flex;
     2104        align-items: center;
     2105        justify-content: center;
     2106        width: 30px;
     2107        height: 30px;
     2108        padding: 0;
     2109        border: 0;
     2110        border-radius: 9px;
     2111        background: transparent;
     2112        color: var(--tg-muted);
     2113        cursor: pointer;
     2114        transition: background .15s ease, color .15s ease;
     2115}
     2116
     2117.tg-plan-side-btn svg {
     2118        transition: transform .2s ease;
     2119}
     2120
     2121.tg-plan-side-btn:hover {
     2122        background: var(--tg-blue-soft);
     2123        color: var(--tg-blue-strong);
     2124}
     2125
     2126.tg-plan-side-btn:focus-visible {
     2127        outline: 2px solid var(--tg-blue);
     2128        outline-offset: 1px;
     2129}
     2130
     2131.tg-plan-side-body {
     2132        flex: 1 1 auto;
     2133        min-height: 0;
     2134        padding: 14px 14px 14px;
     2135        overflow-y: auto;
     2136        overscroll-behavior: contain;
     2137}
     2138
     2139.tg-plan-toggle.is-on {
     2140        background: var(--tg-blue-soft);
     2141        border-color: #b9cdf3;
     2142}
     2143
     2144.tg-plan-side-actions {
     2145        display: flex;
     2146        flex-wrap: wrap;
     2147        gap: 8px;
     2148        margin-bottom: 14px;
     2149}
     2150
     2151.tg-plan-group + .tg-plan-group {
     2152        margin-top: 14px;
     2153}
     2154
     2155.tg-plan-group-label {
     2156        margin: 0 0 7px;
     2157        font-size: 11px;
     2158        font-weight: 700;
     2159        letter-spacing: .07em;
     2160        text-transform: uppercase;
     2161        color: var(--tg-muted);
     2162}
     2163
     2164.tg-plan-group-label.is-today {
     2165        color: var(--tg-blue-strong);
     2166}
     2167
     2168.tg-plan-list {
     2169        display: flex;
     2170        flex-direction: column;
     2171        gap: 7px;
     2172}
     2173
     2174.tg-plan-row {
     2175        display: flex;
     2176        flex-direction: column;
     2177        gap: 5px;
     2178        width: 100%;
     2179        padding: 9px 11px;
     2180        border: 1px solid #e6edf9;
     2181        border-left: 3px solid var(--kc);
     2182        border-radius: 10px;
     2183        background: #fff;
     2184        text-align: left;
     2185        cursor: pointer;
     2186        transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
     2187}
     2188
     2189.tg-plan-row:hover {
     2190        transform: translateY(-1px);
     2191        border-color: #c3d6f5;
     2192        border-left-color: var(--kc);
     2193        box-shadow: 0 8px 18px -10px rgba(21, 44, 105, .35);
     2194}
     2195
     2196.tg-plan-row-meta {
     2197        display: flex;
     2198        align-items: center;
     2199        gap: 7px;
     2200}
     2201
     2202.tg-plan-badge {
     2203        padding: 1px 7px;
     2204        border-radius: 6px;
     2205        background: #0f172a;
     2206        color: #fff;
     2207        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
     2208        font-size: 10.5px;
     2209        font-weight: 700;
     2210        line-height: 17px;
     2211}
     2212
     2213.tg-plan-badge.is-soft {
     2214        background: #eef2f7;
     2215        color: #475569;
     2216        font-family: inherit;
     2217}
     2218
     2219.tg-plan-row-kind {
     2220        font-size: 11px;
     2221        font-weight: 700;
     2222        color: var(--kc);
     2223}
     2224
     2225.tg-plan-row-body {
     2226        display: flex;
     2227        flex-direction: column;
     2228        gap: 2px;
     2229        min-width: 0;
     2230}
     2231
     2232.tg-plan-row-title {
     2233        font-size: 13px;
     2234        font-weight: 700;
     2235        color: var(--tg-ink);
     2236        overflow-wrap: anywhere;
     2237}
     2238
     2239.tg-plan-row-sub,
     2240.tg-plan-row-notes {
     2241        font-size: 12px;
     2242        color: var(--tg-muted);
     2243}
     2244
     2245.tg-plan-row-notes {
     2246        display: -webkit-box;
     2247        -webkit-line-clamp: 2;
     2248        -webkit-box-orient: vertical;
     2249        overflow: hidden;
     2250        white-space: pre-line;
     2251}
     2252
     2253.tg-plan-empty {
     2254        margin: 4px 0 6px;
     2255        padding: 16px 14px;
     2256        border: 1px dashed #d7e1f2;
     2257        border-radius: 12px;
     2258        text-align: center;
     2259        font-size: 12.5px;
     2260        color: var(--tg-muted);
     2261}
     2262
     2263/* Modal: type picker as coloured pills */
     2264.tg-plan-modal-inner {
     2265        width: min(540px, calc(100vw - 40px));
     2266}
     2267
     2268.tg-plan-kinds {
     2269        display: flex;
     2270        flex-wrap: wrap;
     2271        gap: 6px;
     2272}
     2273
     2274.tg-plan-kind {
     2275        position: relative;
     2276        cursor: pointer;
     2277}
     2278
     2279.tg-plan-kind input {
     2280        position: absolute;
     2281        opacity: 0;
     2282        pointer-events: none;
     2283}
     2284
     2285.tg-plan-kind span {
     2286        display: inline-flex;
     2287        align-items: center;
     2288        gap: 7px;
     2289        padding: 6px 12px;
     2290        border: 1px solid #dde7f7;
     2291        border-radius: 999px;
     2292        background: #fff;
     2293        font-size: 12.5px;
     2294        font-weight: 600;
     2295        color: var(--tg-ink);
     2296        transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
     2297}
     2298
     2299.tg-plan-kind span i {
     2300        width: 8px;
     2301        height: 8px;
     2302        border-radius: 50%;
     2303        background: var(--kc);
     2304}
     2305
     2306.tg-plan-kind:hover span {
     2307        border-color: color-mix(in srgb, var(--kc) 45%, #fff);
     2308}
     2309
     2310.tg-plan-kind input:checked + span {
     2311        background: color-mix(in srgb, var(--kc) 11%, #fff);
     2312        border-color: var(--kc);
     2313        color: color-mix(in srgb, var(--kc) 75%, #0f172a);
     2314        box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc) 16%, transparent);
     2315}
     2316
     2317.tg-plan-kind input:focus-visible + span {
     2318        outline: 2px solid var(--tg-blue);
     2319        outline-offset: 2px;
     2320}
     2321
     2322.tg-plan-allday {
     2323        margin-top: 12px;
     2324}
     2325
     2326.tg-plan-error {
     2327        margin: 12px 0 0;
     2328        padding: 9px 12px;
     2329        border-radius: 10px;
     2330        background: #feecec;
     2331        color: #b91c1c;
     2332        font-size: 12.5px;
     2333        font-weight: 600;
     2334}
     2335
     2336.tg-plan-footer {
     2337        align-items: center;
     2338}
     2339
     2340.tg-plan-footer-gap {
     2341        flex: 1 1 auto;
     2342}
     2343
     2344/* Narrow screens: the agenda is a normal block under the calendar. */
     2345@media (max-width: 782px) {
     2346        .tg-plan-side {
     2347                position: static;
     2348                width: auto;
     2349                max-height: none;
     2350                margin-top: 18px;
     2351                animation: none;
     2352                left: auto !important;
     2353                top: auto !important;
     2354        }
     2355        .tg-plan-side-bar {
     2356                cursor: default;
     2357                touch-action: auto;
     2358        }
     2359        .tg-plan-side-grip {
     2360                display: none;
     2361        }
     2362}
     2363
     2364/* Phones: titles do not fit in a seventh of the screen; show colour
     2365   strips only and let the agenda panel carry the words. */
    12422366@media (max-width: 700px) {
    1243         .tg-metric-grid {
    1244                 grid-template-columns: 1fr;
    1245         }
    1246 }
    1247 
    1248 .tg-metric {
     2367        .tg-plan-week {
     2368                grid-template-rows: 28px repeat(var(--lanes, 3), 8px) 18px;
     2369                min-height: 0;
     2370        }
     2371        .tg-plan-more {
     2372                margin: 0;
     2373                padding: 0 2px;
     2374                font-size: 10px;
     2375                line-height: 18px;
     2376        }
     2377        .tg-plan-ev {
     2378                height: 6px;
     2379                padding: 0;
     2380                font-size: 0;
     2381                line-height: 0;
     2382        }
     2383        .tg-plan-ev.is-single {
     2384                background: var(--kc);
     2385                border-left: 0;
     2386                border-radius: 3px;
     2387        }
     2388        .tg-plan-ev-time,
     2389        .tg-plan-ev-title {
     2390                display: none;
     2391        }
     2392        .tg-plan-month {
     2393                min-width: 0;
     2394                font-size: 15px;
     2395        }
     2396        .tg-plan-wd {
     2397                padding: 0 2px;
     2398                text-align: center;
     2399                font-size: 10px;
     2400        }
     2401        .tg-plan-day {
     2402                padding: 3px 2px;
     2403                text-align: center;
     2404        }
     2405        .tg-plan-num {
     2406                min-width: 22px;
     2407                height: 22px;
     2408                font-size: 11.5px;
     2409        }
     2410        .tg-plan-hint {
     2411                display: none;
     2412        }
     2413}
     2414
     2415@media (prefers-reduced-motion: reduce) {
     2416        .tg-plan-ev,
     2417        .tg-plan-ev:hover,
     2418        .tg-plan-row,
     2419        .tg-plan-row:hover {
     2420                transition: none;
     2421                transform: none;
     2422        }
     2423        .tg-plan-side {
     2424                animation: none;
     2425        }
     2426}
     2427
     2428
     2429/* ==================================================================
     2430   Settings: section pills + calendar types editor
     2431   ================================================================== */
     2432
     2433.tg-pills {
     2434        display: inline-flex;
     2435        flex-wrap: wrap;
     2436        gap: 4px;
     2437        margin: 0 0 16px;
     2438        padding: 4px;
     2439        background: #fff;
     2440        border: 1px solid #dde7f7;
     2441        border-radius: 999px;
     2442        box-shadow: 0 4px 14px rgba(21, 44, 105, .06);
     2443}
     2444
     2445.tg-pill {
     2446        display: inline-flex;
     2447        align-items: center;
     2448        gap: 7px;
     2449        padding: 7px 15px;
     2450        border-radius: 999px;
     2451        color: var(--tg-muted);
     2452        font-size: 13px;
     2453        font-weight: 700;
     2454        text-decoration: none;
     2455        transition: background .15s ease, color .15s ease;
     2456}
     2457
     2458.tg-pill:hover,
     2459.tg-pill:focus {
     2460        color: var(--tg-blue-strong);
     2461        background: var(--tg-blue-softer);
     2462}
     2463
     2464.tg-pill.is-active {
     2465        background: linear-gradient(180deg, #3b82f6, var(--tg-blue));
     2466        color: #fff;
     2467        box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .8);
     2468}
     2469
     2470.tg-pill:focus-visible {
     2471        outline: 2px solid var(--tg-blue);
     2472        outline-offset: 2px;
     2473}
     2474
     2475.tg-kinds-intro {
     2476        margin: -6px 0 16px;
     2477}
     2478
     2479.tg-kinds {
    12492480        display: flex;
    12502481        flex-direction: column;
     2482        gap: 8px;
     2483}
     2484
     2485.tg-kind-row {
     2486        display: grid;
     2487        grid-template-columns: 40px minmax(140px, 260px) minmax(0, 1fr) auto 36px;
     2488        align-items: center;
    12512489        gap: 12px;
    1252         padding: 18px 20px;
    1253         margin-bottom: 0;
    1254 }
    1255 
    1256 .tg-metric-title {
     2490        padding: 8px 10px;
     2491        border: 1px solid #e6edf9;
     2492        border-radius: 12px;
     2493        background: #fff;
     2494        transition: border-color .15s ease, box-shadow .15s ease;
     2495}
     2496
     2497.tg-kind-row.is-current,
     2498.tg-kind-row:focus-within {
     2499        border-color: #c3d6f5;
     2500        box-shadow: 0 6px 16px -10px rgba(21, 44, 105, .35);
     2501}
     2502
     2503.tg-kind-row.is-new {
     2504        animation: tg-stat-in .25s ease both;
     2505}
     2506
     2507.tg-kind-swatch {
     2508        position: relative;
     2509        width: 36px;
     2510        height: 36px;
     2511        border-radius: 11px;
     2512        background: var(--kc, #2563eb);
     2513        box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12), 0 6px 12px -6px var(--kc, #2563eb);
     2514        cursor: pointer;
     2515}
     2516
     2517.tg-kind-swatch input {
     2518        position: absolute;
     2519        inset: 0;
     2520        width: 100%;
     2521        height: 100%;
     2522        opacity: 0;
     2523        cursor: pointer;
     2524        border: 0;
     2525        padding: 0;
     2526}
     2527
     2528.tg-kind-swatch:focus-within {
     2529        outline: 2px solid var(--tg-blue);
     2530        outline-offset: 2px;
     2531}
     2532
     2533.tg-kind-label {
     2534        width: 100%;
     2535}
     2536
     2537.tg-kind-preview {
     2538        justify-self: start;
     2539        display: inline-flex;
     2540        align-items: center;
     2541        gap: 7px;
     2542        max-width: 100%;
     2543        padding: 5px 11px;
     2544        border-radius: 999px;
     2545        background: color-mix(in srgb, var(--kc, #2563eb) 10%, #fff);
     2546        color: color-mix(in srgb, var(--kc, #2563eb) 82%, #0f172a);
    12572547        font-size: 12px;
    1258         font-weight: 800;
    1259         text-transform: uppercase;
    1260         letter-spacing: .07em;
    1261         color: var(--tg-muted);
    1262 }
    1263 
    1264 .tg-metric-body {
    1265         display: flex;
    1266         align-items: center;
     2548        font-weight: 600;
     2549        overflow: hidden;
     2550        white-space: nowrap;
     2551}
     2552
     2553.tg-kind-preview i {
     2554        flex: 0 0 auto;
     2555        width: 8px;
     2556        height: 8px;
     2557        border-radius: 50%;
     2558        background: var(--kc, #2563eb);
     2559}
     2560
     2561.tg-kind-preview > span {
     2562        overflow: hidden;
     2563        text-overflow: ellipsis;
     2564}
     2565
     2566.tg-kind-usage {
     2567        font-size: 12px;
     2568        font-weight: 600;
     2569        color: var(--tg-muted);
     2570        white-space: nowrap;
     2571}
     2572
     2573.tg-kind-usage.tg-kind-new {
     2574        padding: 2px 8px;
     2575        border-radius: 999px;
     2576        background: var(--tg-blue-soft);
     2577        color: var(--tg-blue-strong);
     2578}
     2579
     2580.tg-kind-remove {
     2581        display: inline-flex;
     2582        align-items: center;
     2583        justify-content: center;
     2584        width: 34px;
     2585        height: 34px;
     2586        padding: 0;
     2587        border: 1px solid transparent;
     2588        border-radius: 10px;
     2589        background: transparent;
     2590        color: #94a3b8;
     2591        cursor: pointer;
     2592        transition: background .15s ease, color .15s ease, border-color .15s ease;
     2593}
     2594
     2595.tg-kind-remove:hover,
     2596.tg-kind-remove:focus-visible {
     2597        background: #feecec;
     2598        border-color: #f7c4c4;
     2599        color: #dc2626;
     2600        outline: none;
     2601}
     2602
     2603.tg-kinds-add {
     2604        display: flex;
     2605        align-items: center;
     2606        justify-content: space-between;
    12672607        gap: 14px;
    1268 }
    1269 
    1270 .tg-metric-disc {
    1271         width: 58px;
    1272         height: 58px;
    1273         flex: 0 0 58px;
    1274         border-radius: 16px;
    1275         display: flex;
    1276         align-items: center;
    1277         justify-content: center;
    1278 }
    1279 
    1280 .tg-metric-copy {
    1281         display: flex;
    1282         flex-direction: column;
    1283         gap: 4px;
    1284         min-width: 0;
    1285 }
    1286 
    1287 .tg-metric-value {
    1288         font-size: 28px;
    1289         font-weight: 800;
    1290         letter-spacing: -.02em;
    1291         color: var(--tg-navy);
    1292         line-height: 1.05;
    1293 }
    1294 
    1295 .tg-metric-foot {
    1296         display: inline-flex;
    1297         align-items: center;
    1298         gap: 7px;
     2608        flex-wrap: wrap;
     2609        margin-top: 14px;
     2610}
     2611
     2612.tg-kind-presets {
     2613        display: flex;
     2614        align-items: center;
     2615        gap: 6px;
     2616        flex-wrap: wrap;
    12992617        font-size: 12px;
    1300         color: var(--tg-muted);
    1301         font-weight: 500;
    1302 }
    1303 
     2618}
     2619
     2620.tg-kind-preset {
     2621        width: 20px;
     2622        height: 20px;
     2623        padding: 0;
     2624        border: 2px solid #fff;
     2625        border-radius: 50%;
     2626        background: var(--kc);
     2627        box-shadow: 0 0 0 1px rgba(15, 23, 42, .12);
     2628        cursor: pointer;
     2629        transition: transform .12s ease;
     2630}
     2631
     2632.tg-kind-preset:hover,
     2633.tg-kind-preset:focus-visible {
     2634        transform: scale(1.15);
     2635        outline: none;
     2636        box-shadow: 0 0 0 2px var(--kc);
     2637}
     2638
     2639.tg-kinds-limit {
     2640        margin: 12px 0 0;
     2641        font-size: 12px;
     2642}
     2643
     2644@media (max-width: 700px) {
     2645        .tg-kind-row {
     2646                grid-template-columns: 40px minmax(0, 1fr) 36px;
     2647        }
     2648        .tg-kind-preview,
     2649        .tg-kind-usage {
     2650                display: none;
     2651        }
     2652}
    13042653
    13052654/* WordPress admin notices, relocated above the app shell */
  • freelancer-time-log-pro/trunk/assets/admin.js

    r3672459 r3739496  
    10511051         * ------------------------------------------------------- */
    10521052
     1053        /* ---------------------------------------------------------
     1054         * Planning (calendar)
     1055         *
     1056         * The month grid is drawn here from JSON the page prints, so moving
     1057         * between months, saving and deleting never reload the page.
     1058         * Dates are plain "Y-m-d" strings in the site's timezone; all date
     1059         * maths runs in UTC so daylight-saving changes can never shift a day.
     1060         * ------------------------------------------------------- */
     1061
     1062        var PLAN_LANES = 3;
     1063        var LS_PLAN_HIDDEN = "frtlp_tlog_plan_hidden_v1";
     1064
     1065        var plan = null;
     1066
     1067        function pd(str) {
     1068                var p = String(str).split("-");
     1069                return Date.UTC(+p[0], +p[1] - 1, +p[2]);
     1070        }
     1071
     1072        function ymd(ms) {
     1073                var d = new Date(ms);
     1074                return d.getUTCFullYear() + "-" + String(d.getUTCMonth() + 1).padStart(2, "0") + "-" + String(d.getUTCDate()).padStart(2, "0");
     1075        }
     1076
     1077        function addDays(str, n) {
     1078                return ymd(pd(str) + n * 86400000);
     1079        }
     1080
     1081        function daysBetween(a, b) {
     1082                return Math.round((pd(b) - pd(a)) / 86400000);
     1083        }
     1084
     1085        function windowFor(month) {
     1086                var first = month + "-01";
     1087                var dow = new Date(pd(first)).getUTCDay();
     1088                var back = (dow - plan.startOfWeek + 7) % 7;
     1089                var from = addDays(first, -back);
     1090                return { from: from, to: addDays(from, 41) };
     1091        }
     1092
     1093        function shiftMonth(month, n) {
     1094                var p = month.split("-");
     1095                var d = new Date(Date.UTC(+p[0], +p[1] - 1 + n, 1));
     1096                return d.getUTCFullYear() + "-" + String(d.getUTCMonth() + 1).padStart(2, "0");
     1097        }
     1098
     1099        function fmtDate(str, opts) {
     1100                try {
     1101                        return new Intl.DateTimeFormat(plan.locale, $.extend({ timeZone: "UTC" }, opts)).format(new Date(pd(str)));
     1102                } catch (e) {
     1103                        return new Intl.DateTimeFormat("en", $.extend({ timeZone: "UTC" }, opts)).format(new Date(pd(str)));
     1104                }
     1105        }
     1106
     1107        function pt(key, fallback) {
     1108                return (plan && plan.i18n && plan.i18n[key]) || fallback || "";
     1109        }
     1110
     1111        function kindOf(key) {
     1112                for (var i = 0; i < plan.kinds.length; i++) {
     1113                        if (plan.kinds[i].key === key) {
     1114                                return plan.kinds[i];
     1115                        }
     1116                }
     1117                return plan.kinds[0];
     1118        }
     1119
     1120        function hasKind(key) {
     1121                return plan.kinds.some(function (k) { return k.key === key; });
     1122        }
     1123
     1124        // Default type for a new item: the preferred one if it still exists,
     1125        // otherwise the first type in the list.
     1126        function defaultKind(preferred) {
     1127                return preferred && hasKind(preferred) ? preferred : plan.kinds[0].key;
     1128        }
     1129
     1130        // Readable text on a solid bar of any colour the user picked.
     1131        function inkFor(hex) {
     1132                var m = /^#?([0-9a-f]{6})$/i.exec(hex || "");
     1133                if (!m) { return "#fff"; }
     1134                var n = parseInt(m[1], 16);
     1135                var lin = [n >> 16 & 255, n >> 8 & 255, n & 255].map(function (c) {
     1136                        c /= 255;
     1137                        return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
     1138                });
     1139                var L = 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];
     1140                return L > 0.4 ? "#0f172a" : "#fff";
     1141        }
     1142
     1143        function el(tag, cls, text) {
     1144                var n = document.createElement(tag);
     1145                if (cls) { n.className = cls; }
     1146                if (text !== undefined && text !== null) { n.textContent = text; }
     1147                return n;
     1148        }
     1149
     1150        function visibleItems() {
     1151                return plan.items.filter(function (it) {
     1152                        return !plan.hidden[it.kind];
     1153                });
     1154        }
     1155
     1156        function timeLabel(it) {
     1157                if (!it.startTime) {
     1158                        return "";
     1159                }
     1160                return it.endTime ? it.startTime + "–" + it.endTime : it.startTime;
     1161        }
     1162
     1163        function sortItems(list) {
     1164                return list.slice().sort(function (a, b) {
     1165                        if (a.start !== b.start) { return a.start < b.start ? -1 : 1; }
     1166                        var la = daysBetween(a.start, a.end), lb = daysBetween(b.start, b.end);
     1167                        if (la !== lb) { return lb - la; }
     1168                        if ((a.startTime || "") !== (b.startTime || "")) {
     1169                                // Timed items (appointments, deadlines) before all-day notes,
     1170                                // so a busy day hides a note behind "+N more", not a meeting.
     1171                                if (!a.startTime) { return 1; }
     1172                                if (!b.startTime) { return -1; }
     1173                                return a.startTime < b.startTime ? -1 : 1;
     1174                        }
     1175                        return a.id - b.id;
     1176                });
     1177        }
     1178
     1179        /* ---------- Rendering ---------- */
     1180
     1181        function renderPlan() {
     1182                var monthStart = plan.month + "-01";
     1183                document.getElementById("tg-plan-month").textContent = fmtDate(monthStart, { month: "long", year: "numeric" });
     1184
     1185                renderLegend();
     1186                renderHead();
     1187                renderGrid();
     1188                renderSide();
     1189        }
     1190
     1191        function renderLegend() {
     1192                var box = document.getElementById("tg-plan-legend");
     1193                box.textContent = "";
     1194                plan.kinds.forEach(function (k) {
     1195                        var b = el("button", "tg-plan-chip" + (plan.hidden[k.key] ? " is-off" : ""));
     1196                        b.type = "button";
     1197                        b.style.setProperty("--kc", k.color);
     1198                        b.setAttribute("aria-pressed", plan.hidden[k.key] ? "false" : "true");
     1199                        b.setAttribute("data-kind", k.key);
     1200                        b.appendChild(el("i"));
     1201                        b.appendChild(document.createTextNode(k.label));
     1202                        box.appendChild(b);
     1203                });
     1204        }
     1205
     1206        function renderHead() {
     1207                var head = document.getElementById("tg-plan-head");
     1208                head.textContent = "";
     1209                for (var i = 0; i < 7; i++) {
     1210                        var d = addDays(plan.from, i);
     1211                        var c = el("div", "tg-plan-wd", fmtDate(d, { weekday: "short" }));
     1212                        var dow = new Date(pd(d)).getUTCDay();
     1213                        if (dow === 0 || dow === 6) { c.className += " is-weekend"; }
     1214                        head.appendChild(c);
     1215                }
     1216        }
     1217
     1218        function renderGrid() {
     1219                var grid = document.getElementById("tg-plan-grid");
     1220                grid.textContent = "";
     1221
     1222                var items = sortItems(visibleItems());
     1223
     1224                for (var w = 0; w < 6; w++) {
     1225                        var ws = addDays(plan.from, w * 7);
     1226                        var we = addDays(ws, 6);
     1227                        var week = el("div", "tg-plan-week");
     1228                        week.style.setProperty("--lanes", String(PLAN_LANES));
     1229
     1230                        // Day cells (background layer).
     1231                        for (var d = 0; d < 7; d++) {
     1232                                var date = addDays(ws, d);
     1233                                var cell = el("div", "tg-plan-day");
     1234                                var dow = new Date(pd(date)).getUTCDay();
     1235                                cell.setAttribute("data-date", date);
     1236                                cell.style.gridColumn = String(d + 1);
     1237                                if (date.slice(0, 7) !== plan.month) { cell.className += " is-out"; }
     1238                                if (dow === 0 || dow === 6) { cell.className += " is-weekend"; }
     1239                                if (date === plan.today) { cell.className += " is-today"; }
     1240                                if (date < plan.today) { cell.className += " is-past"; }
     1241                                if (date === plan.selected) { cell.className += " is-selected"; }
     1242
     1243                                var num = el("button", "tg-plan-num", String(+date.slice(8)));
     1244                                num.type = "button";
     1245                                num.setAttribute("data-date", date);
     1246                                num.setAttribute("aria-label", fmtDate(date, { weekday: "long", day: "numeric", month: "long" }));
     1247                                cell.appendChild(num);
     1248                                week.appendChild(cell);
     1249                        }
     1250
     1251                        // Lanes: multi-day items first so periods stay on top, as bars.
     1252                        var lanesEnd = [];
     1253                        var hiddenPerDay = [0, 0, 0, 0, 0, 0, 0];
     1254
     1255                        items.forEach(function (it) {
     1256                                if (it.end < ws || it.start > we) {
     1257                                        return;
     1258                                }
     1259                                var s = Math.max(0, daysBetween(ws, it.start));
     1260                                var e = Math.min(6, daysBetween(ws, it.end));
     1261
     1262                                var lane = 0;
     1263                                while (lane < lanesEnd.length && lanesEnd[lane] >= s) {
     1264                                        lane++;
     1265                                }
     1266                                lanesEnd[lane] = e;
     1267
     1268                                if (lane >= PLAN_LANES) {
     1269                                        for (var x = s; x <= e; x++) { hiddenPerDay[x]++; }
     1270                                        return;
     1271                                }
     1272
     1273                                var k = kindOf(it.kind);
     1274                                var multi = it.start !== it.end;
     1275                                var ev = el("button", "tg-plan-ev" + (multi ? " is-multi" : " is-single"));
     1276                                ev.type = "button";
     1277                                ev.setAttribute("data-id", String(it.id));
     1278                                ev.style.setProperty("--kc", k.color);
     1279                                ev.style.setProperty("--kt", inkFor(k.color));
     1280                                ev.style.gridColumn = (s + 1) + " / " + (e + 2);
     1281                                ev.style.gridRow = String(lane + 2);
     1282                                if (it.start >= ws) { ev.className += " is-start"; }
     1283                                if (it.end <= we) { ev.className += " is-end"; }
     1284                                if (it.end < plan.today) { ev.className += " is-past"; }
     1285
     1286                                var tip = it.title + " · " + k.label;
     1287                                if (timeLabel(it)) { tip += " · " + timeLabel(it); }
     1288                                ev.title = tip;
     1289
     1290                                if (!multi) { ev.appendChild(el("i", "tg-plan-ev-dot")); }
     1291                                if (timeLabel(it) && (!multi || it.start >= ws)) {
     1292                                        ev.appendChild(el("span", "tg-plan-ev-time", it.startTime));
     1293                                }
     1294                                ev.appendChild(el("span", "tg-plan-ev-title", it.title));
     1295                                week.appendChild(ev);
     1296                        });
     1297
     1298                        for (var h = 0; h < 7; h++) {
     1299                                if (!hiddenPerDay[h]) { continue; }
     1300                                var more = el("button", "tg-plan-more", pt("more", "+%d more").replace("%d", hiddenPerDay[h]));
     1301                                more.type = "button";
     1302                                more.setAttribute("data-date", addDays(ws, h));
     1303                                more.style.gridColumn = String(h + 1);
     1304                                more.style.gridRow = String(PLAN_LANES + 2);
     1305                                week.appendChild(more);
     1306                        }
     1307
     1308                        grid.appendChild(week);
     1309                }
     1310        }
     1311
     1312        function relativeDay(date) {
     1313                if (date === plan.today) { return pt("today", "Today"); }
     1314                if (date === addDays(plan.today, 1)) { return pt("tomorrow", "Tomorrow"); }
     1315                return fmtDate(date, { weekday: "short", day: "numeric", month: "short" });
     1316        }
     1317
     1318        function agendaRow(it, onDate) {
     1319                var k = kindOf(it.kind);
     1320                var row = el("button", "tg-plan-row");
     1321                row.type = "button";
     1322                row.setAttribute("data-id", String(it.id));
     1323                row.style.setProperty("--kc", k.color);
     1324
     1325                var meta = el("span", "tg-plan-row-meta");
     1326                var len = daysBetween(it.start, it.end) + 1;
     1327                if (timeLabel(it) && (!onDate || onDate === it.start)) {
     1328                        meta.appendChild(el("span", "tg-plan-badge", timeLabel(it)));
     1329                } else if (len > 1) {
     1330                        meta.appendChild(el("span", "tg-plan-badge", pt("days", "%d days").replace("%d", len)));
     1331                } else {
     1332                        meta.appendChild(el("span", "tg-plan-badge is-soft", pt("all_day", "All day")));
     1333                }
     1334                meta.appendChild(el("span", "tg-plan-row-kind", k.label));
     1335
     1336                var body = el("span", "tg-plan-row-body");
     1337                body.appendChild(el("span", "tg-plan-row-title", it.title));
     1338                if (len > 1) {
     1339                        body.appendChild(el("span", "tg-plan-row-sub",
     1340                                fmtDate(it.start, { day: "numeric", month: "short" }) + " – " + fmtDate(it.end, { day: "numeric", month: "short" })));
     1341                }
     1342                if (it.notes) {
     1343                        body.appendChild(el("span", "tg-plan-row-notes", it.notes));
     1344                }
     1345
     1346                row.appendChild(meta);
     1347                row.appendChild(body);
     1348                return row;
     1349        }
     1350
     1351        function sideTitle(title, sub) {
     1352                document.getElementById("tg-plan-side-title").textContent = title;
     1353                document.getElementById("tg-plan-side-sub").textContent = sub || "";
     1354        }
     1355
     1356        function renderSide() {
     1357                var side = document.getElementById("tg-plan-side-body");
     1358                side.textContent = "";
     1359
     1360                if (plan.selected) {
     1361                        var date = plan.selected;
     1362                        var rel = relativeDay(date);
     1363                        var generic = fmtDate(date, { weekday: "short", day: "numeric", month: "short" });
     1364                        sideTitle(fmtDate(date, { weekday: "long", day: "numeric", month: "long" }), rel === generic ? fmtDate(date, { year: "numeric" }) : rel);
     1365
     1366                        var acts = el("div", "tg-plan-side-actions");
     1367                        var add = el("button", "tg-btn tg-btn-primary tg-btn-sm", pt("add_here", "Add to this day"));
     1368                        add.type = "button";
     1369                        add.id = "tg-plan-add-day";
     1370                        add.setAttribute("data-date", date);
     1371                        var back = el("button", "tg-btn tg-btn-secondary tg-btn-sm", pt("back", "Back to upcoming"));
     1372                        back.type = "button";
     1373                        back.id = "tg-plan-back";
     1374                        acts.appendChild(add);
     1375                        acts.appendChild(back);
     1376                        side.appendChild(acts);
     1377
     1378                        var dayItems = sortItems(plan.items.filter(function (it) {
     1379                                return it.start <= date && it.end >= date;
     1380                        }));
     1381                        if (!dayItems.length) {
     1382                                side.appendChild(el("p", "tg-plan-empty", pt("day_empty", "Nothing planned on this day.")));
     1383                                return;
     1384                        }
     1385                        var list = el("div", "tg-plan-list");
     1386                        dayItems.forEach(function (it) { list.appendChild(agendaRow(it, date)); });
     1387                        side.appendChild(list);
     1388                        return;
     1389                }
     1390
     1391                sideTitle(pt("upcoming", "Upcoming"), pt("upcoming_sub", "The next 30 days"));
     1392
     1393                var up = sortItems(plan.upcoming.filter(function (it) { return !plan.hidden[it.kind]; }));
     1394                if (!up.length) {
     1395                        side.appendChild(el("p", "tg-plan-empty", pt("nothing", "Nothing planned.")));
     1396                        return;
     1397                }
     1398
     1399                // Group by the day the item is "next" relevant: ongoing periods sit
     1400                // under today.
     1401                var groups = {};
     1402                var order = [];
     1403                up.forEach(function (it) {
     1404                        var key = it.start < plan.today ? plan.today : it.start;
     1405                        if (!groups[key]) { groups[key] = []; order.push(key); }
     1406                        groups[key].push(it);
     1407                });
     1408                order.sort();
     1409
     1410                order.forEach(function (key) {
     1411                        var g = el("div", "tg-plan-group");
     1412                        g.appendChild(el("div", "tg-plan-group-label" + (key === plan.today ? " is-today" : ""), relativeDay(key)));
     1413                        var list = el("div", "tg-plan-list");
     1414                        groups[key].forEach(function (it) { list.appendChild(agendaRow(it, key)); });
     1415                        g.appendChild(list);
     1416                        side.appendChild(g);
     1417                });
     1418        }
     1419
     1420        /* ---------- Floating agenda panel ----------
     1421         * A window of its own on wide screens: drag it by the bar, collapse it
     1422         * to the bar, or hide it (the "Agenda" button brings it back). Where it
     1423         * sits and how it looks is remembered per browser. On narrow screens
     1424         * it is simply a block under the calendar.
     1425         */
     1426
     1427        var LS_PLAN_FLOAT = "frtlp_tlog_plan_float_v1";
     1428        var floatState = { x: null, y: null, min: false, hidden: false };
     1429
     1430        function isFloating() {
     1431                return !window.matchMedia || window.matchMedia("(min-width: 783px)").matches;
     1432        }
     1433
     1434        function saveFloat() {
     1435                try { localStorage.setItem(LS_PLAN_FLOAT, JSON.stringify(floatState)); } catch (e) {}
     1436        }
     1437
     1438        function clampFloat() {
     1439                var box = document.getElementById("tg-plan-side");
     1440                if (!box || !isFloating() || floatState.x === null) {
     1441                        if (box) { box.style.left = ""; box.style.top = ""; }
     1442                        return;
     1443                }
     1444                var w = box.offsetWidth, h = box.offsetHeight;
     1445                var maxX = Math.max(8, window.innerWidth - w - 8);
     1446                var maxY = Math.max(40, window.innerHeight - Math.min(h, 120) - 8);
     1447                floatState.x = Math.min(maxX, Math.max(8, floatState.x));
     1448                floatState.y = Math.min(maxY, Math.max(40, floatState.y));
     1449                box.style.left = floatState.x + "px";
     1450                box.style.top = floatState.y + "px";
     1451                box.style.right = "auto";
     1452                box.style.bottom = "auto";
     1453        }
     1454
     1455        function applyFloat() {
     1456                var box = document.getElementById("tg-plan-side");
     1457                box.classList.toggle("is-min", !!floatState.min);
     1458                box.classList.toggle("is-hidden", !!floatState.hidden);
     1459                var minBtn = document.getElementById("tg-plan-side-min");
     1460                minBtn.setAttribute("aria-expanded", floatState.min ? "false" : "true");
     1461                var tog = document.getElementById("tg-plan-toggle");
     1462                tog.setAttribute("aria-pressed", floatState.hidden ? "false" : "true");
     1463                tog.classList.toggle("is-on", !floatState.hidden);
     1464                clampFloat();
     1465        }
     1466
     1467        function showFloat() {
     1468                floatState.hidden = false;
     1469                floatState.min = false;
     1470                applyFloat();
     1471                saveFloat();
     1472        }
     1473
     1474        function initFloat() {
     1475                try {
     1476                        var saved = JSON.parse(localStorage.getItem(LS_PLAN_FLOAT) || "null");
     1477                        if (saved && typeof saved === "object") { $.extend(floatState, saved); }
     1478                } catch (e) {}
     1479
     1480                var box = document.getElementById("tg-plan-side");
     1481                var bar = document.getElementById("tg-plan-side-bar");
     1482                var drag2 = null;
     1483
     1484                bar.addEventListener("pointerdown", function (e) {
     1485                        if (!isFloating() || e.button !== 0 || e.target.closest(".tg-plan-side-btn")) { return; }
     1486                        var r = box.getBoundingClientRect();
     1487                        drag2 = { dx: e.clientX - r.left, dy: e.clientY - r.top };
     1488                        box.classList.add("is-dragging");
     1489                        bar.setPointerCapture(e.pointerId);
     1490                        e.preventDefault();
     1491                });
     1492                bar.addEventListener("pointermove", function (e) {
     1493                        if (!drag2) { return; }
     1494                        floatState.x = e.clientX - drag2.dx;
     1495                        floatState.y = e.clientY - drag2.dy;
     1496                        clampFloat();
     1497                });
     1498                function endDrag() {
     1499                        if (!drag2) { return; }
     1500                        drag2 = null;
     1501                        box.classList.remove("is-dragging");
     1502                        saveFloat();
     1503                }
     1504                bar.addEventListener("pointerup", endDrag);
     1505                bar.addEventListener("pointercancel", endDrag);
     1506
     1507                // Double-click the bar to put it back in its corner.
     1508                bar.addEventListener("dblclick", function (e) {
     1509                        if (e.target.closest(".tg-plan-side-btn")) { return; }
     1510                        floatState.x = null;
     1511                        floatState.y = null;
     1512                        box.style.left = box.style.top = box.style.right = box.style.bottom = "";
     1513                        saveFloat();
     1514                });
     1515
     1516                document.getElementById("tg-plan-side-min").addEventListener("click", function () {
     1517                        floatState.min = !floatState.min;
     1518                        applyFloat();
     1519                        saveFloat();
     1520                });
     1521                document.getElementById("tg-plan-side-close").addEventListener("click", function () {
     1522                        floatState.hidden = true;
     1523                        applyFloat();
     1524                        saveFloat();
     1525                        document.getElementById("tg-plan-toggle").focus();
     1526                });
     1527                document.getElementById("tg-plan-toggle").addEventListener("click", function () {
     1528                        floatState.hidden = !floatState.hidden;
     1529                        if (!floatState.hidden) { floatState.min = false; }
     1530                        applyFloat();
     1531                        saveFloat();
     1532                });
     1533
     1534                window.addEventListener("resize", clampFloat);
     1535                applyFloat();
     1536        }
     1537
     1538        /* ---------- Data ---------- */
     1539
     1540        function loadPlan(month) {
     1541                var win = windowFor(month);
     1542                var $grid = $("#tg-plan-grid").addClass("is-loading");
     1543
     1544                return ajax("frtlp_tlog_plan_list", { from: win.from, to: win.to })
     1545                        .done(function (res) {
     1546                                if (!res || !res.success) {
     1547                                        notify(errorFrom(res));
     1548                                        return;
     1549                                }
     1550                                plan.month = month;
     1551                                plan.from = win.from;
     1552                                plan.to = win.to;
     1553                                plan.items = res.data.items || [];
     1554                                plan.upcoming = res.data.upcoming || [];
     1555                                if (plan.selected && (plan.selected < plan.from || plan.selected > plan.to)) {
     1556                                        plan.selected = "";
     1557                                }
     1558                                renderPlan();
     1559                                try {
     1560                                        window.history.replaceState(null, "", plan.baseUrl + "&month=" + month);
     1561                                } catch (e) {}
     1562                        })
     1563                        .fail(function (xhr) {
     1564                                notify(errorFrom(null, xhr));
     1565                        })
     1566                        .always(function () {
     1567                                $grid.removeClass("is-loading");
     1568                        });
     1569        }
     1570
     1571        function findItem(id) {
     1572                id = parseInt(id, 10);
     1573                var all = plan.items.concat(plan.upcoming);
     1574                for (var i = 0; i < all.length; i++) {
     1575                        if (all[i].id === id) { return all[i]; }
     1576                }
     1577                return null;
     1578        }
     1579
     1580        /* ---------- Modal ---------- */
     1581
     1582        function planError(msg) {
     1583                var $e = $("#tg-plan-error");
     1584                if (msg) {
     1585                        $e.text(msg).removeClass("awd-ttt-hidden");
     1586                } else {
     1587                        $e.text("").addClass("awd-ttt-hidden");
     1588                }
     1589        }
     1590
     1591        function setAllDay(on) {
     1592                $("#tg-plan-allday").prop("checked", on);
     1593                $("#tg-plan-times").toggleClass("awd-ttt-hidden", on);
     1594        }
     1595
     1596        function openPlanModal(it, start, end, kind) {
     1597                var editing = !!(it && it.id);
     1598                var $inner = $("#tg-plan-modal .awd-ttt-modal-inner");
     1599
     1600                // Always open centred; the header can still be dragged.
     1601                $inner.removeClass("awd-ttt-modal-manual").css({ left: "", top: "", right: "", bottom: "" });
     1602
     1603                $("#tg-plan-title").text(editing ? pt("edit_item", "Edit planning item") : pt("new_item", "New planning item"));
     1604                $("#tg-plan-id").val(editing ? it.id : 0);
     1605                $("#tg-plan-name").val(editing ? it.title : "");
     1606                $("#tg-plan-notes").val(editing ? it.notes : "");
     1607                $("#tg-plan-start").val(editing ? it.start : start);
     1608                $("#tg-plan-end").val(editing ? it.end : (end || start));
     1609                $("#tg-plan-t1").val(editing ? it.startTime : "");
     1610                $("#tg-plan-t2").val(editing ? it.endTime : "");
     1611                setAllDay(!(editing && it.startTime));
     1612                $('input[name="tg-plan-kind"][value="' + (editing && hasKind(it.kind) ? it.kind : defaultKind(kind)) + '"]').prop("checked", true);
     1613                $("#tg-plan-delete").toggleClass("awd-ttt-hidden", !editing);
     1614                planError("");
     1615
     1616                $("#tg-plan-backdrop, #tg-plan-modal").removeClass("awd-ttt-hidden");
     1617                makeDraggable($inner.first(), $("#tg-plan-modal .awd-ttt-modal-header").first(), "frtlp_tlog_plan_pos_v1");
     1618                setTimeout(function () { $("#tg-plan-name").trigger("focus"); }, 30);
     1619        }
     1620
     1621        function closePlanModal() {
     1622                $("#tg-plan-backdrop, #tg-plan-modal").addClass("awd-ttt-hidden");
     1623        }
     1624
     1625        function savePlan() {
     1626                var title = $.trim($("#tg-plan-name").val());
     1627                var start = $("#tg-plan-start").val();
     1628                var end = $("#tg-plan-end").val() || start;
     1629                var allDay = $("#tg-plan-allday").is(":checked");
     1630
     1631                if (!title) {
     1632                        planError(pt("need_title", "Please enter a title."));
     1633                        $("#tg-plan-name").trigger("focus");
     1634                        return;
     1635                }
     1636                if (!start || end < start) {
     1637                        planError(pt("bad_range", "The end date is before the start date."));
     1638                        return;
     1639                }
     1640
     1641                var $btn = $("#tg-plan-save").prop("disabled", true);
     1642                planError("");
     1643
     1644                ajax("frtlp_tlog_plan_save", {
     1645                        id: $("#tg-plan-id").val(),
     1646                        title: title,
     1647                        notes: $("#tg-plan-notes").val(),
     1648                        kind: $('input[name="tg-plan-kind"]:checked').val() || defaultKind(),
     1649                        start: start,
     1650                        end: end,
     1651                        start_time: allDay ? "" : $("#tg-plan-t1").val(),
     1652                        end_time: allDay ? "" : $("#tg-plan-t2").val()
     1653                })
     1654                        .done(function (res) {
     1655                                if (!res || !res.success) {
     1656                                        planError(errorFrom(res));
     1657                                        return;
     1658                                }
     1659                                closePlanModal();
     1660                                // Jump to the month of the item when it was planned elsewhere.
     1661                                var month = start.slice(0, 7);
     1662                                if (start > plan.to || end < plan.from) {
     1663                                        loadPlan(month);
     1664                                } else {
     1665                                        loadPlan(plan.month);
     1666                                }
     1667                        })
     1668                        .fail(function (xhr) {
     1669                                planError(errorFrom(null, xhr));
     1670                        })
     1671                        .always(function () {
     1672                                $btn.prop("disabled", false);
     1673                        });
     1674        }
     1675
     1676        function deletePlan() {
     1677                var id = $("#tg-plan-id").val();
     1678                if (!id || id === "0" || !window.confirm(pt("confirm_del", "Delete this planning item?"))) {
     1679                        return;
     1680                }
     1681                ajax("frtlp_tlog_plan_delete", { id: id })
     1682                        .done(function (res) {
     1683                                if (!res || !res.success) {
     1684                                        planError(errorFrom(res));
     1685                                        return;
     1686                                }
     1687                                closePlanModal();
     1688                                loadPlan(plan.month);
     1689                        })
     1690                        .fail(function (xhr) {
     1691                                planError(errorFrom(null, xhr));
     1692                        });
     1693        }
     1694
     1695        /* ---------- Drag to select a period ---------- */
     1696
     1697        var drag = null;
     1698
     1699        function markRange(a, b) {
     1700                var lo = a < b ? a : b;
     1701                var hi = a < b ? b : a;
     1702                $("#tg-plan-grid .tg-plan-day").each(function () {
     1703                        var d = this.getAttribute("data-date");
     1704                        this.classList.toggle("is-range", d >= lo && d <= hi);
     1705                });
     1706        }
     1707
     1708        function clearRange() {
     1709                $("#tg-plan-grid .tg-plan-day.is-range").removeClass("is-range");
     1710        }
     1711
     1712        function dayAt(x, y) {
     1713                var n = document.elementFromPoint(x, y);
     1714                var cell = n && n.closest ? n.closest(".tg-plan-day") : null;
     1715                return cell ? cell.getAttribute("data-date") : "";
     1716        }
     1717
     1718        /* ---------- Init ---------- */
     1719
     1720        function initPlanning() {
     1721                var dataEl = document.getElementById("tg-plan-data");
     1722                if (!dataEl) {
     1723                        return;
     1724                }
     1725
     1726                try {
     1727                        plan = JSON.parse(dataEl.textContent);
     1728                } catch (e) {
     1729                        return;
     1730                }
     1731
     1732                plan.selected = "";
     1733                plan.hidden = {};
     1734                try {
     1735                        plan.hidden = JSON.parse(localStorage.getItem(LS_PLAN_HIDDEN) || "{}") || {};
     1736                } catch (e2) {}
     1737
     1738                renderPlan();
     1739                initFloat();
     1740
     1741                $("#tg-plan-prev").on("click", function () { loadPlan(shiftMonth(plan.month, -1)); });
     1742                $("#tg-plan-next").on("click", function () { loadPlan(shiftMonth(plan.month, 1)); });
     1743                $("#tg-plan-today").on("click", function () {
     1744                        plan.selected = plan.today;
     1745                        if (floatState.hidden || floatState.min) { showFloat(); }
     1746                        var m = plan.today.slice(0, 7);
     1747                        if (m === plan.month) { renderPlan(); } else { loadPlan(m); }
     1748                });
     1749                $("#tg-plan-new").on("click", function () {
     1750                        var d = plan.selected || (plan.today.slice(0, 7) === plan.month ? plan.today : plan.month + "-01");
     1751                        openPlanModal(null, d, d);
     1752                });
     1753
     1754                // Legend chips filter types on and off; remembered per browser.
     1755                $("#tg-plan-legend").on("click", ".tg-plan-chip", function () {
     1756                        var k = this.getAttribute("data-kind");
     1757                        if (plan.hidden[k]) { delete plan.hidden[k]; } else { plan.hidden[k] = 1; }
     1758                        try { localStorage.setItem(LS_PLAN_HIDDEN, JSON.stringify(plan.hidden)); } catch (e) {}
     1759                        renderPlan();
     1760                });
     1761
     1762                var $grid = $("#tg-plan-grid");
     1763
     1764                // Existing item: edit.
     1765                $grid.on("click", ".tg-plan-ev", function (e) {
     1766                        e.stopPropagation();
     1767                        var it = findItem(this.getAttribute("data-id"));
     1768                        if (it) { openPlanModal(it); }
     1769                });
     1770
     1771                // Day number or "+N more": show that day in the side panel.
     1772                $grid.on("click", ".tg-plan-num, .tg-plan-more", function (e) {
     1773                        e.stopPropagation();
     1774                        plan.selected = this.getAttribute("data-date");
     1775                        renderPlan();
     1776                        if (floatState.hidden || floatState.min) { showFloat(); }
     1777                });
     1778
     1779                // Empty part of a day: press, optionally drag across days, release.
     1780                $grid.on("pointerdown", ".tg-plan-day", function (e) {
     1781                        if (e.button !== 0 || $(e.target).closest(".tg-plan-num, .tg-plan-ev, .tg-plan-more").length) {
     1782                                return;
     1783                        }
     1784                        var date = this.getAttribute("data-date");
     1785                        drag = { start: date, end: date, touch: e.pointerType === "touch" };
     1786                        markRange(date, date);
     1787                        if (!drag.touch) { e.preventDefault(); }
     1788                });
     1789
     1790                $(document).on("pointermove.tgplan", function (e) {
     1791                        if (!drag || drag.touch) { return; }
     1792                        var d = dayAt(e.clientX, e.clientY);
     1793                        if (d && d !== drag.end) {
     1794                                drag.end = d;
     1795                                markRange(drag.start, d);
     1796                        }
     1797                });
     1798
     1799                $(document).on("pointerup.tgplan pointercancel.tgplan", function (e) {
     1800                        if (!drag) { return; }
     1801                        var a = drag.start < drag.end ? drag.start : drag.end;
     1802                        var b = drag.start < drag.end ? drag.end : drag.start;
     1803                        var cancelled = e.type === "pointercancel";
     1804                        drag = null;
     1805                        clearRange();
     1806                        if (cancelled) { return; }
     1807                        openPlanModal(null, a, b, a !== b ? "off" : "");
     1808                });
     1809
     1810                // Side panel.
     1811                $("#tg-plan-side").on("click", ".tg-plan-row", function () {
     1812                        var it = findItem(this.getAttribute("data-id"));
     1813                        if (it) { openPlanModal(it); }
     1814                }).on("click", "#tg-plan-add-day", function () {
     1815                        var d = this.getAttribute("data-date");
     1816                        openPlanModal(null, d, d);
     1817                }).on("click", "#tg-plan-back", function () {
     1818                        plan.selected = "";
     1819                        renderPlan();
     1820                });
     1821
     1822                // Modal.
     1823                $("#tg-plan-allday").on("change", function () {
     1824                        setAllDay(this.checked);
     1825                        if (!this.checked) { $("#tg-plan-t1").trigger("focus"); }
     1826                });
     1827                $("#tg-plan-start").on("change", function () {
     1828                        var s = this.value;
     1829                        var $end = $("#tg-plan-end");
     1830                        if (s && (!$end.val() || $end.val() < s)) { $end.val(s); }
     1831                });
     1832                $("#tg-plan-form").on("submit", function (e) {
     1833                        e.preventDefault();
     1834                        savePlan();
     1835                });
     1836                $("#tg-plan-save").on("click", savePlan);
     1837                $("#tg-plan-delete").on("click", deletePlan);
     1838                $("#tg-plan-close, #tg-plan-cancel, #tg-plan-backdrop").on("click", closePlanModal);
     1839                $(document).on("keydown.tgplan", function (e) {
     1840                        if (e.key === "Escape" && !$("#tg-plan-modal").hasClass("awd-ttt-hidden")) {
     1841                                closePlanModal();
     1842                        }
     1843                });
     1844        }
     1845
     1846        /* ---------------------------------------------------------
     1847         * Settings > Calendar: types editor
     1848         * ------------------------------------------------------- */
     1849
     1850        function initKindsEditor() {
     1851                var $list = $("#tg-kinds");
     1852                if (!$list.length) {
     1853                        return;
     1854                }
     1855
     1856                var name = $list.data("name");
     1857                var presets = String($list.data("presets") || "").split(",");
     1858                var dirty = false;
     1859                var lastRow = null;
     1860
     1861                function rows() {
     1862                        return $list.children(".tg-kind-row");
     1863                }
     1864
     1865                // Field names follow the row order, so the saved order is what you see.
     1866                function renumber() {
     1867                        rows().each(function (i) {
     1868                                $(this).find("[data-field], input[name]").each(function () {
     1869                                        var field = this.getAttribute("data-field") || (this.name.match(/\[(key|label|color)\]$/) || [])[1];
     1870                                        if (field) {
     1871                                                this.setAttribute("data-field", field);
     1872                                                this.name = name + "[" + i + "][" + field + "]";
     1873                                        }
     1874                                });
     1875                        });
     1876                        $("#tg-kind-add").prop("disabled", rows().length >= 12);
     1877                }
     1878
     1879                function markDirty() {
     1880                        dirty = true;
     1881                        $("#tg-kinds-hint").text(t("kind_unsaved", "Unsaved changes"));
     1882                }
     1883
     1884                function syncPreview($row) {
     1885                        var color = $row.find('input[type="color"]').val();
     1886                        var label = $.trim($row.find(".tg-kind-label").val());
     1887                        $row.find(".tg-kind-swatch, .tg-kind-preview").each(function () {
     1888                                this.style.setProperty("--kc", color);
     1889                        });
     1890                        $row.find(".tg-kind-preview > span").text(label || "…");
     1891                }
     1892
     1893                function nextColor() {
     1894                        var used = rows().map(function () {
     1895                                return String($(this).find('input[type="color"]').val()).toLowerCase();
     1896                        }).get();
     1897                        for (var i = 0; i < presets.length; i++) {
     1898                                if (used.indexOf(presets[i].toLowerCase()) === -1) {
     1899                                        return presets[i];
     1900                                }
     1901                        }
     1902                        return presets[0] || "#2563eb";
     1903                }
     1904
     1905                $list.on("input change", "input", function () {
     1906                        var $row = $(this).closest(".tg-kind-row");
     1907                        lastRow = $row;
     1908                        syncPreview($row);
     1909                        markDirty();
     1910                });
     1911
     1912                $list.on("focusin", ".tg-kind-row", function () {
     1913                        lastRow = $(this);
     1914                        rows().removeClass("is-current");
     1915                        lastRow.addClass("is-current");
     1916                });
     1917
     1918                $("#tg-kind-add").on("click", function () {
     1919                        if (rows().length >= 12) {
     1920                                notify(t("kind_max", "You can have up to 12 types."));
     1921                                return;
     1922                        }
     1923                        var tpl = document.getElementById("tg-kind-template");
     1924                        var $row = $(tpl.content.firstElementChild.cloneNode(true));
     1925                        $row.find('input[type="color"]').val(nextColor());
     1926                        $list.append($row);
     1927                        renumber();
     1928                        syncPreview($row);
     1929                        markDirty();
     1930                        $row.find(".tg-kind-label").trigger("focus");
     1931                });
     1932
     1933                // Quick colours apply to the row you last worked in.
     1934                $(".tg-kind-presets").on("click", ".tg-kind-preset", function () {
     1935                        var $row = lastRow && lastRow.closest("body").length ? lastRow : rows().last();
     1936                        $row.find('input[type="color"]').val(this.getAttribute("data-color"));
     1937                        syncPreview($row);
     1938                        markDirty();
     1939                });
     1940
     1941                $list.on("click", ".tg-kind-remove", function () {
     1942                        var $row = $(this).closest(".tg-kind-row");
     1943                        if (rows().length <= 1) {
     1944                                notify(t("kind_last", "Keep at least one type."));
     1945                                return;
     1946                        }
     1947                        var used = parseInt($row.attr("data-usage"), 10) || 0;
     1948                        if (used > 0) {
     1949                                var $first = rows().not($row).first();
     1950                                var msg = t("kind_remove_used", '%1$d planning item(s) use "%2$s". When you save, they move to "%3$s". Remove this type?')
     1951                                        .replace("%1$d", used)
     1952                                        .replace("%2$s", $.trim($row.find(".tg-kind-label").val()))
     1953                                        .replace("%3$s", $.trim($first.find(".tg-kind-label").val()));
     1954                                if (!window.confirm(msg)) {
     1955                                        return;
     1956                                }
     1957                        }
     1958                        $row.remove();
     1959                        lastRow = null;
     1960                        renumber();
     1961                        markDirty();
     1962                });
     1963
     1964                $("#tg-kinds-form").on("submit", function () {
     1965                        dirty = false;
     1966                });
     1967
     1968                $(window).on("beforeunload", function () {
     1969                        if (dirty) {
     1970                                return t("kind_unsaved", "Unsaved changes");
     1971                        }
     1972                });
     1973
     1974                renumber();
     1975        }
     1976
    10531977        $(function () {
    10541978                TG = window.FRTLP_TLOG || TG;
    … …  
    10641988                refreshState();
    10651989                initProjectsPage();
     1990                initStatCards();
     1991                initPlanning();
     1992                initKindsEditor();
    10661993        });
     1994
     1995        /**
     1996         * Count the numeric stat cards up from zero, like the other Guard
     1997         * plugins. The server already printed the final value, so without JS
     1998         * (or with reduced motion) nothing changes.
     1999         */
     2000        function initStatCards() {
     2001                var grid = document.getElementById("tg-cards");
     2002                if (!grid || !window.requestAnimationFrame) {
     2003                        return;
     2004                }
     2005                if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
     2006                        return;
     2007                }
     2008
     2009                [].forEach.call(grid.querySelectorAll("[data-count]"), function (el, i) {
     2010                        var to = parseInt(el.getAttribute("data-count"), 10) || 0;
     2011                        if (to <= 0) {
     2012                                return;
     2013                        }
     2014                        el.textContent = "0";
     2015                        setTimeout(function () {
     2016                                var dur = 900;
     2017                                var start = performance.now();
     2018                                function step(now) {
     2019                                        var p = Math.min(1, (now - start) / dur);
     2020                                        var e = 1 - Math.pow(1 - p, 3);
     2021                                        el.textContent = String(Math.round(to * e));
     2022                                        if (p < 1) {
     2023                                                requestAnimationFrame(step);
     2024                                        }
     2025                                }
     2026                                requestAnimationFrame(step);
     2027                        }, 270 + i * 90);
     2028                });
     2029        }
    10672030})(jQuery);
  • freelancer-time-log-pro/trunk/freelancer-time-log-pro.php

    r3672459 r3739496  
    44 * Plugin URI:  https://www.alentejowebdesign.nl/
    55 * Description: A lightweight and efficient time tracker for freelancers to log, manage, and review working hours, rates and earnings.
    6  * Version:     1.1.6
     6 * Version:     1.2.1
    77 * Requires at least: 6.0
    88 * Requires PHP: 7.4
    … …  
    2222
    2323if ( ! defined( 'FRTLP_VERSION' ) ) {
    24         define( 'FRTLP_VERSION', '1.1.6' );
     24        define( 'FRTLP_VERSION', '1.2.1' );
    2525}
    2626
    … …  
    4848class FRTLP_Time_Tracker {
    4949
    50         const DB_VERSION               = '1.2.1';
     50        const DB_VERSION               = '1.3.0';
    5151        const DB_VERSION_OPTION        = 'frtlp_tlog_db_version';
    5252        const OPTION_PROJECTS          = 'frtlp_tlog_projects';
    5353        const OPTION_SETTINGS          = 'frtlp_tlog_settings_opts';
     54        const OPTION_PLAN_KINDS        = 'frtlp_tlog_plan_kinds';
    5455        const USERMETA_RUNNING         = 'frtlp_tlog_running';
    5556        const LEGACY_DB_VERSION_OPTION = 'awd_ttt_db_version';
    … …  
    6970                'settings' => '',
    7071                'export'   => '',
     72                'planning' => '',
    7173        );
    7274
    … …  
    100102                add_action( 'wp_ajax_frtlp_tlog_delete_project', array( $this, 'ajax_delete_project' ) );
    101103
     104                // Planning (calendar).
     105                add_action( 'wp_ajax_frtlp_tlog_plan_list', array( $this, 'ajax_plan_list' ) );
     106                add_action( 'wp_ajax_frtlp_tlog_plan_save', array( $this, 'ajax_plan_save' ) );
     107                add_action( 'wp_ajax_frtlp_tlog_plan_delete', array( $this, 'ajax_plan_delete' ) );
     108
    102109                // CSV export.
    103110                add_action( 'admin_post_frtlp_tlog_export_csv', array( $this, 'export_csv' ) );
    … …  
    130137                global $wpdb;
    131138                return $wpdb->prefix . 'frtlp_time_entries';
     139        }
     140
     141        /**
     142         * Planning (calendar) table name.
     143         */
     144        private function plan_table(): string {
     145                global $wpdb;
     146                return $wpdb->prefix . 'frtlp_planning';
    132147        }
    133148
    … …  
    343358
    344359                dbDelta( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery
     360
     361                // Planning items. Dates are stored as plain local calendar dates
     362                // (the site's timezone), not timestamps: "Friday the 16th" must stay
     363                // Friday the 16th whatever the server or the visitor's clock says.
     364                $plan_table = $this->plan_table();
     365                $plan_sql   = "CREATE TABLE {$plan_table} (
     366                        id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
     367                        user_id BIGINT UNSIGNED NOT NULL,
     368                        title VARCHAR(190) NOT NULL,
     369                        notes TEXT NULL,
     370                        kind VARCHAR(20) NOT NULL DEFAULT 'note',
     371                        start_date DATE NOT NULL,
     372                        end_date DATE NOT NULL,
     373                        start_time CHAR(5) NOT NULL DEFAULT '',
     374                        end_time CHAR(5) NOT NULL DEFAULT '',
     375                        created_at_gmt BIGINT UNSIGNED NOT NULL,
     376                        updated_at_gmt BIGINT UNSIGNED NOT NULL,
     377                        PRIMARY KEY  (id),
     378                        KEY user_dates (user_id, start_date, end_date)
     379                ) {$charset};";
     380
     381                dbDelta( $plan_sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery
    345382
    346383                update_option( self::DB_VERSION_OPTION, self::DB_VERSION );
    … …  
    710747                                'invalid_duration'       => __( 'Please enter a duration greater than zero.', 'freelancer-time-log-pro' ),
    711748                                'unsaved'                => __( 'You have unsaved project changes.', 'freelancer-time-log-pro' ),
     749                                /* translators: 1: number of items, 2: type being removed, 3: type the items move to */
     750                                'kind_remove_used'       => __( '%1$d planning item(s) use "%2$s". When you save, they move to "%3$s". Remove this type?', 'freelancer-time-log-pro' ),
     751                                'kind_last'              => __( 'Keep at least one type.', 'freelancer-time-log-pro' ),
     752                                'kind_max'               => __( 'You can have up to 12 types.', 'freelancer-time-log-pro' ),
     753                                'kind_unsaved'           => __( 'Unsaved changes', 'freelancer-time-log-pro' ),
    712754                        ),
    713755                );
    … …  
    770812                );
    771813
     814                $this->hooks['planning'] = add_submenu_page(
     815                        'frtlp-tlog',
     816                        __( 'Planning', 'freelancer-time-log-pro' ),
     817                        __( 'Planning', 'freelancer-time-log-pro' ),
     818                        'read',
     819                        'frtlp-tlog-planning',
     820                        array( $this, 'planning_page' )
     821                );
     822
    772823                $this->hooks['export'] = add_submenu_page(
    773824                        'frtlp-tlog',
    … …  
    799850                                'type'              => 'array',
    800851                                'sanitize_callback' => array( $this, 'sanitize_projects' ),
     852                                'default'           => array(),
     853                        )
     854                );
     855
     856                register_setting(
     857                        'frtlp_tlog_plan_group',
     858                        self::OPTION_PLAN_KINDS,
     859                        array(
     860                                'type'              => 'array',
     861                                'sanitize_callback' => array( $this, 'sanitize_plan_kinds' ),
    801862                                'default'           => array(),
    802863                        )
    … …  
    10371098                                                <p class="tg-choice-actions">
    10381099                                                        <button type="button" class="tg-btn tg-btn-primary" id="awd-ttt-choice-finalize"><?php esc_html_e( 'Finalize', 'freelancer-time-log-pro' ); ?></button>
    1039                                                         <button type="button" class="tg-btn tg-btn-ghost" id="awd-ttt-choice-resume"><?php esc_html_e( 'Resume', 'freelancer-time-log-pro' ); ?></button>
    1040                                                         <button type="button" class="tg-btn tg-btn-danger-link" id="awd-ttt-choice-discard"><?php esc_html_e( 'Discard', 'freelancer-time-log-pro' ); ?></button>
     1100                                                        <button type="button" class="tg-btn tg-btn-secondary" id="awd-ttt-choice-resume"><?php esc_html_e( 'Resume', 'freelancer-time-log-pro' ); ?></button>
     1101                                                        <button type="button" class="tg-btn tg-btn-danger" id="awd-ttt-choice-discard"><?php esc_html_e( 'Discard', 'freelancer-time-log-pro' ); ?></button>
    10411102                                                </p>
    10421103                                        </div>
    … …  
    10831144
    10841145                                <div class="awd-ttt-modal-footer">
    1085                                         <button type="button" class="tg-btn tg-btn-ghost" id="awd-ttt-cancel"><?php esc_html_e( 'Cancel', 'freelancer-time-log-pro' ); ?></button>
     1146                                        <button type="button" class="tg-btn tg-btn-secondary" id="awd-ttt-cancel"><?php esc_html_e( 'Cancel', 'freelancer-time-log-pro' ); ?></button>
    10861147                                        <button type="button" class="tg-btn tg-btn-primary" id="awd-ttt-save"><?php esc_html_e( 'Save', 'freelancer-time-log-pro' ); ?></button>
    10871148                                </div>
    … …  
    11071168                                <div class="awd-ttt-float-time" id="awd-ttt-float-time">00:00:00</div>
    11081169                                <div class="awd-ttt-float-actions">
    1109                                         <button type="button" class="tg-btn tg-btn-ghost tg-btn-sm" id="awd-ttt-float-stop"><?php esc_html_e( 'Stop', 'freelancer-time-log-pro' ); ?></button>
     1170                                        <button type="button" class="tg-btn tg-btn-secondary tg-btn-sm" id="awd-ttt-float-stop"><?php esc_html_e( 'Stop', 'freelancer-time-log-pro' ); ?></button>
    11101171                                        <button type="button" class="tg-link" id="awd-ttt-float-hide"><?php esc_html_e( 'Hide', 'freelancer-time-log-pro' ); ?></button>
    11111172                                </div>
    … …  
    20272088
    20282089        /**
     2090         * Totals for one user over one period.
     2091         *
     2092         * Shared by the Entries stat cards and the status strip on the other
     2093         * tabs, so both always report the same numbers.
     2094         *
     2095         * @param int $user_id   User ID.
     2096         * @param int $start_gmt Period start (GMT timestamp).
     2097         * @param int $end_gmt   Period end (GMT timestamp).
     2098         */
     2099        private function period_totals( int $user_id, int $start_gmt, int $end_gmt ): array {
     2100                global $wpdb;
     2101
     2102                $table = $this->table();
     2103
     2104                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     2105                $row = $wpdb->get_row(
     2106                        $wpdb->prepare(
     2107                                "SELECT
     2108                                        COUNT(*) AS entry_count,
     2109                                        COALESCE(SUM(duration_seconds), 0) AS total_seconds,
     2110                                        COALESCE(SUM(CASE WHEN billable = 1 THEN duration_seconds ELSE 0 END), 0) AS billable_seconds,
     2111                                        COALESCE(SUM(CASE WHEN billable = 1 THEN duration_seconds * hourly_rate / 3600 ELSE 0 END), 0) AS earnings,
     2112                                        COALESCE(SUM(CASE WHEN billable = 1 AND ( hourly_rate IS NULL OR hourly_rate <= 0 ) THEN 1 ELSE 0 END), 0) AS unrated
     2113                                 FROM {$table}
     2114                                 WHERE user_id = %d AND created_at_gmt >= %d AND created_at_gmt < %d",
     2115                                $user_id,
     2116                                $start_gmt,
     2117                                $end_gmt
     2118                        ),
     2119                        ARRAY_A
     2120                );
     2121
     2122                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     2123                $last = (int) $wpdb->get_var( $wpdb->prepare( "SELECT MAX(created_at_gmt) FROM {$table} WHERE user_id = %d", $user_id ) );
     2124
     2125                $total    = (int) ( $row['total_seconds'] ?? 0 );
     2126                $billable = (int) ( $row['billable_seconds'] ?? 0 );
     2127
     2128                return array(
     2129                        'entries'  => (int) ( $row['entry_count'] ?? 0 ),
     2130                        'total'    => $total,
     2131                        'billable' => $billable,
     2132                        'pct'      => $total > 0 ? (int) round( ( $billable / $total ) * 100 ) : 0,
     2133                        'earnings' => (float) ( $row['earnings'] ?? 0 ),
     2134                        'unrated'  => (int) ( $row['unrated'] ?? 0 ),
     2135                        'last'     => $last,
     2136                        'timer'    => $this->state_status( $this->get_running_state( $user_id ) ),
     2137                );
     2138        }
     2139
     2140        /**
     2141         * The four status cards, as data: value, label, pill and one line of
     2142         * explanation each. The cards and the strip both read from this, so a
     2143         * pill and its strip item can never disagree.
     2144         *
     2145         * Pill colours follow the Guard UI kit: green = fine, blue = info,
     2146         * orange = worth a look, off = nothing to report yet.
     2147         *
     2148         * @param array  $t            Totals from period_totals().
     2149         * @param string $period_label Human label of the period.
     2150         */
     2151        private function status_cards( array $t, string $period_label ): array {
     2152                // Total time: carries the live timer state, because that is what
     2153                // explains the number while you are working.
     2154                if ( 'running' === $t['timer'] ) {
     2155                        $total_pill = array( 'green', __( 'Timer running', 'freelancer-time-log-pro' ) );
     2156                        $total_sub  = __( 'The running timer is added when you stop it.', 'freelancer-time-log-pro' );
     2157                } elseif ( 'paused' === $t['timer'] ) {
     2158                        $total_pill = array( 'orange', __( 'Timer paused', 'freelancer-time-log-pro' ) );
     2159                        $total_sub  = __( 'A paused timer is waiting to be finalized or resumed.', 'freelancer-time-log-pro' );
     2160                } elseif ( $t['total'] > 0 ) {
     2161                        $total_pill = array( 'blue', __( 'Time logged', 'freelancer-time-log-pro' ) );
     2162                        $total_sub  = __( 'All time you logged in this period.', 'freelancer-time-log-pro' );
     2163                } else {
     2164                        $total_pill = array( 'off', __( 'Nothing logged yet', 'freelancer-time-log-pro' ) );
     2165                        $total_sub  = __( 'Press Start in the toolbar, or add an entry manually.', 'freelancer-time-log-pro' );
     2166                }
     2167
     2168                // Billable share.
     2169                if ( $t['total'] <= 0 ) {
     2170                        $bill_pill = array( 'off', __( 'No time yet', 'freelancer-time-log-pro' ) );
     2171                } elseif ( $t['pct'] >= 70 ) {
     2172                        $bill_pill = array( 'green', __( 'Healthy ratio', 'freelancer-time-log-pro' ) );
     2173                } elseif ( $t['pct'] >= 40 ) {
     2174                        $bill_pill = array( 'blue', __( 'Mixed', 'freelancer-time-log-pro' ) );
     2175                } else {
     2176                        $bill_pill = array( 'orange', __( 'Mostly non-billable', 'freelancer-time-log-pro' ) );
     2177                }
     2178
     2179                // Earnings: a billable entry without a rate earns nothing, which is
     2180                // the one thing here that silently costs money.
     2181                if ( $t['unrated'] > 0 ) {
     2182                        $earn_pill = array(
     2183                                'orange',
     2184                                /* translators: %d: number of billable entries without an hourly rate */
     2185                                sprintf( _n( '%d entry without a rate', '%d entries without a rate', $t['unrated'], 'freelancer-time-log-pro' ), $t['unrated'] ),
     2186                        );
     2187                        $earn_sub  = __( 'Set a project rate, then apply it under Settings.', 'freelancer-time-log-pro' );
     2188                } elseif ( $t['earnings'] > 0 ) {
     2189                        $earn_pill = array( 'green', __( 'Earning', 'freelancer-time-log-pro' ) );
     2190                        $earn_sub  = __( 'Billable time multiplied by each entry\'s rate.', 'freelancer-time-log-pro' );
     2191                } else {
     2192                        $earn_pill = array( 'off', __( 'No earnings yet', 'freelancer-time-log-pro' ) );
     2193                        $earn_sub  = __( 'Billable time multiplied by each entry\'s rate.', 'freelancer-time-log-pro' );
     2194                }
     2195
     2196                // Entries: how recently anything was logged at all.
     2197                if ( $t['last'] <= 0 ) {
     2198                        $ent_pill = array( 'off', __( 'No entries yet', 'freelancer-time-log-pro' ) );
     2199                } else {
     2200                        $age = time() - $t['last'];
     2201                        /* translators: %s: human time difference, e.g. "3 days" */
     2202                        $ago = sprintf( __( 'Last entry %s ago', 'freelancer-time-log-pro' ), human_time_diff( $t['last'], time() ) );
     2203                        if ( $age < DAY_IN_SECONDS ) {
     2204                                $ent_pill = array( 'green', __( 'Logged today', 'freelancer-time-log-pro' ) );
     2205                        } elseif ( $age < 7 * DAY_IN_SECONDS ) {
     2206                                $ent_pill = array( 'blue', $ago );
     2207                        } else {
     2208                                $ent_pill = array( 'orange', $ago );
     2209                        }
     2210                }
     2211
     2212                $manage = $this->can_manage();
     2213
     2214                return array(
     2215                        array(
     2216                                'key'   => 'total',
     2217                                'title' => __( 'Total Time', 'freelancer-time-log-pro' ),
     2218                                'icon'  => 'clock',
     2219                                'tone'  => 'blue',
     2220                                'acc'   => 'rgba(37,99,235,.13)',
     2221                                'value' => $this->fmt_hm( $t['total'] ),
     2222                                'lbl'   => $period_label,
     2223                                'pill'  => $total_pill,
     2224                                'sub'   => $total_sub,
     2225                                'strip' => __( 'total', 'freelancer-time-log-pro' ),
     2226                                'href'  => '',
     2227                        ),
     2228                        array(
     2229                                'key'   => 'billable',
     2230                                'title' => __( 'Billable Time', 'freelancer-time-log-pro' ),
     2231                                'icon'  => 'check',
     2232                                'tone'  => 'green',
     2233                                'acc'   => 'rgba(22,163,74,.13)',
     2234                                'value' => $this->fmt_hm( $t['billable'] ),
     2235                                /* translators: %d: percentage of total time that is billable */
     2236                                'lbl'   => sprintf( __( '%d%% of total', 'freelancer-time-log-pro' ), $t['pct'] ),
     2237                                'pill'  => $bill_pill,
     2238                                'sub'   => __( 'Toggle billable per entry in the table below.', 'freelancer-time-log-pro' ),
     2239                                /* translators: %d: billable percentage */
     2240                                'strip' => sprintf( __( 'billable (%d%%)', 'freelancer-time-log-pro' ), $t['pct'] ),
     2241                                'href'  => '',
     2242                        ),
     2243                        array(
     2244                                'key'   => 'earnings',
     2245                                'title' => __( 'Earnings', 'freelancer-time-log-pro' ),
     2246                                'icon'  => 'money',
     2247                                'tone'  => 'amber',
     2248                                'acc'   => 'rgba(180,83,9,.12)',
     2249                                'value' => $this->fmt_money( $t['earnings'] ),
     2250                                'lbl'   => $period_label,
     2251                                'pill'  => $earn_pill,
     2252                                'sub'   => $earn_sub,
     2253                                'strip' => __( 'earned', 'freelancer-time-log-pro' ),
     2254                                'href'  => $manage ? admin_url( 'admin.php?page=frtlp-tlog-projects' ) : '',
     2255                        ),
     2256                        array(
     2257                                'key'   => 'entries',
     2258                                'title' => __( 'Entries', 'freelancer-time-log-pro' ),
     2259                                'icon'  => 'chart',
     2260                                'tone'  => 'purple',
     2261                                'acc'   => 'rgba(124,58,237,.12)',
     2262                                'value' => (string) $t['entries'],
     2263                                'count' => $t['entries'],
     2264                                'lbl'   => $period_label,
     2265                                'pill'  => $ent_pill,
     2266                                'sub'   => __( 'Export them per project or client as Excel or CSV.', 'freelancer-time-log-pro' ),
     2267                                'strip' => _n( 'entry', 'entries', $t['entries'], 'freelancer-time-log-pro' ),
     2268                                'href'  => admin_url( 'admin.php?page=frtlp-tlog-export' ),
     2269                        ),
     2270                );
     2271        }
     2272
     2273        /**
     2274         * The four status cards on the Entries screen — the HelpGuard /
     2275         * WarpGuard anatomy: icon disc + caps title (+ chevron when the card
     2276         * links somewhere), the value, a label, a status pill with a pulsing
     2277         * dot and one line of plain explanation, over a soft accent hill and a
     2278         * faint outline watermark.
     2279         *
     2280         * @param array  $t            Totals from period_totals().
     2281         * @param string $period_label Human label of the period.
     2282         */
     2283        private function render_stat_cards( array $t, string $period_label ): void {
     2284                $chev = '<span class="tg-stat-chev"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></span>';
     2285
     2286                echo '<div id="tg-cards" class="tg-statgrid">';
     2287
     2288                foreach ( $this->status_cards( $t, $period_label ) as $c ) {
     2289                        echo '<div class="tg-stat' . ( '' !== $c['href'] ? ' is-link' : '' ) . '" style="--acc:' . esc_attr( $c['acc'] ) . '">';
     2290                        echo '<span class="tg-stat-hill"></span>';
     2291                        echo '<span class="tg-stat-ghost tg-ghost-' . esc_attr( $c['tone'] ) . '">' . $this->icon( $c['icon'], 120 ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     2292
     2293                        if ( '' !== $c['href'] ) {
     2294                                echo '<a class="tg-stat-overlay" href="' . esc_url( $c['href'] ) . '" aria-label="' . esc_attr( $c['title'] ) . '"></a>';
     2295                        }
     2296
     2297                        echo '<div class="tg-stat-head">';
     2298                        echo '<span class="tg-stat-disc tg-tone-' . esc_attr( $c['tone'] ) . '">' . $this->icon( $c['icon'], 22 ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     2299                        echo '<span class="tg-stat-title">' . esc_html( $c['title'] ) . '</span>';
     2300                        if ( '' !== $c['href'] ) {
     2301                                echo $chev; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     2302                        }
     2303                        echo '</div>';
     2304
     2305                        echo '<div class="tg-stat-body">';
     2306                        if ( isset( $c['count'] ) ) {
     2307                                echo '<div class="tg-stat-num" data-count="' . esc_attr( (string) (int) $c['count'] ) . '">' . esc_html( $c['value'] ) . '</div>';
     2308                        } else {
     2309                                echo '<div class="tg-stat-num">' . esc_html( $c['value'] ) . '</div>';
     2310                        }
     2311                        echo '<div class="tg-stat-lbl">' . esc_html( $c['lbl'] ) . '</div>';
     2312                        echo '<span class="tg-stat-pill ' . esc_attr( $c['pill'][0] ) . '"><span class="d"></span>' . esc_html( $c['pill'][1] ) . '</span>';
     2313                        echo '<div class="tg-stat-sub">' . esc_html( $c['sub'] ) . '</div>';
     2314                        echo '</div>';
     2315
     2316                        echo '</div>';
     2317                }
     2318
     2319                echo '</div>';
     2320        }
     2321
     2322        /**
     2323         * The four pills in one line, on every tab but Entries.
     2324         *
     2325         * Same reasoning as WarpGuard's strip: the cards are 190px tall and
     2326         * belong on the screen where you read them; next to a currency field
     2327         * you only want to know where the week stands. One row, the four
     2328         * values coloured by their pill, and the timer state that explains
     2329         * them. The whole strip links back to Entries.
     2330         */
     2331        private function render_status_strip(): void {
     2332                $user_id = get_current_user_id();
     2333
     2334                list( $start_gmt, $end_gmt ) = $this->period_bounds( 'week' );
     2335
     2336                $t     = $this->period_totals( $user_id, $start_gmt, $end_gmt );
     2337                $label = __( 'This week', 'freelancer-time-log-pro' );
     2338                $tone  = array(
     2339                        'green'  => 'is-green',
     2340                        'blue'   => 'is-blue',
     2341                        'orange' => 'is-orange',
     2342                        'red'    => 'is-orange',
     2343                        'off'    => 'is-muted',
     2344                );
     2345
     2346                echo '<a class="tg-strip" href="' . esc_url( admin_url( 'admin.php?page=frtlp-tlog' ) ) . '">';
     2347                echo '<span class="tg-strip-period">' . $this->icon( 'clock', 14 ) . esc_html( $label ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     2348
     2349                $first = true;
     2350                foreach ( $this->status_cards( $t, $label ) as $c ) {
     2351                        if ( ! $first ) {
     2352                                echo '<span class="tg-strip-sep"></span>';
     2353                        }
     2354                        $first = false;
     2355
     2356                        $cls = isset( $tone[ $c['pill'][0] ] ) ? $tone[ $c['pill'][0] ] : 'is-muted';
     2357
     2358                        printf(
     2359                                '<span class="tg-strip-item %1$s" title="%2$s"><span class="tg-strip-dot"></span><b>%3$s</b> %4$s</span>',
     2360                                esc_attr( $cls ),
     2361                                esc_attr( $c['title'] . ': ' . $c['pill'][1] ),
     2362                                esc_html( $c['value'] ),
     2363                                esc_html( $c['strip'] )
     2364                        );
     2365                }
     2366
     2367                if ( 'running' === $t['timer'] ) {
     2368                        echo '<span class="tg-strip-tail is-green"><span class="tg-strip-bars"><i></i><i></i><i></i></span>' . esc_html__( 'timer running', 'freelancer-time-log-pro' ) . '</span>';
     2369                } elseif ( 'paused' === $t['timer'] ) {
     2370                        echo '<span class="tg-strip-tail is-orange">' . esc_html__( 'timer paused', 'freelancer-time-log-pro' ) . '</span>';
     2371                } else {
     2372                        echo '<span class="tg-strip-tail is-muted">' . esc_html__( 'timer idle', 'freelancer-time-log-pro' ) . '</span>';
     2373                }
     2374
     2375                echo '</a>';
     2376        }
     2377
     2378        /**
    20292379         * Shared page header.
    20302380         *
    … …  
    20822432                        'money'     => '<circle cx="12" cy="12" r="9"/><path d="M15 9.2a3.6 3.6 0 1 0 0 5.6"/><path d="M8 11h5"/><path d="M8 13.5h5"/>',
    20832433                        'plus'      => '<path d="M12 5v14"/><path d="M5 12h14"/>',
     2434                        'calendar'  => '<rect x="3" y="4.5" width="18" height="16.5" rx="2.5"/><path d="M3 9.5h18"/><path d="M8 2.5v4"/><path d="M16 2.5v4"/><path d="M7.5 13.5h3"/><path d="M13.5 13.5h3"/><path d="M7.5 17h3"/>',
     2435                        'left'      => '<path d="m15 18-6-6 6-6"/>',
     2436                        'right'     => '<path d="m9 18 6-6-6-6"/>',
    20842437                );
    20852438
    … …  
    21392492                echo '</nav>';
    21402493
     2494                // Planning group.
     2495                echo '<div class="tg-nav-label">' . esc_html__( 'Planning', 'freelancer-time-log-pro' ) . '</div>';
     2496                echo '<nav class="tg-nav">';
     2497                printf(
     2498                        '<a class="tg-nav-a%s" href="%s"%s>%s<span>%s</span></a>',
     2499                        'planning' === $active ? ' is-active' : '',
     2500                        esc_url( admin_url( 'admin.php?page=frtlp-tlog-planning' ) ),
     2501                        'planning' === $active ? ' aria-current="page"' : '',
     2502                        $this->icon( 'calendar' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     2503                        esc_html__( 'Calendar', 'freelancer-time-log-pro' )
     2504                );
     2505                echo '</nav>';
     2506
    21412507                // System group.
    21422508                echo '<div class="tg-nav-label">' . esc_html__( 'System', 'freelancer-time-log-pro' ) . '</div>';
    … …  
    22082574                list( $start_gmt, $end_gmt, $period_label ) = $this->period_bounds( $period );
    22092575
    2210                 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    2211                 $totals = $wpdb->get_row(
    2212                         $wpdb->prepare(
    2213                                 "SELECT
    2214                                         COUNT(*) AS entry_count,
    2215                                         COALESCE(SUM(duration_seconds), 0) AS total_seconds,
    2216                                         COALESCE(SUM(CASE WHEN billable = 1 THEN duration_seconds ELSE 0 END), 0) AS billable_seconds,
    2217                                         COALESCE(SUM(CASE WHEN billable = 1 THEN duration_seconds * hourly_rate / 3600 ELSE 0 END), 0) AS earnings
    2218                                  FROM {$table}
    2219                                  WHERE user_id = %d AND created_at_gmt >= %d AND created_at_gmt < %d",
    2220                                 $user_id,
    2221                                 $start_gmt,
    2222                                 $end_gmt
    2223                         ),
    2224                         ARRAY_A
    2225                 );
    2226 
    2227                 $total_seconds    = (int) ( $totals['total_seconds'] ?? 0 );
    2228                 $billable_seconds = (int) ( $totals['billable_seconds'] ?? 0 );
    2229                 $earnings         = (float) ( $totals['earnings'] ?? 0 );
    2230                 $entry_count      = (int) ( $totals['entry_count'] ?? 0 );
    2231                 $billable_pct     = $total_seconds > 0 ? (int) round( ( $billable_seconds / $total_seconds ) * 100 ) : 0;
     2576                $totals      = $this->period_totals( $user_id, $start_gmt, $end_gmt );
     2577                $entry_count = $totals['entries'];
    22322578
    22332579                $offset = ( $paged - 1 ) * self::PER_PAGE;
    … …  
    22952641                echo '</div></div>';
    22962642
    2297                 $cards = array(
    2298                         array(
    2299                                 'ic'    => 'clock',
    2300                                 'tone'  => 'blue',
    2301                                 'label' => __( 'Total Time', 'freelancer-time-log-pro' ),
    2302                                 'value' => $this->fmt_hm( $total_seconds ),
    2303                                 'sub'   => $period_labels[ $period ],
    2304                         ),
    2305                         array(
    2306                                 'ic'    => 'check',
    2307                                 'tone'  => 'green',
    2308                                 'label' => __( 'Billable Time', 'freelancer-time-log-pro' ),
    2309                                 'value' => $this->fmt_hm( $billable_seconds ),
    2310                                 /* translators: %d: percentage of total time that is billable */
    2311                                 'sub'   => sprintf( __( '%d%% of total', 'freelancer-time-log-pro' ), $billable_pct ),
    2312                         ),
    2313                         array(
    2314                                 'ic'    => 'money',
    2315                                 'tone'  => 'amber',
    2316                                 'label' => __( 'Earnings', 'freelancer-time-log-pro' ),
    2317                                 'value' => $this->fmt_money( $earnings ),
    2318                                 'sub'   => $period_labels[ $period ],
    2319                         ),
    2320                         array(
    2321                                 'ic'    => 'chart',
    2322                                 'tone'  => 'purple',
    2323                                 'label' => __( 'Entries', 'freelancer-time-log-pro' ),
    2324                                 'value' => (string) $entry_count,
    2325                                 'sub'   => $period_labels[ $period ],
    2326                         ),
    2327                 );
    2328 
    2329                 echo '<div class="tg-metric-grid">';
    2330                 foreach ( $cards as $c ) {
    2331                         echo '<div class="tg-card tg-metric">';
    2332                         echo '<span class="tg-metric-title">' . esc_html( $c['label'] ) . '</span>';
    2333                         echo '<div class="tg-metric-body">';
    2334                         echo '<span class="tg-metric-disc tg-tone-' . esc_attr( $c['tone'] ) . '">' . $this->icon( $c['ic'], 24 ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    2335                         echo '<div class="tg-metric-copy">';
    2336                         echo '<span class="tg-metric-value">' . esc_html( $c['value'] ) . '</span>';
    2337                         echo '<span class="tg-metric-foot"><span class="tg-dot tg-dot-' . esc_attr( $c['tone'] ) . '"></span>' . esc_html( $c['sub'] ) . '</span>';
    2338                         echo '</div></div></div>';
    2339                 }
    2340                 echo '</div>';
     2643                $this->render_stat_cards( $totals, $period_labels[ $period ] );
    23412644
    23422645                echo '<div class="tg-card">';
    … …  
    24712774
    24722775                echo '<div class="tg-bulkbar">';
    2473                 echo '<a class="tg-btn tg-btn-ghost" href="' . esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=frtlp_tlog_export_csv&scope=all' ), 'frtlp_tlog_export_csv' ) ) . '"><span class="dashicons dashicons-download"></span>' . esc_html__( 'Export CSV (all)', 'freelancer-time-log-pro' ) . '</a>';
    2474                 echo '<button type="button" class="tg-btn tg-btn-danger-link" id="awd-ttt-delete-all" data-user="' . esc_attr( (string) $user_id ) . '">' . esc_html__( 'Delete all entries', 'freelancer-time-log-pro' ) . '</button>';
     2776                echo '<a class="tg-btn tg-btn-secondary" href="' . esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=frtlp_tlog_export_csv&scope=all' ), 'frtlp_tlog_export_csv' ) ) . '"><span class="dashicons dashicons-download"></span>' . esc_html__( 'Export CSV (all)', 'freelancer-time-log-pro' ) . '</a>';
     2777                echo '<button type="button" class="tg-btn tg-btn-danger" id="awd-ttt-delete-all" data-user="' . esc_attr( (string) $user_id ) . '"><span class="dashicons dashicons-trash"></span>' . esc_html__( 'Delete all entries', 'freelancer-time-log-pro' ) . '</button>';
    24752778                echo '</div>';
    24762779
    … …  
    25362839
    25372840                                <div class="awd-ttt-modal-footer">
    2538                                         <button type="button" class="tg-btn tg-btn-ghost" id="tg-manual-cancel"><?php esc_html_e( 'Cancel', 'freelancer-time-log-pro' ); ?></button>
     2841                                        <button type="button" class="tg-btn tg-btn-secondary" id="tg-manual-cancel"><?php esc_html_e( 'Cancel', 'freelancer-time-log-pro' ); ?></button>
    25392842                                        <button type="button" class="tg-btn tg-btn-primary" id="tg-manual-save"><?php esc_html_e( 'Save entry', 'freelancer-time-log-pro' ); ?></button>
    25402843                                </div>
    … …  
    26882991
    26892992                $this->render_shell_open( 'projects' );
     2993                $this->render_status_strip();
    26902994
    26912995                $this->page_header(
    … …  
    28313135                $settings = $this->get_settings();
    28323136
     3137                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only view parameter.
     3138                $tab = isset( $_GET['tab'] ) && 'calendar' === sanitize_key( wp_unslash( $_GET['tab'] ) ) ? 'calendar' : 'general';
     3139
    28333140                echo '<div class="wrap tg-wrap">';
    2834                 settings_errors( self::OPTION_SETTINGS );
     3141                settings_errors( 'calendar' === $tab ? self::OPTION_PLAN_KINDS : self::OPTION_SETTINGS );
    28353142
    28363143                $this->render_shell_open( 'settings' );
     3144                $this->render_status_strip();
    28373145
    28383146                $this->page_header(
    28393147                        '',
    28403148                        __( 'Settings', 'freelancer-time-log-pro' ),
    2841                         __( 'Set your currency and the default rate for new projects.', 'freelancer-time-log-pro' ),
    2842                         '<span class="tg-head-emblem tg-tone-blue">' . $this->icon( 'gear', 30 ) . '</span>'
    2843                 );
     3149                        'calendar' === $tab
     3150                                ? __( 'Choose the types you can give planning items, and their colours.', 'freelancer-time-log-pro' )
     3151                                : __( 'Set your currency and the default rate for new projects.', 'freelancer-time-log-pro' ),
     3152                        '<span class="tg-head-emblem tg-tone-' . ( 'calendar' === $tab ? 'teal' : 'blue' ) . '">' . $this->icon( 'calendar' === $tab ? 'calendar' : 'gear', 30 ) . '</span>'
     3153                );
     3154
     3155                // Section pills.
     3156                $pills = array(
     3157                        'general'  => array( __( 'General', 'freelancer-time-log-pro' ), 'gear' ),
     3158                        'calendar' => array( __( 'Calendar', 'freelancer-time-log-pro' ), 'calendar' ),
     3159                );
     3160                echo '<nav class="tg-pills" aria-label="' . esc_attr__( 'Settings sections', 'freelancer-time-log-pro' ) . '">';
     3161                foreach ( $pills as $slug => $pill ) {
     3162                        printf(
     3163                                '<a class="tg-pill%1$s" href="%2$s"%3$s>%4$s%5$s</a>',
     3164                                $slug === $tab ? ' is-active' : '',
     3165                                esc_url( admin_url( 'admin.php?page=frtlp-tlog-settings' . ( 'general' === $slug ? '' : '&tab=' . $slug ) ) ),
     3166                                $slug === $tab ? ' aria-current="page"' : '',
     3167                                $this->icon( $pill[1], 15 ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     3168                                esc_html( $pill[0] )
     3169                        );
     3170                }
     3171                echo '</nav>';
     3172
     3173                if ( 'calendar' === $tab ) {
     3174                        $this->render_settings_calendar();
     3175                        $this->render_shell_close();
     3176                        echo '</div>';
     3177                        return;
     3178                }
    28443179
    28453180                // Result notice after applying rates.
    … …  
    28903225                        <p class="tg-muted" style="margin-top:0;"><?php esc_html_e( 'Write the configured project rates onto older entries that still have no rate. Entries that already have a rate are left untouched.', 'freelancer-time-log-pro' ); ?></p>
    28913226                        <p class="tg-apply-rates" style="border-top:0;padding-top:0;margin-top:6px;">
    2892                                 <a class="tg-btn tg-btn-ghost" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=frtlp_tlog_apply_rates' ), 'frtlp_tlog_apply_rates' ) ); ?>">
     3227                                <a class="tg-btn tg-btn-secondary" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=frtlp_tlog_apply_rates' ), 'frtlp_tlog_apply_rates' ) ); ?>">
    28933228                                        <span class="dashicons dashicons-update"></span><?php esc_html_e( 'Apply rates to entries without a rate', 'freelancer-time-log-pro' ); ?>
    28943229                                </a>
    … …  
    29013236        }
    29023237
     3238        /* =========================================================
     3239         * Planning (calendar)
     3240         * ======================================================= */
     3241
     3242        /**
     3243         * Planning item types: label + colour. Kept small on purpose: a
     3244         * freelancer's week is notes, appointments, deadlines, blocks of work
     3245         * and time off. The colours are the Guard accent recipes.
     3246         */
     3247        private function plan_kinds(): array {
     3248                $saved = get_option( self::OPTION_PLAN_KINDS, null );
     3249
     3250                if ( ! is_array( $saved ) || empty( $saved ) ) {
     3251                        return $this->default_plan_kinds();
     3252                }
     3253
     3254                $out = array();
     3255                foreach ( $saved as $key => $k ) {
     3256                        if ( ! is_array( $k ) || empty( $k['label'] ) ) {
     3257                                continue;
     3258                        }
     3259                        $color = sanitize_hex_color( (string) ( $k['color'] ?? '' ) );
     3260
     3261                        $out[ sanitize_key( (string) $key ) ] = array(
     3262                                'label' => (string) $k['label'],
     3263                                'color' => $color ? $color : '#64748b',
     3264                        );
     3265                }
     3266
     3267                return $out ? $out : $this->default_plan_kinds();
     3268        }
     3269
     3270        /**
     3271         * The types a fresh install starts with.
     3272         */
     3273        private function default_plan_kinds(): array {
     3274                return array(
     3275                        'note'        => array(
     3276                                'label' => __( 'Note', 'freelancer-time-log-pro' ),
     3277                                'color' => '#2563eb',
     3278                        ),
     3279                        'appointment' => array(
     3280                                'label' => __( 'Appointment', 'freelancer-time-log-pro' ),
     3281                                'color' => '#4f46e5',
     3282                        ),
     3283                        'deadline'    => array(
     3284                                'label' => __( 'Deadline', 'freelancer-time-log-pro' ),
     3285                                'color' => '#e11d48',
     3286                        ),
     3287                        'work'        => array(
     3288                                'label' => __( 'Work', 'freelancer-time-log-pro' ),
     3289                                'color' => '#b45309',
     3290                        ),
     3291                        'off'         => array(
     3292                                'label' => __( 'Time off', 'freelancer-time-log-pro' ),
     3293                                'color' => '#0d9488',
     3294                        ),
     3295                );
     3296        }
     3297
     3298        /**
     3299         * Sanitize the calendar types posted from Settings > Calendar.
     3300         *
     3301         * Existing types keep their key, so renaming or recolouring a type
     3302         * never detaches the items that use it. A removed type's items move
     3303         * to the first remaining type instead of becoming orphans.
     3304         *
     3305         * @param mixed $value Raw value.
     3306         */
     3307        public function sanitize_plan_kinds( $value ): array {
     3308                $old  = $this->plan_kinds();
     3309                $rows = is_array( $value ) ? $value : array();
     3310
     3311                /*
     3312                 * WordPress runs this callback twice when the option is first
     3313                 * created; the second time it receives our own output, keyed by
     3314                 * type. Recognise that shape and just re-validate it.
     3315                 */
     3316                $is_stored = ! empty( $rows )
     3317                        && ! array_filter( array_keys( $rows ), 'is_int' )
     3318                        && ! array_filter( $rows, static function ( $r ) {
     3319                                return is_array( $r ) && isset( $r['key'] );
     3320                        } );
     3321
     3322                if ( $is_stored ) {
     3323                        $out = array();
     3324                        foreach ( $rows as $key => $k ) {
     3325                                if ( is_array( $k ) && ! empty( $k['label'] ) ) {
     3326                                        $c                           = sanitize_hex_color( (string) ( $k['color'] ?? '' ) );
     3327                                        $out[ sanitize_key( $key ) ] = array(
     3328                                                'label' => mb_substr( sanitize_text_field( (string) $k['label'] ), 0, 40 ),
     3329                                                'color' => $c ? $c : '#64748b',
     3330                                        );
     3331                                }
     3332                        }
     3333                        return $out ? $out : $old;
     3334                }
     3335
     3336                // Keys of existing types that are still posted: new types may not take them.
     3337                $posted = array();
     3338                foreach ( $rows as $row ) {
     3339                        if ( is_array( $row ) && ! empty( $row['key'] ) && isset( $old[ sanitize_key( (string) $row['key'] ) ] ) ) {
     3340                                $posted[] = sanitize_key( (string) $row['key'] );
     3341                        }
     3342                }
     3343
     3344                $out = array();
     3345                foreach ( $rows as $row ) {
     3346                        if ( ! is_array( $row ) ) {
     3347                                continue;
     3348                        }
     3349
     3350                        $label = isset( $row['label'] ) ? trim( sanitize_text_field( (string) $row['label'] ) ) : '';
     3351                        if ( '' === $label ) {
     3352                                continue;
     3353                        }
     3354                        $label = mb_substr( $label, 0, 40 );
     3355
     3356                        $color = sanitize_hex_color( isset( $row['color'] ) ? (string) $row['color'] : '' );
     3357                        $color = $color ? $color : '#64748b';
     3358
     3359                        $key = isset( $row['key'] ) ? sanitize_key( (string) $row['key'] ) : '';
     3360                        if ( '' === $key || ! isset( $old[ $key ] ) || isset( $out[ $key ] ) ) {
     3361                                $base = substr( sanitize_key( sanitize_title( $label ) ), 0, 16 );
     3362                                $base = '' !== $base ? $base : 'type';
     3363                                $key  = $base;
     3364                                $i    = 2;
     3365                                while ( isset( $out[ $key ] ) || in_array( $key, $posted, true ) ) {
     3366                                        $key = $base . '-' . $i++;
     3367                                }
     3368                        }
     3369
     3370                        $out[ $key ] = array(
     3371                                'label' => $label,
     3372                                'color' => $color,
     3373                        );
     3374
     3375                        if ( count( $out ) >= 12 ) {
     3376                                break;
     3377                        }
     3378                }
     3379
     3380                if ( empty( $out ) ) {
     3381                        add_settings_error( self::OPTION_PLAN_KINDS, 'frtlp_kinds_empty', __( 'Keep at least one calendar type. Nothing was changed.', 'freelancer-time-log-pro' ) );
     3382                        return $old;
     3383                }
     3384
     3385                // Items of removed types move to the first remaining type.
     3386                $removed = array_values( array_diff( array_keys( $old ), array_keys( $out ) ) );
     3387                if ( $removed ) {
     3388                        global $wpdb;
     3389
     3390                        $table   = $this->plan_table();
     3391                        $target  = (string) array_key_first( $out );
     3392                        $holders = implode( ',', array_fill( 0, count( $removed ), '%s' ) );
     3393
     3394                        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3395                        $wpdb->query( $wpdb->prepare( "UPDATE {$table} SET kind = %s WHERE kind IN ({$holders})", array_merge( array( $target ), $removed ) ) );
     3396                }
     3397
     3398                return $out;
     3399        }
     3400
     3401        /**
     3402         * How many planning items (all users) use each type.
     3403         */
     3404        private function plan_kind_usage(): array {
     3405                global $wpdb;
     3406
     3407                $table = $this->plan_table();
     3408
     3409                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3410                $rows = $wpdb->get_results( "SELECT kind, COUNT(*) AS n FROM {$table} GROUP BY kind", ARRAY_A );
     3411
     3412                $out = array();
     3413                foreach ( (array) $rows as $r ) {
     3414                        $out[ (string) $r['kind'] ] = (int) $r['n'];
     3415                }
     3416
     3417                return $out;
     3418        }
     3419
     3420        /**
     3421         * A strict Y-m-d date, or '' when invalid.
     3422         *
     3423         * @param string $value Raw value.
     3424         */
     3425        private function plan_date( string $value ): string {
     3426                $value = trim( $value );
     3427                if ( ! preg_match( '/^(\d{4})-(\d{2})-(\d{2})$/', $value, $m ) ) {
     3428                        return '';
     3429                }
     3430
     3431                return checkdate( (int) $m[2], (int) $m[3], (int) $m[1] ) ? $value : '';
     3432        }
     3433
     3434        /**
     3435         * A strict H:i time, or '' when empty/invalid. Time is optional.
     3436         *
     3437         * @param string $value Raw value.
     3438         */
     3439        private function plan_time( string $value ): string {
     3440                $value = trim( $value );
     3441                if ( ! preg_match( '/^([01]\d|2[0-3]):([0-5]\d)$/', $value ) ) {
     3442                        return '';
     3443                }
     3444
     3445                return $value;
     3446        }
     3447
     3448        /**
     3449         * Today, as a local calendar date in the site's timezone.
     3450         */
     3451        private function plan_today(): string {
     3452                return (string) current_time( 'Y-m-d' );
     3453        }
     3454
     3455        /**
     3456         * One DB row as the shape the calendar script expects.
     3457         *
     3458         * @param array $r Row.
     3459         */
     3460        private function plan_out( array $r ): array {
     3461                $kinds = $this->plan_kinds();
     3462                $kind  = isset( $kinds[ $r['kind'] ] ) ? (string) $r['kind'] : (string) array_key_first( $kinds );
     3463
     3464                return array(
     3465                        'id'        => (int) $r['id'],
     3466                        'title'     => (string) $r['title'],
     3467                        'notes'     => (string) ( $r['notes'] ?? '' ),
     3468                        'kind'      => $kind,
     3469                        'start'     => (string) $r['start_date'],
     3470                        'end'       => (string) $r['end_date'],
     3471                        'startTime' => (string) ( $r['start_time'] ?? '' ),
     3472                        'endTime'   => (string) ( $r['end_time'] ?? '' ),
     3473                );
     3474        }
     3475
     3476        /**
     3477         * Items of one user that overlap [from, to] (inclusive local dates).
     3478         *
     3479         * @param int    $user_id User ID.
     3480         * @param string $from    Y-m-d.
     3481         * @param string $to      Y-m-d.
     3482         */
     3483        private function plan_items( int $user_id, string $from, string $to ): array {
     3484                global $wpdb;
     3485
     3486                $table = $this->plan_table();
     3487
     3488                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3489                $rows = $wpdb->get_results(
     3490                        $wpdb->prepare(
     3491                                "SELECT * FROM {$table}
     3492                                 WHERE user_id = %d AND start_date <= %s AND end_date >= %s
     3493                                 ORDER BY start_date ASC, start_time ASC, id ASC
     3494                                 LIMIT 1000",
     3495                                $user_id,
     3496                                $to,
     3497                                $from
     3498                        ),
     3499                        ARRAY_A
     3500                );
     3501
     3502                return array_map( array( $this, 'plan_out' ), (array) $rows );
     3503        }
     3504
     3505        /**
     3506         * What is coming up: everything still running today or starting in
     3507         * the next 30 days, soonest first.
     3508         *
     3509         * @param int $user_id User ID.
     3510         */
     3511        private function plan_upcoming( int $user_id ): array {
     3512                $today = $this->plan_today();
     3513                $until = gmdate( 'Y-m-d', strtotime( $today . ' +30 days' ) );
     3514
     3515                return array_slice( $this->plan_items( $user_id, $today, $until ), 0, 25 );
     3516        }
     3517
     3518        /**
     3519         * The 6-week window (42 days) a month view shows, starting on the
     3520         * site's first day of the week.
     3521         *
     3522         * @param string $month Y-m.
     3523         */
     3524        private function plan_window( string $month ): array {
     3525                $first = strtotime( $month . '-01 00:00:00 UTC' );
     3526                $sow   = (int) get_option( 'start_of_week', 1 );
     3527                $dow   = (int) gmdate( 'w', $first );
     3528                $back  = ( $dow - $sow + 7 ) % 7;
     3529                $start = $first - $back * DAY_IN_SECONDS;
     3530
     3531                return array( gmdate( 'Y-m-d', $start ), gmdate( 'Y-m-d', $start + 41 * DAY_IN_SECONDS ) );
     3532        }
     3533
     3534        /**
     3535         * Load items for a date window (month navigation).
     3536         */
     3537        public function ajax_plan_list() {
     3538                $this->ajax_check();
     3539
     3540                // phpcs:disable WordPress.Security.NonceVerification.Missing -- verified in ajax_check().
     3541                $from = $this->plan_date( isset( $_POST['from'] ) ? sanitize_text_field( wp_unslash( $_POST['from'] ) ) : '' );
     3542                $to   = $this->plan_date( isset( $_POST['to'] ) ? sanitize_text_field( wp_unslash( $_POST['to'] ) ) : '' );
     3543                // phpcs:enable WordPress.Security.NonceVerification.Missing
     3544
     3545                if ( '' === $from || '' === $to || $to < $from ) {
     3546                        wp_send_json_error( array( 'message' => __( 'Invalid date range.', 'freelancer-time-log-pro' ) ), 400 );
     3547                }
     3548
     3549                // A month view never needs more than ~6 weeks; cap abuse.
     3550                if ( ( strtotime( $to ) - strtotime( $from ) ) > 120 * DAY_IN_SECONDS ) {
     3551                        wp_send_json_error( array( 'message' => __( 'Invalid date range.', 'freelancer-time-log-pro' ) ), 400 );
     3552                }
     3553
     3554                $user_id = get_current_user_id();
     3555
     3556                wp_send_json_success(
     3557                        array(
     3558                                'items'    => $this->plan_items( $user_id, $from, $to ),
     3559                                'upcoming' => $this->plan_upcoming( $user_id ),
     3560                        )
     3561                );
     3562        }
     3563
     3564        /**
     3565         * Create or update one planning item.
     3566         */
     3567        public function ajax_plan_save() {
     3568                $this->ajax_check();
     3569
     3570                global $wpdb;
     3571
     3572                // phpcs:disable WordPress.Security.NonceVerification.Missing -- verified in ajax_check().
     3573                $id    = isset( $_POST['id'] ) ? absint( wp_unslash( $_POST['id'] ) ) : 0;
     3574                $title = isset( $_POST['title'] ) ? sanitize_text_field( wp_unslash( $_POST['title'] ) ) : '';
     3575                $notes = isset( $_POST['notes'] ) ? sanitize_textarea_field( wp_unslash( $_POST['notes'] ) ) : '';
     3576                $kind  = isset( $_POST['kind'] ) ? sanitize_key( wp_unslash( $_POST['kind'] ) ) : 'note';
     3577                $start = $this->plan_date( isset( $_POST['start'] ) ? sanitize_text_field( wp_unslash( $_POST['start'] ) ) : '' );
     3578                $end   = $this->plan_date( isset( $_POST['end'] ) ? sanitize_text_field( wp_unslash( $_POST['end'] ) ) : '' );
     3579                $t1    = $this->plan_time( isset( $_POST['start_time'] ) ? sanitize_text_field( wp_unslash( $_POST['start_time'] ) ) : '' );
     3580                $t2    = $this->plan_time( isset( $_POST['end_time'] ) ? sanitize_text_field( wp_unslash( $_POST['end_time'] ) ) : '' );
     3581                // phpcs:enable WordPress.Security.NonceVerification.Missing
     3582
     3583                $title = trim( $title );
     3584                if ( '' === $title ) {
     3585                        wp_send_json_error( array( 'message' => __( 'Please enter a title.', 'freelancer-time-log-pro' ) ), 400 );
     3586                }
     3587                $title = mb_substr( $title, 0, 190 );
     3588
     3589                $kinds = $this->plan_kinds();
     3590                if ( ! isset( $kinds[ $kind ] ) ) {
     3591                        $kind = (string) array_key_first( $kinds );
     3592                }
     3593
     3594                if ( '' === $start ) {
     3595                        wp_send_json_error( array( 'message' => __( 'Please choose a valid start date.', 'freelancer-time-log-pro' ) ), 400 );
     3596                }
     3597                if ( '' === $end ) {
     3598                        $end = $start;
     3599                }
     3600                if ( $end < $start ) {
     3601                        wp_send_json_error( array( 'message' => __( 'The end date is before the start date.', 'freelancer-time-log-pro' ) ), 400 );
     3602                }
     3603
     3604                // An end time without a start time means nothing; on a single day
     3605                // the end time may not come before the start time.
     3606                if ( '' === $t1 ) {
     3607                        $t2 = '';
     3608                }
     3609                if ( '' !== $t2 && $start === $end && $t2 < $t1 ) {
     3610                        wp_send_json_error( array( 'message' => __( 'The end time is before the start time.', 'freelancer-time-log-pro' ) ), 400 );
     3611                }
     3612
     3613                $table   = $this->plan_table();
     3614                $user_id = get_current_user_id();
     3615                $now     = time();
     3616
     3617                $data = array(
     3618                        'title'          => $title,
     3619                        'notes'          => $notes,
     3620                        'kind'           => $kind,
     3621                        'start_date'     => $start,
     3622                        'end_date'       => $end,
     3623                        'start_time'     => $t1,
     3624                        'end_time'       => $t2,
     3625                        'updated_at_gmt' => $now,
     3626                );
     3627
     3628                if ( $id > 0 ) {
     3629                        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3630                        $owner = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$table} WHERE id = %d", $id ) );
     3631
     3632                        if ( null === $owner ) {
     3633                                wp_send_json_error( array( 'message' => __( 'Item not found.', 'freelancer-time-log-pro' ) ), 404 );
     3634                        }
     3635
     3636                        // The calendar is personal: only its owner may change an item.
     3637                        if ( (int) $owner !== $user_id ) {
     3638                                wp_send_json_error( array( 'message' => __( 'Not allowed', 'freelancer-time-log-pro' ) ), 403 );
     3639                        }
     3640
     3641                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3642                        $wpdb->update( $table, $data, array( 'id' => $id ), array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ), array( '%d' ) );
     3643                } else {
     3644                        $data['user_id']        = $user_id;
     3645                        $data['created_at_gmt'] = $now;
     3646
     3647                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
     3648                        $ok = $wpdb->insert( $table, $data, array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d' ) );
     3649                        if ( ! $ok ) {
     3650                                wp_send_json_error( array( 'message' => __( 'The item could not be saved.', 'freelancer-time-log-pro' ) ), 500 );
     3651                        }
     3652                        $id = (int) $wpdb->insert_id;
     3653                }
     3654
     3655                wp_send_json_success( array( 'id' => $id ) );
     3656        }
     3657
     3658        /**
     3659         * Delete one planning item (owner only).
     3660         */
     3661        public function ajax_plan_delete() {
     3662                $this->ajax_check();
     3663
     3664                global $wpdb;
     3665
     3666                // phpcs:ignore WordPress.Security.NonceVerification.Missing -- verified in ajax_check().
     3667                $id = isset( $_POST['id'] ) ? absint( wp_unslash( $_POST['id'] ) ) : 0;
     3668                if ( $id <= 0 ) {
     3669                        wp_send_json_error( array( 'message' => __( 'Item not found.', 'freelancer-time-log-pro' ) ), 400 );
     3670                }
     3671
     3672                $table = $this->plan_table();
     3673
     3674                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3675                $owner = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$table} WHERE id = %d", $id ) );
     3676
     3677                if ( null === $owner ) {
     3678                        wp_send_json_error( array( 'message' => __( 'Item not found.', 'freelancer-time-log-pro' ) ), 404 );
     3679                }
     3680
     3681                if ( (int) $owner !== get_current_user_id() ) {
     3682                        wp_send_json_error( array( 'message' => __( 'Not allowed', 'freelancer-time-log-pro' ) ), 403 );
     3683                }
     3684
     3685                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
     3686                $wpdb->delete( $table, array( 'id' => $id ), array( '%d' ) );
     3687
     3688                wp_send_json_success();
     3689        }
     3690
     3691        /**
     3692         * Planning screen: a month calendar plus an agenda panel.
     3693         *
     3694         * The grid is drawn by admin.js from the JSON below, so moving between
     3695         * months, saving and deleting never reload the page.
     3696         */
     3697        public function planning_page() {
     3698                if ( ! $this->can_use() ) {
     3699                        wp_die( esc_html__( 'Not allowed.', 'freelancer-time-log-pro' ) );
     3700                }
     3701
     3702                $user_id = get_current_user_id();
     3703                $today   = $this->plan_today();
     3704
     3705                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only view parameter.
     3706                $month = isset( $_GET['month'] ) ? sanitize_text_field( wp_unslash( $_GET['month'] ) ) : '';
     3707                if ( ! preg_match( '/^\d{4}-(0[1-9]|1[0-2])$/', $month ) ) {
     3708                        $month = substr( $today, 0, 7 );
     3709                }
     3710
     3711                list( $from, $to ) = $this->plan_window( $month );
     3712
     3713                $kinds = array();
     3714                foreach ( $this->plan_kinds() as $key => $k ) {
     3715                        $kinds[] = array(
     3716                                'key'   => $key,
     3717                                'label' => $k['label'],
     3718                                'color' => $k['color'],
     3719                        );
     3720                }
     3721
     3722                $boot = array(
     3723                        'month'       => $month,
     3724                        'today'       => $today,
     3725                        'from'        => $from,
     3726                        'to'          => $to,
     3727                        'startOfWeek' => (int) get_option( 'start_of_week', 1 ),
     3728                        'locale'      => str_replace( '_', '-', get_user_locale() ),
     3729                        'kinds'       => $kinds,
     3730                        'items'       => $this->plan_items( $user_id, $from, $to ),
     3731                        'upcoming'    => $this->plan_upcoming( $user_id ),
     3732                        'baseUrl'     => admin_url( 'admin.php?page=frtlp-tlog-planning' ),
     3733                        'i18n'        => array(
     3734                                'today'        => __( 'Today', 'freelancer-time-log-pro' ),
     3735                                'tomorrow'     => __( 'Tomorrow', 'freelancer-time-log-pro' ),
     3736                                'upcoming'     => __( 'Upcoming', 'freelancer-time-log-pro' ),
     3737                                'upcoming_sub' => __( 'The next 30 days', 'freelancer-time-log-pro' ),
     3738                                'nothing'      => __( 'Nothing planned. Click a day in the calendar to add something.', 'freelancer-time-log-pro' ),
     3739                                'day_empty'    => __( 'Nothing planned on this day.', 'freelancer-time-log-pro' ),
     3740                                'add_here'     => __( 'Add to this day', 'freelancer-time-log-pro' ),
     3741                                'back'         => __( 'Back to upcoming', 'freelancer-time-log-pro' ),
     3742                                'all_day'      => __( 'All day', 'freelancer-time-log-pro' ),
     3743                                /* translators: %d: number of hidden items in a calendar day */
     3744                                'more'         => __( '+%d more', 'freelancer-time-log-pro' ),
     3745                                /* translators: %d: number of days */
     3746                                'days'         => __( '%d days', 'freelancer-time-log-pro' ),
     3747                                'new_item'     => __( 'New planning item', 'freelancer-time-log-pro' ),
     3748                                'edit_item'    => __( 'Edit planning item', 'freelancer-time-log-pro' ),
     3749                                'need_title'   => __( 'Please enter a title.', 'freelancer-time-log-pro' ),
     3750                                'bad_range'    => __( 'The end date is before the start date.', 'freelancer-time-log-pro' ),
     3751                                'confirm_del'  => __( 'Delete this planning item?', 'freelancer-time-log-pro' ),
     3752                                'drag_hint'    => __( 'Tip: drag across several days to plan a period, such as a holiday.', 'freelancer-time-log-pro' ),
     3753                        ),
     3754                );
     3755
     3756                $new_btn = '<button type="button" class="tg-btn tg-btn-primary" id="tg-plan-new">' . $this->icon( 'plus', 16 ) . esc_html__( 'New item', 'freelancer-time-log-pro' ) . '</button>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     3757
     3758                echo '<div class="wrap tg-wrap">';
     3759
     3760                $this->render_shell_open( 'planning' );
     3761                $this->render_status_strip();
     3762
     3763                $this->page_header(
     3764                        '',
     3765                        __( 'Planning', 'freelancer-time-log-pro' ),
     3766                        __( 'Notes, appointments, deadlines and time off at a glance. Click a day to add, drag across days for a period.', 'freelancer-time-log-pro' ),
     3767                        $new_btn
     3768                );
     3769                ?>
     3770
     3771                <div class="tg-plan" id="tg-plan">
     3772                        <div class="tg-plan-main tg-card">
     3773                                <div class="tg-plan-toolbar">
     3774                                        <div class="tg-plan-nav">
     3775                                                <button type="button" class="tg-plan-arrow" id="tg-plan-prev" aria-label="<?php esc_attr_e( 'Previous month', 'freelancer-time-log-pro' ); ?>"><?php echo $this->icon( 'left', 18 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></button>
     3776                                                <h2 class="tg-plan-month" id="tg-plan-month" aria-live="polite"></h2>
     3777                                                <button type="button" class="tg-plan-arrow" id="tg-plan-next" aria-label="<?php esc_attr_e( 'Next month', 'freelancer-time-log-pro' ); ?>"><?php echo $this->icon( 'right', 18 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></button>
     3778                                                <button type="button" class="tg-btn tg-btn-secondary tg-btn-sm" id="tg-plan-today"><?php esc_html_e( 'Today', 'freelancer-time-log-pro' ); ?></button>
     3779                                                <button type="button" class="tg-btn tg-btn-secondary tg-btn-sm tg-plan-toggle" id="tg-plan-toggle" aria-pressed="true" aria-controls="tg-plan-side"><?php echo $this->icon( 'calendar', 15 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php esc_html_e( 'Agenda', 'freelancer-time-log-pro' ); ?></button>
     3780                                        </div>
     3781                                        <div class="tg-plan-legend" id="tg-plan-legend" role="group" aria-label="<?php esc_attr_e( 'Show types', 'freelancer-time-log-pro' ); ?>"></div>
     3782                                </div>
     3783
     3784                                <div class="tg-plan-head" id="tg-plan-head" aria-hidden="true"></div>
     3785                                <div class="tg-plan-grid" id="tg-plan-grid"></div>
     3786                                <p class="tg-plan-hint"><?php esc_html_e( 'Tip: drag across several days to plan a period, such as a holiday.', 'freelancer-time-log-pro' ); ?></p>
     3787                        </div>
     3788
     3789                        <aside class="tg-plan-side" id="tg-plan-side" aria-labelledby="tg-plan-side-title">
     3790                                <div class="tg-plan-side-bar" id="tg-plan-side-bar" title="<?php esc_attr_e( 'Drag to move', 'freelancer-time-log-pro' ); ?>">
     3791                                        <span class="tg-plan-side-grip" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i></span>
     3792                                        <span class="tg-plan-side-icon" aria-hidden="true"><?php echo $this->icon( 'calendar', 17 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
     3793                                        <span class="tg-plan-side-titles">
     3794                                                <strong id="tg-plan-side-title"></strong>
     3795                                                <span id="tg-plan-side-sub"></span>
     3796                                        </span>
     3797                                        <button type="button" class="tg-plan-side-btn" id="tg-plan-side-min" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse', 'freelancer-time-log-pro' ); ?>" title="<?php esc_attr_e( 'Collapse', 'freelancer-time-log-pro' ); ?>"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button>
     3798                                        <button type="button" class="tg-plan-side-btn" id="tg-plan-side-close" aria-label="<?php esc_attr_e( 'Hide agenda', 'freelancer-time-log-pro' ); ?>" title="<?php esc_attr_e( 'Hide agenda', 'freelancer-time-log-pro' ); ?>"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
     3799                                </div>
     3800                                <div class="tg-plan-side-body" id="tg-plan-side-body" aria-live="polite"></div>
     3801                        </aside>
     3802                </div>
     3803
     3804                <script type="application/json" id="tg-plan-data"><?php echo wp_json_encode( $boot, JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE ); ?></script>
     3805
     3806                <?php
     3807                $this->render_shell_close();
     3808                $this->render_plan_modal();
     3809                echo '</div>';
     3810        }
     3811
     3812        /**
     3813         * Add / edit modal for planning items.
     3814         */
     3815        private function render_plan_modal(): void {
     3816                ?>
     3817                <div id="tg-plan-backdrop" class="awd-ttt-hidden"></div>
     3818                <div id="tg-plan-modal" class="awd-ttt-hidden" role="dialog" aria-modal="true" aria-labelledby="tg-plan-title">
     3819                        <div class="awd-ttt-modal-inner tg-plan-modal-inner">
     3820                                <div class="awd-ttt-modal-header">
     3821                                        <h2 id="tg-plan-title"><?php esc_html_e( 'New planning item', 'freelancer-time-log-pro' ); ?></h2>
     3822                                        <button type="button" class="awd-ttt-x" id="tg-plan-close" aria-label="<?php esc_attr_e( 'Close', 'freelancer-time-log-pro' ); ?>">&times;</button>
     3823                                </div>
     3824
     3825                                <form class="awd-ttt-modal-body" id="tg-plan-form" novalidate>
     3826                                        <input type="hidden" id="tg-plan-id" value="0" />
     3827
     3828                                        <label class="awd-ttt-label" for="tg-plan-name"><?php esc_html_e( 'Title', 'freelancer-time-log-pro' ); ?></label>
     3829                                        <input type="text" id="tg-plan-name" class="awd-ttt-field" maxlength="190" autocomplete="off" placeholder="<?php esc_attr_e( 'e.g. Call with client, Holiday in Portugal', 'freelancer-time-log-pro' ); ?>" />
     3830
     3831                                        <span class="awd-ttt-label"><?php esc_html_e( 'Type', 'freelancer-time-log-pro' ); ?></span>
     3832                                        <div class="tg-plan-kinds" role="radiogroup" aria-label="<?php esc_attr_e( 'Type', 'freelancer-time-log-pro' ); ?>">
     3833                                                <?php
     3834                                                $first_kind = '';
     3835                                                foreach ( $this->plan_kinds() as $key => $k ) :
     3836                                                        $first_kind = '' === $first_kind ? $key : $first_kind;
     3837                                                        ?>
     3838                                                        <label class="tg-plan-kind" style="--kc:<?php echo esc_attr( $k['color'] ); ?>">
     3839                                                                <input type="radio" name="tg-plan-kind" value="<?php echo esc_attr( $key ); ?>" <?php checked( $first_kind, $key ); ?> />
     3840                                                                <span><i></i><?php echo esc_html( $k['label'] ); ?></span>
     3841                                                        </label>
     3842                                                <?php endforeach; ?>
     3843                                        </div>
     3844
     3845                                        <div class="tg-grid-2">
     3846                                                <div>
     3847                                                        <label class="awd-ttt-label" for="tg-plan-start"><?php esc_html_e( 'Start date', 'freelancer-time-log-pro' ); ?></label>
     3848                                                        <input type="date" id="tg-plan-start" class="awd-ttt-field" />
     3849                                                </div>
     3850                                                <div>
     3851                                                        <label class="awd-ttt-label" for="tg-plan-end"><?php esc_html_e( 'End date', 'freelancer-time-log-pro' ); ?></label>
     3852                                                        <input type="date" id="tg-plan-end" class="awd-ttt-field" />
     3853                                                </div>
     3854                                        </div>
     3855
     3856                                        <label class="tg-check tg-plan-allday">
     3857                                                <input type="checkbox" id="tg-plan-allday" checked />
     3858                                                <span><?php esc_html_e( 'All day (no time)', 'freelancer-time-log-pro' ); ?></span>
     3859                                        </label>
     3860
     3861                                        <div class="tg-grid-2 tg-plan-times awd-ttt-hidden" id="tg-plan-times">
     3862                                                <div>
     3863                                                        <label class="awd-ttt-label" for="tg-plan-t1"><?php esc_html_e( 'Start time', 'freelancer-time-log-pro' ); ?></label>
     3864                                                        <input type="time" id="tg-plan-t1" class="awd-ttt-field" step="300" />
     3865                                                </div>
     3866                                                <div>
     3867                                                        <label class="awd-ttt-label" for="tg-plan-t2"><?php esc_html_e( 'End time (optional)', 'freelancer-time-log-pro' ); ?></label>
     3868                                                        <input type="time" id="tg-plan-t2" class="awd-ttt-field" step="300" />
     3869                                                </div>
     3870                                        </div>
     3871
     3872                                        <label class="awd-ttt-label" for="tg-plan-notes"><?php esc_html_e( 'Notes', 'freelancer-time-log-pro' ); ?></label>
     3873                                        <textarea id="tg-plan-notes" class="awd-ttt-field" rows="3" placeholder="<?php esc_attr_e( 'Anything to remember?', 'freelancer-time-log-pro' ); ?>"></textarea>
     3874
     3875                                        <p class="tg-plan-error awd-ttt-hidden" id="tg-plan-error" role="alert"></p>
     3876                                        <button type="submit" class="awd-ttt-hidden" tabindex="-1" aria-hidden="true"></button>
     3877                                </form>
     3878
     3879                                <div class="awd-ttt-modal-footer tg-plan-footer">
     3880                                        <button type="button" class="tg-btn tg-btn-danger awd-ttt-hidden" id="tg-plan-delete"><span class="dashicons dashicons-trash"></span><?php esc_html_e( 'Delete', 'freelancer-time-log-pro' ); ?></button>
     3881                                        <span class="tg-plan-footer-gap"></span>
     3882                                        <button type="button" class="tg-btn tg-btn-secondary" id="tg-plan-cancel"><?php esc_html_e( 'Cancel', 'freelancer-time-log-pro' ); ?></button>
     3883                                        <button type="button" class="tg-btn tg-btn-primary" id="tg-plan-save"><?php esc_html_e( 'Save', 'freelancer-time-log-pro' ); ?></button>
     3884                                </div>
     3885                        </div>
     3886                </div>
     3887                <?php
     3888        }
     3889
     3890        /**
     3891         * Settings > Calendar: manage the planning types.
     3892         */
     3893        private function render_settings_calendar(): void {
     3894                $kinds = $this->plan_kinds();
     3895                $usage = $this->plan_kind_usage();
     3896                $name  = self::OPTION_PLAN_KINDS;
     3897
     3898                // Presets offered for new rows, in the Guard accent family.
     3899                $presets = array( '#2563eb', '#4f46e5', '#9333ea', '#e11d48', '#dc2626', '#b45309', '#d97706', '#16a34a', '#0d9488', '#0891b2', '#475569', '#0f172a' );
     3900                ?>
     3901                <form method="post" action="options.php" id="tg-kinds-form">
     3902                        <?php settings_fields( 'frtlp_tlog_plan_group' ); ?>
     3903
     3904                        <div class="tg-card tg-card-pad">
     3905                                <h2 class="tg-section-title"><?php esc_html_e( 'Calendar types', 'freelancer-time-log-pro' ); ?></h2>
     3906                                <p class="tg-muted tg-kinds-intro"><?php esc_html_e( 'Rename a type or change its colour at any time: items keep their type. When you remove a type, its items move to the first type in the list.', 'freelancer-time-log-pro' ); ?></p>
     3907
     3908                                <div class="tg-kinds" id="tg-kinds" data-presets="<?php echo esc_attr( implode( ',', $presets ) ); ?>" data-name="<?php echo esc_attr( $name ); ?>">
     3909                                        <?php
     3910                                        $i = 0;
     3911                                        foreach ( $kinds as $key => $k ) :
     3912                                                $n = isset( $usage[ $key ] ) ? (int) $usage[ $key ] : 0;
     3913                                                ?>
     3914                                                <div class="tg-kind-row" data-usage="<?php echo esc_attr( (string) $n ); ?>">
     3915                                                        <input type="hidden" name="<?php echo esc_attr( $name . '[' . $i . '][key]' ); ?>" value="<?php echo esc_attr( $key ); ?>" />
     3916                                                        <label class="tg-kind-swatch" style="--kc:<?php echo esc_attr( $k['color'] ); ?>">
     3917                                                                <input type="color" name="<?php echo esc_attr( $name . '[' . $i . '][color]' ); ?>" value="<?php echo esc_attr( $k['color'] ); ?>" aria-label="<?php esc_attr_e( 'Colour', 'freelancer-time-log-pro' ); ?>" />
     3918                                                        </label>
     3919                                                        <input type="text" class="tg-input tg-kind-label" maxlength="40" required name="<?php echo esc_attr( $name . '[' . $i . '][label]' ); ?>" value="<?php echo esc_attr( $k['label'] ); ?>" aria-label="<?php esc_attr_e( 'Name', 'freelancer-time-log-pro' ); ?>" />
     3920                                                        <span class="tg-kind-preview" style="--kc:<?php echo esc_attr( $k['color'] ); ?>"><i></i><span><?php echo esc_html( $k['label'] ); ?></span></span>
     3921                                                        <span class="tg-kind-usage">
     3922                                                                <?php
     3923                                                                /* translators: %d: number of planning items using this type */
     3924                                                                echo esc_html( sprintf( _n( '%d item', '%d items', $n, 'freelancer-time-log-pro' ), $n ) );
     3925                                                                ?>
     3926                                                        </span>
     3927                                                        <button type="button" class="tg-kind-remove" aria-label="<?php esc_attr_e( 'Remove type', 'freelancer-time-log-pro' ); ?>" title="<?php esc_attr_e( 'Remove type', 'freelancer-time-log-pro' ); ?>"><span class="dashicons dashicons-trash"></span></button>
     3928                                                </div>
     3929                                                <?php
     3930                                                ++$i;
     3931                                        endforeach;
     3932                                        ?>
     3933                                </div>
     3934
     3935                                <div class="tg-kinds-add">
     3936                                        <button type="button" class="tg-btn tg-btn-secondary" id="tg-kind-add"><?php echo $this->icon( 'plus', 16 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php esc_html_e( 'Add type', 'freelancer-time-log-pro' ); ?></button>
     3937                                        <div class="tg-kind-presets" role="group" aria-label="<?php esc_attr_e( 'Quick colours for the last row', 'freelancer-time-log-pro' ); ?>">
     3938                                                <span class="tg-muted"><?php esc_html_e( 'Quick colours:', 'freelancer-time-log-pro' ); ?></span>
     3939                                                <?php foreach ( $presets as $c ) : ?>
     3940                                                        <button type="button" class="tg-kind-preset" style="--kc:<?php echo esc_attr( $c ); ?>" data-color="<?php echo esc_attr( $c ); ?>" aria-label="<?php echo esc_attr( $c ); ?>"></button>
     3941                                                <?php endforeach; ?>
     3942                                        </div>
     3943                                </div>
     3944
     3945                                <template id="tg-kind-template">
     3946                                        <div class="tg-kind-row is-new" data-usage="0">
     3947                                                <input type="hidden" data-field="key" value="" />
     3948                                                <label class="tg-kind-swatch"><input type="color" data-field="color" value="#2563eb" aria-label="<?php esc_attr_e( 'Colour', 'freelancer-time-log-pro' ); ?>" /></label>
     3949                                                <input type="text" class="tg-input tg-kind-label" maxlength="40" required data-field="label" value="" placeholder="<?php esc_attr_e( 'e.g. Workshop', 'freelancer-time-log-pro' ); ?>" aria-label="<?php esc_attr_e( 'Name', 'freelancer-time-log-pro' ); ?>" />
     3950                                                <span class="tg-kind-preview"><i></i><span></span></span>
     3951                                                <span class="tg-kind-usage tg-kind-new"><?php esc_html_e( 'New', 'freelancer-time-log-pro' ); ?></span>
     3952                                                <button type="button" class="tg-kind-remove" aria-label="<?php esc_attr_e( 'Remove type', 'freelancer-time-log-pro' ); ?>" title="<?php esc_attr_e( 'Remove type', 'freelancer-time-log-pro' ); ?>"><span class="dashicons dashicons-trash"></span></button>
     3953                                        </div>
     3954                                </template>
     3955
     3956                                <p class="tg-kinds-limit tg-muted"><?php esc_html_e( 'Up to 12 types. The first type is the default for new items.', 'freelancer-time-log-pro' ); ?></p>
     3957                        </div>
     3958
     3959                        <p class="tg-savebar">
     3960                                <button type="submit" class="tg-btn tg-btn-primary tg-btn-lg"><?php esc_html_e( 'Save changes', 'freelancer-time-log-pro' ); ?></button>
     3961                                <span class="tg-muted tg-savehint" id="tg-kinds-hint"></span>
     3962                        </p>
     3963                </form>
     3964                <?php
     3965        }
     3966
    29033967        /**
    29043968         * Export screen: pick a scope and a format, then download.
    … …  
    29243988
    29253989                $this->render_shell_open( 'export' );
     3990                $this->render_status_strip();
    29263991
    29273992                $this->page_header(
  • freelancer-time-log-pro/trunk/languages/freelancer-time-log-pro.pot

    r3672459 r3739496  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: TimeGuard - Freelancer Time Log Pro 1.1.6\n"
     5"Project-Id-Version: TimeGuard - Freelancer Time Log Pro 1.2.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/freelancer-time-log-pro\n"
    77"MIME-Version: 1.0\n"
    … …  
    427427msgstr[0] ""
    428428msgstr[1] ""
     429
     430#: freelancer-time-log-pro.php:2094
     431msgid "Timer running"
     432msgstr ""
     433
     434#: freelancer-time-log-pro.php:2095
     435msgid "The running timer is added when you stop it."
     436msgstr ""
     437
     438#: freelancer-time-log-pro.php:2097
     439msgid "Timer paused"
     440msgstr ""
     441
     442#: freelancer-time-log-pro.php:2098
     443msgid "A paused timer is waiting to be finalized or resumed."
     444msgstr ""
     445
     446#: freelancer-time-log-pro.php:2100
     447msgid "Time logged"
     448msgstr ""
     449
     450#: freelancer-time-log-pro.php:2101
     451msgid "All time you logged in this period."
     452msgstr ""
     453
     454#: freelancer-time-log-pro.php:2103
     455msgid "Nothing logged yet"
     456msgstr ""
     457
     458#: freelancer-time-log-pro.php:2109
     459msgid "No time yet"
     460msgstr ""
     461
     462#: freelancer-time-log-pro.php:2111
     463msgid "Healthy ratio"
     464msgstr ""
     465
     466#: freelancer-time-log-pro.php:2113
     467msgid "Mixed"
     468msgstr ""
     469
     470#: freelancer-time-log-pro.php:2115
     471msgid "Mostly non-billable"
     472msgstr ""
     473
     474#: freelancer-time-log-pro.php:2126
     475msgid "Set a project rate, then apply it under Settings."
     476msgstr ""
     477
     478#: freelancer-time-log-pro.php:2128
     479msgid "Earning"
     480msgstr ""
     481
     482#: freelancer-time-log-pro.php:2129
     483msgid "Billable time multiplied by each entry's rate."
     484msgstr ""
     485
     486#: freelancer-time-log-pro.php:2131
     487msgid "No earnings yet"
     488msgstr ""
     489
     490#: freelancer-time-log-pro.php:2137
     491msgid "No entries yet"
     492msgstr ""
     493
     494#: freelancer-time-log-pro.php:2141
     495#, php-format
     496msgid "Last entry %s ago"
     497msgstr ""
     498
     499#: freelancer-time-log-pro.php:2143
     500msgid "Logged today"
     501msgstr ""
     502
     503#: freelancer-time-log-pro.php:2164
     504msgid "total"
     505msgstr ""
     506
     507#: freelancer-time-log-pro.php:2177
     508msgid "Toggle billable per entry in the table below."
     509msgstr ""
     510
     511#: freelancer-time-log-pro.php:2179
     512#, php-format
     513msgid "billable (%d%%)"
     514msgstr ""
     515
     516#: freelancer-time-log-pro.php:2192
     517msgid "earned"
     518msgstr ""
     519
     520#: freelancer-time-log-pro.php:2205
     521msgid "Export them per project or client as Excel or CSV."
     522msgstr ""
     523
     524#: freelancer-time-log-pro.php:2307
     525msgid "timer running"
     526msgstr ""
     527
     528#: freelancer-time-log-pro.php:2309
     529msgid "timer paused"
     530msgstr ""
     531
     532#: freelancer-time-log-pro.php:2311
     533msgid "timer idle"
     534msgstr ""
     535
     536#: freelancer-time-log-pro.php:2124
     537#, php-format
     538msgid "%d entry without a rate"
     539msgid_plural "%d entries without a rate"
     540msgstr[0] ""
     541msgstr[1] ""
     542
     543#: freelancer-time-log-pro.php:2206
     544msgid "entry"
     545msgid_plural "entries"
     546msgstr[0] ""
     547msgstr[1] ""
     548
     549#: freelancer-time-log-pro.php:810
     550msgid "Planning"
     551msgstr ""
     552
     553#: freelancer-time-log-pro.php:2487
     554msgid "Calendar"
     555msgstr ""
     556
     557#: freelancer-time-log-pro.php:3204
     558msgid "Note"
     559msgstr ""
     560
     561#: freelancer-time-log-pro.php:3208
     562msgid "Appointment"
     563msgstr ""
     564
     565#: freelancer-time-log-pro.php:3212
     566msgid "Deadline"
     567msgstr ""
     568
     569#: freelancer-time-log-pro.php:3216
     570msgid "Work"
     571msgstr ""
     572
     573#: freelancer-time-log-pro.php:3220
     574msgid "Time off"
     575msgstr ""
     576
     577#: freelancer-time-log-pro.php:3352
     578msgid "Invalid date range."
     579msgstr ""
     580
     581#: freelancer-time-log-pro.php:3391
     582msgid "Please enter a title."
     583msgstr ""
     584
     585#: freelancer-time-log-pro.php:3400
     586msgid "Please choose a valid start date."
     587msgstr ""
     588
     589#: freelancer-time-log-pro.php:3406
     590msgid "The end date is before the start date."
     591msgstr ""
     592
     593#: freelancer-time-log-pro.php:3415
     594msgid "The end time is before the start time."
     595msgstr ""
     596
     597#: freelancer-time-log-pro.php:3438
     598msgid "Item not found."
     599msgstr ""
     600
     601#: freelancer-time-log-pro.php:3455
     602msgid "The item could not be saved."
     603msgstr ""
     604
     605#: freelancer-time-log-pro.php:3539
     606msgid "Today"
     607msgstr ""
     608
     609#: freelancer-time-log-pro.php:3540
     610msgid "Tomorrow"
     611msgstr ""
     612
     613#: freelancer-time-log-pro.php:3541
     614msgid "Upcoming"
     615msgstr ""
     616
     617#: freelancer-time-log-pro.php:3542
     618msgid "The next 30 days"
     619msgstr ""
     620
     621#: freelancer-time-log-pro.php:3543
     622msgid "Nothing planned. Click a day in the calendar to add something."
     623msgstr ""
     624
     625#: freelancer-time-log-pro.php:3544
     626msgid "Nothing planned on this day."
     627msgstr ""
     628
     629#: freelancer-time-log-pro.php:3545
     630msgid "Add to this day"
     631msgstr ""
     632
     633#: freelancer-time-log-pro.php:3546
     634msgid "Back to upcoming"
     635msgstr ""
     636
     637#: freelancer-time-log-pro.php:3547
     638msgid "All day"
     639msgstr ""
     640
     641#: freelancer-time-log-pro.php:3549
     642#, php-format
     643msgid "+%d more"
     644msgstr ""
     645
     646#: freelancer-time-log-pro.php:3551
     647#, php-format
     648msgid "%d days"
     649msgstr ""
     650
     651#: freelancer-time-log-pro.php:3552
     652msgid "New planning item"
     653msgstr ""
     654
     655#: freelancer-time-log-pro.php:3553
     656msgid "Edit planning item"
     657msgstr ""
     658
     659#: freelancer-time-log-pro.php:3556
     660msgid "Delete this planning item?"
     661msgstr ""
     662
     663#: freelancer-time-log-pro.php:3557
     664msgid "Tip: drag across several days to plan a period, such as a holiday."
     665msgstr ""
     666
     667#: freelancer-time-log-pro.php:3561
     668msgid "New item"
     669msgstr ""
     670
     671#: freelancer-time-log-pro.php:3571
     672msgid "Notes, appointments, deadlines and time off at a glance. Click a day to add, drag across days for a period."
     673msgstr ""
     674
     675#: freelancer-time-log-pro.php:3580
     676msgid "Previous month"
     677msgstr ""
     678
     679#: freelancer-time-log-pro.php:3582
     680msgid "Next month"
     681msgstr ""
     682
     683#: freelancer-time-log-pro.php:3585
     684msgid "Show types"
     685msgstr ""
     686
     687#: freelancer-time-log-pro.php:3620
     688msgid "Title"
     689msgstr ""
     690
     691#: freelancer-time-log-pro.php:3621
     692msgid "e.g. Call with client, Holiday in Portugal"
     693msgstr ""
     694
     695#: freelancer-time-log-pro.php:3623
     696msgid "Type"
     697msgstr ""
     698
     699#: freelancer-time-log-pro.php:3635
     700msgid "Start date"
     701msgstr ""
     702
     703#: freelancer-time-log-pro.php:3639
     704msgid "End date"
     705msgstr ""
     706
     707#: freelancer-time-log-pro.php:3646
     708msgid "All day (no time)"
     709msgstr ""
     710
     711#: freelancer-time-log-pro.php:3651
     712msgid "Start time"
     713msgstr ""
     714
     715#: freelancer-time-log-pro.php:3655
     716msgid "End time (optional)"
     717msgstr ""
     718
     719#: freelancer-time-log-pro.php:3660
     720msgid "Notes"
     721msgstr ""
     722
     723#: freelancer-time-log-pro.php:3661
     724msgid "Anything to remember?"
     725msgstr ""
     726
     727#: freelancer-time-log-pro.php:750
     728#, php-format
     729msgid "%1$d planning item(s) use \"%2$s\". When you save, they move to \"%3$s\". Remove this type?"
     730msgstr ""
     731
     732#: freelancer-time-log-pro.php:751
     733msgid "Keep at least one type."
     734msgstr ""
     735
     736#: freelancer-time-log-pro.php:752
     737msgid "You can have up to 12 types."
     738msgstr ""
     739
     740#: freelancer-time-log-pro.php:753
     741msgid "Unsaved changes"
     742msgstr ""
     743
     744#: freelancer-time-log-pro.php:3150
     745msgid "Choose the types you can give planning items, and their colours."
     746msgstr ""
     747
     748#: freelancer-time-log-pro.php:3157
     749msgid "General"
     750msgstr ""
     751
     752#: freelancer-time-log-pro.php:3160
     753msgid "Settings sections"
     754msgstr ""
     755
     756#: freelancer-time-log-pro.php:3381
     757msgid "Keep at least one calendar type. Nothing was changed."
     758msgstr ""
     759
     760#: freelancer-time-log-pro.php:3779
     761msgid "Agenda"
     762msgstr ""
     763
     764#: freelancer-time-log-pro.php:3790
     765msgid "Drag to move"
     766msgstr ""
     767
     768#: freelancer-time-log-pro.php:3797
     769msgid "Collapse"
     770msgstr ""
     771
     772#: freelancer-time-log-pro.php:3798
     773msgid "Hide agenda"
     774msgstr ""
     775
     776#: freelancer-time-log-pro.php:3905
     777msgid "Calendar types"
     778msgstr ""
     779
     780#: freelancer-time-log-pro.php:3906
     781msgid "Rename a type or change its colour at any time: items keep their type. When you remove a type, its items move to the first type in the list."
     782msgstr ""
     783
     784#: freelancer-time-log-pro.php:3917
     785msgid "Colour"
     786msgstr ""
     787
     788#: freelancer-time-log-pro.php:3919
     789msgid "Name"
     790msgstr ""
     791
     792#: freelancer-time-log-pro.php:3927
     793msgid "Remove type"
     794msgstr ""
     795
     796#: freelancer-time-log-pro.php:3936
     797msgid "Add type"
     798msgstr ""
     799
     800#: freelancer-time-log-pro.php:3937
     801msgid "Quick colours for the last row"
     802msgstr ""
     803
     804#: freelancer-time-log-pro.php:3938
     805msgid "Quick colours:"
     806msgstr ""
     807
     808#: freelancer-time-log-pro.php:3949
     809msgid "e.g. Workshop"
     810msgstr ""
     811
     812#: freelancer-time-log-pro.php:3951
     813msgid "New"
     814msgstr ""
     815
     816#: freelancer-time-log-pro.php:3956
     817msgid "Up to 12 types. The first type is the default for new items."
     818msgstr ""
     819
     820#: freelancer-time-log-pro.php:3924
     821#, php-format
     822msgid "%d item"
     823msgid_plural "%d items"
     824msgstr[0] ""
     825msgstr[1] ""
  • freelancer-time-log-pro/trunk/readme.txt

    r3672459 r3739496  
    11=== TimeGuard - Freelancer Time Log Pro ===
    22Contributors: fredawd
    3 Tags: time tracking, time tracker, admin bar, invoicing, freelancers
     3Tags: time tracking, time tracker, freelancers, calendar, invoicing
    44Requires at least: 6.0
    55Tested up to: 7.0
    66Requires PHP: 7.4
    7 Stable tag: 1.1.6
     7Stable tag: 1.2.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Time tracking for freelancers: admin-bar timer, manual entries, hourly rates, billable hours, earnings, and CSV export.
     11Lightweight time tracker and planner for freelancers: log hours from the admin bar, plan your week in a calendar, export to Excel or CSV.
    1212
    1313== Description ==
    1414
    15 TimeGuard (formerly Freelancer Time Log Pro) is a lightweight time tracker for freelancers who want to log work fast without leaving wp-admin.
     15TimeGuard (formerly Freelancer Time Log Pro) is a lightweight time tracker and planner for freelancers who want to log work fast and keep their week in view, without leaving wp-admin.
     16
     17**New in 1.2: Planning.** A built-in calendar for notes, appointments, deadlines and time off, right next to your hours.
     18
     19= Track your time =
    1620
    1721* Start / pause / resume timer in the WordPress admin bar
    1822* Draggable floating timer that survives page loads
    1923* Add entries by hand when you forgot to start the timer
    20 * Edit any logged entry afterwards — correct the project, date, duration, tag, billable flag or description
     24* Edit any logged entry afterwards: project, date, duration, tag, billable flag or description
    2125* Client + project assignment, ticket number, tag and description
    2226* Hourly rate per project, billable toggle per entry, automatic earnings
    23 * This week / this month / all time overview with summary cards
     27
     28= Plan your week =
     29
     30* Month calendar: click a day to add a note or appointment, drag across days to block a period such as a holiday
     31* Optional start and end times; multi-day items run as one bar across the calendar
     32* Floating, movable agenda panel with everything coming up in the next 30 days
     33* Your own item types and colours (Settings > Calendar), with a filter per type
     34* Personal per user: everyone sees and edits only their own planning
     35
     36= Review and export =
     37
     38* Status cards for this week / this month / all time: total, billable share, earnings and entries at a glance
     39* A compact status bar on every screen, so you always know where your week stands
    2440* Project overview with total time, billable share and earnings
    25 * CSV export (all, per project, per client)
     41* Export to Excel (.xlsx) or CSV: everything, per project or per client
    2642* Delete single entries, a project's logged time, or everything
    2743
    … …  
    34503. Go to **TimeGuard > Projects** and set up your clients, projects and hourly rates.
    35514. Use the Start/Stop button in the admin bar, or **New Entry** on the Entries screen.
     525. Open **TimeGuard > Planning** to plan your week. Adjust the calendar types and colours under **Settings > Calendar**.
    3653
    3754== Frequently Asked Questions ==
    3855
    39 = Where are my time entries stored? =
    40 In your own WordPress database, in the table `wp_frtlp_time_entries`, per user.
     56= Where are my time entries and planning stored? =
     57In your own WordPress database, per user: time entries in `wp_frtlp_time_entries`, calendar items in `wp_frtlp_planning`.
    4158
    4259= Does uninstalling delete my time entries? =
    43 No. Uninstalling removes the plugin settings but deliberately leaves the entries table intact so billing history is never lost by accident.
     60No. Uninstalling removes the plugin settings but deliberately leaves the entries and planning tables intact, so billing history and your calendar are never lost by accident.
    4461
    4562= Can I export my time entries? =
    46 Yes: all entries, per project, or per client, as CSV including rate and amount columns.
     63Yes: all entries, per project, or per client, as Excel (.xlsx) or CSV, including rate and amount columns and a totals row.
     64
     65= Can other users see my calendar? =
     66No. Planning is personal: every user sees and edits only their own items, administrators included. The calendar types and colours are shared site-wide and managed by administrators.
     67
     68= What happens to items when I remove a calendar type? =
     69They are kept and move to the first type in the list. Renaming or recolouring a type never changes its items.
    4770
    4871= I upgraded from 1.0.x. Do I lose anything? =
    … …  
    5174== Screenshots ==
    5275
    53 1. Entries overview with summary cards, rates and earnings
     761. Entries overview with status cards, rates and earnings
    54772. Projects overview with billable share per project
    55783. Admin bar timer and floating timer widget
    56794. Save-entry modal
     805. Planning: month calendar with periods, appointments and the floating agenda panel
     816. Settings > Calendar: your own types and colours
    5782
    5883== Changelog ==
     84
     85= 1.2.1 =
     86* New: the agenda panel on Planning is now a floating window. Drag it anywhere by its bar, collapse it, or hide it with the "Agenda" button; its position is remembered. Double-click the bar to put it back in the corner. The calendar now uses the full width.
     87* New: Settings has section pills (General and Calendar). Under Calendar you can add, rename, recolour and remove planning types, with a colour picker and quick colours. Items of a removed type move to the first type in the list.
     88* Improved: text on multi-day bars switches to dark on light colours, so every type colour stays readable.
     89
     90= 1.2.0 =
     91* New: Planning. A calendar tab for notes, appointments, deadlines, work blocks and time off. Click a day to add an item, or drag across several days to plan a period such as a holiday. Times are optional. Periods run as one bar across the days they cover.
     92* New: an "Upcoming" panel next to the calendar lists the next 30 days. Click a day number to see that day's agenda.
     93* New: filter the calendar by type with the coloured chips; the choice is remembered per browser.
     94* Planning items are personal: every user sees and edits only their own.
     95
     96= 1.1.7 =
     97* New: the Entries screen shows four status cards in the Guard family layout (as in HelpGuard and WarpGuard). Each card has a status pill: timer running or paused, billable ratio, billable entries that still have no rate, and how recently you last logged time.
     98* New: a one-line status strip on the Projects, Export and Settings tabs repeats those four statuses for this week plus the timer state, and links back to Entries.
     99* Improved: buttons follow the Guard colour rules: blue for the main action, white for neutral side actions, red for irreversible deletes.
    59100
    60101= 1.1.6 =
    … …  
    110151== Upgrade Notice ==
    111152
     153= 1.2.1 =
     154Floating, movable agenda panel and your own calendar types with colours (Settings > Calendar). No database changes.
     155
     156= 1.2.0 =
     157Adds a Planning calendar. Creates one new database table (wp_frtlp_planning) automatically on update; existing time entries are not touched.
     158
     159= 1.1.7 =
     160New status cards and pills on Entries, a status strip on the other tabs and Guard-style buttons. No database changes.
     161
    112162= 1.1.6 =
    113163Adds an "Edit entry" action so you can correct a logged entry instead of deleting and re-adding it. No database changes.
  • freelancer-time-log-pro/trunk/uninstall.php

    r3617473 r3739496  
    55 * Options and transient timer state are removed. The entries table is
    66 * deliberately left in place so that uninstalling never destroys billing
    7  * history; drop wp_frtlp_time_entries by hand if you really want it gone.
     7 * history; drop wp_frtlp_time_entries (and wp_frtlp_planning for the
     8 * calendar) by hand if you really want them gone.
    89 *
    910 * @package freelancer-time-log-pro
Note: See TracChangeset for help on using the changeset viewer.