/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import { h } from "@stencil/core";
import cn from "../../../global/lib/cn";
export const DeadStockItem = ({ isOpened, item, key, icon, locale, toggleAccordion }) => {
    var _a, _b, _c;
    return (h("div", { key: key, class: "dead-stock-item" }, h("button", { onClick: () => toggleAccordion(item === null || item === void 0 ? void 0 : item.companyName), class: cn('button', {
            'cursor-default': !((_a = item === null || item === void 0 ? void 0 : item.branchDeadStock) === null || _a === void 0 ? void 0 : _a.length),
            'bg-slate-100': isOpened,
        }) }, h("div", { class: "shift-skeleton flex-1 header" }, (item === null || item === void 0 ? void 0 : item.companyName) ? item === null || item === void 0 ? void 0 : item.companyName : h("span", null, "\u00A0")), h("div", { class: cn('shift-skeleton icon-container', {
            'rotate-0': isOpened,
        }) }, icon)), !!((_b = item === null || item === void 0 ? void 0 : item.branchDeadStock) === null || _b === void 0 ? void 0 : _b.length) && (h("flexible-container", { isOpened: isOpened }, h("table", { class: "dead-stock-table" }, h("thead", null, h("tr", null, h("th", { class: "dead-stock-table-header" }, locale.branch), h("th", { class: "dead-stock-table-header" }, locale.availableQuantity))), h("tbody", null, (_c = item === null || item === void 0 ? void 0 : item.branchDeadStock) === null || _c === void 0 ? void 0 : _c.map(branchDeadStock => (h("tr", { class: "dead-stock-table-row",
        // @ts-ignore
        key: branchDeadStock === null || branchDeadStock === void 0 ? void 0 : branchDeadStock.companyBranchIntegrationID }, h("td", null, h("span", { class: "shift-skeleton" }, branchDeadStock === null || branchDeadStock === void 0 ? void 0 : branchDeadStock.companyBranchName)), h("td", null, h("strong", { class: "shift-skeleton" }, branchDeadStock === null || branchDeadStock === void 0 ? void 0 : branchDeadStock.quantity)))))))))));
};
