<!DOCTYPE html>
<html lang="en" class="h-100">


<head>
    <!-- meta and links start -->
    <%- include('templet/meta')-%>



</head>

<body>
    <%- include('templet/preloder_topbar_sidebar',{titel: accessdata?.topbardata?.name})-%>
        <!--********** Content body start **********-->

        <div class="content-body">

            <div class="container-fluid" style="min-height: 100vh;">
                <div class="row">
                    <div class="col-12">
                        <div class="card ">
                            <div class="card-header">
                                <h3 class="card-title">
                                    <%= language.Branch_Store_Settings %>
                                </h3>
                            </div>
                            <div class="card-body">
                                <% storedata.forEach(function(data){ %>
                                  
                                    <form class="row g-4 align-items-center need-validation"
                                        action="/tool/branchdata/<%=data.id %>" method="post"
                                        enctype="multipart/form-data">

                                        <div>
                                            <%= language.APPLICATION_DETAILS %>
                                        </div>

                                        <hr>
                                        <div class="row">

                                            <div class="col-xl-9">
                                                <div class="row mt-3">
                                                    <div class="col-md-6">
                                                        <label class="form-label">
                                                            <%= language.Application_Name %> <span
                                                                    class="text-danger">*</span>
                                                        </label>
                                                        <input type="text" placeholder="Enter Application Name"
                                                            class="form-control" name="name" value="<%=data.name %>"
                                                            required>
                                                    </div>

                                                    <div class="col-md-6">
                                                        <label class="form-label">
                                                            <%= language.Phone_Number %> <span
                                                                    class="text-danger">*</span>
                                                        </label>
                                                        <input type="text" class="form-control"
                                                            placeholder="Enter Phone Number" name="number"
                                                            value="<%= data.mobile_number %>" required>
                                                    </div>
                                                </div>

                                                <div class="row mt-4">
                                                    <div class="col-md-6">
                                                        <label class="form-label">
                                                            <%= language.Username %> <span class="text-danger">*</span>
                                                        </label>
                                                        <input type="text" class="form-control"
                                                            placeholder="Enter Username" name="username"
                                                            value="<%= data.username %>" required>
                                                    </div>

                                                    <div class="col-md-6">
                                                        <label class="form-label">
                                                            <%= language.Password %> <span class="text-danger">*</span>
                                                        </label>
                                                        <input type="text" class="form-control"
                                                            placeholder="Update Password" name="password"
                                                            value="">
                                                    </div>
                                                </div>

                                            </div>

                                            <div class="col-xl-3">
                                                <div class="center">
                                                    <div class="form-input">
                                                        <div class="preview m-3 mt-0">
                                                            <img id="file-preview" width="180"
                                                                src="../../uploads/<%=data.logo %>" alt="image">
                                                        </div>

                                                        <input class="d-none" type="file" id="file-1" name="logo"
                                                            accept="image/*" onchange="showPreview(event);">

                                                        <label class="btn btn-primary w-100" for="file-1">
                                                            <%= language.Upload_App_Logo %>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>

                                        <hr>

                                        <div>
                                            <%= language.FINANCE_SETTINGS %>
                                        </div>

                                        <hr>

                                        <div class="col-md-4">
                                            <label class="form-label">
                                                <%= language.Shop_Commission %>
                                            </label>
                                            <input type="number" class="form-control" placeholder="Shop Commission"
                                                name="commission" value="<%=data.shop_commission %>" required>
                                        </div>

                                        <div class="col-md-4">
                                            <label class="form-label">
                                                <%= language.Tax_Percentage %>
                                            </label>
                                            <input type="text" class="form-control" name="taxpercent"
                                                value="<%=data.tax_percent %>" required>
                                        </div>

                                        <hr>

                                        <div>
                                            <%= language.FIRM_ADDRESS %>
                                        </div>

                                        <hr>
 

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.Country %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter Country Name"
                                                name="country" value="<%=data.country %>" required>
                                            <!-- <select class="default-select form-control wide mb-3" name="country" required >
                                            <option value="" selected disabled>Select One</option>
                                            <option value="AR"  >Argentina [AR]</option>
                                            <option value="AU" >Australia [AU]</option>
                                            <option value="BE" >Belgium [BE]</option>
                                            <option value="BR" >Brazil [BR]</option>
                                            <option value="CA" >Canada [CA]</option>
                                            <option value="CN" >China [CN]</option>
                                            <option value="DK" >Denmark [DK]</option>
                                            <option value="IN" >India [IN]</option>
                                            <option value="EG" >Egypt [EG]</option>
                                            <option value="FR" >France [FR]</option>
                                            <option value="DE" >Germany [DE]</option>
                                            <option value="JP" >Japan [JP]</option>
                                        </select> -->
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.State %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter State Name"
                                                name="state" value="<%=data.state %>" required>
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.City %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter City Name"
                                                name="city" value="<%=data.city %>" required>
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.District %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter District Name"
                                                name="district" value="<%=data.district %>" required>
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.Zip_Code %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter Zip Code"
                                                name="zip_code" value="<%=data.zipcode %>" required>
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.Store_Email %>
                                            </label>
                                            <input type="email" class="form-control" placeholder="Enter Store Email"
                                                name="store_email" value="<%=data.store_email %>" required>
                                        </div>

                                        <div class="col-md-3">
                                            <label class="form-label">
                                                <%= language.Store_Tax_Number %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter Store Tax Number"
                                                name="tax_number" value="<%=data.store_tax_number %>" required>
                                        </div>

                                        <div class="col-12 mb-3">
                                            <label for="inputAddress" class="form-label">
                                                <%= language.Address %>
                                            </label>
                                            <input type="text" class="form-control" placeholder="Enter Address"
                                                name="address" value="<%=data.address %>" required>
                                        </div>

                                        <hr>

                                        <h4>
                                            <%= language.Store_Status %>
                                        </h4>
                                        <div class="col-12 mb-5 d-flex justify-content-between">

                                            <div class="col-md-2">

                                                <div class="form-check custom-checkbox mb-3 checkbox-success">
                                                    <input type="radio" class="form-check-input" id="approved"
                                                        name="status" value="1" <%=data.status==1 ? 'checked' : '' %>
                                                    required >
                                                    <label class="form-check-label text-success" for="approved">
                                                        <%= language.Approved %>
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="col-md-2">

                                                <div class="form-check custom-checkbox mb-3 checkbox-danger">
                                                    <input type="radio" class="form-check-input" id="rejected"
                                                        name="status" value="0" <%=data.status==0 ? 'checked' : '' %>
                                                    required >
                                                    <label class="form-check-label text-danger" for="rejected">
                                                        <%= language.Rejected %>
                                                    </label>
                                                </div>
                                            </div>

                                            <div class="col-md-4">
                                                <!-- blank div -->
                                            </div>

                                            <div class="col-md-4">
                                                <!-- <label class="form-label">
                                                    <%= language.Store_Access_Roll %>
                                                </label> -->
                                                <!-- <select class="default-select form-control wide mb-3" name="roll"
                                                    required>
                                                    <option value="" selected disabled>Select One</option>
                                                    <% rolldata.forEach(function(x){ %>
                                                        <option value="<%= x.id %>" <%=data.roll_ID==x.id ? 'selected'
                                                            : '' %> ><%= x.roll %>
                                                        </option>
                                                        <% }) %>

                                                </select> -->
                                                <% let storeRole=rolldata.find(val=> val.rollType === 'store'); %>
                                                    <input type="hidden" value="<%= storeRole.id%>"  name="roll">
                                            </div>





                                        </div>

                                        <hr>

                                        <button type="submit" class="btn btn-primary">
                                            <%= language.Save_Data %>
                                        </button>

                                    </form>
                                    <% }) %>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </div>

        <!--********** Content body end **********-->

        </div>
        <!--**********************************
            Footer start
        ***********************************-->
        <%- include('templet/footer')-%>

            <!--**********************************
            Footer end
        ***********************************-->

            </div>

            <!--********** Main wrapper end **********-->
            <%- include('templet/script')-%>

</body>


</html>