<!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.default%> <%=lan.notification%></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.default%> <%=lan.notification%></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.def_notification[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_coupon"><%=lan.add%> <%=lan.notification%></button>
                    </div>
                    <% } %>
                    <div class="card-body">
                        <div class="table-responsive theme-scrollbar">
                            <table class="display" id="basic-1">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th><%=lan.title%></th>
                                        <% let permissions = per != "1" ? per.def_notification[2] : "1" %>
                                        <% if(permissions == "1"){ %>
                                        <th><%=lan.action%></th>
                                        <% } %>
                                    </tr>
                                </thead>
                                <tbody>
                                    <% var i = 1 %>
                                    <% dem_list.forEach((data) => { %>
                                        <tr>
                                            <td><%= i %></td>
                                            <td><%= data.title %></td>
                                            <% if(permissions == "1"){ %>
                                            <td> 
                                                <ul class="action"> 
                                                    <li class="edit"><a data-bs-toggle="modal" data-bs-target="#edit_def_notimodal" id="edit_def_noti" data-id="<%= data.id %>" 
                                                        data-title="<%= data.title %>"><i class="icon-pencil-alt"></i></a></li>
                                                    <li class="delete"><a href="/driver/delete_def_noti/<%= 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 bd-example-modal-lg" id="add_coupon" tabindex="-1" role="dialog" aria-labelledby="add_coupon" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><%=lan.add%> <%=lan.notification%></h5>
                    <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="<%=lan.close%>"></button>
                </div>
                <form class="needs-validation" novalidate="" action="/driver/add_def_noti" method="post">
                    <div class="modal-body">
                        <div class="row g-3">
                            <div class="col-12">
                                <label class="form-label"><%=lan.title%></label>
                                <textarea class="form-control" rows="3" name="title"></textarea>
                            </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 bd-example-modal-lg" id="edit_def_notimodal" tabindex="-1" role="dialog" aria-labelledby="edit_def_notimodal" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><%=lan.edit%> <%=lan.notification%></h5>
                    <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="<%=lan.close%>"></button>
                </div>
                <form class="needs-validation" id="edit_form_def_noti" novalidate="" action="" method="post">
                    <div class="modal-body">
                        <div class="row g-3">
                            <div class="col-12">
                                <label class="form-label"><%=lan.title%></label>
                                <textarea class="form-control" id="edit_def_noti_title" rows="3" name="title"></textarea>
                            </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>
