<?php

/**
 * PaintOps - Vehicle Log (Pro)
 *
 * A simple, IRS-friendly log for the business's vehicle tax deduction. The
 * deduction METHOD is chosen once by the admin under Business > Vehicle &
 * Mileage (the two methods are mutually exclusive per the IRS):
 *
 *   - 'mileage' : Standard mileage rate, log business miles; the report
 *                 totals miles and estimates the deduction at the configured
 *                 IRS cents-per-mile rate.
 *   - 'expense' : Actual expenses, log real vehicle costs (fuel receipts,
 *                 maintenance, insurance, etc.); the report totals dollars,
 *                 broken down by category.
 *
 * Every driver logs their OWN entries (owner/staff can log on behalf of any
 * team member and can see everyone's; a Painter/Helper sees and manages only
 * their own). This sidesteps the "where did the trip start" problem that makes
 * auto-distance unreliable, the person records what they actually drove/paid.
 *
 * A route template: required on demand from paintops_fetch_csjobs() (?vehicle=1) like
 * timeoff.php, so it handles its own POST and echoes its own page. The small
 * option-backed helpers (method, rate, categories, permission) live in
 * paintops.php so the nav and Settings can reach them without loading this.
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
if ( !function_exists( 'paintops_user_can_use_vehicle_log' ) || !paintops_user_can_use_vehicle_log() ) {
    echo '<div class="paintops-login-required"><p>You do not have access to this page.</p></div>';
    return;
}
// The page body exists only in the premium build; the free build's nav
// never links here, so this shows only on a direct URL.
if ( !function_exists( 'paintops_pro_code_present' ) ) {
    if ( function_exists( 'paintops_render_pro_pointer' ) ) {
        paintops_render_pro_pointer( 'Vehicle & Mileage tracking' );
    }
    return;
}
// paintops_fs()->is__premium_only()