<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" encoding="utf-8" indent="yes"/>

    <!-- Parameters -->

    <xsl:param name="VERSION">1.0</xsl:param>
    <xsl:param name="PAGE-TITLE">Upload CSV File</xsl:param>
    <xsl:param name="PAGE-NAME">uploadCSVFile</xsl:param>
    <xsl:param name="IMPORT-TYPE">incremental</xsl:param>

    <xsl:template match="/">
    
        <!--<link href="css/dropzone.min.css?version={$VERSION}" rel="stylesheet" media="screen"/>-->

        <script src="js/{$PAGE-NAME}.js?version={$VERSION}"/>   
        <!--<script src="js/dropzone.min.js?version={$VERSION}"/>-->   
        
        <div class="{$PAGE-NAME}">
      
            <div class="card">
        
                <div class="card-header bg-primary text-white p-1 ps-3">
                    <i class="bi bi-filetype-csv me-2"/>
                    <xsl:value-of select="$PAGE-TITLE"/>
                </div>
        
                <div class="card-body">
          
                    <form action="" name="{$PAGE-NAME}" method="post" id="{$PAGE-NAME}" enctype="multipart/form-data">

                        <input type="hidden" name="action" value="Import.uploadCSVFile"/>
                        <input type="hidden" name="step"   value="upload"/>
            
                        <div class="row">

                            <div class="col-6 mt-3 mb-4">
                                <input type="file" class="form-control form-control-sm file-input" name="csvfile" id="csvfile" accept=".csv"/>
                            </div>

                            <div class="col-3 mt-3 mb-4">
                                <select class="form-control form-control-sm" name="upload_type" id="upload_type">

                                    <xsl:choose>

                                        <xsl:when test="$IMPORT-TYPE = 'incremental'">

                                            <option value="incremental" selected="selected">
                                                Incremental Upload
                                            </option>

                                            <option value="full">
                                                Full Upload
                                            </option>

                                        </xsl:when>

                                        <xsl:when test="$IMPORT-TYPE = 'full'">

                                            <option value="incremental">
                                                Incremental Upload
                                            </option>

                                            <option value="full" selected="selected">
                                                Full Upload
                                            </option>

                                        </xsl:when>

                                        <xsl:otherwise>

                                            <option value="incremental">
                                                Incremental Upload
                                            </option>

                                            <option value="full">
                                                Full Upload
                                            </option>

                                        </xsl:otherwise>

                                    </xsl:choose>

                                </select>
                            </div>


                        </div>

                    </form>

                    <div class="buttons mt-2 mb-2">
                        <button type="button" class="btn btn-sm btn-primary me-2 btnUpload" disabled="disabled">
                            <i class="bi bi-cloud-arrow-up me-2"/>Upload</button>
                        <button type="button" class="btn btn-sm btn-primary me-2 btnCancel">
                            <i class="bi bi-box-arrow-left me-2"/>Cancel</button>
                    </div>
          
                </div>
        
            </div>
      
        </div>
          
    </xsl:template>

</xsl:stylesheet>
