<!-- <style type="text/css">
    textarea {
        height: 842px;
        width: 595px;
        resize: none;
}
</style> -->

<div class="row">
    <div class="col-lg-11">
        <div class="card-body row">
            <div class="col-lg-4">
                <div class="form-group row">
                    <div class="col-lg-12">
                        <label class="col-lg-12 col-form-label"></label>
                    </div>
                </div>                
            </div>
            <div class="col-lg-6">
                <div class="form-group row">
                    <label class="col-lg-2 col-form-label" style="font-weight:bold;">Preview = </label>
                    <div class="col-lg-2">
                        <div class="kt-checkbox-inline">
                            <label class="kt-checkbox kt-checkbox--brand">
                                <input type="checkbox" id="chkSelectIssue" onclick="javascript:onCheckChanged(this, 'txtPageIssue');" /> Tab Select
                                <span></span>
                            </label>
                        </div>
                        <span class="form-text text-muted"></span>
                    </div>
                    <div class="col-lg-2" style="max-width: 75px;">
                        <input style="text-align:right" type="number" class="form-control" id="txtPageIssue" />
                    </div>
                    <label class="col-lg-2 col-form-label">Tab Sequence</label>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="card-body row" style="padding-top: 0px;">
            <div class="col-lg-5">
                <textarea style="resize: none;" class="form-control" name="" id="txtSalesIssue" cols="num" rows="5"></textarea>
            </div>
            <div style="width: 50px;">
            </div>
            <div class="col-lg-5">
                <form id="form_issue_attachment" action="#" enctype="multipart/form-data">
                <div class="kt-datatable kt-datatable--default kt-datatable--brand kt-datatable--loaded" >
                    <table class="kt-datatable__table" id="table_data" >
                        <thead class="kt-datatable__head" >
                            <tr class="dnd-moved kt-datatable__row" style="left: 0px;">
                                <th data-field="id" class="kt-datatable__cell" id="col_id" style="display: none;"><span>ID </th>
                                <th data-field="number" class="kt-datatable__cell" id="col_no" style="width: 50px;"><span>No. </th>
                                <th data-field="caption" class="kt-datatable__cell" id="col_caption" style="width: 150px;"><span>Attachment</span></th>
                                <th data-field="attachment" class="kt-datatable__cell" id="col_attachment" style="width: 200px;"><span>Upload File</span></th>
                                <th data-field="" class="kt-datatable__cell" style="width:50px;" id="col_action"></th>
                            </tr>                            
                        </thead>
                        <tbody class="kt-datatable__body"  id="sales-quotation-issue-attachment-list">
                            <?php if(!is_null($rowsAttach) && count($rowsAttach)>0) {
                                foreach($rowsAttach as $row_attach) {
                            ?>
                                <tr class="dnd-moved kt-datatable__row" style="left: 0px;">
                                    <td data-field="id" class="kt-datatable__cell" id="col_id" style="display: none;"><span><?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?></td>
                                    <td data-field="number" class="kt-datatable__cell" id="col_no"><span><?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ORDER] ?></td>
                                    <td data-field="caption" class="kt-datatable__cell" id="col_caption"><span><?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_CAPTION] ?></span></td>
                                    <td data-field="attachment" class="kt-datatable__cell" id="col_attachment_issue<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>">
                                    <?php if(trim($row_attach[SalesQuotationAttachmentTable::C_DOC_NAME]) == "") { ?>
                                    <input type="file" class="form-control" id="txtSalesQuotationAttachmentIssue<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>" name="txtSalesQuotationAttachmentIssue<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>" onchange="onChangedSalesQuotationAttachmentUpload(this.form, <?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>);" />
                                    <input type="hidden" class="form-control" id="txtSalesQuotationAttachmentFilenameIssue<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>"/>
                                    <?php } else { ?>
                                        <a title='View Attachment' style='color:green; margin-top: 5px;' href='javascript:' onclick='downloadSalesQuotationFile("<?php echo $row_attach[SalesQuotationAttachmentTable::C_ID]; ?>", "<?php echo trim($row_attach[SalesQuotationAttachmentTable::C_DOC_NAME]); ?>")'><?php echo trim($row_attach[SalesQuotationAttachmentTable::C_DESC]); ?></a>
                                    <?php } ?>
                                    </td>
                                    <td data-field="" class="kt-datatable__cell" id="col_action_issue<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>">
                                    <?php if(trim($row_attach[SalesQuotationAttachmentTable::C_DOC_NAME]) == "") { ?>
                                        <button type='button' class='btn btn btn-icon btn-success btn-sm btn-icon-md' onclick='uploadSalesQuotationAttachmentIssue(<?php echo $row_attach[SalesQuotationAdditionalAttachmentTable::C_ID] ?>);'><i class='fa fa-upload'></i></button>
                                    <?php } else { ?>
                                        <button type='button' class='btn btn btn-icon btn-danger btn-sm btn-icon-md' onclick='removeSalesQuotationAttachment(<?php echo $row_attach[SalesQuotationAttachmentTable::C_ATTACH_ID]; ?>);'><i class='fa fa-trash'></i></button>
                                    <?php } ?>
                                    </td>
                                </tr> 
                            <?php 
                            }
                                } ?>
                        </tbody>
                    </table>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>