<?php
// _rowinput.php
// process.php에서 extract($row) 이후에 include 하여 한 행(<tr>…</tr>)을 렌더링합니다.
?>
<tr data-num="<?php echo htmlspecialchars($num, ENT_QUOTES, 'UTF-8'); ?>" onclick='maketext(<?php echo json_encode($manager_name, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($representative_name, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($phone, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($vendor_name, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($contact_info, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($secondordnum, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($num, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode(preg_replace('/\s+/', ' ', str_replace(['<br>','<br/>'], ' ', $address)), JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($secondordpaydate, JSON_UNESCAPED_UNICODE); ?>,
    <?php echo json_encode($paydate, JSON_UNESCAPED_UNICODE); ?>);'>
    <td class="text-center text-primary fw-bold"><?php echo htmlspecialchars($represent, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center text-secondary"><?php echo htmlspecialchars($secondordnum, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center <?php echo ($PurchaseSales === '매입매출' ? 'text-danger' : ($PurchaseSales === '매입' ? 'text-primary' : 'text-secondary')); ?>">
        <?php echo htmlspecialchars($PurchaseSales, ENT_QUOTES, 'UTF-8'); ?>
    </td>
    <td class="text-start text-dark fw-bold" title="<?php echo htmlspecialchars($vendor_name, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($vendor_name, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center" title="<?php echo htmlspecialchars($representative_name, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($representative_name, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center" title="<?php echo htmlspecialchars($manager_name, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($manager_name, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center" title="<?php echo htmlspecialchars($contact_info, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($contact_info, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center text-secondary"><?php echo htmlspecialchars($secondordpaydate, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center text-primary"><?php echo htmlspecialchars($paydate, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center text-danger"><?php echo ($baddebt === '1') ? '악성채권' : ''; ?></td>
    <td class="text-end"><?php echo htmlspecialchars($debtAmount, ENT_QUOTES, 'UTF-8'); ?></td>
    <td class="text-center">
        <?php if (!empty($represent)): ?>
            <button type="button" class="btn btn-dark btn-sm" onclick="addFn('<?php echo $num; ?>'); event.stopPropagation();">
                <i class="bi bi-plus-square"></i>
            </button>
        <?php endif; ?>
        <button type="button" class="btn btn-danger btn-sm" onclick="delFn('<?php echo $num; ?>'); event.stopPropagation();">
            <i class="bi bi-x-circle"></i>
        </button>
    </td>
</tr>
