package dev_employeeanalytic

import "cpone/models"
import "strconv"

templ ListingData(
    data []models.DashboardPic,
    listID string,
) {
    <div id={listID} class="align-items-center pt-8 flex-column" hx-swap-oob="true">
        <div class="bg-field rounded">
            <div class="p-8">
                for i, d := range data {
                    if i == (len(data) - 1)  {
                        <div id={ strconv.Itoa(int(d.Mgm_McuID)) } class="card shadow p-8" hx-get={"/corp/dashboard_pic/click/" + strconv.Itoa(d.Mgm_McuID)}>
                            @ItemCard(d)
                        </div>
                    } else {
                        <div id={ strconv.Itoa(int(d.Mgm_McuID)) } class="card shadow p-8 mb-8" hx-get={"/corp/dashboard_pic/click/" + strconv.Itoa(d.Mgm_McuID)}>
                            @ItemCard(d)
                        </div>
                    }
                }
            </div>
        </div>
    </div>
}

templ ItemCard(data models.DashboardPic) {
    <div class="row d-flex align-items-center">
        <div class="col-7">
            <h3 class="text-black">{ data.Mgm_McuLabel }</h3>
        </div>
        <div class="col-md col-lg text-right">
            <span class="text-black font-weight-bolder">{ data.Mgm_McuNote }</span>
        </div>
        <div class="col-md col-lg text-right">
            <span class="text-black font-weight-bolder">{ data.Mgm_McuStartDate } - { data.Mgm_McuEndDate }</span>
        </div>
    </div>    
}