<%@ Page Title="Inventory Master" Language="C#" MasterPageFile="~/SunMaster.Master" ValidateRequest="false"
    AutoEventWireup="true" CodeBehind="InventoryMaster.aspx.cs" Inherits="SUNWEB.InventoryMaster" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%--<%@ OutputCache NoStore="True" Duration="1" VaryByParam='*' Location="None" %> --%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  
 <style type="text/css">
  .gridview5
   {
     background-color:red;
   }
  element.style 
  {
   color: #000066;
   background-color: red;
  }

  .form-select {
    max-width: 300px;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ced4da;
}

  .form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
</style>

    <style type="text/css">
        @media only screen and (max-width: 600px) 
        {
         table, th, td 
         {
           font-size: 10px;
           font-weight: bold;
         }

        .Labels 
        {
          font-size: 10px;
        }

       .alnright 
        {
         text-align: right;
        }
        }
    </style>
    <style type="text/css">
        .overlay {
            position: fixed;
            top: 0px;
            left: 0px;
            z-index: 0;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: White;
            filter: alpha(opacity=60);
            opacity: 0.9;
            _smoz-opacity: 1;
        }

        .LoadingDivCss {
            margin: 0;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
        }

        .LoadingImgCss {
            height: 100px;
            width: 100px;
        }

        .label5{
              display: inline-block;
              vertical-align: middle;
              margin: 10px 0;
             }
    </style>


      <script language="javascript" type="text/javascript">
          $(document).ready(function ()
          {
            var DB = localStorage.getItem("Initialbranch");
            console.log("Intial Branch Loaded->",DB)
            Loadunitpricelable(DB);
          });
      </script>


    
    <script type="text/javascript">
        function showProgress() {
            var updateProgress = $get("<%= UpdateProgress.ClientID %>");
            updateProgress.style.display = "block";
        }

        function showProgress1() {
            var updateProgress1 = $get("<%= UpdateProgress1.ClientID %>");
             updateProgress1.style.display = "block";
         }

    </script>


    <script type="text/javascript">

        (function () {
            var process_scripts = false;
            var rep = /.*?.*/,
                links = document.getElementsByTagName('link'),
                scripts = document.getElementsByTagName('script');
            var value = document.getElementsByName('clear-browser-cache');

            
            for (var i = 0; i < value.length; i++) {
                var val = value[i],
                    outerHTML = val.outerHTML;
                var check = /.*value="true".*/;
                if (check.test(outerHTML)) {
                    process_scripts = true;
                }
            }
            for (var i = 0; i < links.length; i++) {
                var link = links[i],
                    href = link.href;
                if (rep.test(href)) {
                    link.href = href + '&' + Date.now();
                }
                else {
                    link.href = href + '?' + Date.now();
                }
            }
            if (process_scripts) {
                for (var i = 0; i < scripts.length; i++) {
                    var script = scripts[i],
                        src = script.src;
                    if (src !== "") {
                        if (rep.test(src)) {
                            script.src = src + '&' + Date.now();
                        }
                        else {
                            script.src = src + '?' + Date.now();
                        }
                    }
                }
            }
        })();

    </script>








    <script language="javascript" type="text/javascript">
        function show() {
            document.write("<head></head>");
        }
    </script>
    <script type="text/javascript" language="javascript">

        $(document).ready(function () {




            $('#btnSubmit').on('click', function (e) {
                var sText = $('#cmbServiceTaxValue option:selected').text().toLowerCase();
                if (sText == 'select servicetax') {
                    alert('Please select Service C.');
                    e.preventDefault();
                }
                else
                    alert('Well Done!!!!');
            })
        })


      

         
        

    </script>
    <script type="text/javascript">
        function validate(el) {
            var maxfilesize = 200000,  // 200 Kb
                filesize = el.files[0].size,

            if (filesize > maxfilesize) {
                document.getElementById('dvMsg').style.display = "block";
                return false;
            }
            else {
                document.getElementById('dvMsg').style.display = "none";
                return true;
            }
        }

    </script>
    <%--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>--%>
    
    <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-7HkLzGjljyzvU6Kp8uNUYB6cczTxEwj0sA+1j2JqbAA=" crossorigin="anonymous"></script>

    <script type="text/javascript">
        function GetActiveSession5() {
            $.ajax({
                type: "post",
                url: "InventoryMaster.aspx/GetSessionValue5",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: '{"key":"BranchFullName"}',

                success: function (result) {
                    OnSuccess(result.d);
                },
                error: function (xhr, status, error) {
                    OnFailure(error);
                }
            });
        }

        function OnSuccess(userName5) {

            document.getElementById("lblActiveBranchFullNameinupload").innerHTML = userName5;
            

        }
        function OnFailure(error) {
            alert(error);
        }

    </script>






    <script type='text/javascript'>
        function HideInvSearchDiv(sValue) {
            //            $('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
            //                localStorage.setItem('activeTab', $(e.target).attr('href'));
            //            });

            //            var activeTab = localStorage.getItem('activeTab');
            //            alert(activeTab);
            //alert(sValue)
            if (sValue == 'Misc') {
                document.getElementById('<%=btnUpdateInv.ClientID %>').style.display = "none";
                // document.getElementById('divBtn').style.display = "none";
            } else {
                document.getElementById('<%=btnUpdateInv.ClientID %>').style.display = "";
                //document.getElementById('divBtn').style.display = "block";
            }
        }

        function ConfirmationMsg(sMsg) {
            if (confirm(sMsg)) {
                return true;
            } else {
                return false;
            }
        }

        function ConfirmationMsg1(sMsg) {

            if (confirm(sMsg) == true) {
                return true;
            } else {
                //Need to check if slave barcode already exist on inventorymutibarcode table

            }
        }

        function ValidateSlavebarcode() {
            if (confirm('This slave is already exist from different master barcode. adding this slave will delete from another master, Are you sure you want to proceed?') == 'true') {
                return true;
            } else {
                return false;
            }
        }

        function Confirm() {
            var confirm_value = document.createElement("INPUT"); 
            confirm_value.type = "hidden";
            confirm_value.name = "confirm_value";
            if (confirm("Do you want to save data?")) {
                confirm_value.value = "Yes";
            } else {
                confirm_value.value = "No";
            }
            document.forms[0].appendChild(confirm_value);
        }

    </script>
    <%--    <script type="text/javascript">
        $(document).ready(function () {
            $('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
                localStorage.setItem('activeTab', $(e.target).attr('href'));
            });
            var activeTab = localStorage.getItem('activeTab');
            alert(activeTab);
            if (activeTab) {
                $('#myTab5 a[href="' + activeTab + '"]').tab('show');
            }
        });
    </script>--%>
    <script type="text/javascript">
        function GetClientUTC() {
            window.scrollTo(0, 0);
            alert('Test');
        }
    </script>
    <script language="javascript" type="text/javascript">
        
        //john added on 07-Nov-2024 
        $(document).ready(function(e){
            $(document).keypress(function(e){
                if(e.keyCode == 13 || e.keyCode == 34 || e.keyCode == 39)
                  return false;
            });
        });


        function validate()
        {

            if (document.getElementById("<%=txtBarcode.ClientID %>").value == "") {
                alert("Enter the Barcode in BASIC Section");
                document.getElementById("<%=txtBarcode.ClientID %>").focus();
                return false;
            }

            if (document.getElementById("<%=txtInventoryName.ClientID %>").value == "") {
                alert("Enter InventoryName in BASIC Section");
                document.getElementById("<%=txtInventoryName.ClientID %>").focus();
                return false;
            }          

            if (document.getElementById("<%=txtDescription.ClientID %>").value == "") {
                alert("Enter Description in BASIC Section");
                document.getElementById("<%=txtDescription.ClientID %>").focus();
                return false;
            }


            if (document.getElementById("<%=txtPrice1.ClientID %>").value == "") {
                alert("Enter the Price1 ");
                document.getElementById("<%=txtPrice1.ClientID %>").focus();
                return false;
            }


            if (document.getElementById("<%=txtEffectiveDt.ClientID %>").value == "") {
                alert("Enter  Effective Date");
                document.getElementById("<%=txtEffectiveDt.ClientID %>").focus();
                return false;
            }






        }

        function validateSearch() {

            if (document.getElementById("<%=txtSearchVal.ClientID %>").value == "") {
                 alert("Enter the Search Value");
                 document.getElementById("<%=txtSearchVal.ClientID %>").focus();
                 return false;
             }

             



         }
    </script>
    <script type="text/javascript" language="javascript"><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    function AllowOnlyNumeric() {
        // Get the ASCII value of the key that the user entered
        var key = window.event.keyCode;

        // Verify if the key entered was a numeric character (0-9) or a decimal (.)
        if ((key > 47 && key < 58) || key == 46)
            // If it was, then allow the entry to continue
            return;

        else
            // If it was not, then dispose the key and continue with entry
            window.event.returnValue = null;
        alert("Number Only Allowed")
    }



    function isNumberKey(evt, obj) {

        var charCode = (evt.which) ? evt.which : event.keyCode
        var value = obj.value;
        var dotcontains = value.indexOf(".") != -1;
        if (dotcontains)
            if (charCode == 46) return false;
        if (charCode == 46) return true;
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
    }





    function ValidateCharacters(evt) {

        if (evt.shiftKey || evt.ctrlKey)//Deny Shift/Ctrl Keys
            return false;

        if ((evt.keyCode >= 65 && evt.keyCode <= 91) || //Allow Alphabets
            evt.keyCode == 8 || //Allow backspace
            evt.keyCode == 46 ||//Allow Del
            evt.keyCode == 32 ||//Allow space



            (evt.keyCode >= 37 && evt.keyCode <= 40) || //Allow arrow keys
            (evt.keyCode >= 47 && evt.keyCode <= 58))//Allow numerics
            return true;
        else
            return false;
    }



    function ValidateCharacters5(evt) {

        if (evt.shiftKey || evt.ctrlKey)//Deny Shift/Ctrl Keys
            return false;

        if ((evt.keyCode >= 65 && evt.keyCode <= 91) || //Allow Alphabets
            evt.keyCode == 8 || //Allow backspace
            evt.keyCode == 46 ||//Allow Del
            evt.keyCode == 32 ||//Allow space
            evt.keyCode == 189 ||//Allow Dash


            (evt.keyCode >= 37 && evt.keyCode <= 40) || //Allow arrow keys
            (evt.keyCode >= 47 && evt.keyCode <= 58))//Allow numerics
            return true;
        else
            return false;
    }






    </script>
    <style type="text/css">
        /* File Upload Design  */
        .file-upload {
            display: inline-block;
            overflow: hidden;
            position: relative;
            text-align: center;
            vertical-align: middle; /* Cosmetics */
            border: 1px solid #5C005C;
            background: #5C005C;
            color: #fff; /* browser can do it */
            border-radius: 6px;
            -moz-border-radius: 6px;
            text-shadow: #000 1px 1px 2px;
            -webkit-border-radius: 6px;
        }

        /* The button size */
        .file-upload {
            height: 2.8em;
        }

            .file-upload, .file-upload span {
                width: 5.5em;
            }

                .file-upload input {
                    position: absolute;
                    top: 0;
                    left: 0;
                    margin: 0;
                    font-size: 11px; /* Loses tab index in webkit if width is set to 0 */
                    opacity: 0;
                    filter: alpha(opacity=0);
                }

                .file-upload strong {
                    font: normal 12px Tahoma,sans-serif;
                    text-align: center;
                    vertical-align: middle;
                }

                .file-upload span {
                    position: absolute;
                    top: 0;
                    left: 0;
                    display: inline-block; /* Adjust button text vertical alignment */
                    padding-top: .15em;
                }
    </style>
    <style type="text/css">
        .modalBackground {
            background-color: Black;
            filter: alpha(opacity=90);
            opacity: 0.8;
        }

        .modalPopup {
            background-color: #FFFFFF;
            border-width: 3px;
            border-style: solid;
            border-color: black;
            padding-top: 10px;
            padding-left: 10px;
            width: 520px;
            height: 480px;
        }
    </style>
    <style type="text/css">
        @media only screen and (max-width: 600px) {
            table, th, td {
                font-size: 10px;
                font-weight: bold;
            }

            .modalPopup {
                background-color: #FFFFFF;
                border-width: 3px;
                border-style: solid;
                border-color: black;
                padding-top: 10px;
                padding-left: 10px;
                width: 320px;
                height: 300px;
            }
        }
    </style>
    <style type="text/css">
        /*Popup Control*/ .popupControl {
            background-color: White;
            position: absolute;
            visibility: hidden;
        }

        .closeLabel {
            background-color: #666666;
            color: #FFFFFF;
            text-align: center;
            font-weight: bold;
            text-decoration: none;
            border: outset thin #FFFFFF;
            padding: 5px;
            cursor: pointer;
        }
    </style>
    <style type="text/css">
        @media only screen and (max-width: 600px) {
            div {
                text-align: left;
            }
        }

        #container {
            width: 98%; /*border-radius: 25px;*/
            border: 0px solid white;
            padding: 0px 0px 0px 0px;
            margin: 0px 0px 0px 0px;
            background: #FFFFFF;
            overflow: visible; /* box-shadow: 5px 5px 2px #888888;*/
            position: relative;
        }

        .mdalbuttonX {
            position: absolute;
            background: white;
            color: black;
            border: none;
            top: -10px;
            right: -5px;
            font-size: 20px;
            font-weight: 900;
        }

        .modX {
            position: absolute;
            background: #4c4c4c;
            color: white;
            border: none;
            top: 10px;
            right: 15px;
            font-size: 20px;
            font-weight: 900;
        }
    </style>

    <%--Newly added css on 22-05-21 --%>
    <style type="text/css">
        /*Popup Control*/ .popupControl {
            background-color: White;
            position: absolute;
            visibility: hidden;
        }

        .closeLabel {
            background-color: #666666;
            color: #FFFFFF;
            text-align: center;
            font-weight: bold;
            text-decoration: none;
            border: outset thin #FFFFFF;
            padding: 5px;
            cursor: pointer;
        }
    </style>
    <style type="text/css">
        body {
            font-family: Arial;
            font-size: 10pt;
        }

        .modalBackground {
            background-color: #F7F7F7;
            filter: alpha(opacity=90);
            opacity: 0.8;
        }

        .modalPopup {
            background-color: white;
            border: 3px solid #ccc;
            padding: 10px;
            width: 720px;
            height: 450px;
        }



        .modalPopup1 {
            background-color: white;
            border: 3px solid #ccc;
            padding: 10px;
            width: 1000px;
            height: 850px;
            bottom: 20px;
        }

        .modalPopup2 {
            background-color: white;
            border: 3px solid #ccc;
            padding: 10px;
            width: 690px;
            height: 410px;
        }

        .modalPopup3 {
            background-color: white;
            border: 3px solid #ccc;
            padding: 10px;
            width: 600px;
            height: 390px;
        }



        .modalPopupsmall {
            background-color: white;
            border: 3px solid #ccc;
            padding: 10px;
            width: 550px;
            height: 230px;
        }
    </style>

    <style>
        @media only screen and (min-device-width : 320px) and (max-device-width : 428px) {

            .ButtonExcel {
                font-size: 13px;
                border: medium;
                font-family: Circular Std Book;
                border: none;
                color: white;
                background-color: Green;
                text-align: center;
                border-radius: 0px;
            }

            .ButtonSearch {
                font-size: 18px;
                border: medium;
                font-family: Circular Std Book;
                border: none;
                color: white;
                background-color: #1874CD;
                text-align: center;
                border-radius: 0px;
                border: 3px solid black;
                width: 35%;
                height: 55%;
                margin-bottom: 7px;
            }

            .LableTitle {
                font-size: 20px;
                font-weight: 500;
            }

            .modalCss {
                display: none; /* Hidden by default */
                position: fixed; /* Stay in place */
                z-index: 1; /* Sit on top */
                padding-top: 80px; /* Location of the box */
                left: 0;
                top: 0;
                width: 80%; /* Full width */
                height: 80%; /* Full height */
                overflow: auto; /* Enable scroll if needed */
                background-color: rgb(0,0,0); /* Fallback color */
                background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
            }



            .modal-dialogCss {
            }

            /* Modal Content */
            .modal-contentCss {
                background-color: #fefefe;
                margin: auto;
                /*padding: 20px;*/
                /*border: 1px solid #888;*/
                width: 500px;
                height: 6+0px;
                border-radius: 3px;
            }


            /* Create two equal columns that floats next to each other */
            .column {
                float: left;
                width: 40%;
                padding: 1px;
                height: auto; /* Should be removed. Only for demonstration */
            }

            /* Clear floats after the columns */
            .row:after {
                content: "";
                display: table;
                clear: both;
            }
        }

        @media screen and (min-width: 1200px) {

            .ButtonExcel {
                font-size: 14px;
                border: medium;
                font-family: Circular Std Book;
                border: none;
                color: white;
                font-weight: lighter;
                background-color: Green;
                text-align: center;
                border-radius: 2px;
            }

            .ButtonSearch {
                background: #ffc108;
                margin: 0;
                font-family: Circular Std Book;
                font-size: 14px;
                line-height: inherit;
                border-width: thin;
                border-color: #212529;
                border-radius: 5px;
                height:30px;
                color: #212529;
            }

            .LableTitle {
                font-size: 28px;
                font-weight: 500;
            }



            .modalCss {
                display: none; /* Hidden by default */
                position: fixed; /* Stay in place */
                z-index: 1; /* Sit on top */
                padding-top: 80px; /* Location of the box */
                left: 0;
                top: 0;
                width: 100%; /* Full width */
                height: 100%; /* Full height */
                overflow: auto; /* Enable scroll if needed */
                background-color: rgb(0,0,0); /* Fallback color */
                background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
            }



            .modal-dialogCss {
            }

            /* Modal Content */
            .modal-contentCss {
                background-color: #fefefe;
                margin: auto;
                /*padding: 20px;*/
                /*border: 1px solid #888;*/
                width: 1200px;
                height: 850px;
                border-radius: 3px;
            }


            /* Create two equal columns that floats next to each other */
            .column {
                float: left;
                width: 40%;
                padding: 1px;
                height: auto; /* Should be removed. Only for demonstration */
            }

            /* Clear floats after the columns */
            .row:after {
                content: "";
                display: table;
                clear: both;
            }
        }
    </style>


    <style type="text/css">
        .modalCss {
            display: none; /* Hidden by default */
            position: fixed; /* Stay in place */
            z-index: 1; /* Sit on top */
            padding-top: 80px; /* Location of the box */
            left: 0;
            top: 0;
            width: 100%; /* Full width */
            height: 100%; /* Full height */
            overflow: auto; /* Enable scroll if needed */
            background-color: rgb(0,0,0); /* Fallback color */
            background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }



        .modal-dialogCss {
        }

        /* Modal Content */
        .modal-contentCss {
            background-color: #fefefe;
            margin: auto;
            /*padding: 20px;*/
            /*border: 1px solid #888;*/
            width: 1200px;
            height: 820px;
            border-radius: 3px;
        }


        /* Create two equal columns that floats next to each other */
        .column {
            float: left;
            width: 40%;
            padding: 2px;
            margin-left: 7px;
            height: auto; /* Should be removed. Only for demonstration */
        }

        /* Clear floats after the columns */
        .row:after {
            content: "";
            display: table;
            clear: both;
        }

        .ButtonSearch {
            background: #ffc108;
            margin: 0;
            font-family: Circular Std Book;
            font-size: 14px;
            line-height: inherit;
            border-width: thin;
            border-color: #212529;
            border-radius: 2px;
            color: #212529;
        }

        /*Model Css for Import And Export  */


        .modalCss1 {
            display: none; /* Hidden by default */
            position: fixed; /* Stay in place */
            z-index: 1; /* Sit on top */
            padding-top: 80px; /* Location of the box */
            left: 0;
            top: 0;
            width: 100%; /* Full width */
            height: 100%; /* Full height */
            overflow: auto; /* Enable scroll if needed */
            background-color: rgb(0,0,0); /* Fallback color */
            background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }



        .modal-dialogCss1 {
        }

        /* Modal Content */
        .modal-contentCss1 {
            background-color: #fefefe;
            margin: auto;
            /*padding: 20px;*/
            /*border: 1px solid #888;*/
            width: 800px;
            height: 300px;
            border-radius: 3px;
        }


        /* Create two equal columns that floats next to each other */
        .column1 {
            float: left;
            width: 40%;
            padding: 2px;
            margin-left: 7px;
            height: auto; /* Should be removed. Only for demonstration */
        }

        /* Clear floats after the columns */
        .row:after {
            content: "";
            display: table;
            clear: both;
        }

        .ButtonSearch {
            background: #ffc108;
            margin: 0;
            font-family: Circular Std Book;
            font-size: 14px;
            line-height: inherit;
            border-width: thin;
            border-color: #212529;
            border-radius: 2px;
            color: #212529;
        }

        .Excelcss {
            background: green;
            margin: 0;
            font-family: Circular Std Book;
            font-size: 12px;
            line-height: inherit;
            border-width: thin;
            border-color: #212529;
            border-radius: 2px;
            color: white;
            height: 28px;
            display:inline-block;
        }

        .Heading {
            /*
          font-family: Circular Std Book;
          font-size: 25px;
          color:Black;
          padding:20px;
          padding-bottom:10px;
          */
            font-family: arial;
            font-size: 20px;
            font-weight: 600;
            color: Black;
            padding: 20px;
            padding-bottom: 10px;
        }

        .Para {
            /*
          font-family: Circular Std Book;
          font-size: 12px;
          color:Black;
          padding:20px;
          padding-bottom:0px;
          */
            font-family: arial;
            color: Black;
            padding: 20px;
            padding-bottom: 10px;
            line-height: 1.2;
        }

        .Para5 {
            font-family: arial;
            color: red;
            padding: 20px;
            padding-bottom: 10px;
            line-height: 0.5;
        }

        .Parax {
            font-family: arial;
            color: darkred;
            padding: 20px;
            padding-bottom: 5px;
            line-height: 1.2;
            width: 100%;
        }


        .Para2 {
            /*
          font-family: Circular Std Book;
          font-size: 12px;
          color:Black;
          padding:20px;
          padding-bottom:0px;
          */
            font-family: arial;
            color: Black;
            padding: 20px;
            padding-bottom: 0px;
            line-height: 1.2;
        }


        .ExcelContend {
            font-family: Circular Std Book;
            padding: 15px;
            margin-top: -22px;
        }

        .UploadFileBTN {
            background: red;
            font-family: Circular Std Book;
            font-size: 12px;
            color: white;
            height: 28px;
        }

        .UploadFile {
            padding: 20px;
        }


        .Continue {
            background: #CD3700;
            margin: 0;
            font-family: Circular Std Book;
            font-size: 13px;
            line-height: inherit;
            border-width: thin;
            border-color: #212529;
            border-radius: 5px;
            color: white;
            height: 35px;
            width: 10%;
        }
    </style>
    <script type="text/javascript">

        //Search Condiment
        function CloseModalInventoryList() {
            var modal = document.getElementById("ModaInventoruList");
            modal.style.display = "none";
        }


        function ShowModalInventoryList() {
            var modal = document.getElementById("ModaInventoruList");
            modal.style.display = "block";
        }

        function CloseModal() {
            var modal = document.getElementById("ModaInventoruList");
            modal.style.display = "none";
        }

        function ShowModalImportExport() {
            var modal = document.getElementById("ModalImportExport");
            modal.style.display = "block";
        }

        function CloseImportExportModal() {
            var modal = document.getElementById("ModalImportExport");
            modal.style.display = "none";
            GetActiveSession5();
        }



        function ShowModalPrinterList() {
            var modal = document.getElementById("modelPrinterLable");
            modal.style.display = "block";
        }

        function CloseModlePrinterListModal() {
            var modal = document.getElementById("modelPrinterLable");
            modal.style.display = "none";
        }


        function ShowImageUpload() {
            var modal = document.getElementById("modelimageUpload");
            modal.style.display = "block";
        }

        function CloseModelImageUpload() {
            var modal = document.getElementById("modelimageUpload");
            modal.style.display = "none";
        }

    </script>

    <%--  Image Saving into S3 Bucket using Ajax --%>

    <script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        function loadImage1() {

            var fd = new FormData();
            fd.append("", fileUploadnew.files[0]);
            var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
            var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
            var filename = $("#<%= txtBarcode.ClientID %>").val();

            
            $.ajax({
                //url: 'https://www.suntoyo.online/api/FileService/GetObject?fileName=' + filename + '.jpg&clientName=' + clientname + '&storeName=' + branchname + '/category',
                //type: 'GET',
                //mimeType: "multipart/form-data",
                //async: true,
                url: 'https://www.suntoyo.online/api/FileService/GetObject?fileName=' + filename + '&clientName=' + clientname + '&storeName=' + branchname,
                type: 'GET',
                mimeType: "multipart/form-data",
                data: fd,
                crossDomain: true,
                success: function (data) {
                    console.log(data);
                    //if (data != "") {
                    //    var dataUrl = "https://suntoyo-aws-s3.s3.ap-southeast-1.amazonaws.com/" + clientname + "/" + branchname + "/category/jpg/" + filename.toLowerCase().replaceAll(' ', '') + ".jpg";
                    //    var imgCategory = document.createElement("img");
                    //    imgCategory.id = "imgCategory";
                    //    imgCategory.src = dataUrl + "?nocache=" + Math.random();
                    //    imgCategory.style = "width:100px; height:85px; margin-bottom: 10px;";
                    //    document.getElementById("divImage").appendChild(imgCategory);
                    //}
                },
                error: function (data) {
                    console.log(data);
                },
                beforeSend: function (request) {
                    request.setRequestHeader("fileName", filename);
                    request.setRequestHeader("clientName", clientname);
                    request.setRequestHeader("storeName", branchname);
                },
                cache: false,
                contentType: false,
                processData: false
            });
        }



        $(function () {
            // Modified belwo Line : 19-08-21  
            $("body").on("click", "#uploadBTN", function () {
                if ($('#fileUploadnew').val() == "") {
                    alert("No file selected!");
                    return false;
                }

                else if ($('#<%=txtReadInventroyId.ClientID%>').val() == "") {
                    alert("Add Inventory First and Upload Image!");
                    return false;
                }

                // This Validation For Image size should not Exceed 200 Kb 
                if (fileUploadnew.files[0].size > 200000) {
                    document.getElementById('dvMsg').style.display = "block";
                    return false;
                }
                else {

                }
                //console.log(fileUploadnew.files[0].size);

                var fd = new FormData();
                fd.append("", fileUploadnew.files[0]);

                var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
                var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
                var filename = $("#<%= txtBarcode.ClientID %>").val();                   //  Pass the Barcode 

                console.log(clientname);
                console.log(branchname);
                console.log(filename);

                //let divImg = document.getElementById("divImg")
                //divImg.style = "display:block";

                let imgInventory = document.getElementById('imgInventory')
                if (imgInventory !== null) {
                    imgInventory.remove();
                }
                $.ajax({
                    xhr: function () {
                        var xhr = new window.XMLHttpRequest();
                        xhr.upload.addEventListener("progress", function (evt) {
                            if (evt.lengthComputable) {
                                var percentComplete = ((evt.loaded / evt.total) * 100);
                                $(".progress-bar").width(percentComplete + '%');
                                $(".progress-bar").html(percentComplete + '%');
                            }
                        }, false);
                        return xhr;
                    },

                    url: 'https://www.suntoyo.online/api/FileService/Upload',
                    // url: 'http://54.251.229.140:4545/api/FileService/Upload',
                    // # Diable Test Url
                    // # Later Enable  Server url  Here 

                    type: 'POST',
                    mimeType: "multipart/form-data",
                    data: fd,
                    crossDomain: true,
                    success: function (data) {
                        // $('#output').html(data);
                        S3_CallUpdateLogic(branchname, filename, data);
                        //location.reload();
                        $('#<%=lbldbpath.ClientID%>').html(data);




                        //John added on 17-July-2023 refresh image(imgInventory);
                        var imgPath = JSON.parse(data)                      
                        var imgInventory = document.createElement("img");
                        imgInventory.id = "imgInventory";
                        imgInventory.src = imgPath.dbPath + "?nocache=" + Math.random();
                        imgInventory.style = " margin-left: 0px; width: 100px; height: 85px; background-size: cover; background-position: center; background-repeat: no-repeat;";
                        document.getElementById("imgHolder").appendChild(imgInventory);

                        //hide divImage
                        var divImg = document.getElementById("divImg");
                        if (divImg != null) {
                            divImg.remove();
                        }



                    },
                    beforeSend: function (request) {
                        request.setRequestHeader("clientName", clientname);
                        request.setRequestHeader("fileName", filename);
                        request.setRequestHeader("branchName", branchname);
                        $(".progress-bar").width('0%');
                        $('#uploadStatus').html('<img src="images/loading.gif"/>');
                    },
                    /*
                    Bucket name should conform with DNS requirements:
                    - Should not contain uppercase characters
                    - Should not contain underscores (_)
                    - Should be between 3 and 63 characters long
                    - Should not end with a dash
                    - Cannot contain two, adjacent periods
                    - Cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)
                    */
                    cache: false,
                    contentType: false,
                    processData: false
                });

            });
        });


        function RefreshPage() {
            location.reload();
        }


        function S3_CallUpdateLogic(_branch, _barcode, _data) {
            var ret;
            $.ajax({
                type: "POST",
                url: "InventoryMaster.aspx/SaveImagetoS3",
                async: false,
                data: "{'branchalias':'" + _branch + "','Barcode':'" + _barcode + "','data':'" + _data + "'}",
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    //alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown)
                    alert(_barcode);
                },
                success: function (result) {
                    var data = JSON.parse(result.d);
                    if (data) {
                        ret = data.toString();
                    } else {
                        ret = 0;
                    }
                }

            });
        }





    </script>

     <%--Grid Pager CSS :--%>
 <style>
     .GridPager a,
     .GridPager span {
         display: inline-block;
         padding: 0px 9px;
         margin-right: 4px;
         border-radius: 3px;
         border: solid 1px #c0c0c0;
         background: #e9e9e9;
         box-shadow: inset 0px 1px 0px rgba(255,255,255, .8), 0px 1px 3px rgba(0,0,0, .1);
         font-size:12PX;
         font-weight: bold;
         text-decoration: none;
         color: #717171;
         text-shadow: 0px 1px 0px rgba(255,255,255, 1);
     }

     .GridPager a {
         background-color: #f5f5f5;
         color: #969696;
         border: 1px solid #969696;
     }

     .GridPager span {

         background: #616161;
         box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .8);
         color: #f0f0f0;
         text-shadow: 0px 0px 3px rgba(0,0,0, .5);
         border: 1px solid #3AC0F2;
     }

 </style>



    <script type="text/javascript">
        function Loadunitpricelable(DB) {
            $.ajax({
                type: "POST",
                url: "InventoryMaster.aspx/IsEnableUnitPrice",
                data: "{DB:'" + DB + "'}",
                async: false,
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                error: function (XMLHttpRequest, textStatus, errorThrown)
                {

                },
                success: function (result)
                {
                    var data = JSON.parse(result.d);
                    if (data)
                    {
                        var ret = data.ini_value.toString();
                        var unitprice_label = document.getElementById("unitprice_label");
                        var unitprice_value = document.getElementById("unitprice_value");
                        console.log("This is called..s");

                        console.log("ret val:", ret)
                         
                        if (ret== "1")
                        {
                            console.log(" Show called..");
                            unitprice_label.style.display = "block";      // Show the lable
                            unitprice_value.style.display = "block";
                        }
                        else
                        {    
                            console.log(" Hide called..");
                            unitprice_label.style.display = "none";       // Hide the label
                            unitprice_value.style.display = "none";
                        }

                        localStorage.removeItem("Initialbranch");
                    }
                }

            });
        }

    </script>


    <script type="text/javascript">
        function callUpdate()
        {
            // Simulate a click on the server-side button
            __doPostBack('<%= btnUpdateInv.UniqueID %>', '');
        }
        function ShowTopUpdateButton() {

            document.getElementById("btnupdate").style.display = "block"; 
        }

    </script>


    <%--End --%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    
    <asp:HiddenField ID="HiddenField11" runat="server" />


    <%--<asp:DropDownList ID="cmdImport" runat="server">
        <asp:ListItem Text="Inventory" Value="0"></asp:ListItem>
        <asp:ListItem Text="Voucher" Value="1"></asp:ListItem>
    </asp:DropDownList>--%>



    <%-- Import And Export Model Popup --%>

    <div class="modalCss1" id="ModalImportExport">
        <div class="modal-dialogCss1">
            <div class="modal-contentCss1">
                <div class="modal-body1">

                    <div class="card" style="height: 45%">
                        <h5 class="card-header">Import / Export Inventory
             <button type="button" class="close" style="color: Black; opacity: 1;" onclick="CloseImportExportModal()" data-dismiss="modal">
                 &times;</button></h5>


                        <div>
                            <br />
                            <span class="Heading">1. Download  your items template file 
                            </span>
                            <p class="Para">
                                Start by downloading our CSV template file. This file has the correct column headings, which are required for the Suntoyo Import Inventory function.
                            </p>
                            <div class="ExcelContend">
                                <img src="IMG/csv.jpeg" width="35px" height="35px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                
                 <asp:LinkButton ID="lnkExcel" runat="server" OnClick="lnkExcel_Click" Text="Download Inventory CSV file " Font-Size="Large" ForeColor="#4F94CD"></asp:LinkButton>

                            </div>


                            <span class="Heading">2. Copy your items into the template
                            </span>
                            <p class="Para">
                                Using Excel or another editor, fill the format with the details of your items. Make sure the item
                  details match the column headings provided in the template.
                  IMPORTANT: Do not change the column headings in the template file. These need to be unchanged for
                  the import to work in the next step.<br />
                                <br />
                                The import will use the barcode to determine whether an item exists and should be updated, or does not
                  exist and should be created. Items which are failed to import, will not be deleted using this function. So you can safely
                  update a subset of your inventory items without fear of losing the others.



                            </p>


                            <span class="Heading">3. Upload CSV file for the Import Process
                            </span>

                            <p class="Para">
                                Save your updated template as .CSV format and press Continue
                            </p>
                            <p class="Para5">
                            <b style="color:black;"> Note : </b>  A Maximum of <b style="color: green"> 3000</b> rows of records can be imported for each .csv file.  
                            </p>
                            <p class="Parax">
                                You have selected  this Branch To Import  ->
                                <label id="lblActiveBranchFullNameinupload"/>

                            </p>


                        </div>

                        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                         <ContentTemplate>


                       
                        <div class="UploadFile">
                            <asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload>
                            __________________________________________________________________________________________________
              
              
                        </div>

                        <div align="right" style="margin-right: 40px;">
                            <asp:Button ID="btnUpload" runat="server" Text="Continue"
                              
                                OnClientClick="return confirm('Are you sure you want to Import to  this Branch?'), showProgress1(),CloseImportExportModal(),GetActiveSession5() ; "
                                ToolTip="To Import  Click Here" CssClass="Continue" OnClick="btnUpload_Click" />


                        </div>
                        </ContentTemplate>
                             
                         <Triggers>
                        <asp:PostBackTrigger ControlID="btnUpload" />
                        </Triggers>
                        </asp:UpdatePanel>

                        <div id="container">
                            <div id="divInventory">

                                <div>
                                    <!-- #4c4c4c-->
                                    <%--     <h4 style="background-color: White; color: White; text-align: left;">
                    Inventory
                </h4>--%>
                                </div>
                                <%--     <div style="text-align: left">
                    Export Inventory
                </div>--%>
                                <div style="text-align: left; display: none">
                                    Choose file first before importing.
                                </div>

                                <%--  <div style="text-align: left">
                </div>--%>
                            </div>
                            <br />
                            <div id="divMaster" style="display: none">
                                <div style="text-align: left">
                                    <h5>Import/Export Master and Slave</h5>
                                </div>
                                <div>
                                    <!-- #4c4c4c-->
                                    <%--     <h4 style="background-color: White; color: White; text-align: left;">
                    Inventory
                </h4>--%>
                                </div>
                                <div style="text-align: left;">
                                    <asp:Button ID="btnExportMSBarcode" runat="server" Text="Export" ToolTip="Download Inventory"
                                        BackColor="green" BorderColor="green" CssClass="btn btn-success btn-xs" OnClick="btnExportMSBarcode_Click" />
                                    <%-- <asp:Button ID="btnImportMSBarcode" runat="server" Text="Import" ToolTip="To Import  Click Here"
                        CssClass="btn btn-brand btn-xs" OnClick="btnImportMSBarcode_Click" />--%>
                                </div>
                                <div style="text-align: left">
                                    Choose file first before importing.
                                </div>
                                <div style="text-align: left">
                                    <asp:FileUpload ID="FileUploadMasterSlave" runat="server"></asp:FileUpload>
                                    <asp:Button ID="btnImportMSBarcode" runat="server" Text="Import" ToolTip="To Import  Click Here"
                                        CssClass="btn btn-brand btn-xs" BorderWidth="2px" OnClick="btnImportMSBarcode_Click" />
                                    <div style="font-size: 12px;">
                                        <p>
                                            Note: Make sure that the slavecode is currently not under to any mastercode.
                            <br />
                                            If under to any current mastercode, current record will be deleted.
                                        </p>
                                    </div>
                                </div>
                                <%-- <div style="text-align: left">
                   
                </div>--%>
                            </div>
                            <br />
                            <br />


                        </div>

                         


                    </div>
                </div>
            </div>
        </div>
    </div>


  
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
           
            <div class="row" runat="server" id="AlertA">
                <div class="card-body border-top">
                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                        <asp:Label ID="lblimportError" runat="server"></asp:Label>
                        <a href="#" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </a>
                    </div>
                </div>
            </div>

           <%-- <table style="width: 100%; padding-bottom: 2px;">
                <tr>
                    <td style="width:150px">

                    <button type="button" onclick="ShowModalImportExport()" class="btn btn-success" tooltip="Import/Export Excel">
                    Import/Export 
                    </button>
                    
                    </td>
                    <td  align="left" style="display:inline-block;vertical-align:middle">
                    <h8 style="color:forestgreen; font-weight:700"> You are at .. <asp:Label ID="lblSelectedBranchCaption1"  ForeColor="Black" runat="server"> </asp:Label>   </h8> 
                    </td>

                    <td align="right" style="padding-bottom: 7px;">
                    <label for="validationCustom05">
                    Branch
                    <asp:Label ID="lblBranchAliasName" runat="server"></asp:Label>
                    </label>
                    <asp:DropDownList ID="cmbBranches" CssClass="form-select" runat="server" Width="250px"
                    AutoPostBack="true" OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged">
                    </asp:DropDownList>
                    </td>
                </tr>
            </table>
--%>
            <div class="container-fluid mb-3">
            <div class="row align-items-center">
                <!-- Left: Import/Export Button -->
                <div class="col-md-3 col-sm-12 mb-2">
                    <button type="button" onclick="ShowModalImportExport()" class="btn btn-success" title="Import/Export Excel">
                        Import/Export
                    </button>
                </div>

                <!-- Center: "You are at..." label -->
                <div class="col-md-6 col-sm-12 mb-2">
                    <span class="fw-bold text-success">
                        You are at..
                        <asp:Label ID="lblSelectedBranchCaption1" runat="server" ForeColor="Black" />
                    </span>
                </div>

                <!-- Right: Branch Dropdown -->
              <div class="col-md-3 col-sm-12 text-end mb-2 d-flex justify-content-end align-items-center">
                <label for="cmbBranches" class="form-label mb-0 me-2">Branch</label>
                   <asp:Label ID="lblBranchAliasName" runat="server"></asp:Label>
                <asp:DropDownList ID="cmbBranches" runat="server" 
                    CssClass="form-select"
                    AutoPostBack="true"
                    ssssStyle="width: 250px;"
                    OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged" />
            </div>
            </div>
        </div>

            




            <div class="row">
               
               
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                  
                    <div class="simple-card" role="tabpanel" id="TabsID">
                        <ul class="nav nav-tabs" id="myTab5" role="tablist">
                            <li id="Basic" class="nav-item" runat="server"><a runat="server" class="nav-link active border-left-0"
                                id="aBasic" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true"
                                onclick="HideInvSearchDiv('Basic')">BASIC </a></li>

                            <li class="nav-item"><a class="nav-link" id="contact-tab-simple" data-toggle="tab"
                                href="#contact-simple" role="tab" aria-controls="contact" aria-selected="false"
                                onclick="HideInvSearchDiv('Stock')" style="display: none;">STOCK LEVEL</a></li>

                            <%--<li class="nav-item"><a class="nav-link" id="navMisc" data-toggle="tab" href="#Misc"
                        role="tab" aria-controls="Misc" aria-selected="false" data-tab='aMisc' onclick="HideInvSearchDiv('Misc')">MISC</a> </li>--%>
                            <li class="nav-item" id="navMisc" runat="server"><a id="aMisc" data-toggle="tab"
                                class="nav-link" aria-controls="misc" href="#Misc" onclick="HideInvSearchDiv('Misc')"
                                runat="server">MISC</a> </li>


                        </ul>
                        <div class="tab-content" id="myTabContent5">
                            <%--  <div class="tab-pane fade show active" id="home-simple" role="tabpanel" aria-labelledby="aBasic">--%>
                            <asp:Panel class="tab-pane fade show active" ClientIDMode="Static" ID="home" role="tabpanel"
                                aria-labelledby="aBasic" runat="server">
                                  
                                <div id="Inventoryx">
                                    
                                    <div class="d-flex justify-content-end mb-1"> <button id="btnupdate" class="btn btn-primary" onclick="callUpdate();" style="display:none" >Update</button> </div>  
                                    <div class="card">
                                       
                                        <h5 class="card-header" style="background-color: #4c4c4c; color: White;">
                                            <span style="font-size: 14px; color: #F8F9FA">INVENTORY INFORMATION </span>&nbsp;&nbsp;
                                            <asp:Button ID="btnAddNew" OnClick="btnAddNew_Click" runat="server" CssClass="btn btn-success"   Text="Add New" />

                                            <button type="button" onclick="ShowModalInventoryList()"  class="btn btn-warning">
                                                Search
                                            </button>
                                             
                                             <span >
                                                <asp:Button ID="btnDelete" runat="server" class="btn btn-danger mb-0 float-end" Text="Delete" OnClick="btnDelete_Click"
                                                    OnClientClick="return confirm('Warning: Deleting an existing product barcode\n will affect transaction records if the\n product have been sold before. ');" />
                                            </span>



                                            <%--This Code for Image validation   Msg --%>
                                        </h5>
                                        
                                        <div class="card-body">
                                            <div class="form-row">
                                            <%--<label class="col-form-label">Barcode</label>--%>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        InventoryID</label>
                                                    <asp:TextBox ID="txtReadInventroyId" runat="server" class="form-control"> </asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Barcode</label>
                                                    <%--onkeydown="return ValidateCharacters(event);"--%>
                                                    <asp:TextBox ID="txtBarcode" runat="server" AutoPostBack="true" class="form-control"> </asp:TextBox>

                                                    <div class="input-group-append">
                                                        <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="txtBarcode"
                                                            ErrorMessage="You Must Enter Barcode!" ForeColor="Red" ValidationGroup="SubmitBasic"
                                                            Display="Dynamic" />
                                                        <asp:RegularExpressionValidator ID="Regex1" runat="server" ControlToValidate="txtBarcode"
                                                            ValidationExpression="^[a-zA-Z0-9_-]+$" ErrorMessage="Special Characters Not Allowed (Including space)"
                                                            ForeColor="Red" />
                                                    </div>
                                                </div>

                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        StockCode
                                                    </label>
                                                    <asp:TextBox ID="txtRStockCode" runat="server" class="form-control"> </asp:TextBox>
                                                </div>

                                            </div>

                                            <div class="form-row">
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        InventoryName</label>
                                                    <asp:TextBox ID="txtInventoryName" runat="server" AutoPostBack="true" class="form-control"></asp:TextBox>


                                                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ValidationGroup="SubmitBasic"
                                                        ControlToValidate="txtInventoryName" ErrorMessage="You Must  Enter InventoryName!"
                                                        ForeColor="Red" />
                                                    <div class="invalid-feedback">
                                                        Please provide a InventoryName
                                                    </div>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Description</label>
                                                    <asp:TextBox ID="txtDescription" runat="server" class="form-control"> </asp:TextBox>

                                                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ValidationGroup="SubmitBasic"
                                                        ControlToValidate="txtDescription" ErrorMessage="You Must Enter Description!"
                                                        ForeColor="Red" />
                                                </div>

                                                 <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2" id="divReOrder">
                                                 <label for="validationCustom03">
                                                  Reorder</label>
                                                 <asp:TextBox ID="txtReorder" runat="server" placeholder="0" class="form-control"
                                                 onkeypress="return isNumberKey(event,this)"></asp:TextBox>
   
                                            </div>

                                            </div>
                                            <asp:CheckBox ID="chkActiveStatus" runat="server" Checked="true" />
                                            <label for="validationCustom03">
                                                POS Active</label>&nbsp;&nbsp;&nbsp;
                                            <asp:CheckBox ID="ChkNotAvailable" runat="server" />
                                            <label for="validationCustom03">
                                                POS Not Available</label>&nbsp;&nbsp;&nbsp;
                                            <asp:CheckBox ID="chkMainProductRelation" runat="server" />
                                            <label for="chkMainProductRelation">
                                                Main Product Relation</label>&nbsp;&nbsp;&nbsp;
                                            <asp:CheckBox ID="chkNotIncludeProductRelation" runat="server" />
                                            <label for="chkNotIncludeProductRelation">
                                               Not include on Product Relation</label>&nbsp;&nbsp;&nbsp;
                                            <%--      <asp:CheckBox ID="ChkShowItem" runat="server" />
                                            <label for="validationCustom03">
                                               Show Item</label>--%>
                                            <div class="form-row">


                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2" style="display:none">
                                                    <%-- <label for="validationCustom03">
                                                        File Upload
                                                     </label>--%>
                                                    <%--Exiting UploadFile--%>
                                                    <asp:FileUpload ID="Fileploadid" class="form-control" runat="server" onchange="return validateFileSize();" Visible="false" />

                                                    <input type="file" id="fileUploadnew" accept=".png,.jpg,.gif" onchange='validate(this)' />
                                                    <button id="uploadBTN" type="button" value="Upload">Upload</button>
                                                    <br />
                                                    * Only jpg,gif and png Allowed upload
                                                     
                                                    <div class="progress" style="margin: 10px; margin-left: -3px">
                                                        <div class="progress-bar"></div>
                                                    </div>

                                                    <%--<br />--%>
                                                    <asp:Label ID="lblImageError" runat="server" ForeColor="Gray"></asp:Label>
                                                    <div id="dvMsg" style="background-color: Red; color: White; width: 280px; padding: 2px; display: none;">
                                                        Image size Not Exceeds More than 200 KB
                                                    </div>
                                                </div>
                                               <div class="form-row">
                                               <div  style="width:100%; padding-bottom:5px;">
                                               &nbsp;<asp:Button runat="server" ID="btnShowPopup" Text="Add Image " CssClass="btn btn-primary" CausesValidation="false" OnClientClick="openModal(); return false;" />
                                                     <asp:Button ID="btnRemove" runat="server" class="btn  btn-danger" Text="Remove Image" OnClick="btnRemove_Click" />
                                               </div>
                                           
                                                   
                                                 <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                   <asp:DataList ID="dtimg" runat="server">
                                                   <ItemTemplate>
                                                   
                                                   <div id="divImg" class="imgHolder" style="background: url('<%#Eval("ImagePath")%>'); margin-left: 0px; background-size: cover; background-position: center; background-repeat: no-repeat; padding: 10px;">
                                                   </div>
                                                   
                                                   </ItemTemplate>
                                                   </asp:DataList>
                                                   <div id="imgHolder" class="imgHolder" style="display:none">
                                                   </div>
                                                   <div id="divImg">
                                                   </div>

                                               </div>


                                                </div>




                                            </div>


                                        </div>



                                 </div>



                                    <div class="input-group-append">
                                        <asp:Button ID="btnSearchBarcode" runat="server" class="btn btn-primary" Text="Enter"
                                            OnClick="btnSearchBarcode_Click" Visible="false" />
                                    </div>

                                    <div class="card">

                                    <h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">PRICE AND CATEGORY</h8>
                                    <div class="card-body">
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03" runat="server" id="lblPrice1">
                                                    Price 1</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                                <asp:CheckBox ID="chkPrice1" runat="server" />
                                                Not Available
                                                    <%--<input type="text" class="form-control" id="validationCustom03" placeholder="City" required>--%>
                                                <asp:TextBox ID="txtPrice1" runat="server" placeholder="0.00" class="form-control"
                                                    onkeypress="return isNumberKey(event,this)"></asp:TextBox>
                                                <div class="invalid-feedback">
                                                    Please provide a valid Price 1.
                                                </div>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom04" runat="server" id="lblPrice2">
                                                    Price 2</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                                <asp:CheckBox ID="chkPrice2" runat="server" />
                                                Not Available
                                                    <asp:TextBox ID="txtPrice2" runat="server" onkeypress="return isNumberKey(event,this)"
                                                        placeholder="0.00" class="form-control"></asp:TextBox>
                                                <div class="invalid-feedback">
                                                    Please provide a valid Price 2.
                                                </div>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom05" runat="server" id="lblPrice3">
                                                    Price 3</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                                <asp:CheckBox ID="chkPrice3" runat="server" />
                                                Not Available
                                                    <asp:TextBox ID="txtPrice3" runat="server" onkeypress="return isNumberKey(event,this)"
                                                        placeholder="0.00" class="form-control"></asp:TextBox>
                                                <div class="invalid-feedback">
                                                    Please provide a valid Price3.
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03" runat="server" id="lblPrice4">
                                                    Price 4</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                                <asp:CheckBox ID="chkPrice4" runat="server" />
                                                Not Available
                                                    <%--<input type="text" class="form-control" id="validationCustom03" placeholder="City" required>--%>
                                                <asp:TextBox ID="txtPrice4" runat="server" onkeypress="return isNumberKey(event,this)"
                                                    placeholder="0.00" class="form-control"></asp:TextBox>
                                                <div class="invalid-feedback">
                                                    Please provide a valid Price 4.
                                                </div>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Category</label>
                                                <asp:DropDownList ID="cmbCategoryName" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Class</label>
                                                <asp:DropDownList ID="cmbClass" CssClass="custom-select" runat="server">
                                                    <asp:ListItem Text="Product" Value="0"></asp:ListItem>
                                                    <asp:ListItem Text="Voucher" Value="5"></asp:ListItem>
                                                    <asp:ListItem Text="ZeroPrice" Value="6"></asp:ListItem>
                                                    <asp:ListItem Text="Master" Value="10"></asp:ListItem>
                                                    <asp:ListItem Text="Slave" Value="11"></asp:ListItem>
                                                    <asp:ListItem Text="Package" Value="9"></asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Units</label>
                                                <asp:DropDownList ID="cmbUnits" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Price Caption Type</label>
                                                <asp:DropDownList ID="cmbPriceTypeCaption" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>

                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Notes
                                                </label>

                                                <asp:TextBox ID="txtNotes" runat="server" class="form-control"></asp:TextBox>
                                                <asp:RegularExpressionValidator ID="ValidationNotes" ControlToValidate="txtNotes" ValidationExpression="[^']*" ErrorMessage="Single Quote Not allowed" runat="server" />

                                            </div>


                                        </div>

                                         <div class="form-row">

                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <%--   <label for="validationCustom03">
                                                    <label id="lblunitpricelable">Unit Price </label> : <label id="lblunitpriceValue">UnitValue</label>
                                                   </label>--%>


                                                    <label id="unitprice_label"  style="display:none;">Unit Price</label>
                                                    <span id="unitprice_value"  style="display:none;"> 0.0000</span>


                                               </div>  

                                       </div>

                                    </div>

                                     </div>

                                    <%--Include the Group contend --%>
                                    <div class="card">
                                    
                                    <h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">GROUP</h8>
                                    <div class="card-body">
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Group 1
                                                </label>
                                                <asp:DropDownList ID="cmbGroup1" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Group 2
                                                </label>
                                                <asp:DropDownList ID="cmbGroup2" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Group 3
                                                </label>
                                                <asp:DropDownList ID="cmbGroup3" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Group 4
                                                </label>
                                                <asp:DropDownList ID="cmbGroup4" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Group 5
                                                </label>
                                                <asp:DropDownList ID="cmbGroup5" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                    </div>
                                    </div>


                                   <div class="card">
                                    <%--<h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">TAX--%>
                                        <h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">TAX</h8>
                                    
                                    <div class="card-body">
                                        <%--  <div class="form-row">--%>
                                        <asp:CheckBox ID="ChkKeyValueTax" runat="server" Visible="false" />
                                        <label class="validationCustom03" style="display: none">
                                            1: Inventory Flag ; 0:Category Flag
                                        </label>



                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTaxRate6" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax6" runat="server"></asp:Label>
                                            </span>
                                        </label>
                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTaxRate5" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax5" runat="server"></asp:Label></span>
                                        </label>
                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTax4" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax4" runat="server"></asp:Label></span>
                                        </label>
                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTax3" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax3" runat="server"></asp:Label></span>
                                        </label>
                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTax2" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax2" runat="server"></asp:Label></span>
                                        </label>
                                        <label class="custom-control custom-checkbox">
                                            <asp:CheckBox ID="chkTax1" runat="server" />
                                            <span>
                                                <asp:Label ID="lblATax1" runat="server"></asp:Label></span>
                                        </label>



                                        <div>
                                            <asp:HiddenField ID="hidNewTax" runat="server" />
                                        </div>
                                    </div>

                                   </div>

                                    
                                    <%--<h5 class="card-header" style="font-size: 14px; display: none;">ICONS SETTING</h5>--%>
                                    <%--<h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">ICONS SETTING</h8>--%>
                                    <div class="card-body" style="display: none;">
                                        <div class="form-row">
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkSpicy" runat="server" />
                                                <span>Spicy</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkChef" runat="server" />
                                                <span>Chef Recommended</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkBeef" runat="server" />
                                                <span>Beef</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkChicken" runat="server" />
                                                <span>Chicken</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkPork" runat="server" />
                                                <span>Pork</span>
                                            </label>
                                        </div>
                                    </div>
                                    

                                    <%--Include the Printer setting --%>

                                    <div class="card">
                                    <%--<h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">PRINTER--%>
                                    <h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">PRINTER

                                     <button type="button" onclick="ShowModalPrinterList()" class="btn btn-warning">
                                         Edit 
                                     </button>
                                    </h8>

                                    <div class="card-body">
                                        <table>
                                            <tbody>
                                                <tr>
                                                    <td style="width: 0.5%"></td>
                                                    <td style="width: 2%"></td>
                                                </tr>
                                            </tbody>

                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2Invoice2" runat="server" Visible="false" />
                                                    <span style="display: none">1: Inventory Flag ; 0:CategoryFlag</span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP19" runat="server" />


                                                    <span>
                                                        <asp:Label ID="lblLPrinter19" runat="server"></asp:Label></span>
                                                </td>



                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP18" runat="server" />
                                                    <span><span>
                                                        <asp:Label ID="lblLPrinter18" runat="server"></asp:Label></span></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP17" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter17" runat="server"></asp:Label>
                                                    </span>

                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP16" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter16" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP15" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter15" runat="server"></asp:Label></span>
                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP14" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter14" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP13" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter13" runat="server"></asp:Label></span>
                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP12" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter12" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP11" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter11" runat="server"></asp:Label></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP10" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter10" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP9" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter9" runat="server"></asp:Label></span>
                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP8" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter8" runat="server"></asp:Label>

                                                    </span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP7" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter7" runat="server"></asp:Label></span>

                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP6" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter6" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP5" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter5" runat="server"></asp:Label></span>
                                                </td>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP4" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter4" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP3" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter3" runat="server"></asp:Label></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chk2RP2" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter2" runat="server"></asp:Label></span>
                                                </td>
                                                <td style="padding: 5px;">
                                                    <asp:CheckBox ID="chk2RP1" runat="server" />
                                                    <span>
                                                        <asp:Label ID="lblLPrinter1" runat="server"></asp:Label></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Button ID="btnSavePrinterMain" OnClick="btnSavePrinterMain_Click" runat="server"
                                                        class="btn btn-space btn-secondary" Text="ADD PRINTER" Visible="false" />
                                                </td>
                                                <td>
                                                    <asp:HiddenField ID="HideInvenPrinter" runat="server" />
                                                    <asp:Label ID="lblmsgPrinterMain" runat="server" Text="Label" Visible="false"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>

                                    </div>
                                    </div>


                                    <div class="card">
                                    
                                     <h8 class="card-header" style=" font-size: 14px; background-color:  #4c4c4c;font-weight:700;  color: White;">WEB APPLICATION</h8>
                                    
                                    <div class="card-body">
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Takeaway Charge
                                                </label>
                                                <asp:DropDownList ID="cmbTakeAway" CssClass="custom-select" runat="server">
                                                </asp:DropDownList>
                                            </div>

                                         <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                         <label for="validationCustom03">
                                             QROrder Stock Count
                                         </label>
                                         <asp:TextBox ID="txtWebstockcount" runat="server" Text="1.00" class="form-control" onkeypress="return onlyNumbers(event)"></asp:TextBox> 

                                         </div>

                                        </div>
                                        <div class="form-row">
                                            <label for="validationCustom03">
                                                <asp:CheckBox ID="ChkShowItem" runat="server" />
                                                <span>Weborder Show Item</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chkTA" runat="server" />
                                                <span>Weborder Not Available for Takeaway</span>
                                            </label>


                                            <label class="custom-control custom-checkbox" style="display: none">
                                                <asp:CheckBox ID="chkPromo" runat="server" />
                                                <span>Promotion Item</span>
                                            </label>


                                        </div>
                                        <div class="form-row">
                                            <label for="validationCustom04">
                                                <asp:CheckBox ID="ChkNoDiscount" runat="server" />
                                                <span>No Discount</span>
                                            </label>
                                        </div>

                                    </div>
                                    </div>
                                </div>
                            </asp:Panel>


                            <br />

                            <%--</div>--%>

                            <div class="tab-pane fade" id="contact-simple" role="tabpanel" aria-labelledby="contact-tab-simple">
                                <div class="card">
                                    <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">STOCK LEVEL</h5>
                                    <div class="card-body">
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <%--  <label for="validationCustom03">
                                                    Reorder</label>
                                                <asp:TextBox ID="txtReorder" runat="server" placeholder="0" class="form-control"
                                                    onkeypress="return isNumberKey(event,this)"></asp:TextBox>--%>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom04">
                                                    Safty</label>
                                                <asp:TextBox ID="txtSafty" runat="server" placeholder="0" class="form-control" onkeypress="return isNumberKey(event,this)"></asp:TextBox>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom05">
                                                    Maximum</label>
                                                <asp:TextBox ID="txtMaximum" runat="server" placeholder="0" class="form-control"
                                                    onkeypress="return isNumberKey(event,this)"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    Stock Code</label>
                                                <asp:TextBox ID="txtStockCode" runat="server" placeholder="0" class="form-control"
                                                    onkeypress="return isNumberKey(event,this)"></asp:TextBox>
                                            </div>
                                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom03">
                                                    EffectiveDT</label>
                                                <asp:TextBox ID="txtEffectiveDt" class="form-control" runat="server"></asp:TextBox>
                                                <asp:CalendarExtender ID="calFirstDueDate" Format="yyyy-MM-dd" runat="server" TargetControlID="txtEffectiveDt"
                                                    PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane fade" id="Stock-simple" role="tabpanel" aria-labelledby="Stock-tab-simple">
                                <div class="card">
                                    <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">TAX</h5>
                                    <div class="card-body">
                                        <div class="custom-controls-stacked">
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2InventoryCate" runat="server" /><span> 1: Inventory Flag ; 0:Category
                                                    Flag</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2Always" runat="server" />
                                                <span>Always : 0</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2TaxRate6" runat="server" />
                                                <span>Tax Rate 6</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2TaxRate5" runat="server" />
                                                <span>Tax Rate 5</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2TaxRate4" runat="server" />
                                                <span>Tax Rate 4</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2TaxRate3" runat="server" />
                                                <span>Tax Rate 3</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2scvc" runat="server" />
                                                <span>Scv.C</span>
                                            </label>
                                            <label class="custom-control custom-checkbox">
                                                <asp:CheckBox ID="chk2GST" runat="server" />
                                                <span>GST</span>
                                            </label>
                                            <div>
                                                <asp:Button ID="btnSaveTaxMain" runat="server" class="btn btn-space btn-secondary"
                                                    Text="ADDTAX" OnClick="btnSaveTaxMain_Click" />
                                            </div>
                                            <asp:HiddenField ID="hidenInventoryTax" runat="server" />
                                            Selected Tax Settings -
                                            <asp:Label ID="lblmsgTaxMain" runat="server" Text="Label"></asp:Label>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!--MISC NAVA-->
                            <%--  <div class="tab-pane fade" id="Misc" role="tabpanel" aria-labelledby="Stock-tab-simple" runat="server">--%>
                            <asp:Panel class="tab-pane fade" ClientIDMode="Static" ID="Misc" role="tabpanel"
                                aria-labelledby="Stock-tab-simple" runat="server">
                                <div class="card">
                                    <%-- <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                                        MISC</h5>--%>
                                    <div class="card-body" style="display: none;">
                                        <div class="custom-controls-stacked">
                                            <%--    <div class="form-row">
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        File Upload</label>
                                                    <asp:FileUpload ID="Fileploadid" class="form-control" runat="server" onchange="return validateFileSize();" />
                                                    <br />
                                                    <asp:Label ID="lblImageError" runat="server" ForeColor="Gray"></asp:Label>
                                                    <div id="dvMsg" style="background-color: Red; color: White; width: 280px; padding: 2px;
                                                        display: none;">
                                                        Image size Not Exceeds More than 200 KB</div>
                                                </div>
                                            </div>--%>
                                        </div>
                                        <div class="custom-controls-stacked">
                                            <div class="form-row">
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Price Type Caption
                                                    </label>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <asp:TextBox ID="txtCaptionPrice1" runat="server" class="form-control">Regular</asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-12 mb-2">
                                                    <asp:TextBox ID="txtCaptionPrice2" runat="server" class="form-control">Medium</asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <asp:TextBox ID="txtCaptionPrice3" runat="server" class="form-control">Large</asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <asp:TextBox ID="txtCaptionPrice4" runat="server" class="form-control">XLarge</asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        <asp:Button ID="btnPriceCaption" runat="server" Text="Save" Width="100%" Height="90%"
                                                            CssClass="btn btn-primary" OnClick="btnPriceCaption_Click" />
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">MASTER BARCODE</h5>
                                    <div class="card-body">
                                        <div class="custom-controls-stacked">
                                            <div class="form-row">
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Master Barcode</label>
                                                    <asp:TextBox ID="TxtMBarcode" runat="server" onkeypress="return isNumberKey(event,this)"
                                                        placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Inventory Name</label>
                                                    <asp:TextBox ID="txtMName" runat="server" onkeypress="return isNumberKey(event,this)"
                                                        placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                    <label for="validationCustom03">
                                                        Description
                                                    </label>
                                                    <asp:TextBox ID="txtMDesc" runat="server" onkeypress="return isNumberKey(event,this)"
                                                        placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                                                </div>
                                                <div class="card">
                                                    <!--Slave GridView under MasterBarcode-->
                                                    <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                                                        <asp:Label ID="Label3" runat="server">Slave List</asp:Label>
                                                    </h5>
                                                    <div class="card-body">
                                                        <div class="table-responsive">
                                                            <table id="Table2" class="table table-striped table-bordered second" style="width: 100%">
                                                                <tbody>
                                                                    <caption>
                                                                        <asp:Panel ID="Panel2" runat="server" BackColor="white" Height="250px" ScrollBars="Auto"
                                                                            Width="1500px">
                                                                            <asp:GridView ID="GrdSlaveListUnderMaster" runat="server" AutoGenerateColumns="False"
                                                                                EmptyDataRowStyle-CssClass="alert-dark" Font-Size="11px" HeaderStyle-BackColor="White"
                                                                                EmptyDataText="No Record Found ! " FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
                                                                                Width="750px" AllowPaging="true" PageSize="20" BackColor="White" AllowSorting="true"
                                                                                OnSorting="OnSorting" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                                                                                CellPadding="3" OnSelectedIndexChanged="GrdSlaveListUnderMaster_OnSelectedIndexChanged">
                                                                                <Columns>
                                                                                    <asp:TemplateField HeaderText="ID" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblID" runat="server" Text='<%#Eval("InventoryID") %>' ></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Barcode" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblBarcode" runat="server" Text='<%#Eval("Barcode") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Name" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Description" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblDesc" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:LinkButton ID="lnkDelete" runat="server" Font-Underline="true" ForeColor="Blue"
                                                                                                CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick=" return ConfirmationMsg('Are you sure you want to delete this slave barcode?')"
                                                                                                CausesValidation="false">Delete</asp:LinkButton>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                </Columns>
                                                                            </asp:GridView>
                                                                        </asp:Panel>
                                                                    </caption>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                </div>
                                                
                                                <div class="card">
                                                    <h4 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                                                        <asp:Label ID="Label1" runat="server">Search Slave Result</asp:Label>
                                                    </h4>
                                                     <div class="card-body"> 
                                                    <div class="row">
                                                    <div class="column">
                                                      <label for="validationCustom03">
                                                         Search by
                                                     </label>

                                                     <asp:DropDownList ID="cmbSSearch" CssClass="custom-select" runat="server">
                                                     <asp:ListItem Text="All" Value="All"></asp:ListItem>
                                                     <asp:ListItem Text="Barcode" Value="Barcode"></asp:ListItem>
                                                     <asp:ListItem Text="Name" Value="Name"></asp:ListItem>
                                                     <asp:ListItem Text="Description" Value="Description"></asp:ListItem>
                                                    </asp:DropDownList>

                                                    </div>
                                                   
                                                    <div class="column">
                                                    <label for="validationCustom03">
                                                     Search Value
                                                     </label>
                                                     <asp:TextBox ID="txtSearch" runat="server" placeholder="" class="form-control" ReadOnly="false"></asp:TextBox>
                                                    </div>
                                                   
                                                    <div class="column">
                                                    <asp:Button ID="btnSearchSlave" runat="server" Text="Apply" CssClass="btn btn-primary"
                                                     OnClick="btnSearchSlave_Click" />
                                                     <asp:HiddenField ID="TabName" runat="server" />
                                                    </div>

                                                 </div>
                                                
                                                
                                                        <div class="table-responsive">
                                                            <table id="Table1" class="table table-striped table-bordered second" style="width: 100%">
                                                                <tbody>
                                                                    <caption>
                                                                        <asp:Panel ID="Panel9" runat="server" BackColor="white" Height="250px" ScrollBars="Auto"
                                                                            Width="1500px">
                                                                            <%--Panel Start--%>
                                                                            <asp:GridView ID="GrdMasterSlaveInventory" runat="server" AutoGenerateColumns="False"
                                                                                EmptyDataRowStyle-CssClass="alert-dark" Font-Size="11px" HeaderStyle-BackColor="White"
                                                                                EmptyDataText="No Record Found ! " FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
                                                                                Width="750px" AllowPaging="true" PageSize="20" BackColor="White" AllowSorting="true"
                                                                                OnSorting="OnSorting" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                                                                                CellPadding="3">
                                                                                <Columns>
                                                                                    <asp:TemplateField>
                                                                                        <ItemTemplate>
                                                                                            <asp:CheckBox ID="chkRow" runat="server" />
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="ID" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblID" runat="server" Text='<%#Eval("InventoryID") %>' Width></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Barcode" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblBarcode" runat="server" Text='<%#Eval("Barcode") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Name" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Description" SortExpression="" HeaderStyle-CssClass="text-left"
                                                                                        ItemStyle-CssClass="text-left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblDesc" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                </Columns>
                                                                            </asp:GridView>
                                                                        </asp:Panel>
                                                                        <%--Panel End--%>
                                                                    </caption>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                
                                            </div>
                                        </div>
                                        <asp:Button ID="btnAddSlave" runat="server" Text="Add Slave" class="btn btn-primary"
                                            OnClick="btnAddSlave_Click" OnClientClick="return confirm('Note:If slave barcode already exist in diff masterbarcode.,slave will be delete. \n\n Are you sure you want to add slave?');return false;" />
                                        <%--OnClick="btnAddSlave_Click" OnClientClick="Confirm()" />--%>
                                        <%--  <asp:Button ID="btnAddSlave" runat="server" Text="Add Slave" class="btn btn-primary"
                                            OnClick="btnAddSlave_Click" OnClientClick="ConfirmationMsg1('Are you sure you want to add slave?');" />--%>
                                    </div>
                                </div>
                            </asp:Panel>
                            <%--</div>--%>
                          
                        </div>

                        <br />
                        <div align="left" id="divBtn">
                        <asp:Button ID="btnSubmit" runat="server" Text="Save" ValidationGroup="SubmitBasic"
                        class="btn btn-primary" OnClick="btnSubmit_Click" />
                        <asp:Button ID="btnUpdateInv" runat="server" Text="Update" class="btn btn-primary"
                        OnClick="btnUpdateInv_Click" OnClientClick="return validate()" />
                        </div>

                        <div style="margin-top:12px">
                         <h8 style="color:forestgreen; font-weight:700"> You are at ..  <asp:Label ID="lblSelctedBranchCaption2" ForeColor="Black" runat="server"> </asp:Label>   </h8>
                        </div>
                             



                    </div>
                    
                </div>
                
               
            </div>
            <br />

            <div class="modalCss" id="ModaInventoruList">
                <div class="modal-dialogCss">
                    <div class="modal-contentCss" style="width:90%;">
                        <%--    <div class="modal-header">
                        </div>--%>
                        <div class="modal-body" style="padding: 0px;">


                            <div class="card" >
                                <h8 class="card-header" style="background-color: #4c4c4c; color: White;">SEARCH INVENTORY  
                                    <button type="button" class="close" style="color: White; opacity: 1;" onclick="CloseModal()" data-dismiss="modal">
                                     &times;</button></h8>
                                <div class="card-body">
                                    <div class="row">
                                        <div class="column">
                                            <label for="validationCustom03">
                                                Search Type
                                            </label>
                                            <asp:DropDownList ID="cmbSearch"  CssClass="form-select"  OnSelectedIndexChanged="cmbSearch_SelectedIndexChanged"
                                                runat="server" AutoPostBack="true">
                                                <asp:ListItem Value="0" Text="Select"></asp:ListItem>
                                                <asp:ListItem Value="1" Text="Inventory Id"></asp:ListItem>
                                                <asp:ListItem Value="2" Text="Barcode"></asp:ListItem>
                                                <asp:ListItem Value="3" Text="Inventory Name"></asp:ListItem>
                                                <asp:ListItem Value="4" Text="Description"></asp:ListItem>
                                                <asp:ListItem Value="5" Text="Price"></asp:ListItem>
                                                <asp:ListItem Value="6" Text="Category Type"></asp:ListItem>
                                                <asp:ListItem Value="7" Text="Master Barcode"></asp:ListItem>   
                                                <asp:ListItem Value="8" Text="Group1"></asp:ListItem>
                                                <asp:ListItem Value="9" Text="Group2"></asp:ListItem>
                                                <asp:ListItem Value="10" Text="Group3"></asp:ListItem>
                                                <asp:ListItem Value="11" Text="Group4"></asp:ListItem>
                                                <asp:ListItem Value="12" Text="Group5"></asp:ListItem>
                                                <asp:ListItem Value="13" Text="Promo Items"></asp:ListItem>
                                                <asp:ListItem Value="14" Text="TakeAway"></asp:ListItem>
                                                <asp:ListItem Value="15" Text="StockCode"></asp:ListItem>
                                            </asp:DropDownList>

                                        </div>

                                        <div class="column">
                                            <label for="validationCustom03">
                                                Enter Description
                                            </label>
                                            <asp:TextBox ID="txtSearchVal" class="form-control" runat="server"  autocomplete="off"  Width="300px"></asp:TextBox>


                                        </div>


                                    </div>
                                    <div class="row">
                                        <div class="column">
                                            <asp:CheckBox ID="chkActiveonly" runat="server" Checked="true" />
                                            <span>Active Only</span>
                                        </div>

                                    </div>


                                    <div class="row">
                                        <div class="column">
                                            <asp:Button ID="btnSearch" runat="server" Text="Apply" CssClass="btn btn-primary" OnClientClick ="return validateSearch()" OnClick="btnSearch_Click" />
                                            <asp:Button ID="btnSearchClear" runat="server" Text="Clear" CssClass="btn btn-warning" OnClick="btnSearchClear_Click"  />
                                        </div>
                                    </div>
                                </div>


                            </div>
                            <div>
                                <div class="table-responsive" style="padding: 0px 20px 0px 20px;">
                                    <%--<label for="validationCustom03">--%>
                                        Search Result:
                                    </label>
                                 <table id="Table3" class="table table-striped table-bordered second">
                                        <tbody>
                                            <caption>

                                                <asp:Panel ID="Panel8" runat="server" BackColor="white" Height="480px" ScrollBars="Auto"
                                                    Width="1650px">
                                                    <asp:GridView ID="grdInventoryView" runat="server" AutoGenerateColumns="False" EmptyDataRowStyle-CssClass="alert-dark"
                                                        Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Record Found ! "
                                                        DataKeyNames="InventoryID" FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
                                                        Width="1500px" AllowPaging="true" PageSize="20"
                                                        BackColor="White" AllowSorting="false" OnSorting="OnSorting" BorderColor="#CCCCCC"
                                                        BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                                                        OnSelectedIndexChanged="OnSelectedIndexChanged" OnPageIndexChanging="grdInventoryView_PageIndexChanging">
                                                        <Columns>
                                                        <%--<asp:TemplateField HeaderText="SNo">
                                                        <ItemTemplate>
                                                        <%#Container.DataItemIndex+1 %>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>--%>
                                                        
                                                        <asp:TemplateField>
                                                        <ItemTemplate>
                                                        <asp:LinkButton ID="imgbtn1" runat="server" Font-Underline="true" ForeColor="Blue"
                                                        CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" CausesValidation="false">Edit</asp:LinkButton>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="InvenID" SortExpression="InventoryId" ItemStyle-HorizontalAlign="Center">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblInventoryID" runat="server" Text='<%#Eval("InventoryID") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Barcode" ItemStyle-Width="80px" SortExpression="BarCode">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblBarCode" runat="server" Text='<%#Eval("BarCode") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Inv.Name" ItemStyle-Width="180px" SortExpression="InventoryName"
                                                        ItemStyle-HorizontalAlign="Left">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblInventoryName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Description" ItemStyle-Width="180px" SortExpression="Description">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblDescription" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="180px" SortExpression="CategoryName">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblCategoryName" runat="server" Text='<%#Eval("CategoryName") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Price" SortExpression="Price" HeaderStyle-HorizontalAlign="Right"
                                                        ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price" ,"{0:F2}") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Price2" SortExpression="Price2" HeaderStyle-HorizontalAlign="Right"
                                                        ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblPrice2" runat="server" Text='<%#Eval("Price2" ,"{0:F2}") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Price3" SortExpression="Price3" HeaderStyle-HorizontalAlign="Right"
                                                        ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblPrice3" runat="server" Text='<%#Eval("Price3" ,"{0:F2}") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Price4" SortExpression="Price4" HeaderStyle-HorizontalAlign="Right"
                                                        ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblPrice4" runat="server" Text='<%#Eval("Price4" ,"{0:F2}") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>

                                                        <asp:TemplateField HeaderText="StockCode" ItemStyle-Width="180px">
                                                        <ItemTemplate>
                                                        <asp:Label ID="lblGStockCodes" runat="server" Text='<%#Eval("Stockcode") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>
                                                            
                                                        <asp:ButtonField Text="Select" CommandName="Select" ItemStyle-Width="150" Visible="false" />
                                                        </Columns>
                                                        <PagerStyle CssClass="gridview5" ></PagerStyle>
                                                        <PagerStyle HorizontalAlign="Left" CssClass="GridPager" />
                                                        <FooterStyle BackColor="#006699" ForeColor="White"></FooterStyle>
                                                        <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black"></HeaderStyle>
                                                        
                                                        <RowStyle ForeColor="#000066" />
                                                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                                        <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                                        <SortedDescendingHeaderStyle BackColor="#00547E" />
                                                    </asp:GridView>
                                                    <%--Newly Added Grid--%>
                                                    <asp:GridView ID="GridView1" runat="server" AllowPaging="true" Visible="false">
                                                    </asp:GridView>
                                                </asp:Panel>

                                            </caption>
                                        </tbody>
                                   </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

  
 


                
            <div class="modalCss" id="modelPrinterLable">
                <div class="modal-dialogCss" style="width:95%">
                    <%--<div class="modal-contentCss" style="width: 60%">--%>
                    <div class="row">
                        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                            <div class="card" style="width: 90%; height:650px; margin-left: 150px">
                             <h5 class="card-header" style="background-color: #4c4c4c; color: White;">Printer Lable
                             <button type="button" class="close" style="color: White; opacity: 1;" onclick="CloseModlePrinterListModal()" data-dismiss="modal">
                             &times;</button></h5>
                                <div class="card-body">
                                    <table>
                                        <tbody>
                                            <tr>
                                                <td style="width: 2%">Visible
                                                </td>
                                                <td>Printer No
                                                </td>
                                                <td>Printer Name
                                                </td>
                                                <td style="width: 2%">Visible
                                                </td>
                                                <td>Printer No
                                                </td>
                                                <td>Printer Name
                                                </td>
                                            </tr>
                                        </tbody>
                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP19" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id19" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo19" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName19" class="form-control" runat="server"></asp:TextBox>
                                            </td>

                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP18" runat="server" />
                                            </td>
                                            <td>

                                                <asp:HiddenField ID="id18" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo18" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName18" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>

                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP17" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id17" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo17" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName17" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP16" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id16" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo16" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName16" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>
                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP15" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id15" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo15" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName15" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP14" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id14" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo14" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName14" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>

                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP13" runat="server" />
                                            </td>

                                            <td>
                                                <asp:HiddenField ID="id13" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo13" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName13" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP12" runat="server" />
                                            </td>

                                            <td>
                                                <asp:HiddenField ID="id12" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo12" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName12" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>


                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP11" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id11" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo11" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName11" class="form-control" runat="server"></asp:TextBox>
                                            </td>

                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP10" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id10" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo10" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName10" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>


                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP9" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id9" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo9" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName9" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP8" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id8" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo8" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName8" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>

                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP7" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id7" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo7" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName7" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP6" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id6" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo6" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName6" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>

                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP5" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id5" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo5" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName5" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP4" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id4" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo4" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName4" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>

                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP3" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id3" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo3" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName3" class="form-control" runat="server"></asp:TextBox>
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP2" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id2" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo2" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName2" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>


                                        <tr>
                                            <td>&nbsp;&nbsp;&nbsp;<asp:CheckBox ID="chkVP1" runat="server" />
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="id1" runat="server" />
                                                <asp:TextBox ID="txtPrinterNo1" class="form-control" runat="server" Enabled="false"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPrinterName1" class="form-control" runat="server"></asp:TextBox>
                                            </td>


                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <asp:Button ID="btnPrinterLable" runat="server" Text="Apply" CssClass="btn btn-primary" OnClick="btnPrinterLable_Click" />
                                            </td>
                                        </tr>

                                    </table>

                                </div>
                            </div>




                        </div>
                    </div>
                </div>
                <br />
            </div>





            <div id="s3bucketParameters" runat="server">

                <table style="display: none">
                    <tr>
                        <td>

                            <asp:Label ID="lblclientname" runat="server"></asp:Label>

                        </td>
                        <td>

                            <asp:Label ID="lblstorename" runat="server"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbldbpath" runat="server"></asp:Label>
                            <asp:HiddenField ID="hdnPath" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="hdnurl" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="hdnfileid" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="IsExistImagePath" runat="server" ClientIDMode="Static" />

                        </td>
                    </tr>

                </table>



            </div>

            <!-- Commanded because s3 upload Not working under UpdatePanel -->

        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnUpdateInv" />

        </Triggers>
    </asp:UpdatePanel>


    <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="overlay">
                <%--  <div style="z-index: 1000; margin-left: 450px; margin-top: 0; opacity: 1; -moz-opacity: 1;">--%>
                <div class="LoadingDivCss">
                    <img alt="" src="IMG/Spinner.gif" class="LoadingImgCss" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>


    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
        <ProgressTemplate>
            <div class="overlay">
                <%--  <div style="z-index: 1000; margin-left: 450px; margin-top: 0; opacity: 1; -moz-opacity: 1;">--%>
                <%--<div class="LoadingDivCss">--%>
                    <img alt="" src="IMG/Spinner.gif" class="LoadingImgCss" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>




      <%-- New code For  image Saving Part   on 13-06-2025  --%>
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
 <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css?v=1.1" rel="stylesheet" />


  <div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="uploadModalLabel">Upload Image</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <div id="dropZone" style="border: 2px dashed #ccc; padding: 20px; text-align: center; cursor: pointer;">
          Drag & Drop or Click to select image
        </div>
        <input type="file" id="fileInput"  accept=".jpg,.jpeg,.png,.gif" hidden />
        <div id="preview" class="mt-2"></div>
        <span id="msg" style="color: green;"></span>
        <div class="progress mt-2" style="display: none;">
          <div class="progress-bar" role="progressbar"></div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" id="btnUpload" class="btn btn-success">Upload</button>
        <button type="button" class="btn btn-secondary" onclick="return clearModal();" data-bs-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
  <style>
    #dropZone {
        border: 2px dashed #ccc;
        width: 100%; /* or a fixed value like 400px */
        height: 250px; /* increase height as needed */
        padding: 20px;
        text-align: center;
        cursor: pointer;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        background-color: #f9f9f9;
    }

    #dropZone.hover {
        background-color: #e3f2fd;
        border-color: #007bff;
    }

    #dropZone img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
</style>
  <script>
      var modal = new bootstrap.Modal(document.getElementById('uploadModal'));
      var selectedFile = null;

      function openModal() {
          clearModal();
          modal.show();
      }

      function clearModal() {
          selectedFile = null;
          $('#msg').text('').css('color', 'red');
          $('#preview').html('');
          $('#fileInput').val('');
          $(".progress-bar").width('0%').text('');
          $(".progress").hide();
          $('#dropZone').removeClass('hover');
      }

      $(document).ready(function () {
          $(".progress").hide();

          $('#dropZone').on('click', function () {
              $('#fileInput').click();
              
          });

          $('#dropZone').on('dragover', function (e) {
              e.preventDefault();
              $(this).addClass('hover');
          });

          $('#dropZone').on('dragleave', function (e) {
              e.preventDefault();
              $(this).removeClass('hover');
          });

          $('#dropZone').on('drop', function (e) {
              e.preventDefault();
              $(this).removeClass('hover');
              var files = e.originalEvent.dataTransfer.files;
              if (files.length > 0) handleFile(files[0]);
          });

          $('#fileInput').on('change', function () {
              if (this.files.length > 0) {
                  handleFile(this.files[0]);
              }
          });

          function handleFile(file) {
              $('#msg').text('');
              $('#preview').html('');
              const allowedTypes = ['image/jpeg', 'image/png', 'image/gif'];
              if (!allowedTypes.includes(file.type)) {
                  $('#msg').text('Only JPG, PNG, and GIF files allowed.');
                  selectedFile = null;
                  return;
              }
              if (file.size > 200 * 1024) {
                  $('#msg').text('File must be less than 200 KB.');
                  selectedFile = null;
                  return;
              }

              selectedFile = file;

              const reader = new FileReader();
              reader.onload = function (e) {
                  /*$('#preview').html('<img src="' + e.target.result + '" class="img-fluid" />');*/
                  $('#dropZone').html('<img src="' + e.target.result + '" class="img-fluid" />');
              };
              reader.readAsDataURL(file);
          }







          $('#btnUpload').on('click', function () {
              if (!selectedFile)
              {
                 
                 
                 // $('#msg').addClass('text-success').text('Please select an image to upload.').show();
                  clearDropzone();
                  $('#msg').text('Please select an image to upload.');
                   //$('#msg').removeClass('text-danger').addClass('text-success').text('Please select an image to upload.');
                  return;
                  
              }
              else if ($('#<%=txtReadInventroyId.ClientID%>').val() == "")
              {
                  
                  //alert("Add Inventory First and Upload Image!");
                  clearDropzone();
                  $('#msg').text('Add Inventory First and Upload Image. ');
                  return false;

                  
              }


              EnableDiv();
              clearimg();

              //var clientname = "49"
              //var branchname = "da6"
              //var filename ="FD001";

              var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
              var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
              var filename = $("#<%= txtBarcode.ClientID %>").val();                   // Pass the Barcode 


              const fd = new FormData();
              fd.append("file", selectedFile);

              $.ajax({
                  xhr: function () {
                      var xhr = new window.XMLHttpRequest();
                      xhr.upload.addEventListener("progress", function (evt) {
                          if (evt.lengthComputable) {
                              var percent = Math.floor((evt.loaded / evt.total) * 100);
                              $(".progress").show();
                              $(".progress-bar").width(percent + '%').text(percent + '%');
                          }
                      }, false);
                      return xhr;
                  },
                  url: 'https://www.suntoyo.online/api/FileService/Upload',
                  type: 'POST',
                  data: fd,
                  crossDomain: true,
                  beforeSend: function (request) {
                      request.setRequestHeader("clientName", clientname);
                      request.setRequestHeader("fileName", filename);
                      request.setRequestHeader("branchName", branchname);
                      $(".progress-bar").width('0%');
                  },
                  success: function (data) {


                      S3_CallUpdateLogic(branchname, filename, data.dbPath);
                      $('#<%=lbldbpath.ClientID%>').html(data.dbPath);


                      // Clear existing image
                      $('#imgHolder').html('');

                      console.log("Image path.x:", data);
                      var imgPath = data.dbPath;
                      console.log("Image path.img:", imgPath);
                      var imgInventory = document.createElement("img");
                      imgInventory.id = "imgInventory";
                      imgInventory.src = imgPath + "?nocache=" + Math.random();
                      imgInventory.style = " margin-left: 0px; width: 200px; height:220px; background-size: cover; background-position: center; background-repeat: no-repeat; ";
                      document.getElementById("imgHolder").appendChild(imgInventory);

                      console.log("Upload response:", data);
                      console.log("Image path:", data.dbPath);

                     

                      //hide divImage
                      var divImg = document.getElementById("divImg");
                       if (divImg != null) {
                          divImg.remove();
                      }

                      $('#msg').removeClass('text-danger').addClass('text-success').text('Upload successful!');
                      //$('#msg').css('color', 'green').text('Upload successful!');
                      // You can add the success logic here like appending image or refreshing

                      // ✅ Clear the drop zone and form after upload

                      selectedFile = null;
                      $('#dropZone').html('Drag & Drop or Click to select image');
                      $('#fileInput').val('');
                      $(".progress-bar").width('0%').text('');
                      $(".progress").hide();



                  },
                  error: function ()
                  {
                      $('#msg').css('color', 'red').text('Upload failed.');
                  },
                  contentType: false,
                  processData: false,
                  cache: false
              });
          });

          // Reset modal when closed
          $('#uploadModal').on('hidden.bs.modal', clearModal);
      });
  </script>

  
    <script type="text/javascript">
      


        function clearimg()
        {
            var divImg = document.getElementById("divImg");
            if (divImg != null) {
                divImg.remove();
            }

        }


        function clearDropzone() {
            selectedFile = null;

            // Clear file input (if you're using a hidden input manually)
            $('#fileInput').val('');

            // Clear Dropzone HTML preview (if Dropzone is used only for UI)
            $('#dropZone').html('Drag & Drop or Click to select image');

            // Optional: Clear any Dropzone instance
            try {
                let dz = Dropzone.forElement("#dropZone");
                dz.removeAllFiles(true);
            } catch (e) {
                // It's not a real Dropzone instance — ignore
            }

            $(".progress-bar").width('0%').text('');
            /*//$(".progress").hide();*/
            $('#msg').text('');
        }



        function disableDiv() {
            var div = document.getElementById('imgHolder');
           // div.style.pointerEvents = 'none';
           // div.style.opacity = '0.5';
           div.style.display='none'

        }

        function EnableDiv() {
            var div = document.getElementById('imgHolder');
            // div.style.pointerEvents = 'none';
            // div.style.opacity = '0.5';
            div.style.display = 'block'

        }

        function disableImageDiv() {
            var div = document.getElementById('divImg');
            // div.style.pointerEvents = 'none';
            // div.style.opacity = '0.5';
            div.style.display = 'none'

        }


        

    </script>
   

  <style type="text/css">
  .imgHolder 
  {
    width: 120px;
    height: 120px;
    padding: 10px;
    border: 2px dashed #6c757d;
    border-radius: 12px;
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
  }

  .imgHolder img {
    max-width: 100%;
    max-height:110%;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.3s ease;
  }

  .imgHolder:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
  }

  .imgHolder:hover img {
    transform: scale(1.05);
  }
</style>


<script type="text/javascript" >
function onlyNumbers(evt) 
{
    var charCode = evt.which ? evt.which : evt.keyCode;
    // Allow only digits (0-9)
    if (charCode < 48 || charCode > 57) 
    {
        return false;
    }
    return true;
}
</script>
   
</asp:Content>
