mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +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) => {
|
server.get('/api/buyers', checkAuthenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const buyers = await db.collection('buyers').find({}).toArray();
|
const buyers = await db.collection('buyers').find({}).toArray();
|
||||||
|
if (buyers.length > 0) {
|
||||||
res.json(buyers);
|
res.json(buyers);
|
||||||
|
} else res.send({
|
||||||
|
error: 'Покупателей в магазине пока что нет.'
|
||||||
|
});
|
||||||
} catch {
|
} catch {
|
||||||
res.status(500).render('main/404');
|
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
|
.user-view
|
||||||
.background
|
.background
|
||||||
img(src="/img/admin/background-user.jpg", alt="#")
|
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="#")
|
a(href="#")
|
||||||
img(class="circle" src="/img/admin/avatar-user.jpg", alt="alt")
|
img(class="circle" src="/img/admin/avatar-user.jpg", alt="alt")
|
||||||
a(href="#")
|
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
|
.file-field.input-field.col.s12
|
||||||
.btn.orange
|
.btn.orange
|
||||||
span Иконка
|
span Иконка
|
||||||
input(type="file" name="img" required)
|
input(type="file" accept="image/*" name="img" required)
|
||||||
.file-path-wrapper
|
.file-path-wrapper
|
||||||
input(type="text" class="file-path" placeholder="Загрузите иконку в формате .svg")
|
input(type="text" class="file-path" placeholder="Загрузите иконку в формате .svg")
|
||||||
button(type="submit" class="btn right" style="margin-right: 10px;") Добавить
|
button(type="submit" class="btn right" style="margin-right: 10px;") Добавить
|
||||||
|
|||||||
@ -52,8 +52,8 @@ export class PaginationComponent extends Component {
|
|||||||
// выполняем запрос на сервер и выводим на данные
|
// выполняем запрос на сервер и выводим на данные
|
||||||
async moveTo(page, insertTo, request) {
|
async moveTo(page, insertTo, request) {
|
||||||
this.loader.show();
|
this.loader.show();
|
||||||
insertTo.innerHTML = '';
|
|
||||||
const response = await request(page);
|
const response = await request(page);
|
||||||
|
insertTo.innerHTML = '';
|
||||||
if (response != '') {
|
if (response != '') {
|
||||||
this.$el.setAttribute('data-page', page);
|
this.$el.setAttribute('data-page', page);
|
||||||
insertTo.insertAdjacentHTML('afterbegin', response);
|
insertTo.insertAdjacentHTML('afterbegin', response);
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
export function renderBuyers(buyers) {
|
export function renderBuyers(buyers) {
|
||||||
|
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('');
|
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