<!--views/admin/index.ejs-->
<link rel="stylesheet" href="/styles/admin/index.css" />
<script src="/scripts/paginate.js"></script>
<section class="Header">
<div class="wrapper region">
<div class="logo"><%= data.pageTitle %></div>
<form action="/admin/search" method="post">
<select name="adminSelect">
<option>ទំនិញ</option>
<option>ប្រភេទ</option>
</select>
<input type="text" name="q" placeholder="Search" required />
<input type="submit" value="ស្វែងរក" />
</form>
<div class="logout"><a href="/">ទំព័រមុខ</a> | <a href="/login/logout">ចេញក្រៅ</a></div>
</div>
</section>
<section class="Main">
<div class="wrapper region">
<div class="sidebar">
<div class="inner">
<a href="/admin/post"><img src="/images/bigsale.png" /></a>
<a href="/admin/post" class="title">ទំនិញ</a>
<a href="/admin/category"><img src="/images/category.png" /></a>
<a href="/admin/category" class="title">ប្រភេទ</a>
<a href="/admin/upload"><img src="/images/upload.png" /></a>
<a href="/admin/upload" class="title">Upload</a>
<a href="/admin/user"><img src="/images/users.png" /></a>
<a href="/admin/user" class="title">អ្នកប្រើប្រាស់</a>
<a href="/admin/setting"><img src="/images/setting.png" /></a>
<a href="/admin/setting" class="title">Setting</a>
</div>
</div>
<div class="content">
<% if(data.route === '/admin/category'){ %>
<%- include('category.ejs') %>
<% }else if(data.route === '/admin/post'){ %>
<%- include('post.ejs') %>
<% }else if(data.route === '/admin/upload'){ %>
<%- include('upload.ejs') %>
<% }else if(data.route === '/admin/user'){ %>
<%- include('user.ejs') %>
<% } %>
</div>
</div>
</section>
<% if(data.items){ %>
<section class="Footer region">
<% if(data.count){ %>
<div class="info">សរុបទាំងអស់មានចំនួនៈ <%= data.count %></div>
<% }else{ %>
<div class="info">សរុបទាំងអស់មានចំនួនៈ</div>
<% } %>
<ul class="list">
<% for(let item of data.items) { %>
<li>
<div class='thumb'>
<a href='/<%= data.type %>/<%= item.id %>'>
<img src='<%= item.thumb %>'/>
<% if((item.video)&&(item.video !== '[]')){ %>
<img class="play-icon" src="/images/play.png"/>
<% } %>
</a>
</div>
<div class="title">
<a href="/<%= data.type %>/<%= item.id %>"><%= item.title %></a>
<div><%= (new Date(item.postdate)).toLocaleDateString('it-IT') %></div>
</div>
<div class="edit">
<a href="<%= data.route %>/edit/<%= item.id %>"><img src="/images/edit.png"/></a>
<a href="<%= data.route %>/delete/<%= item.id %>"><img src="/images/delete.png"/></a>
</div>
</li>
<% } %>
</ul>
<div class="pagination">
<img onClick="paginate('<%= data.route %>')" src="/images/load-more.png" />
</div>
<div class="credit">© 2022 <a href="https://khmerweb.vercel.app/">Khmer Web</a></div>
</section>
<% } %>
<!--views/admin/user.ejs-->
<link rel="stylesheet" href="/styles/admin/user.css" />
<script src="/scripts/ckeditor/ckeditor.js"></script>
<section class="User">
<form action="/admin/user" method="post">
<input type="text" name="title" required placeholder="ឈ្មោះអ្នកប្រើប្រាស់" />
<textarea name="content" id="editor"></textarea>
<div class="wrapper">
<input type="text" name="thumb" required placeholder="តំណរភ្ជាប់រូបតំណាង" />
<input type="datetime-local" name="datetime" required />
<select name="category" id="category">
<option>Author</option>
<% if(data.user.role === 'Admin'){ %>
<option>Editor</option>
<option>Admin</option>
<% } %>
</select>
<input type="email" name="email" required placeholder="Email" />
<input type="password" name="password" required />
<input type="submit" value="បញ្ជូន" />
</div>
</form>
</section>
<script src="/scripts/ckeditor/config.js"></script>
/* static/styles/admin/user.css */
.User form .ck-editor__editable{
min-height: 300px;
}
.User form .wrapper{
display: grid;
grid-template-columns: auto auto 20%;
}
.User form input,.User form select{
font: var(--body-font);
width: 100%;
padding: 2px 5px;
}