@using CarCareTracker.Helper
<!DOCTYPE html>
@inject IConfigHelper config
@{
    var userConfig = config.GetUserConfig(User);
    var useDarkMode = userConfig.UseDarkMode;
    var enableCsvImports = userConfig.EnableCsvImports;
    var shortDatePattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
    var numberFormat = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
    shortDatePattern = shortDatePattern.ToLower();
    if (!shortDatePattern.Contains("dd"))
    {
        shortDatePattern = shortDatePattern.Replace("d", "dd");
    }
    if (!shortDatePattern.Contains("mm"))
    {
        shortDatePattern = shortDatePattern.Replace("m", "mm");
    }
}
<html lang="en" data-bs-theme="@(useDarkMode ? "dark" : "light")">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="apple-mobile-web-app-title" content="LubeLogger" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>@ViewData["Title"] - CarCareTracker</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap-icons.css" />
    <link rel="stylesheet" href="~/lib/bootstrap-datepicker/css/bootstrap-datepicker.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/loader.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/sweetalert/sweetalert2.min.css" asp-append-version="true" />
    <link rel="icon" sizes="192x192" href="~/defaults/lubelogger_icon_192.png" />
    <link rel="icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
    <link rel="apple-touch-icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
    <link rel="apple-touch-icon-precomposed" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
    <link rel="apple-touch-startup-image" href="~/defaults/lubelogger_launch.png" />
    <link rel="manifest" href="~/manifest.json">
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/js/shared.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/lib/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
    <script src="~/sweetalert/sweetalert2.all.min.js"></script>
    <script src="~/js/loader.js"></script>
    <script>
        function getGlobalConfig() {
            return {
                useDarkMode : "@useDarkMode" == "True",
                enableCsvImport : "@enableCsvImports" == "True"
            }
        }
        function getShortDatePattern() {
            return {
                pattern: "@shortDatePattern"
            }
        }
        function globalParseFloat(input){
            //remove thousands separator.
            var thousandSeparator = "@numberFormat.NumberGroupSeparator";
            var decimalSeparator = "@numberFormat.NumberDecimalSeparator";
            //strip thousands from input.
            input = input.replace(thousandSeparator, "");
            //convert to JS format where decimal is only separated by .
            input = input.replace(decimalSeparator, ".");
            return parseFloat(input);
        }
        function globalFloatToString(input) {
            var decimalSeparator = "@numberFormat.NumberDecimalSeparator";
            input = input.replace(".", decimalSeparator);
            return input;
        }
    </script>
    @await RenderSectionAsync("Scripts", required: false)
</head>
<body>
    <div class="container" style="height:85vh;">
        <main role="main">
            @RenderBody()
        </main>
    </div>
</body>
</html>
