aceberg/ExerciseDiary

View on GitHub
internal/web/templates/weight.html

Summary

Maintainability
Test Coverage
{{ define "weight.html" }}
<script src="/fs/public/js/weight.js"></script>
<script src="/fs/public/js/weight-chart.js"></script>
<link rel="stylesheet" type="text/css" href="/fs/public/css/index.css" />
<body>
    <div class="container-lg mt-4">
    <div class="row">
        <div class="col-md-4 mb-4">
            <div class="card border-primary">
                <div class="card-header">Weight</div>
                <div class="card-body table-responsive">
                <table class="table table-borderless">
                    <thead>
                        <th class="col-1"></th>
                        <th class="col-5">Date</th>
                        <th class="col-5">Weight</th>
                        <th class="col-1">Del</th>
                    </thead>
                    <tbody id="weightList">
                    </tbody>
                </table>
                <div class="gap-3 hstack">
                    <button onclick='setWeights({{ .ExData.Weight }}, {{ .Config.HeatColor }}, 1, {{ .Config.PageStep }});' class="m-auto btn del-set-button"><i class="bi bi-arrow-left-square"></i></button>
                    <button onclick='setWeights({{ .ExData.Weight }}, {{ .Config.HeatColor }}, -1, {{ .Config.PageStep }});' class="m-auto btn del-set-button"><i class="bi bi-arrow-right-square"></i></button>
                </div>
                </div>
            </div>
        </div>
        <div class="col-md-8">
            <div class="card border-primary mb-4">
                <div class="card-header">Chart</div>
                <div class="card-body">
                    <div class="chart-container m-auto">
                        <canvas id="weight-chart" style="max-height: 200px;"></canvas>
                    </div>
                </div>
            </div>
            <div class="card border-primary mb-4">
                <div class="card-header">Add</div>
                <div class="card-body">
                    <form action="/weight/" method="post" name="sets" class="input-group">
                        <input name="date" type="date" class="form-control" id="todayDate">
                        <input name="weight" type="number" step="any" min="0" class="form-control">
                        <button type="submit" class="btn btn-primary">Add</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
    </div>
        
<script>
    setToday();
    setWeights({{ .ExData.Weight }}, {{ .Config.HeatColor }}, 0, {{ .Config.PageStep }});
</script>

{{ template "footer.html" }}
{{ end }}