    <?php
    session_start();
if(isset($_SESSION['userId'])){

}else{
header("location: ../../login.php");
        }
                                    
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Home page</title>
    <!-- Bootstrap CSS -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
     <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" ></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" ></script>
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/xls/0.7.4-a/xls.core.min.js"></script>

    <style>
          @import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700,800,900');
        :root{
            --theme-color:#5664d2;
        }
        .theme-color{
            color:var(--theme-color);
        }
        .btn-theme-type1{
            color:#fff!important;
            background-color:var(--theme-color)!important;
            border-radius:28px!important;
            font-size:12px!important;
            box-shadow:none!important;
        }
        .btn-theme-type1:hover{
            color:var(--theme-color)!important;
            background-color:#fff!important;
            border-color:var(--theme-color)!important;
        }
        .btn-theme-type2{
            border-radius:28px!important;
            background-color:#fff!important;
            font-size:12px!important;
            box-shadow:none!important;
            border-color:var(--theme-color)!important;
            color:var(--theme-color)!important;
        }
        .btn-theme-type2:hover{
            color:#fff!important;
            background-color:var(--theme-color)!important;
        }

        body {
            font-family: 'Poppins', sans-serif;
            font-size: 13px;
            background: #f8f8f8;
        }
        .container, .container-md, .container-sm {
                max-width: 100%;
            }
        .bg-light-success{
            background-color:#d4ffde!important;
        }
        .bg-light-danger{
            background-color:rgba(255, 0, 0, 0.14)!important;
        }

        .existingSiteAllocationSection table,
        .existingSiteAllocationSection table select,
        .existingSiteAllocationSection table input,
        #exceltable,
        #exceltable select,
        #exceltable input {
            font-size: 10px!important;
        }
        .existingSiteAllocationSection table th,
        .existingSiteAllocationSection table td,
        #exceltable th,
        #exceltable td{
            padding: 0.25rem;
        }

        select.form-control {
            height: 30px;
            font-size: 12px;
        }

        thead th {
            text-transform: capitalize;
        }

        .table td,
        .table th {
            vertical-align: middle;
        }
        .existingSiteAllocationSection table .bg-warning,
        #exceltable.table tr.bg-warning,
        #exceltable.table .bg-warning {
            background-color: #ffefc1!important;
        }
        select option{
            background-color:#fff;
        }

        section.content {
            box-shadow: 0px 15px 16.83px 0.17px rgba(0, 0, 0, 0.05);
            border-radius: 14px;
            border-top-left-radius: 0px;
            border: 1px solid #5664d285;

        }

        .uploadExcelFile::-webkit-file-upload-button {
            background: #2222225c;
        }

        .uploadExcelFile {
            font-weight: 700;
            font-size: 13px;
            border-radius: 10px;        }

        .uploadExcelFile::-webkit-file-upload-button {
            color: white;
            display: inline-block;
            background: #212529e0;
            border: none;
            padding: 12px 15px;
            font-weight: 600;
            border-radius: 3px;
            white-space: nowrap;
            cursor: pointer;
            font-size: 13px;
        }
        .cursor-pointer{
            cursor:pointer;
        }
        .note h6{
            font-size:13px;
        }
        .note ol{
            font-size:10px;
        }
        .misMatchError{
            background-color:#ff000024;
        }
        #errorConsole, #existingSiteAllocationTab_ErrorConsole{
            background-color:#f4f4f4;
            width:40%;
            border-radius:14px;
            padding:15px;
        }
        #exceltable .border-left{
            border-left:2px solid #dee2e6!important;
        }
        .existingSiteAllocationSection table thead tr th:not(:first-child){
            width:15%;
        }
        .existingSiteAllocationSection table .operationsTd,
        #exceltable .operationsTd{
            font-size:12px;
        }
        .existingSiteAllocationSection table i,
        #exceltable .operationsTd i{
            cursor:pointer;
        }
        .existingSiteAllocationSection table .operationsTd i.fa-trash:hover,
        #exceltable .operationsTd i.fa-trash:hover{
            color:red;
        }
        .existingSiteAllocationSection table .operationsTd i.fa-eraser:hover,
         #exceltable .operationsTd i.fa-eraser:hover{
            color:darkorange;
        }
        .existingSiteAllocationSection table .operationsTd i.fa-clone:hover,
         #exceltable .operationsTd i.fa-clone:hover{
            color:#28a745;
        }

       
        #exceltable.table tr th:nth-child(3){
            width:10%;
        }
        #submit:disabled{
            cursor: not-allowed;
        }
        
        
        /*.updatingSiteAllocationTabs p.inactive{*/
        /*    background: #f8f8f8;*/
        /*    color: #5664d2;*/
        /*    border-top-left-radius: 42px;*/
        /*    border-bottom: 1px solid;*/
        /*}*/
        .updatingSiteAllocationTabs p.active{
            background: #ffffff;
            color: #5664d2;
            font-weight: 700;
            border: 1px solid #5664d285;
            border-bottom: 0;
            font-size: 15px;
        }
        .updatingSiteAllocationTabs .newSiteAllocationsTab.active{
             border-top-right-radius: 58px;
        }
        .updatingSiteAllocationTabs .existingSiteAllocationsTab.active{
             border-top-left-radius: 58px;
        }
        
        @media (max-width: 768px){
           
              .uploadExcelFile::-webkit-file-upload-button,.uploadExcelFile,  #viewfile, #submit{
                   font-size: 10px;
              }
              #viewfile{
                  margin-left:0px!important;
              }
              .table td, .table th {
                vertical-align: middle;
                padding: 0;
                font-size: 10px;
                }
            .container, .container-md, .container-sm {
                width: fit-content;
                max-width: initial;
            }
            .customerNameTh{
            width: 18%;
            padding: 0 10px;
            }
               
          }
           @media (max-width: 410px){
                #viewfile{
                        margin-top: 15px !important;
                }
                
          }

    </style>

</head>

<body>

    <div class="container">
        <section class="updatingSiteAllocationTabs">
            <div class="d-flex mt-5" style="margin-bottom: -1px;">
                <p class="tab w-25 text-right mb-0 p-3 pr-5 newSiteAllocationsTab  active cursor-pointer" data-tab-reference="newSiteAllocationSection">Add New Site Allocations</p>
                <p class="tab w-25 text-left mb-0 p-3 pl-5 existingSiteAllocationsTab cursor-pointer" data-tab-reference="existingSiteAllocationSection">Add Exisiting Site Allocations</p>
            </div>
        </section>
        <section class="content tabContent  newSiteAllocationSection mb-5 bg-white p-4">
            <input type="file" id="excelfile" class="uploadExcelFile" />
            <input type="button" id="viewfile" value="Export To Table" class="btn btn-theme-type1 mt-0 p-2 px-3 ml-5"/>
            <table class="table table-hover my-5 bg-white mx-auto" id="exceltable">
            </table>
            <div id="errorConsole" class="d-none">
                <h6>Console</h6>
                <div class="content">
                    <ul>
                        <li>Total number of records.<span>:<b id="totalRecordsValue">200</b></span></li>
                        <li>Already existing records.<span>:</span><b id="noOfDuplicateRecords">10</b>
                            <button id="highlightBtn" class="btn btn-theme-type2">Highlight</button>
                        </li>
                        <li>No.of records to submit.<span>:</span><b id="noOfSubmitRecords">190</b></li>
                    </ul>
                </div>
            </div>
            <button class="btn btn-theme-type1 mb-2 mx-2 mt-3" id="submit">Submit<i class="fa fa-spinner fa-spin ml-2 d-none"></i></button>
            <button class="btn btn-theme-type1 mb-2 mx-2 mt-3" id="validateExcelData">Validate<i class="fa fa-spinner fa-spin ml-2 d-none"></i></button>
            <a id="triggerAnchr" href="" class="d-none">trigger</a>
            <p class="ml-2 text-success" id="resultMessage"><b></b></p>
            <div id="downloadTemplateLink"  class="font-weight-bold" style="font-size: 13px;">Click here to download Bulk New Site's Allocation template<a href="../convert%20Excel%20to%20HTML/ADD-NEW-SITE-ALLOCATIONS TEMPLATE.xlsx" class="ml-2 font-weight-light theme-color">Clik Here</a></div>
        </section>
        <section class="content tabContent existingSiteAllocationSection  mb-5 bg-white p-4 d-none">
            <input type="file" id="excelfileTab2" class="uploadExcelFile"/>
            <input type="button" id="viewFileTab2" value="Export To Table" class="btn btn-theme-type1 mt-0 p-2 px-3 ml-5"/>
            <table class="table table-hover my-5 bg-white mx-auto">
            </table>
            <div id="existingSiteAllocationTab_ErrorConsole" class="d-none">
                <h6>Console</h6>
                <div class="content">
                    <ul>
                        <li>Total number of records <span>: <b id="existingSiteAllocationTab_totalRecordsValue"></b></span></li>
                        <li>Already existing records <span>:</span><b id="existingSiteAllocationTab_noOfDuplicateRecords"></b>
                            <button id="existingSiteAllocationTab_highlightBtn" class="btn btn-theme-type2">Highlight</button>
                        </li>
                         <li>Invalid or SiteIds not exist records <span>:</span><b id="existingSiteAllocationTab_noOfInvalidRecords"></b>
                            <button id="existingSiteAllocationTab_InvalidRecordsHighlightBtn" class="btn btn-theme-type2">Highlight</button>
                        </li>
                        <li>No.of records to submit <span>:</span><b id="existingSiteAllocationTab_noOfSubmitRecords"></b></li>
                    </ul>
                </div>
            </div>
            <button class="btn btn-theme-type1 mb-2 mx-2 mt-3" id="existingSiteAllocationTab_submit">Submit <i class="fa fa-spinner fa-spin ml-2 d-none"></i></button>
            <button class="btn btn-theme-type1 mb-2 mx-2 mt-3" id="existingSiteAllocationTab_validateExcelData">Validate<i class="fa fa-spinner fa-spin ml-2 d-none"></i></button>
            <a id="existingSiteAllocationTab_triggerAnchr" href="" class="d-none">trigger</a>
            <p class="mt-2 ml-2 text-success" id="existingSiteAllocationTab_resultMessage"><b></b></p>
            <div id="existingSiteAllocationTab_downloadTemplateLink" class="font-weight-bold" style="font-size:13px">Click here to download Bulk Existing Site's Allocation template<a href="../convert%20Excel%20to%20HTML/ADD-EXISTING-SITE-ALLOCATIONS TEMPLATE.xlsx" class="ml-2 font-weight-light theme-color">Click Here</a></div>
        </section>
    </div>
    
    <div class="note px-4">
        <h6 class="font-weight-bold"> Note:-</h6>
        <ol>
            <li>Only one record allowed with same(SiteId, EmpId, SiteVisitDate) i.e Any employee cant visit a same site twice in a day.</li>
            <li>If Po details not available, skip assigning employee details(leave as empty cells).</li>
            <li>Site-Visit-Date formate (YYYY-MM-DD) in excel.</li>
        </ol>
    </div>
</body>
    <script>
        var loggedUserId=<?php session_start(); echo json_encode($_SESSION["userId"]) ?>;
        var loggedUserName=<?php session_start(); echo json_encode($_SESSION["userName"])?>;
    </script>
<script type="text/javascript" src="sortRawData.js?version= 0.1"></script>
<script type="text/javascript" src="../../js/constants.js?version= 1.8"></script>
<script src="../../js/dynamicDropdown_of_project_&_stageOfAudit.js?version=1.0"></script>
<script src="../../js/HttpRequest.js?version=1.0"></script>
<script src="../../js/readExcelTemplate.js?versio=0.1"></script>
<script type="text/javascript" src="main.js?version= 3.0"></script>
<script type="text/javascript" src="existingSiteAllocations_tableConstruction.js?version=1.0"></script>
<!--<script type="text/javascript" src="constants.js"></script>-->
<script type="text/javascript" src="DynamicTabledata.js?version= 1.7"></script>
<!--<script type="text/javascript" src="dropDownClass.js"></script>-->

</html>
