<!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.Ride%> <%=lan.Review%> <%=lan.List%></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.Ride%> <%=lan.Review%> <%=lan.List%></li>
                    </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">
                        <% let permiss = per != "1" ? per.ride_review_list[1] : "1" %>
                        <% if(permiss == "1"){ %>
                        <div class="card-header d-flex justify-content-end pb-0">
                            <button class="btn btn-square btn-primary b-r-10" type="button" data-bs-toggle="modal" data-bs-target="#add_review"><%=lan.Add%> <%=lan.Review%> <%=lan.List%></button>
                        </div>
                        <% } %>
                        <div class="card-body">
                            <div class="table-responsive theme-scrollbar">
                                <table class="display" id="basic-1">
                                    <thead>
                                        <tr>
                                            <th><%= lan.number %></th>
                                            <th><%=lan.Title%></th>
                                            <th><%=lan.Status%></th>
                                            <% let permissions = per != "1" ? per.ride_review_list[2] : "1" %>
                                            <% if(permissions == "1"){ %>
                                            <th><%=lan.Action%></th>
                                            <% } %>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% var i = 1 %>
                                        <% reason_list.forEach((data) => { %>
                                            <tr>
                                                <td><%= i %></td>
                                                <td><%= data.title %></td>
                                                <td>
                                                    <% if (data.status == '1') { %>
                                                        <span class="badge badge-success"><%=lan.Active%></span>
                                                    <% } else { %>
                                                        <span class="badge badge-danger"><%=lan.Deactive%></span>
                                                    <% } %>
                                                </td>
                                                <% if(permissions == "1"){ %>
                                                <td> 
                                                    <ul class="action"> 
                                                        <li class="edit"> <a data-bs-toggle="modal" data-bs-target="#edit_review" id="edit_review_data" data-id="<%= data.id %>" 
                                                            data-title="<%= data.title %>" data-status="<%= data.status %>"><i class="icon-pencil-alt"></i></a></li>
                                                        <li class="delete"><a href="/settings/review_reason_delete/<%= data.id %>"><i class="icon-trash"></i></a></li>
                                                    </ul>
                                                </td>
                                                <% } %>
                                            </tr>
                                        <% i++ %>
                                        <% }) %>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>



        <div class="modal fade" id="add_review" tabindex="-1" role="dialog" aria-labelledby="add_review" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title"><%=lan.Add%>  <%=lan.Review%> <%=lan.List%></h5>
                        <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="<%= lan.close_label %>"></button>
                    </div>
                    <form  class="needs-validation" novalidate="" action="/settings/add_review_reason" method="post">
                        <div class="modal-body">
                            <div class="row g-3">
                                <div class="col-12">
                                    <label class="form-label"><%=lan.Title%></label>
                                    <input class="form-control" type="text" name="title" placeholder="<%=lan.Enter%> <%=lan.Title%>" required>
                                </div>
                                <div class="col-12">
                                    <div class="d-flex" style="margin-top: 30px;">
                                        <div class="icon-state switch-outline">
                                            <label class="switch">
                                                <input type="checkbox" name="status"><span class="switch-state bg-success"></span>
                                            </label>
                                        </div>
                                        <label class="col-form-label m-l-10"><%=lan.Status%></label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-secondary" type="button" data-bs-dismiss="modal"><%=lan.Close%></button>
                            <button class="btn btn-primary" type="submit"><%=lan.Save%></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="modal fade" id="edit_review" tabindex="-1" role="dialog" aria-labelledby="edit_review" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title"><%=lan.Edit%>  <%=lan.Review%> <%=lan.List%></h5>
                        <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="<%= lan.close_label %>"></button>
                    </div>
                    <form  class="needs-validation" id="edit_review_reason" novalidate="" action="" method="post">
                        <div class="modal-body">
                            <div class="row g-3">
                                <div class="col-12">
                                    <label class="form-label"><%=lan.Title%></label>
                                    <input class="form-control" id="review_title" type="text" name="title" placeholder="<%=lan.Enter%> <%=lan.Title%>" required>
                                </div>
                                <div class="col-12">
                                    <div class="d-flex" style="margin-top: 10px;">
                                        <div class="icon-state switch-outline">
                                            <label class="switch">
                                                <input type="checkbox" id="review_status" name="status"><span class="switch-state bg-success"></span>
                                            </label>
                                        </div>
                                        <label class="col-form-label m-l-10"><%=lan.Status%></label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-secondary" type="button" data-bs-dismiss="modal"><%=lan.Close%></button>
                            <button class="btn btn-primary" type="submit"><%=lan.Save%></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

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