mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 02:09:05 +03:00
img type & load
This commit is contained in:
parent
b8dc1a55e9
commit
5bbe5e68f7
@ -80,7 +80,11 @@ module.exports = function(server, db) {
|
||||
server.get('/api/buyers', checkAuthenticated, async (req, res) => {
|
||||
try {
|
||||
const buyers = await db.collection('buyers').find({}).toArray();
|
||||
res.json(buyers);
|
||||
if (buyers.length > 0) {
|
||||
res.json(buyers);
|
||||
} else res.send({
|
||||
error: 'Покупателей в магазине пока что нет.'
|
||||
});
|
||||
} catch {
|
||||
res.status(500).render('main/404');
|
||||
}
|
||||
|
||||
2
dist/views/admin/assets/templates/header.pug
vendored
2
dist/views/admin/assets/templates/header.pug
vendored
@ -11,7 +11,7 @@ header.admin-header
|
||||
.user-view
|
||||
.background
|
||||
img(src="/img/admin/background-user.jpg", alt="#")
|
||||
span(style="padding-top: 5px;padding-bottom:10px;display:block;").white-text Control Panel v1.0.0
|
||||
span(style="padding-top: 5px;padding-bottom:10px;display:block;").white-text Панель управления
|
||||
a(href="#")
|
||||
img(class="circle" src="/img/admin/avatar-user.jpg", alt="alt")
|
||||
a(href="#")
|
||||
|
||||
2
dist/views/admin/icons.pug
vendored
2
dist/views/admin/icons.pug
vendored
@ -17,7 +17,7 @@ body.has-fixed-sidenav
|
||||
.file-field.input-field.col.s12
|
||||
.btn.orange
|
||||
span Иконка
|
||||
input(type="file" name="img" required)
|
||||
input(type="file" accept="image/*" name="img" required)
|
||||
.file-path-wrapper
|
||||
input(type="text" class="file-path" placeholder="Загрузите иконку в формате .svg")
|
||||
button(type="submit" class="btn right" style="margin-right: 10px;") Добавить
|
||||
|
||||
@ -52,8 +52,8 @@ export class PaginationComponent extends Component {
|
||||
// выполняем запрос на сервер и выводим на данные
|
||||
async moveTo(page, insertTo, request) {
|
||||
this.loader.show();
|
||||
insertTo.innerHTML = '';
|
||||
const response = await request(page);
|
||||
insertTo.innerHTML = '';
|
||||
if (response != '') {
|
||||
this.$el.setAttribute('data-page', page);
|
||||
insertTo.insertAdjacentHTML('afterbegin', response);
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
export function renderBuyers(buyers) {
|
||||
return buyers.map(buyer => `<tr data-info='{"bill_id": "${buyer.bill_id}", "email": "${buyer.email}", "method": "${buyer.method[0].toUpperCase() + buyer.method.slice(1)}", "date": "${new Date(buyer.date).toLocaleDateString()}", "amount": "${buyer.amount}", "data": "${buyer.data}"}'><td>${buyer.email}</td><td>${buyer.method[0].toUpperCase() + buyer.method.slice(1)}</td><td>${new Date(buyer.date).toLocaleDateString()}</td><td>${buyer.amount} ₽</td><td><button id="billDataOpen" class="btn orange">Данные аккаунтов</button></td></tr>`).join('');
|
||||
if (!buyers.error) {
|
||||
return buyers.map(buyer => `<tr data-info='{"bill_id": "${buyer.bill_id}", "email": "${buyer.email}", "method": "${buyer.method[0].toUpperCase() + buyer.method.slice(1)}", "date": "${new Date(buyer.date).toLocaleDateString()}", "amount": "${buyer.amount}", "data": "${buyer.data}"}'><td>${buyer.email}</td><td>${buyer.method[0].toUpperCase() + buyer.method.slice(1)}</td><td>${new Date(buyer.date).toLocaleDateString()}</td><td>${buyer.amount} ₽</td><td><button id="billDataOpen" class="btn orange">Данные аккаунтов</button></td></tr>`).join('');
|
||||
} else {
|
||||
return 'Покупателей в магазине пока что нету';
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user