<!DOCTYPE html>
<html lang="en">
  
<head>
    <%- include('./partials/head'); -%>
    
</head>
<body onload="startTime()">
    <%- include('./partials/header_sidebar'); -%>
    
    <!-- tap on top starts-->
     
        <!-- Page Sidebar Ends-->
        <div class="page-body">
          <div class="container-fluid">
            <div class="page-title">
              <div class="row">
                <div class="col-sm-6">
                  <h3><%= lan.edit %> <%= lan.role %> <%= lan.permission %></h3>
                </div>
                <div class="col-sm-6">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/index"><i data-feather="home"></i></a></li>
                    <li class="breadcrumb-item"><%= lan.dashboard %></li>
                    <li class="breadcrumb-item active"><%= lan.edit %> <%= lan.role %> <%= lan.permission %></li>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-body">
                            <form class="needs-validation" id="erole_form" novalidate="" action="/role/edit_role/<%=role.id%>" method="post">
                                <div class="row">
                                    <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                        <label class="col-form-label"><%= lan.name %></label>
                                        <input class="form-control checkin" type="text" name="name" value="<%=role.name%>" placeholder="<%= lan.enter_name %>" required>
                                    </div>
                                    <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                        <label class="col-form-label"><%= lan.email %></label>
                                        <input class="form-control checkin" id="edit_email" type="text" name="email" value="<%=role.email%>" placeholder="<%= lan.enter_email %>" required>
                                        <input type="hidden" id="rold_email" value="<%= role.email %>">
                                    </div>

                                    <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                        <label class="col-form-label"><%= lan.phone_number %>.</label>
                                        <div class="row">
                                            <div class="col-4">
                                                <select class="js-example-basic-single checkin" id="erole_countrycode" name="country_code" required>
                                                    <option value selected disabled><%= lan.country_code %></option>
                                                    <% CountryCode.forEach((data, x) => { %>
                                                        <option value="<%= data %>" <%= role.country_code == data ? 'selected' : "" %>> <%= nameCode[x] %> <%= data %> </option>
                                                    <% }) %>
                                                </select>
                                            </div>
                                            <div class="col-8">
                                                <input class="form-control checkin" id="erole_phone" type="number" name="phone" value="<%=role.phone%>" placeholder="<%= lan.enter_phone_number %>" required>
                                            </div>
                                            <input type="hidden" id="rold_code" value="<%= role.country_code %>">
                                            <input type="hidden" id="rold_phone" value="<%= role.phone %>">
                                        </div>
                                    </div>
                                    
                                    <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                        <label class="col-form-label"><%= lan.active_status %></label>
                                        <select class="js-example-basic-single checkin" name="status" required>
                                            <option value selected disabled><%= lan.status_list %></option>
                                            <option value="1" <%= role.status == '1' ? 'selected' : "" %>><%= lan.active %></option>
                                            <option value="0" <%= role.status == '2' ? 'selected' : "" %>><%= lan.inactive %></option>
                                        </select>
                                    </div>

                                    <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                        <label class="col-form-label"><%= lan.password %></label>
                                        <input class="form-control" type="password" name="password" required>
                                    </div>

                                    <div>
                                        <div class="p-3 mt-3" style="background-color: rgb(235, 232, 232);">
                                            <h6 class="m-0"><%= lan.accessibility %></h6>
                                        </div>
                                    </div>
                                    
                                    <div class="mt-4">
                                        <div class="table-responsive theme-scrollbar">
                                            <table class="table">
                                                <thead class="table-dark">
                                                    <tr>
                                                        <th>#</th>
                                                        <th><%= lan.permission %></th>
                                                        <th><%= lan.view %></th>
                                                        <th><%= lan.add %></th>
                                                        <th><%= lan.edit %></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>1</td>
                                                        <td><%=lan.Customer%></td>
                                                        <td><input class="checkinc" name="cusview" type="checkbox" <%= role.customer[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="cusadd" type="checkbox" <%= role.customer[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="cusedit" type="checkbox" <%= role.customer[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>2</td>
                                                        <td><%=lan.Driver%></td>
                                                        <td><input class="checkinc" name="driview" type="checkbox" <%= role.driver[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="driadd" type="checkbox" <%= role.driver[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="driedit" type="checkbox" <%= role.driver[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>3</td>
                                                        <td><%=lan.Vehicle%> <%=lan.Preference%></td>
                                                        <td><input class="checkinc" name="vehpview" type="checkbox" <%= role.vehicle_pre[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="vehpadd" type="checkbox" <%= role.vehicle_pre[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="vehpedit" type="checkbox" <%= role.vehicle_pre[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>4</td>
                                                        <td><%=lan.Document%> <%=lan.Setting%></td>
                                                        <td><input class="checkinc" name="docseview" type="checkbox" <%= role.doc_setting[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="docseadd" type="checkbox" <%= role.doc_setting[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="docseedit" type="checkbox" <%= role.doc_setting[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>5</td>
                                                        <td><%=lan.Default%> <%=lan.Notification%></td>
                                                        <td><input class="checkinc" name="defnoview" type="checkbox" <%= role.def_notification[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="defnoadd" type="checkbox" <%= role.def_notification[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="defnoedit" type="checkbox" <%= role.def_notification[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>6</td>
                                                        <td><%=lan.Vehicle%></td>
                                                        <td><input class="checkinc" name="vehiview" type="checkbox" <%= role.vehicle[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="vehiadd" type="checkbox" <%= role.vehicle[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="vehiedit" type="checkbox" <%= role.vehicle[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>7</td>
                                                        <td><%=lan.Outstation%> <%=lan.Category%></td>
                                                        <td><input class="checkinc" name="outcatview" type="checkbox" <%= role.out_category[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="outcatadd" type="checkbox" <%= role.out_category[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="outcatedit" type="checkbox" <%= role.out_category[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>8</td>
                                                        <td><%=lan.Outstation%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="olistview" type="checkbox" <%= role.out_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="olistadd" type="checkbox" <%= role.out_list[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="olistedit" type="checkbox" <%= role.out_list[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>9</td>
                                                        <td><%=lan.Outstation%> <%=lan.Setting%></td>
                                                        <td><input class="checkinc" name="outseview" type="checkbox" <%= role.out_setting[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="outseedit" type="checkbox" <%= role.out_setting[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>10</td>
                                                        <td><%=lan.Rental%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="renliview" type="checkbox" <%= role.rental_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="renliadd" type="checkbox" <%= role.rental_list[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="renliedit" type="checkbox" <%= role.rental_list[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>11</td>
                                                        <td><%=lan.Rental%> <%=lan.Setting%></td>
                                                        <td><input class="checkinc" name="renseview" type="checkbox" <%= role.rental_setting[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="renseedit" type="checkbox" <%= role.rental_setting[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>12</td>
                                                        <td><%=lan.Package%> <%=lan.Category%></td>
                                                        <td><input class="checkinc" name="packcatview" type="checkbox" <%= role.pack_category[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="packcatadd" type="checkbox" <%= role.pack_category[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="packcatedit" type="checkbox" <%= role.pack_category[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>13</td>
                                                        <td><%=lan.Package%> <%=lan.Setting%></td>
                                                        <td><input class="checkinc" name="pacsetview" type="checkbox" <%= role.pack_setting[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="pacsetedit" type="checkbox" <%= role.pack_setting[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>7</td>
                                                        <td><%=lan.Ride%> <%=lan.Cancel%> <%=lan.Reason%></td>
                                                        <td><input class="checkinc" name="rcanrview" type="checkbox" <%= role.ride_cancel_reason[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="rcanradd" type="checkbox" <%= role.ride_cancel_reason[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="rcanredit" type="checkbox" <%= role.ride_cancel_reason[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>8</td>
                                                        <td><%=lan.Ride%> <%=lan.Review%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="rrlisview" type="checkbox" <%= role.ride_review_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="rrlisadd" type="checkbox" <%= role.ride_review_list[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="rrlisedit" type="checkbox" <%= role.ride_review_list[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>9</td>
                                                        <td><%=lan.Vehicle%> <%=lan.Report%></td>
                                                        <td><input class="checkinc" name="vehrepview" type="checkbox" <%= role.vehicle_report[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="vehrepedit" type="checkbox" <%= role.vehicle_report[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>17</td>
                                                        <td><%=lan.Outstation%> <%=lan.Report%></td>
                                                        <td><input class="checkinc" name="outrepoview" type="checkbox" <%= role.outstation_report[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="outrepoedit" type="checkbox" <%= role.outstation_report[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>18</td>
                                                        <td><%=lan.Rental%> <%=lan.Report%></td>
                                                        <td><input class="checkinc" name="renrepopview" type="checkbox" <%= role.rental_report[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="renrepopedit" type="checkbox" <%= role.rental_report[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>19</td>
                                                        <td><%=lan.Package%> <%=lan.Report%></td>
                                                        <td><input class="checkinc" name="packrepopview" type="checkbox" <%= role.package_report[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="packrepopedit" type="checkbox" <%= role.package_report[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>10</td>
                                                        <td><%=lan.Coupon%></td>
                                                        <td><input class="checkinc" name="coupview" type="checkbox" <%= role.coupon[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="coupadd" type="checkbox" <%= role.coupon[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="coupedit" type="checkbox" <%= role.coupon[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>11</td>
                                                        <td><%=lan.Payment%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="payliview" type="checkbox" <%= role.payment_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="payliedit" type="checkbox" <%= role.payment_list[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>12</td>
                                                        <td><%=lan.Payout%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="paylview" type="checkbox" <%= role.payout_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="payledit" type="checkbox" <%= role.payout_list[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>13</td>
                                                        <td><%=lan.FAQ%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="faqliview" type="checkbox" <%= role.faq_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="faqliadd" type="checkbox" <%= role.faq_list[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="faqliedit" type="checkbox" <%= role.faq_list[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>14</td>
                                                        <td><%=lan.Send%> <%=lan.Notification%></td>
                                                        <td><input class="checkinc" name="senotiview" type="checkbox" <%= role.send_notification[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="senotiadd" type="checkbox" <%= role.send_notification[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="senotiedit" type="checkbox" <%= role.send_notification[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>15</td>
                                                        <td><%=lan.Pages%> <%=lan.List%></td>
                                                        <td><input class="checkinc" name="pagliview" type="checkbox" <%= role.page_list[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="pagliedit" type="checkbox" <%= role.page_list[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>16</td>
                                                        <td><%=lan.Zone%></td>
                                                        <td><input class="checkinc" name="zoneview" type="checkbox" <%= role.zone[0] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="zoneadd" type="checkbox" <%= role.zone[1] == 1 ? 'checked' : '' %>></td>
                                                        <td><input class="checkinc" name="zoneedit" type="checkbox" <%= role.zone[2] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                    <tr>
                                                        <td>17</td>
                                                        <td><%=lan.Setting%></td>
                                                        <td><input class="checkinc" name="settview" type="checkbox" <%= role.setting[0] == 1 ? 'checked' : '' %>></td>
                                                        <td></td>
                                                        <td><input class="checkinc" name="settedit" type="checkbox" <%= role.setting[1] == 1 ? 'checked' : '' %>></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>

                                    <div class="text-center">
                                        <p class="text-danger d-none mt-3" id="erole_all_check"><%= lan.please_enter_all_detail %>.</p>
                                        <p class="text-danger d-none mt-3" id="erole_phone_check"><%= lan.phone_already_registered %>.</p>
                                    </div>
                                    
                                </div>
                            </form>
                            <div class="text-end mt-5">
                                <button class="btn btn-square btn-primary btn-air-primary add_detail_btn b-r-10" id="edit_role_fbtn" type="submit"><%=lan.Submit%></button> 
                            </div>
                        </div>
                    </div>
                </div>
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>

        <%- include('./partials/footer'); -%>
        <%- include('./partials/script'); -%>
  </body>
</html>