init commit
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.venv/
|
||||
.history/
|
||||
2
lottery/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
var/mysql
|
||||
var
|
||||
14
lottery/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
.venv
|
||||
.env
|
||||
.history
|
||||
.__pycache__/
|
||||
var
|
||||
|
||||
# Добавьте эти строки в .gitignore
|
||||
*.pyc
|
||||
__pycache__/
|
||||
var/mysql/
|
||||
.sqlite3
|
||||
.db
|
||||
.png
|
||||
|
||||
23
lottery/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM python:3.12-alpine
|
||||
|
||||
# Устанавливаем рабочую директорию
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем файл зависимостей и устанавливаем их
|
||||
COPY requirements.txt /app/
|
||||
RUN set -ex && \
|
||||
apk update && \
|
||||
apk add --no-cache build-base mariadb-connector-c-dev && \
|
||||
pip install --upgrade pip && \
|
||||
pip install -r requirements.txt && \
|
||||
pip cache purge && \
|
||||
apk del build-base
|
||||
|
||||
# Копируем исходный код проекта
|
||||
COPY . /app
|
||||
|
||||
# Открываем порт 8000 для веб-сервера
|
||||
EXPOSE 8000
|
||||
|
||||
# Определяем команду по умолчанию (например, запуск веб-сервера)
|
||||
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||
37
lottery/api_test.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import requests
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
load_dotenv('.env')
|
||||
|
||||
def fetch_clients(api_url, api_key):
|
||||
"""
|
||||
Подключаемся к API с использованием заданного X-API-Key
|
||||
"""
|
||||
headers = {
|
||||
"X-API-Key": api_key
|
||||
}
|
||||
try:
|
||||
response = requests.get(api_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Ошибка при запросе к API: {e}")
|
||||
return None
|
||||
|
||||
if __name__ == '__main__':
|
||||
api_endpoint = os.getenv("API_URL")
|
||||
api_key = os.getenv("API_KEY")
|
||||
|
||||
print(api_endpoint, api_key)
|
||||
if not api_endpoint or not api_key:
|
||||
print("Необходимо задать API_URL и API_KEY в .env файле.")
|
||||
exit(1)
|
||||
|
||||
clients = fetch_clients(api_endpoint, api_key)
|
||||
|
||||
if clients is not None:
|
||||
print(json.dumps(clients, indent=4, ensure_ascii=False))
|
||||
else:
|
||||
print("Не удалось получить данные с API.")
|
||||
0
lottery/bin/cli
Normal file
3
lottery/bin/cli.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose exec web python3 manage.py "$@"
|
||||
3
lottery/bin/pip3.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose exec web pip3 "$@"
|
||||
12
lottery/bin/update.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd `dirname $0`/..
|
||||
|
||||
git pull
|
||||
|
||||
docker compose down
|
||||
docker compose build
|
||||
docker compose up -d web
|
||||
sleep 1
|
||||
./bin/cli migrate
|
||||
docker compose up -d
|
||||
0
lottery/bot/__init__.py
Normal file
13
lottery/bot/admin.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.contrib import admin
|
||||
from .models import BotConfig, WelcomeMessage
|
||||
|
||||
|
||||
@admin.register(BotConfig)
|
||||
class BotConfigAdmin(admin.ModelAdmin):
|
||||
list_display = ("bot_name", "channel_id", "bot_token")
|
||||
search_fields = ("bot_name", "channel_id", "bot_token")
|
||||
|
||||
@admin.register(WelcomeMessage)
|
||||
class WWelcomeMessageAdmin(admin.ModelAdmin):
|
||||
list_display = ("bot", "welcome_message", "welcome_image", "admin_contact", "channel_link", "group_link", "custom_link1_name", "custom_link1_url")
|
||||
|
||||
7
lottery/bot/apps.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BotConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'bot'
|
||||
verbose_name='Telegram Бот'
|
||||
92
lottery/bot/chat.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# chat.py
|
||||
import logging
|
||||
from telegram import Update, InputMediaPhoto
|
||||
from telegram.ext import ContextTypes
|
||||
from asgiref.sync import sync_to_async
|
||||
from bot.state import BINDING_PENDING
|
||||
|
||||
class ChatHandler:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
@sync_to_async
|
||||
def get_bot_settings(self):
|
||||
from bot.models import BotConfig
|
||||
settings = BotConfig.objects.first()
|
||||
if settings is None:
|
||||
settings = BotConfig.objects.create(chat_enabled=True)
|
||||
return settings
|
||||
|
||||
@sync_to_async
|
||||
def get_client_by_telegram_id(self, telegram_id: int):
|
||||
from webapp.models import Client
|
||||
try:
|
||||
return Client.objects.get(telegram_id=str(telegram_id))
|
||||
except Client.DoesNotExist:
|
||||
return None
|
||||
|
||||
@sync_to_async
|
||||
def get_all_clients(self):
|
||||
from webapp.models import Client
|
||||
return list(Client.objects.all())
|
||||
|
||||
async def broadcast_message(self, sender, message_text: str, photo_media: InputMediaPhoto = None):
|
||||
clients = await self.get_all_clients()
|
||||
for client in clients:
|
||||
if client.telegram_id == sender.telegram_id:
|
||||
continue
|
||||
try:
|
||||
if photo_media:
|
||||
await self.bot.send_photo(
|
||||
chat_id=client.telegram_id,
|
||||
photo=photo_media.media,
|
||||
caption=photo_media.caption,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
else:
|
||||
await self.bot.send_message(
|
||||
chat_id=client.telegram_id,
|
||||
text=message_text,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Ошибка отправки сообщения пользователю {client.telegram_id}: {e}")
|
||||
|
||||
async def handle_chat_message(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if not update.message:
|
||||
return
|
||||
|
||||
bot_settings = await self.get_bot_settings()
|
||||
if not bot_settings.chat_enabled:
|
||||
await update.message.reply_text("🚫 Чат временно отключён администрацией.")
|
||||
return
|
||||
|
||||
chat_id = update.message.chat_id
|
||||
sender = await self.get_client_by_telegram_id(chat_id)
|
||||
# Если пользователь не привязан, но находится в pending, обрабатываем как ввод КК
|
||||
if not sender and chat_id in BINDING_PENDING:
|
||||
# Импортируем функцию process_binding_input из bot.handlers
|
||||
from bot.handlers import process_binding_input
|
||||
await process_binding_input(update, context)
|
||||
return
|
||||
# Если пользователь не привязан и не находится в pending, просим привязаться
|
||||
if not sender:
|
||||
await update.message.reply_text("🚫 Для участия в чате привяжите свою клиентскую карту с помощью /bind")
|
||||
return
|
||||
|
||||
# Если у пользователя отключена возможность отправки сообщений
|
||||
if getattr(sender, "chat_disabled", False):
|
||||
await update.message.reply_text("🚫 Вы не можете отправлять сообщения. Обратитесь к администратору.")
|
||||
return
|
||||
|
||||
sender_name = sender.name if sender else "Аноним"
|
||||
broadcast_text = f"💬 *{sender_name} пишет:*\n{update.message.text or ''}"
|
||||
|
||||
photo_media = None
|
||||
if update.message.photo:
|
||||
photo = update.message.photo[-1]
|
||||
caption = update.message.caption or broadcast_text
|
||||
photo_media = InputMediaPhoto(photo.file_id, caption=caption)
|
||||
|
||||
await self.broadcast_message(sender, broadcast_text, photo_media)
|
||||
140
lottery/bot/handlers.py
Normal file
@@ -0,0 +1,140 @@
|
||||
# bot/handlers.py
|
||||
import re
|
||||
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from telegram.ext import ContextTypes
|
||||
from asgiref.sync import sync_to_async
|
||||
from webapp.models import BindingRequest, Client, Invoice
|
||||
from draw.models import Lottery, DrawResult, LotteryParticipant
|
||||
from bot.state import BINDING_PENDING
|
||||
|
||||
@sync_to_async
|
||||
def get_client_by_telegram_id(telegram_id: int):
|
||||
try:
|
||||
return Client.objects.get(telegram_id=str(telegram_id))
|
||||
except Client.DoesNotExist:
|
||||
return None
|
||||
|
||||
@sync_to_async
|
||||
def get_invoices_for_client(client):
|
||||
return list(Invoice.objects.filter(client_club_card_number=client.club_card_number))
|
||||
|
||||
@sync_to_async
|
||||
def get_draws_for_client(client):
|
||||
return list(
|
||||
DrawResult.objects.filter(participant__invoice__client_club_card_number=client.club_card_number)
|
||||
.select_related('lottery', 'prize', 'participant__invoice')
|
||||
)
|
||||
|
||||
@sync_to_async
|
||||
def create_binding_request(telegram_chat_id, client_card):
|
||||
return BindingRequest.objects.create(
|
||||
telegram_chat_id=str(telegram_chat_id),
|
||||
client_card=client_card
|
||||
)
|
||||
|
||||
async def whoami(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if not update.message:
|
||||
return
|
||||
chat_id = update.message.chat_id
|
||||
client = await get_client_by_telegram_id(chat_id)
|
||||
if not client:
|
||||
await update.message.reply_text(
|
||||
"❌ Пользователь не найден. Возможно, Вы ещё не привязали свою клубную карту."
|
||||
)
|
||||
return
|
||||
|
||||
invoices = await get_invoices_for_client(client)
|
||||
draws = await get_draws_for_client(client)
|
||||
|
||||
message_text = f"👤 *Профиль клиента:*\n" \
|
||||
f"• *Имя:* {client.name}\n" \
|
||||
f"• *Клубная карта:* {client.club_card_number}\n\n"
|
||||
|
||||
message_text += "💳 *Счета:*\n"
|
||||
if invoices:
|
||||
show_all = len(invoices) > 5
|
||||
displayed_invoices = invoices[:5] if show_all else invoices
|
||||
for inv in displayed_invoices:
|
||||
invoice_str = str(inv).split('/')[0].strip()
|
||||
message_text += f" • {invoice_str} (*{inv.sum}*)\n"
|
||||
else:
|
||||
message_text += " _Нет счетов_\n"
|
||||
|
||||
message_text += "\n🎉 *Розыгрыши и выигранные призы:*\n"
|
||||
if draws:
|
||||
for draw in draws:
|
||||
lottery_name = draw.lottery.name if draw.lottery else "неизвестно"
|
||||
invoice_info = (draw.participant.invoice
|
||||
if draw.participant and hasattr(draw.participant, 'invoice')
|
||||
else "неизвестно")
|
||||
prize_info = (draw.prize.reward
|
||||
if draw.prize and hasattr(draw.prize, 'reward')
|
||||
else "неизвестно")
|
||||
message_text += f" • Лотерея: *{lottery_name}*\n Счет: _{invoice_info}_\n Выигрыш: *{prize_info}*\n\n"
|
||||
else:
|
||||
message_text += " _Нет результатов розыгрышей_\n"
|
||||
|
||||
reply_markup = None
|
||||
if invoices and len(invoices) > 5:
|
||||
reply_markup = InlineKeyboardMarkup([
|
||||
[InlineKeyboardButton("Показать все счета", callback_data="show_all_invoices")]
|
||||
])
|
||||
|
||||
await update.message.reply_text(message_text, parse_mode="Markdown", reply_markup=reply_markup)
|
||||
|
||||
async def handle_client_card(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
"""
|
||||
Обработчик команды /bind.
|
||||
После ввода команды бот запрашивает ввод номера КК и ожидает сообщение с кодом.
|
||||
Здесь мы просто добавляем ID пользователя в pending.
|
||||
"""
|
||||
if not update.message:
|
||||
return
|
||||
telegram_chat_id = update.message.chat_id
|
||||
# Если пользователь уже привязан, сообщаем об этом.
|
||||
client = await get_client_by_telegram_id(telegram_chat_id)
|
||||
if client:
|
||||
await update.message.reply_text("✅ Вы уже привязаны!")
|
||||
return
|
||||
|
||||
# Добавляем пользователя в список pending и просим ввести номер КК.
|
||||
BINDING_PENDING.add(telegram_chat_id)
|
||||
await update.message.reply_text("Введите номер вашей клубной карты (КК):")
|
||||
|
||||
async def process_binding_input(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
"""
|
||||
Обрабатывает ввод номера КК от пользователя, который находится в состоянии ожидания.
|
||||
"""
|
||||
if not update.message or not update.message.text:
|
||||
return
|
||||
client_card = update.message.text.strip()
|
||||
telegram_chat_id = update.message.chat_id
|
||||
|
||||
if not re.fullmatch(r'\d{3,}', client_card):
|
||||
await update.message.reply_text("❌ Неверный формат клиентской карты. Пожалуйста, введите корректный код (минимум 3 цифры).")
|
||||
return
|
||||
|
||||
await create_binding_request(telegram_chat_id, client_card)
|
||||
if telegram_chat_id in BINDING_PENDING:
|
||||
BINDING_PENDING.remove(telegram_chat_id)
|
||||
await update.message.reply_text("✅ Заявка отправлена. После подтверждения вы сможете участвовать в чате.")
|
||||
|
||||
async def show_all_invoices_callback(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
query = update.callback_query
|
||||
await query.answer()
|
||||
chat_id = query.message.chat_id
|
||||
client = await get_client_by_telegram_id(chat_id)
|
||||
if not client:
|
||||
await query.edit_message_text("❌ Пользователь не найден. Возможно, Вы ещё не привязали свою клубную карту.")
|
||||
return
|
||||
|
||||
invoices = await get_invoices_for_client(client)
|
||||
message_text = "💳 *Все счета:*\n"
|
||||
if invoices:
|
||||
for inv in invoices:
|
||||
invoice_str = str(inv).split('/')[0].strip()
|
||||
message_text += f" • {invoice_str} (*{inv.sum}*)\n"
|
||||
else:
|
||||
message_text += " _Нет счетов_\n"
|
||||
|
||||
await query.edit_message_text(message_text, parse_mode="Markdown")
|
||||
33
lottery/bot/management/commands/runbot.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# bot/management/commands/runbot.py
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from bot.utils import create_bot_instance
|
||||
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, CallbackQueryHandler
|
||||
from bot.handlers import whoami, show_all_invoices_callback, handle_client_card
|
||||
from bot.chat import ChatHandler
|
||||
from bot.welcome import WelcomeHandler
|
||||
class Command(BaseCommand):
|
||||
help = 'Запускает Telegram-бота'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
try:
|
||||
bot = create_bot_instance()
|
||||
except Exception as e:
|
||||
raise CommandError(f"Ошибка при создании бота: {e}")
|
||||
|
||||
application = ApplicationBuilder().token(bot.token).build()
|
||||
|
||||
async def start_command(update, context):
|
||||
await update.message.reply_text("Здравствуйте! Используйте команду /bind для привязки клиентской карты.")
|
||||
|
||||
welcome_handler = WelcomeHandler(bot=application.bot)
|
||||
application.add_handler(CommandHandler("start", welcome_handler.send_welcome))
|
||||
application.add_handler(CommandHandler("bind", handle_client_card))
|
||||
application.add_handler(CommandHandler("whoami", whoami))
|
||||
application.add_handler(CallbackQueryHandler(show_all_invoices_callback, pattern="^show_all_invoices$"))
|
||||
|
||||
chat_handler = ChatHandler(bot=application.bot)
|
||||
application.add_handler(MessageHandler(filters.TEXT | filters.PHOTO, chat_handler.handle_chat_message))
|
||||
|
||||
self.stdout.write("Бот запущен. Ожидание обновлений...")
|
||||
application.run_polling()
|
||||
self.stdout.write("Бот остановлен.")
|
||||
23
lottery/bot/migrations/0001_initial.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-21 03:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='BotConfig',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('bot_token', models.CharField(help_text='Токен для подключения к Telegram API', max_length=255)),
|
||||
('channel_id', models.CharField(help_text='ID канала/чата, куда бот будет отправлять сообщения', max_length=100)),
|
||||
('bot_name', models.CharField(help_text='Отображаемое имя бота', max_length=100)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-21 12:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bot', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='botconfig',
|
||||
name='chat_enabled',
|
||||
field=models.BooleanField(default=True, help_text='Если выключено, то глобально блокируется рассылка сообщений в чате.', verbose_name='Чат включён'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='botconfig',
|
||||
name='global_block_message',
|
||||
field=models.TextField(default='', help_text='Сообщение, которое показывается пользователям, если чат отключён.', verbose_name='Сообщение о глобальном блоке'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,38 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-23 01:00
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bot', '0002_botconfig_chat_enabled_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='botconfig',
|
||||
options={'verbose_name': 'Настройка бота', 'verbose_name_plural': 'Настройки Ботов'},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='WelcomeMessage',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('welcome_message', models.TextField(blank=True, help_text='Текст, который будет отправлен при запуске команды /start', null=True, verbose_name='Приветственное сообщение')),
|
||||
('welcome_image', models.URLField(blank=True, help_text='URL изображения для приветствия', null=True, verbose_name='Ссылка на приветственное изображение')),
|
||||
('admin_contact', models.CharField(blank=True, help_text='Ссылка или контакт для связи с администратором', max_length=255, null=True, verbose_name='Контакт администратора')),
|
||||
('channel_link', models.URLField(blank=True, help_text='URL канала бота', null=True, verbose_name='Ссылка на канал')),
|
||||
('group_link', models.URLField(blank=True, help_text='URL группы бота', null=True, verbose_name='Ссылка на группу')),
|
||||
('custom_link1_name', models.CharField(blank=True, max_length=100, null=True, verbose_name='Название кастомной ссылки 1')),
|
||||
('custom_link1_url', models.URLField(blank=True, null=True, verbose_name='URL кастомной ссылки 1')),
|
||||
('custom_link2_name', models.CharField(blank=True, max_length=100, null=True, verbose_name='Название кастомной ссылки 2')),
|
||||
('custom_link2_url', models.URLField(blank=True, null=True, verbose_name='URL кастомной ссылки 2')),
|
||||
('bot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bot.botconfig', verbose_name='Бот')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Приветственное сообщение',
|
||||
'verbose_name_plural': 'Приветственные сообщения',
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-23 01:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bot', '0003_alter_botconfig_options_welcomemessage'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='welcomemessage',
|
||||
name='welcome_image',
|
||||
field=models.ImageField(blank=True, help_text='Загрузите изображение для приветствия', null=True, upload_to='welcome_images/', verbose_name='Приветственное изображение'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-23 01:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bot', '0004_alter_welcomemessage_welcome_image'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='welcomemessage',
|
||||
name='welcome_image',
|
||||
field=models.ImageField(blank=True, help_text='Загрузите изображение для приветствия', null=True, upload_to='', verbose_name='Приветственное изображение'),
|
||||
),
|
||||
]
|
||||
0
lottery/bot/migrations/__init__.py
Normal file
87
lottery/bot/models.py
Normal file
@@ -0,0 +1,87 @@
|
||||
from django.db import models
|
||||
|
||||
class BotConfig(models.Model):
|
||||
bot_token = models.CharField(max_length=255, help_text="Токен для подключения к Telegram API")
|
||||
channel_id = models.CharField(max_length=100, help_text="ID канала/чата, куда бот будет отправлять сообщения")
|
||||
bot_name = models.CharField(max_length=100, help_text="Отображаемое имя бота")
|
||||
chat_enabled = models.BooleanField(
|
||||
default=True,
|
||||
verbose_name="Чат включён",
|
||||
help_text="Если выключено, то глобально блокируется рассылка сообщений в чате."
|
||||
)
|
||||
global_block_message = models.TextField(
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name="Сообщение о глобальном блоке",
|
||||
help_text="Сообщение, которое показывается пользователям, если чат отключён."
|
||||
)
|
||||
def __str__(self):
|
||||
return self.bot_name
|
||||
class Meta:
|
||||
verbose_name = "Настройка бота"
|
||||
verbose_name_plural = "Настройки Ботов"
|
||||
|
||||
|
||||
class WelcomeMessage(models.Model):
|
||||
bot = models.ForeignKey(BotConfig, on_delete=models.CASCADE, verbose_name="Бот")
|
||||
welcome_message = models.TextField(
|
||||
verbose_name="Приветственное сообщение",
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="Текст, который будет отправлен при запуске команды /start"
|
||||
)
|
||||
welcome_image = models.ImageField(
|
||||
upload_to='static/upload_image/',
|
||||
verbose_name="Приветственное изображение",
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="Загрузите изображение для приветствия"
|
||||
)
|
||||
admin_contact = models.CharField(
|
||||
max_length=255,
|
||||
verbose_name="Контакт администратора",
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="Ссылка или контакт для связи с администратором"
|
||||
)
|
||||
channel_link = models.URLField(
|
||||
verbose_name="Ссылка на канал",
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="URL канала бота"
|
||||
)
|
||||
group_link = models.URLField(
|
||||
verbose_name="Ссылка на группу",
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="URL группы бота"
|
||||
)
|
||||
custom_link1_name = models.CharField(
|
||||
max_length=100,
|
||||
verbose_name="Название кастомной ссылки 1",
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
custom_link1_url = models.URLField(
|
||||
verbose_name="URL кастомной ссылки 1",
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
custom_link2_name = models.CharField(
|
||||
max_length=100,
|
||||
verbose_name="Название кастомной ссылки 2",
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
custom_link2_url = models.URLField(
|
||||
verbose_name="URL кастомной ссылки 2",
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Приветственное сообщение"
|
||||
verbose_name_plural = "Приветственные сообщения"
|
||||
|
||||
def __str__(self):
|
||||
return f"Приветствие для {self.bot}"
|
||||
105
lottery/bot/notifications.py
Normal file
@@ -0,0 +1,105 @@
|
||||
# notifications.py
|
||||
import logging
|
||||
from asgiref.sync import sync_to_async
|
||||
|
||||
class NotificationService:
|
||||
def __init__(self, bot):
|
||||
"""
|
||||
Инициализация сервиса уведомлений.
|
||||
:param bot: экземпляр telegram.Bot, используемый для отправки сообщений.
|
||||
"""
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
@sync_to_async
|
||||
def _get_all_clients(self):
|
||||
from webapp.models import Client
|
||||
# Возвращаем только клиентов, у которых telegram_id заполнен корректно
|
||||
return list(Client.objects.exclude(telegram_id__in=[None, "", "NULL"]))
|
||||
|
||||
@sync_to_async
|
||||
def _prepare_results(self, results):
|
||||
# Принудительно загружаем связанные объекты через select_related
|
||||
return list(results.select_related('prize', 'participant__invoice'))
|
||||
|
||||
async def notify_draw_start(self, lottery):
|
||||
"""
|
||||
Уведомляет всех клиентов о запуске розыгрыша.
|
||||
:param lottery: объект розыгрыша (например, модель Lottery)
|
||||
"""
|
||||
message_text = f"🎉 *Розыгрыш '{lottery.name}' начался!* Следите за обновлениями."
|
||||
clients = await self._get_all_clients()
|
||||
for client in clients:
|
||||
if not client.telegram_id:
|
||||
continue
|
||||
try:
|
||||
await self.bot.send_message(
|
||||
chat_id=client.telegram_id,
|
||||
text=message_text,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Ошибка отправки уведомления о запуске розыгрыша пользователю {client.telegram_id}: {e}")
|
||||
|
||||
async def notify_draw_results(self, lottery, results):
|
||||
"""
|
||||
Отправляет результаты розыгрыша всем клиентам.
|
||||
:param lottery: объект розыгрыша (Lottery)
|
||||
:param results: QuerySet с результатами розыгрыша (например, объекты DrawResult)
|
||||
"""
|
||||
# Принудительно загружаем связанные объекты
|
||||
results_list = await self._prepare_results(results)
|
||||
message_text = f"🎉 *Результаты розыгрыша '{lottery.name}':*\n"
|
||||
for result in results_list:
|
||||
status = "✅ Подтвержден" if result.confirmed else "⏳ В ожидании подтверждения"
|
||||
prize = result.prize.reward if result.prize and hasattr(result.prize, "reward") else "неизвестно"
|
||||
account = (str(result.participant.invoice).split('/')[0].strip()
|
||||
if result.participant and hasattr(result.participant, "invoice") else "неизвестно")
|
||||
message_text += f"• Приз: *{prize}*, Счет: _{account}_, Статус: *{status}*\n"
|
||||
clients = await self._get_all_clients()
|
||||
for client in clients:
|
||||
if not client.telegram_id:
|
||||
continue
|
||||
try:
|
||||
await self.bot.send_message(
|
||||
chat_id=client.telegram_id,
|
||||
text=message_text,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Ошибка отправки результатов розыгрыша пользователю {client.telegram_id}: {e}")
|
||||
|
||||
async def notify_prize_status_update(self, client, result):
|
||||
"""
|
||||
Отправляет конкретному пользователю обновление по статусу подтверждения приза.
|
||||
:param client: объект клиента (Client)
|
||||
:param result: объект результата розыгрыша (DrawResult)
|
||||
"""
|
||||
status = "✅ Подтвержден" if result.confirmed else "⏳ В ожидании подтверждения"
|
||||
prize = result.prize.reward if result.prize and hasattr(result.prize, "reward") else "неизвестно"
|
||||
message_text = f"🎉 *Обновление розыгрыша:*\nВаш приз *{prize}* имеет статус: *{status}*."
|
||||
try:
|
||||
if client.telegram_id:
|
||||
await self.bot.send_message(
|
||||
chat_id=client.telegram_id,
|
||||
text=message_text,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Ошибка отправки обновления статуса приза пользователю {client.telegram_id}: {e}")
|
||||
|
||||
async def notify_binding_complete(self, client):
|
||||
"""
|
||||
Уведомляет пользователя об окончании привязки клубной карты к Telegram ID.
|
||||
:param client: объект клиента (Client)
|
||||
"""
|
||||
message_text = "✅ *Привязка завершена!* Ваша клубная карта успешно привязана к Telegram. Теперь вы можете участвовать в розыгрышах и чате."
|
||||
try:
|
||||
if client.telegram_id:
|
||||
await self.bot.send_message(
|
||||
chat_id=client.telegram_id,
|
||||
text=message_text,
|
||||
parse_mode="Markdown"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Ошибка отправки уведомления о привязке пользователю {client.telegram_id}: {e}")
|
||||
2
lottery/bot/state.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# bot/state.py
|
||||
BINDING_PENDING = set()
|
||||
9
lottery/bot/storage.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
from django.conf import settings
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
# Кастомное хранилище для загрузки изображений в /static/upload_image
|
||||
static_storage = FileSystemStorage(
|
||||
location=os.path.join(settings.BASE_DIR, 'static', 'upload_image'),
|
||||
base_url='/static/upload_image/'
|
||||
)
|
||||
3
lottery/bot/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
39
lottery/bot/utils.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# bot/utils.py
|
||||
from telegram import Bot
|
||||
from django.conf import settings
|
||||
from telegram import Bot
|
||||
from bot.models import BotConfig
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
def create_bot_instance():
|
||||
"""
|
||||
Получает настройки бота из БД и создаёт экземпляр Telegram Bot.
|
||||
"""
|
||||
config = BotConfig.objects.first() # предполагается, что конфигурация одна
|
||||
if not config:
|
||||
raise ImproperlyConfigured("Настройки бота (BotConfig) не сконфигурированы в базе данных.")
|
||||
|
||||
# Можно дополнительно использовать config.channel_id и config.bot_name при необходимости.
|
||||
bot = Bot(token=config.bot_token)
|
||||
return bot
|
||||
|
||||
|
||||
def notify_user(binding_request, approved=True):
|
||||
bot_token = settings.BOT_CONFIG.bot_token # можно использовать модель BotConfig или настройку из settings
|
||||
bot = Bot(token=bot_token)
|
||||
message = "Ваша заявка на привязку успешно подтверждена!" if approved else "Ваша заявка на привязку отклонена."
|
||||
try:
|
||||
bot.send_message(chat_id=binding_request.telegram_chat_id, text=message)
|
||||
except Exception as e:
|
||||
# Обработка ошибок отправки сообщения
|
||||
print(f"Ошибка уведомления: {e}")
|
||||
|
||||
|
||||
# Пример использования в точке входа приложения:
|
||||
if __name__ == '__main__':
|
||||
# Предполагается, что Django уже настроен (например, через manage.py shell или management command)
|
||||
bot = create_bot_instance()
|
||||
# Теперь можно использовать объект bot для отправки сообщений, обработки обновлений и т.д.
|
||||
print(f"Бот {bot.name} успешно создан!")
|
||||
|
||||
|
||||
3
lottery/bot/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
82
lottery/bot/welcome.py
Normal file
@@ -0,0 +1,82 @@
|
||||
# bot/welcome.py
|
||||
import logging
|
||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from telegram.ext import ContextTypes
|
||||
from asgiref.sync import sync_to_async
|
||||
from bot.models import WelcomeMessage
|
||||
|
||||
class WelcomeHandler:
|
||||
def __init__(self, bot):
|
||||
"""
|
||||
Инициализация обработчика приветственных сообщений.
|
||||
:param bot: экземпляр telegram.Bot для отправки сообщений.
|
||||
"""
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
@sync_to_async
|
||||
def get_welcome_config(self):
|
||||
"""
|
||||
Получает первую запись настроек приветствия.
|
||||
"""
|
||||
try:
|
||||
return WelcomeMessage.objects.select_related("bot").first()
|
||||
except WelcomeMessage.DoesNotExist:
|
||||
return None
|
||||
|
||||
async def send_welcome(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
"""
|
||||
Отправляет приветственное сообщение с inline-кнопками, расположенными в 3 строки:
|
||||
1 кнопка, затем 2 и затем 2.
|
||||
"""
|
||||
if not update.message:
|
||||
return
|
||||
|
||||
config = await self.get_welcome_config()
|
||||
if not config:
|
||||
await update.message.reply_text("Добро пожаловать!")
|
||||
return
|
||||
|
||||
# Формируем список всех кнопок
|
||||
buttons = []
|
||||
if config.admin_contact:
|
||||
buttons.append(InlineKeyboardButton("📞 Связаться с администратором", url=config.admin_contact))
|
||||
if config.channel_link:
|
||||
buttons.append(InlineKeyboardButton(" 📢 Канал", url=config.channel_link))
|
||||
if config.group_link:
|
||||
buttons.append(InlineKeyboardButton("👥 Группа", url=config.group_link))
|
||||
if config.custom_link1_name and config.custom_link1_url:
|
||||
buttons.append(InlineKeyboardButton(config.custom_link1_name, url=config.custom_link1_url))
|
||||
if config.custom_link2_name and config.custom_link2_url:
|
||||
buttons.append(InlineKeyboardButton(config.custom_link2_name, url=config.custom_link2_url))
|
||||
|
||||
# Распределяем кнопки по рядам: первая строка 1 кнопка, вторая – 2, третья – 2.
|
||||
row1 = buttons[0:1] if len(buttons) >= 1 else []
|
||||
row2 = buttons[1:3] if len(buttons) >= 3 else buttons[1:] if len(buttons) > 1 else []
|
||||
row3 = buttons[3:5] if len(buttons) >= 5 else []
|
||||
|
||||
# Собираем список рядов, исключая пустые строки
|
||||
keyboard = []
|
||||
if row1:
|
||||
keyboard.append(row1)
|
||||
if row2:
|
||||
keyboard.append(row2)
|
||||
if row3:
|
||||
keyboard.append(row3)
|
||||
|
||||
reply_markup = InlineKeyboardMarkup(keyboard) if keyboard else None
|
||||
|
||||
# Отправка сообщения с изображением, если задано
|
||||
if config.welcome_image:
|
||||
await update.message.reply_photo(
|
||||
photo=config.welcome_image,
|
||||
caption=config.welcome_message,
|
||||
parse_mode="Markdown",
|
||||
reply_markup=reply_markup
|
||||
)
|
||||
else:
|
||||
await update.message.reply_text(
|
||||
text=config.welcome_message,
|
||||
parse_mode="Markdown",
|
||||
reply_markup=reply_markup
|
||||
)
|
||||
BIN
lottery/db.sqlite3
Normal file
57
lottery/docker-compose.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
services:
|
||||
db:
|
||||
image: mariadb:11.6
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${DJANGO_DB_ROOT_PASSWORD:-rootpassword}
|
||||
- MYSQL_DATABASE=${DJANGO_DB_NAME}
|
||||
- MYSQL_USER=${DJANGO_DB_USER}
|
||||
- MYSQL_PASSWORD=${DJANGO_DB_PASSWORD}
|
||||
ports:
|
||||
- "${DJANGO_DB_PORT}:3306"
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
networks:
|
||||
default:
|
||||
|
||||
bot:
|
||||
image: lottery_py
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
entrypoint: ["./wait-for-db.sh"]
|
||||
command: ["python3", "manage.py", "runbot"]
|
||||
depends_on:
|
||||
- db
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .:/app
|
||||
- ./var:/app/var
|
||||
networks:
|
||||
default:
|
||||
|
||||
web:
|
||||
image: lottery_py
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
entrypoint: ["./wait-for-db.sh"]
|
||||
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||
ports:
|
||||
- "${DOCKER_HTTP_BIND:-8000}:8000"
|
||||
depends_on:
|
||||
- db
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .:/app
|
||||
networks:
|
||||
default:
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
0
lottery/draw/__init__.py
Normal file
479
lottery/draw/admin.py
Normal file
@@ -0,0 +1,479 @@
|
||||
# import random
|
||||
# import logging
|
||||
# from asgiref.sync import async_to_sync
|
||||
# from django.contrib import admin, messages
|
||||
# from django.urls import path, reverse
|
||||
# from django.shortcuts import render, redirect, get_object_or_404
|
||||
# from django.utils import timezone
|
||||
# from django.http import HttpResponseRedirect, HttpResponse
|
||||
# from django.utils.html import format_html
|
||||
# from .models import Lottery, Prize, LotteryParticipant, DrawResult
|
||||
# from .forms import AddParticipantsForm
|
||||
# from webapp.models import Invoice, Client, BindingRequest
|
||||
# from bot.notifications import NotificationService
|
||||
# from bot.utils import create_bot_instance
|
||||
|
||||
# # Настройка логгера
|
||||
# logger = logging.getLogger(__name__)
|
||||
# logger.setLevel(logging.DEBUG)
|
||||
# if not logger.handlers:
|
||||
# console_handler = logging.StreamHandler()
|
||||
# console_handler.setLevel(logging.DEBUG)
|
||||
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
# console_handler.setFormatter(formatter)
|
||||
# logger.addHandler(console_handler)
|
||||
|
||||
|
||||
# def add_participants_view(request):
|
||||
# lottery_id = request.GET.get("lottery_id")
|
||||
# if not lottery_id:
|
||||
# return HttpResponse("Не указан параметр lottery_id", status=400)
|
||||
# lottery = get_object_or_404(Lottery, id=lottery_id)
|
||||
|
||||
# used_invoice_ids = LotteryParticipant.objects.filter(lottery=lottery).values_list("invoice_id", flat=True)
|
||||
# qs = Invoice.objects.exclude(id__in=used_invoice_ids)
|
||||
|
||||
# deposit_min = request.GET.get("deposit_min")
|
||||
# deposit_max = request.GET.get("deposit_max")
|
||||
# if deposit_min:
|
||||
# qs = qs.filter(deposit_sum__gte=deposit_min)
|
||||
# if deposit_max:
|
||||
# qs = qs.filter(deposit_sum__lte=deposit_max)
|
||||
|
||||
# if request.method == "POST":
|
||||
# form = AddParticipantsForm(request.POST)
|
||||
# form.fields["invoices"].queryset = qs
|
||||
# if form.is_valid():
|
||||
# selected_invoices = form.cleaned_data["invoices"]
|
||||
# for invoice in selected_invoices:
|
||||
# LotteryParticipant.objects.create(lottery=lottery, invoice=invoice)
|
||||
# messages.success(request, "Участники успешно добавлены.")
|
||||
# return redirect("admin:draw_lotteryparticipant_changelist")
|
||||
# else:
|
||||
# form = AddParticipantsForm()
|
||||
# form.fields["invoices"].queryset = qs
|
||||
|
||||
# context = {"form": form, "lottery": lottery}
|
||||
# return render(request, "admin/add_participants.html", context)
|
||||
|
||||
|
||||
# def get_client_by_invoice(invoice):
|
||||
# """
|
||||
# Возвращает клиента, используя значение поля client_club_card_number у счета.
|
||||
# Предполагается, что у модели Invoice есть поле client_club_card_number.
|
||||
# """
|
||||
# try:
|
||||
# return Client.objects.get(club_card_number=invoice.client_club_card_number)
|
||||
# except Client.DoesNotExist:
|
||||
# return None
|
||||
|
||||
|
||||
# def start_draw(request, lottery_id):
|
||||
# lottery = get_object_or_404(Lottery, id=lottery_id)
|
||||
# logger.info("Запуск розыгрыша для лотереи: %s", lottery.name)
|
||||
|
||||
# notifier = NotificationService(bot=create_bot_instance())
|
||||
# # Используем async_to_sync для уведомления о запуске розыгрыша
|
||||
# async_to_sync(notifier.notify_draw_start)(lottery)
|
||||
|
||||
# for prize in lottery.prizes.all():
|
||||
# logger.info("Обработка приза: %s", prize.prize_place)
|
||||
|
||||
# # Если для приза уже назначен победитель вручную, сохраняем его в таблице результатов
|
||||
# if prize.winner:
|
||||
# logger.info("Приз '%s' имеет установленного вручную победителя. Сохраняем в таблице результатов.", prize.prize_place)
|
||||
# try:
|
||||
# draw_result = lottery.draw_results.get(prize=prize)
|
||||
# draw_result.participant = prize.winner
|
||||
# draw_result.drawn_at = timezone.now()
|
||||
# draw_result.confirmed = False
|
||||
# draw_result.save()
|
||||
# except DrawResult.DoesNotExist:
|
||||
# DrawResult.objects.create(
|
||||
# lottery=lottery,
|
||||
# prize=prize,
|
||||
# participant=prize.winner,
|
||||
# confirmed=False,
|
||||
# drawn_at=timezone.now()
|
||||
# )
|
||||
# continue
|
||||
|
||||
# try:
|
||||
# draw_result = lottery.draw_results.get(prize=prize)
|
||||
# if draw_result.confirmed:
|
||||
# logger.info("Приз '%s' уже подтвержден.", prize.prize_place)
|
||||
# continue
|
||||
# except DrawResult.DoesNotExist:
|
||||
# draw_result = None
|
||||
|
||||
# participants = list(lottery.participants.filter(used=False))
|
||||
# logger.info("Найдено свободных участников для приза '%s': %d", prize.prize_place, len(participants))
|
||||
# if not participants:
|
||||
# logger.warning("Нет свободных участников для приза '%s'.", prize.prize_place)
|
||||
# continue
|
||||
|
||||
# winner_participant = random.choice(participants)
|
||||
# winner_participant.used = True
|
||||
# winner_participant.save()
|
||||
# logger.info("Выбран участник с счетом '%s' для приза '%s'.", winner_participant.invoice.api_id, prize.prize_place)
|
||||
|
||||
# if draw_result:
|
||||
# draw_result.participant = winner_participant
|
||||
# draw_result.drawn_at = timezone.now()
|
||||
# draw_result.confirmed = False
|
||||
# draw_result.save()
|
||||
# logger.info("Обновлен результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
# else:
|
||||
# DrawResult.objects.create(
|
||||
# lottery=lottery,
|
||||
# prize=prize,
|
||||
# participant=winner_participant,
|
||||
# confirmed=False,
|
||||
# drawn_at=timezone.now()
|
||||
# )
|
||||
# logger.info("Создан результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
|
||||
# draw_results = lottery.draw_results.all()
|
||||
# async_to_sync(notifier.notify_draw_results)(lottery, draw_results)
|
||||
# return render(request, "admin/draw_result.html", {"lottery": lottery, "draw_results": draw_results})
|
||||
|
||||
|
||||
# def confirm_draw_result(request, result_id):
|
||||
# from django.http import HttpResponseRedirect
|
||||
# result = get_object_or_404(DrawResult, id=result_id)
|
||||
# result.confirmed = True
|
||||
# result.save()
|
||||
|
||||
# prize = result.prize
|
||||
# prize.winner = result.participant
|
||||
# prize.save()
|
||||
|
||||
# logger.info("Подтвержден результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
# messages.success(request, f"Результат для приза '{prize.prize_place}' подтвержден.")
|
||||
|
||||
# # Получаем клиента по счету участника
|
||||
# client = get_client_by_invoice(result.participant.invoice)
|
||||
# notifier = NotificationService(bot=create_bot_instance())
|
||||
# if client:
|
||||
# async_to_sync(notifier.notify_prize_status_update)(client, result)
|
||||
|
||||
# return HttpResponseRedirect(reverse("admin:start_draw", args=[result.lottery.id]))
|
||||
|
||||
|
||||
# @admin.register(Lottery)
|
||||
# class LotteryAdmin(admin.ModelAdmin):
|
||||
# list_display = ("name", "description", "created_at", "start_draw_button")
|
||||
# search_fields = ("name", "description")
|
||||
|
||||
# def get_urls(self):
|
||||
# urls = super().get_urls()
|
||||
# custom_urls = [
|
||||
# path('<int:lottery_id>/start-draw/', self.admin_site.admin_view(start_draw), name='start_draw'),
|
||||
# path('confirm-draw-result/<int:result_id>/', self.admin_site.admin_view(confirm_draw_result), name='confirm_draw_result'),
|
||||
# ]
|
||||
# return custom_urls + urls
|
||||
|
||||
# def start_draw_button(self, obj):
|
||||
# url = reverse("admin:start_draw", args=[obj.pk])
|
||||
# return format_html('<a class="btn btn-primary" href="{}">Запуск розыгрыша</a>', url)
|
||||
# start_draw_button.short_description = "Розыгрыш"
|
||||
|
||||
|
||||
# @admin.register(Prize)
|
||||
# class PrizeAdmin(admin.ModelAdmin):
|
||||
# list_display = ("lottery", "prize_place", "reward", "winner")
|
||||
# list_filter = ("lottery",)
|
||||
# search_fields = ("prize_place", "description")
|
||||
|
||||
|
||||
# @admin.register(LotteryParticipant)
|
||||
# class LotteryParticipantAdmin(admin.ModelAdmin):
|
||||
# list_display = ("lottery", "invoice", "added_at", "used")
|
||||
# list_filter = ("lottery", "used")
|
||||
# search_fields = ("invoice__api_id", "lottery__name")
|
||||
# change_list_template = "admin/draw/lotteryparticipant/change_list.html"
|
||||
|
||||
# def changelist_view(self, request, extra_context=None):
|
||||
# extra_context = extra_context or {}
|
||||
# from draw.models import Lottery
|
||||
# active_lotteries = Lottery.objects.filter(prizes__winner__isnull=True).distinct()
|
||||
# extra_context['active_lotteries'] = active_lotteries
|
||||
# return super().changelist_view(request, extra_context=extra_context)
|
||||
|
||||
# def get_urls(self):
|
||||
# from django.urls import path
|
||||
# urls = super().get_urls()
|
||||
# custom_urls = [
|
||||
# path('add-participants/', self.admin_site.admin_view(add_participants_view), name="add_participants"),
|
||||
# ]
|
||||
# return custom_urls + urls
|
||||
|
||||
|
||||
# @admin.register(DrawResult)
|
||||
# class DrawResultAdmin(admin.ModelAdmin):
|
||||
# list_display = ("lottery", "prize", "participant", "confirmed", "drawn_at")
|
||||
# list_filter = ("lottery", "confirmed")
|
||||
# search_fields = ("prize__prize_place", "participant__invoice__api_id")
|
||||
|
||||
import random
|
||||
import logging
|
||||
from asgiref.sync import async_to_sync
|
||||
from django.contrib import admin, messages
|
||||
from django.urls import path, reverse
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.utils import timezone
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.utils.html import format_html
|
||||
from .models import Lottery, Prize, LotteryParticipant, DrawResult
|
||||
from .forms import AddParticipantsForm
|
||||
from webapp.models import Invoice, Client, BindingRequest
|
||||
from bot.notifications import NotificationService
|
||||
from bot.utils import create_bot_instance
|
||||
|
||||
# Настройка логгера
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
if not logger.handlers:
|
||||
console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
console_handler.setFormatter(formatter)
|
||||
logger.addHandler(console_handler)
|
||||
|
||||
|
||||
def add_participants_view(request):
|
||||
lottery_id = request.GET.get("lottery_id")
|
||||
if not lottery_id:
|
||||
return HttpResponse("Не указан параметр lottery_id", status=400)
|
||||
lottery = get_object_or_404(Lottery, id=lottery_id)
|
||||
|
||||
# Только счета, у которых used=False, и не добавленные в данную лотерею
|
||||
used_invoice_ids = LotteryParticipant.objects.filter(lottery=lottery).values_list("invoice_id", flat=True)
|
||||
qs = Invoice.objects.filter(used=False).exclude(id__in=used_invoice_ids)
|
||||
|
||||
deposit_min = request.GET.get("deposit_min")
|
||||
deposit_max = request.GET.get("deposit_max")
|
||||
if deposit_min:
|
||||
qs = qs.filter(deposit_sum__gte=deposit_min)
|
||||
if deposit_max:
|
||||
qs = qs.filter(deposit_sum__lte=deposit_max)
|
||||
|
||||
if request.method == "POST":
|
||||
form = AddParticipantsForm(request.POST)
|
||||
form.fields["invoices"].queryset = qs
|
||||
if form.is_valid():
|
||||
selected_invoices = form.cleaned_data["invoices"]
|
||||
for invoice in selected_invoices:
|
||||
# При добавлении участника отмечаем счет как использованный
|
||||
invoice.used = True
|
||||
invoice.save()
|
||||
LotteryParticipant.objects.create(lottery=lottery, invoice=invoice)
|
||||
messages.success(request, "Участники успешно добавлены.")
|
||||
return redirect("admin:draw_lotteryparticipant_changelist")
|
||||
else:
|
||||
form = AddParticipantsForm()
|
||||
form.fields["invoices"].queryset = qs
|
||||
|
||||
context = {"form": form, "lottery": lottery}
|
||||
return render(request, "admin/add_participants.html", context)
|
||||
|
||||
|
||||
def get_client_by_invoice(invoice):
|
||||
"""
|
||||
Возвращает клиента, используя значение поля client_club_card_number у счета.
|
||||
Предполагается, что у модели Invoice есть поле client_club_card_number.
|
||||
"""
|
||||
try:
|
||||
return Client.objects.get(club_card_number=invoice.client_club_card_number)
|
||||
except Client.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def start_draw(request, lottery_id):
|
||||
lottery = get_object_or_404(Lottery, id=lottery_id)
|
||||
logger.info("Запуск розыгрыша для лотереи: %s", lottery.name)
|
||||
|
||||
# Если лотерея уже завершена, кнопку запускать не показываем
|
||||
if lottery.finished:
|
||||
messages.warning(request, "Розыгрыш уже завершён.")
|
||||
return redirect("..")
|
||||
|
||||
notifier = NotificationService(bot=create_bot_instance())
|
||||
async_to_sync(notifier.notify_draw_start)(lottery)
|
||||
|
||||
for prize in lottery.prizes.all():
|
||||
logger.info("Обработка приза: %s", prize.prize_place)
|
||||
|
||||
# Если для приза уже назначен победитель вручную, сохраняем его в таблице результатов
|
||||
if prize.winner:
|
||||
logger.info("Приз '%s' имеет установленного вручную победителя. Сохраняем в таблице результатов.", prize.prize_place)
|
||||
try:
|
||||
draw_result = lottery.draw_results.get(prize=prize)
|
||||
draw_result.participant = prize.winner
|
||||
draw_result.drawn_at = timezone.now()
|
||||
draw_result.confirmed = False
|
||||
draw_result.save()
|
||||
except DrawResult.DoesNotExist:
|
||||
DrawResult.objects.create(
|
||||
lottery=lottery,
|
||||
prize=prize,
|
||||
participant=prize.winner,
|
||||
confirmed=False,
|
||||
drawn_at=timezone.now()
|
||||
)
|
||||
continue
|
||||
|
||||
try:
|
||||
draw_result = lottery.draw_results.get(prize=prize)
|
||||
if draw_result.confirmed:
|
||||
logger.info("Приз '%s' уже подтвержден.", prize.prize_place)
|
||||
continue
|
||||
except DrawResult.DoesNotExist:
|
||||
draw_result = None
|
||||
|
||||
participants = list(lottery.participants.filter(used=False))
|
||||
logger.info("Найдено свободных участников для приза '%s': %d", prize.prize_place, len(participants))
|
||||
if not participants:
|
||||
logger.warning("Нет свободных участников для приза '%s'.", prize.prize_place)
|
||||
continue
|
||||
|
||||
winner_participant = random.choice(participants)
|
||||
winner_participant.used = True
|
||||
winner_participant.save()
|
||||
logger.info("Выбран участник с счетом '%s' для приза '%s'.", winner_participant.invoice.api_id, prize.prize_place)
|
||||
|
||||
if draw_result:
|
||||
draw_result.participant = winner_participant
|
||||
draw_result.drawn_at = timezone.now()
|
||||
draw_result.confirmed = False
|
||||
draw_result.save()
|
||||
logger.info("Обновлен результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
else:
|
||||
DrawResult.objects.create(
|
||||
lottery=lottery,
|
||||
prize=prize,
|
||||
participant=winner_participant,
|
||||
confirmed=False,
|
||||
drawn_at=timezone.now()
|
||||
)
|
||||
logger.info("Создан результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
|
||||
draw_results = lottery.draw_results.all()
|
||||
async_to_sync(notifier.notify_draw_results)(lottery, draw_results)
|
||||
|
||||
# Если все призы розыгрыша подтверждены, устанавливаем флаг завершения лотереи
|
||||
if not lottery.prizes.filter(winner__isnull=True).exists():
|
||||
lottery.finished = True
|
||||
lottery.save()
|
||||
|
||||
return render(request, "admin/draw_result.html", {"lottery": lottery, "draw_results": draw_results})
|
||||
|
||||
|
||||
def confirm_draw_result(request, result_id):
|
||||
from django.http import HttpResponseRedirect
|
||||
result = get_object_or_404(DrawResult, id=result_id)
|
||||
|
||||
# Проверяем, что для результата задан участник и его счет
|
||||
if not result.participant or not result.participant.invoice:
|
||||
messages.error(request, "Невозможно подтвердить результат: отсутствует участник или его счет.")
|
||||
return HttpResponseRedirect(reverse("admin:start_draw", args=[result.lottery.id]))
|
||||
|
||||
result.confirmed = True
|
||||
result.save()
|
||||
|
||||
prize = result.prize
|
||||
prize.winner = result.participant
|
||||
prize.save()
|
||||
|
||||
logger.info("Подтвержден результат розыгрыша для приза '%s'.", prize.prize_place)
|
||||
messages.success(request, f"Результат для приза '{prize.prize_place}' подтвержден.")
|
||||
|
||||
# Получаем клиента по счету участника
|
||||
client = get_client_by_invoice(result.participant.invoice)
|
||||
# Если уведомление вызывает ошибки, можно временно его отключить,
|
||||
# чтобы проверить базовую функциональность подтверждения.
|
||||
if client:
|
||||
try:
|
||||
# Можно попробовать запуск уведомления в отдельном потоке или отключить его временно:
|
||||
async_to_sync(NotificationService(bot=create_bot_instance()).notify_prize_status_update)(client, result)
|
||||
except Exception as e:
|
||||
logger.error(f"Ошибка отправки уведомления о статусе приза пользователю {client.telegram_id}: {e}")
|
||||
|
||||
return HttpResponseRedirect(reverse("admin:start_draw", args=[result.lottery.id]))
|
||||
|
||||
|
||||
@admin.register(Lottery)
|
||||
class LotteryAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "description", "created_at", "finished", "start_draw_button")
|
||||
search_fields = ("name", "description")
|
||||
|
||||
def get_urls(self):
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
path('<int:lottery_id>/start-draw/', self.admin_site.admin_view(start_draw), name='start_draw'),
|
||||
path('confirm-draw-result/<int:result_id>/', self.admin_site.admin_view(confirm_draw_result), name='confirm_draw_result'),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
def start_draw_button(self, obj):
|
||||
# Если лотерея завершена, кнопку скрываем
|
||||
if obj.finished:
|
||||
return ""
|
||||
url = reverse("admin:start_draw", args=[obj.pk])
|
||||
return format_html('<a class="btn btn-primary" href="{}">Запуск розыгрыша</a>', url)
|
||||
start_draw_button.short_description = "Розыгрыш"
|
||||
|
||||
|
||||
@admin.register(Prize)
|
||||
class PrizeAdmin(admin.ModelAdmin):
|
||||
list_display = ("lottery", "prize_place", "reward", "winner")
|
||||
list_filter = ("lottery",)
|
||||
search_fields = ("prize_place", "description")
|
||||
|
||||
def get_form(self, request, obj=None, **kwargs):
|
||||
form = super().get_form(request, obj, **kwargs)
|
||||
# При создании нового приза поле winner скрываем, так как участников ещё нет
|
||||
if obj is None:
|
||||
form.base_fields.pop('winner', None)
|
||||
return form
|
||||
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
if db_field.name == "winner" and request.resolver_match.kwargs.get('object_id'):
|
||||
obj_id = request.resolver_match.kwargs.get('object_id')
|
||||
try:
|
||||
prize_obj = self.model.objects.get(pk=obj_id)
|
||||
# Ограничиваем выбор участниками данной лотереи
|
||||
kwargs["queryset"] = prize_obj.lottery.participants.all()
|
||||
except self.model.DoesNotExist:
|
||||
kwargs["queryset"] = self.model.objects.none()
|
||||
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
||||
|
||||
|
||||
@admin.register(LotteryParticipant)
|
||||
class LotteryParticipantAdmin(admin.ModelAdmin):
|
||||
list_display = ("lottery", "invoice", "added_at", "used")
|
||||
list_filter = ("lottery", "used")
|
||||
search_fields = ("invoice__api_id", "lottery__name")
|
||||
change_list_template = "admin/draw/lotteryparticipant/change_list.html"
|
||||
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
extra_context = extra_context or {}
|
||||
from draw.models import Lottery
|
||||
active_lotteries = Lottery.objects.filter(prizes__winner__isnull=True).distinct()
|
||||
extra_context['active_lotteries'] = active_lotteries
|
||||
return super().changelist_view(request, extra_context=extra_context)
|
||||
|
||||
def get_urls(self):
|
||||
from django.urls import path
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
path('add-participants/', self.admin_site.admin_view(add_participants_view), name="add_participants"),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
|
||||
@admin.register(DrawResult)
|
||||
class DrawResultAdmin(admin.ModelAdmin):
|
||||
list_display = ("lottery", "prize", "participant", "confirmed", "drawn_at")
|
||||
list_filter = ("lottery", "confirmed")
|
||||
search_fields = ("prize__prize_place", "participant__invoice__api_id")
|
||||
7
lottery/draw/apps.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class DrawConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'draw'
|
||||
verbose_name='Розыгрыш'
|
||||
14
lottery/draw/forms.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django import forms
|
||||
from webapp.models import Invoice
|
||||
|
||||
|
||||
class AddParticipantsForm(forms.Form):
|
||||
deposit_min = forms.DecimalField(label="Минимальный депозит", required=False)
|
||||
deposit_max = forms.DecimalField(label="Максимальный депозит", required=False)
|
||||
invoices = forms.ModelMultipleChoiceField(
|
||||
queryset=Invoice.objects.none(),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False,
|
||||
label="Доступные счета"
|
||||
)
|
||||
|
||||
36
lottery/draw/migrations/0001_initial.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 10:42
|
||||
|
||||
import django.db.models.deletion
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('webapp', '0002_invoice'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Lottery',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='Название лотереи')),
|
||||
('description', models.TextField(blank=True, verbose_name='Описание')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Prize',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('prize_place', models.CharField(help_text='Например, 1 место, 2 место и т.д.', max_length=50, verbose_name='Призовое место')),
|
||||
('description', models.TextField(blank=True, verbose_name='Описание приза')),
|
||||
('reward', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=10, verbose_name='Награда')),
|
||||
('lottery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prizes', to='draw.lottery', verbose_name='Лотерея')),
|
||||
('winner', models.ForeignKey(blank=True, help_text='Выберите счет участника лотереи, который выиграл приз', null=True, on_delete=django.db.models.deletion.SET_NULL, to='webapp.invoice', verbose_name='Победитель (счет)')),
|
||||
],
|
||||
),
|
||||
]
|
||||
29
lottery/draw/migrations/0002_lotteryparticipant.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 10:47
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0001_initial'),
|
||||
('webapp', '0002_invoice'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='LotteryParticipant',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('added_at', models.DateTimeField(auto_now_add=True, verbose_name='Дата добавления')),
|
||||
('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='webapp.invoice', verbose_name='Счет участника')),
|
||||
('lottery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participants', to='draw.lottery', verbose_name='Лотерея')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Участник лотереи',
|
||||
'verbose_name_plural': 'Участники лотереи',
|
||||
'unique_together': {('lottery', 'invoice')},
|
||||
},
|
||||
),
|
||||
]
|
||||
19
lottery/draw/migrations/0003_alter_prize_winner.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 10:48
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0002_lotteryparticipant'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='prize',
|
||||
name='winner',
|
||||
field=models.ForeignKey(blank=True, help_text='Выберите счет участника лотереи, который выиграл приз', null=True, on_delete=django.db.models.deletion.SET_NULL, to='draw.lotteryparticipant', verbose_name='Победитель (счет)'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 10:52
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0003_alter_prize_winner'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='lottery',
|
||||
options={'verbose_name': 'Розыгрыш', 'verbose_name_plural': 'Розыгрыши'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='prize',
|
||||
options={'verbose_name': 'Приз', 'verbose_name_plural': 'Призы'},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,56 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 11:19
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0004_alter_lottery_options_alter_prize_options'),
|
||||
('webapp', '0003_alter_client_options_alter_invoice_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='lottery',
|
||||
options={},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='prize',
|
||||
options={},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='lottery',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Дата создания'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='lotteryparticipant',
|
||||
name='used',
|
||||
field=models.BooleanField(default=False, help_text='Отметка, что этот счет уже участвовал в розыгрыше', verbose_name='Использован'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='lotteryparticipant',
|
||||
name='invoice',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='draw.lotteryparticipant', verbose_name='Счет участника'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='prize',
|
||||
name='winner',
|
||||
field=models.ForeignKey(blank=True, help_text='Выберите счет участника лотереи, который выиграл приз', null=True, on_delete=django.db.models.deletion.SET_NULL, to='webapp.invoice', verbose_name='Победитель (счет)'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DrawResult',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('confirmed', models.BooleanField(default=False, verbose_name='Подтвержден')),
|
||||
('drawn_at', models.DateTimeField(auto_now_add=True, verbose_name='Время розыгрыша')),
|
||||
('lottery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='draw_results', to='draw.lottery', verbose_name='Лотерея')),
|
||||
('participant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='draw.lotteryparticipant', verbose_name='Победитель')),
|
||||
('prize', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='draw.prize', verbose_name='Приз')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 11:21
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0005_alter_lottery_options_alter_prize_options_and_more'),
|
||||
('webapp', '0003_alter_client_options_alter_invoice_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lotteryparticipant',
|
||||
name='invoice',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='webapp.invoice', verbose_name='Счет участника'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='prize',
|
||||
name='winner',
|
||||
field=models.ForeignKey(blank=True, help_text='Выберите счет участника лотереи, который выиграл приз', null=True, on_delete=django.db.models.deletion.SET_NULL, to='draw.lotteryparticipant', verbose_name='Победитель (счет)'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-06 11:29
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0006_alter_lotteryparticipant_invoice_alter_prize_winner'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='drawresult',
|
||||
options={'verbose_name': 'Результат розыгрыша', 'verbose_name_plural': 'Результаты розыгрыша'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='lottery',
|
||||
options={'verbose_name': 'Лотерея', 'verbose_name_plural': 'Лотереи'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='prize',
|
||||
options={'verbose_name': 'Приз', 'verbose_name_plural': 'Призы'},
|
||||
),
|
||||
]
|
||||
18
lottery/draw/migrations/0008_lottery_finished.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-22 22:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('draw', '0007_alter_drawresult_options_alter_lottery_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lottery',
|
||||
name='finished',
|
||||
field=models.BooleanField(default=False, verbose_name='Завершена'),
|
||||
),
|
||||
]
|
||||
0
lottery/draw/migrations/__init__.py
Normal file
113
lottery/draw/models.py
Normal file
@@ -0,0 +1,113 @@
|
||||
from django.db import models
|
||||
from decimal import Decimal
|
||||
from webapp.models import Invoice # Явно импортируем модель Invoice из приложения webapp
|
||||
|
||||
class Lottery(models.Model):
|
||||
name = models.CharField("Название лотереи", max_length=255)
|
||||
description = models.TextField("Описание", blank=True)
|
||||
created_at = models.DateTimeField("Дата создания", auto_now_add=True)
|
||||
finished = models.BooleanField(default=False, verbose_name="Завершена")
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Лотерея"
|
||||
verbose_name_plural = "Лотереи"
|
||||
|
||||
|
||||
class Prize(models.Model):
|
||||
lottery = models.ForeignKey(
|
||||
Lottery,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="prizes",
|
||||
verbose_name="Лотерея"
|
||||
)
|
||||
prize_place = models.CharField(
|
||||
"Призовое место",
|
||||
max_length=50,
|
||||
help_text="Например, 1 место, 2 место и т.д."
|
||||
)
|
||||
description = models.TextField("Описание приза", blank=True)
|
||||
reward = models.DecimalField(
|
||||
"Награда",
|
||||
max_digits=10,
|
||||
decimal_places=2,
|
||||
default=Decimal("0.00")
|
||||
)
|
||||
# Победитель назначается администратором из списка участников лотереи (LotteryParticipant)
|
||||
winner = models.ForeignKey(
|
||||
"draw.LotteryParticipant",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="Победитель (счет)",
|
||||
help_text="Выберите счет участника лотереи, который выиграл приз"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.prize_place} - {self.lottery.name}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Приз"
|
||||
verbose_name_plural = "Призы"
|
||||
|
||||
|
||||
class LotteryParticipant(models.Model):
|
||||
lottery = models.ForeignKey(
|
||||
Lottery,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="participants",
|
||||
verbose_name="Лотерея"
|
||||
)
|
||||
# Ссылка на счет-участник из приложения webapp (модель Invoice)
|
||||
invoice = models.ForeignKey(
|
||||
Invoice,
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name="Счет участника"
|
||||
)
|
||||
added_at = models.DateTimeField("Дата добавления", auto_now_add=True)
|
||||
used = models.BooleanField("Использован", default=False,
|
||||
help_text="Отметка, что этот счет уже участвовал в розыгрыше")
|
||||
|
||||
class Meta:
|
||||
unique_together = ("lottery", "invoice")
|
||||
verbose_name = "Участник лотереи"
|
||||
verbose_name_plural = "Участники лотереи"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.invoice} в {self.lottery.name}"
|
||||
|
||||
|
||||
class DrawResult(models.Model):
|
||||
"""
|
||||
Результат розыгрыша для конкретного приза.
|
||||
Каждому призу соответствует один активный результат розыгрыша.
|
||||
"""
|
||||
lottery = models.ForeignKey(
|
||||
Lottery,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="draw_results",
|
||||
verbose_name="Лотерея"
|
||||
)
|
||||
prize = models.OneToOneField(
|
||||
Prize,
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name="Приз"
|
||||
)
|
||||
# Ссылка на участника (LotteryParticipant), выбранного в розыгрыше
|
||||
participant = models.ForeignKey(
|
||||
LotteryParticipant,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="Победитель"
|
||||
)
|
||||
confirmed = models.BooleanField("Подтвержден", default=False)
|
||||
drawn_at = models.DateTimeField("Время розыгрыша", auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Результат для {self.prize} — {self.participant}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Результат розыгрыша"
|
||||
verbose_name_plural = "Результаты розыгрыша"
|
||||
3
lottery/draw/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
lottery/draw/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
5
lottery/entrypoint.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Запускаем бота в фоне
|
||||
python3 manage.py runbot &
|
||||
# Запускаем веб-сервер
|
||||
python3 manage.py runserver 0.0.0.0:8000
|
||||
137
lottery/invoices.py
Normal file
@@ -0,0 +1,137 @@
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
def fetch_invoices(api_url, api_key=None, params=None):
|
||||
"""
|
||||
Запрашивает счета с API по указанному URL.
|
||||
|
||||
Параметры:
|
||||
api_url (str): URL для получения счетов.
|
||||
api_key (str, optional): API ключ для авторизации.
|
||||
params (dict, optional): Параметры запроса.
|
||||
|
||||
Возвращает:
|
||||
dict: Декодированный JSON-ответ при успешном запросе или None в случае ошибки.
|
||||
"""
|
||||
headers = {
|
||||
"accept": "application/ld+json"
|
||||
}
|
||||
if api_key:
|
||||
headers["X-API-Key"] = api_key
|
||||
|
||||
try:
|
||||
response = requests.get(api_url, headers=headers, params=params)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Ошибка при запросе счетов: {e}")
|
||||
return None
|
||||
|
||||
def print_invoice(invoice):
|
||||
"""
|
||||
Выводит информацию об одном счёте.
|
||||
"""
|
||||
print("-" * 60)
|
||||
print(f"Invoice: {invoice.get('@id', 'N/A')}")
|
||||
print(f" Type: {invoice.get('@type', 'N/A')}")
|
||||
print(f" Created at: {invoice.get('created_at', 'N/A')}")
|
||||
print(f" Closed at: {invoice.get('closed_at', 'N/A')}")
|
||||
print(f" External ID: {invoice.get('ext_id', 'N/A')}")
|
||||
print(f" External Type: {invoice.get('ext_type', 'N/A')}")
|
||||
|
||||
# Данные клиента
|
||||
client = invoice.get("client", {})
|
||||
print(" Client:")
|
||||
print(f" ID: {client.get('@id', 'N/A')}")
|
||||
print(f" Type: {client.get('@type', 'N/A')}")
|
||||
print(f" Name: {client.get('name', 'N/A')}")
|
||||
print(f" Club Card Number: {client.get('club_card_num', 'N/A')}")
|
||||
|
||||
# Финансовые данные
|
||||
print(f" Sum: {invoice.get('sum', 'N/A')}")
|
||||
print(f" Company Number: {invoice.get('comp_num', 'N/A')}")
|
||||
print(f" Bonus: {invoice.get('bonus', 'N/A')}")
|
||||
print(f" Start Bonus: {invoice.get('start_bonus', 'N/A')}")
|
||||
print(f" Deposit Sum: {invoice.get('deposit_sum', 'N/A')}")
|
||||
print(f" Notes: {invoice.get('notes', 'N/A')}")
|
||||
print("-" * 60)
|
||||
|
||||
def print_view(view):
|
||||
"""
|
||||
Выводит информацию о навигации (пагинация) коллекции.
|
||||
"""
|
||||
print("\nНавигация коллекции:")
|
||||
print(f" View ID: {view.get('@id', 'N/A')}")
|
||||
print(f" Type: {view.get('@type', 'N/A')}")
|
||||
print(f" First page: {view.get('first', 'N/A')}")
|
||||
print(f" Last page: {view.get('last', 'N/A')}")
|
||||
print(f" Previous page: {view.get('previous', 'N/A')}")
|
||||
print(f" Next page: {view.get('next', 'N/A')}")
|
||||
|
||||
def print_search(search):
|
||||
"""
|
||||
Выводит информацию о параметрах поиска.
|
||||
"""
|
||||
print("\nПараметры поиска:")
|
||||
print(f" Type: {search.get('@type', 'N/A')}")
|
||||
print(f" Template: {search.get('template', 'N/A')}")
|
||||
print(f" Variable Representation: {search.get('variableRepresentation', 'N/A')}")
|
||||
mapping = search.get('mapping', [])
|
||||
if mapping:
|
||||
print(" Mapping:")
|
||||
for m in mapping:
|
||||
print(f" Variable: {m.get('variable', 'N/A')}")
|
||||
print(f" Property: {m.get('property', 'N/A')}")
|
||||
print(f" Required: {m.get('required', 'N/A')}")
|
||||
else:
|
||||
print(" Mapping: N/A")
|
||||
|
||||
def print_invoices_data(data):
|
||||
"""
|
||||
Анализирует и выводит всю информацию, полученную от API.
|
||||
"""
|
||||
total_items = data.get("totalItems", 0)
|
||||
print(f"\nОбщее количество счетов: {total_items}\n")
|
||||
|
||||
# Разбор счетов
|
||||
members = data.get("member", [])
|
||||
if members:
|
||||
print("Счета:")
|
||||
for invoice in members:
|
||||
print_invoice(invoice)
|
||||
else:
|
||||
print("Счета не найдены.")
|
||||
|
||||
# Разбор навигационной информации
|
||||
view = data.get("view")
|
||||
if view:
|
||||
print_view(view)
|
||||
else:
|
||||
print("\nИнформация о навигации не предоставлена.")
|
||||
|
||||
# Разбор параметров поиска
|
||||
search = data.get("search")
|
||||
if search:
|
||||
print_search(search)
|
||||
else:
|
||||
print("\nИнформация о параметрах поиска не предоставлена.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
base_url = "http://10.8.0.4:8000/api/invoices"
|
||||
params = {
|
||||
"page": 1,
|
||||
"created_at[before]": "2025-03-05", # можно изменить диапазон дат по необходимости
|
||||
"created_at[after]": "2025-02-01"
|
||||
}
|
||||
api_key = os.getenv("API_KEY") # Если API-ключ не требуется, можно оставить None
|
||||
|
||||
data = fetch_invoices(base_url, api_key, params)
|
||||
|
||||
if data is not None:
|
||||
print_invoices_data(data)
|
||||
else:
|
||||
print("Не удалось получить данные счетов с API.")
|
||||
0
lottery/lottery/__init__.py
Normal file
16
lottery/lottery/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for lottery project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottery.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
212
lottery/lottery/settings.py
Normal file
@@ -0,0 +1,212 @@
|
||||
"""
|
||||
Django settings for lottery project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 5.1.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = os.getenv('DJANGO_DEBUG')
|
||||
|
||||
ALLOWED_HOSTS = [os.getenv('DJANGO_ALLOWED_HOSTS'),]
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'jazzmin',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'webapp',
|
||||
'draw',
|
||||
'bot',
|
||||
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'lottery.urls'
|
||||
|
||||
import os
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')], # Убедитесь, что шаблоны лежат здесь
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request', # Для админки
|
||||
'django.contrib.auth.context_processors.auth', # Для админки
|
||||
'django.contrib.messages.context_processors.messages', # Для админки
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'lottery.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
||||
|
||||
DB_ENGINE = os.getenv('DJANGO_DB_ENGINE', 'sqlite').lower()
|
||||
|
||||
if DB_ENGINE == 'mariadb' or DB_ENGINE == 'mysql':
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql', # или 'django.db.backends.mysql' для MariaDB
|
||||
'NAME': os.getenv('DJANGO_DB_NAME', 'lottery'),
|
||||
'USER': os.getenv('DJANGO_DB_USER', 'your_username'),
|
||||
'PASSWORD': os.getenv('DJANGO_DB_PASSWORD', 'your_password'),
|
||||
'HOST': os.getenv('DJANGO_DB_HOST', 'localhost'),
|
||||
'PORT': os.getenv('DJANGO_DB_PORT', '3306'),
|
||||
'OPTIONS': {
|
||||
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
|
||||
},
|
||||
}
|
||||
}
|
||||
else: # по умолчанию SQLite
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / os.getenv('DJANGO_DB_NAME', 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'ru-RU'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATICFILES_DIRS = [BASE_DIR / "static",]
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
|
||||
JAZZMIN_SETTINGS = {
|
||||
# Общие настройки
|
||||
"site_title": "LuckyTicket",
|
||||
"site_header": "Lucky Ticket",
|
||||
"site_brand": "EasyPlay",
|
||||
"welcome_sign": "Добро пожаловать в аLuckyTicket",
|
||||
"copyright": "© 2025 LuckyTicket",
|
||||
|
||||
# Верхнее меню
|
||||
"topmenu_links": [
|
||||
{"name": "Домой", "url": "admin:index", "permissions": ["auth.view_user"]},
|
||||
{"app": "auth", "model": "user"},
|
||||
{"app": "draw", "label": "Розыгрыши"},
|
||||
],
|
||||
|
||||
# Меню пользователя (справа сверху)
|
||||
"usermenu_links": [
|
||||
{"name": "Мой профиль", "url": "admin:password_change", "icon": "fas fa-user"},
|
||||
{"model": "auth.user"},
|
||||
],
|
||||
|
||||
# Настройка сайдбара
|
||||
"show_sidebar": True,
|
||||
"navigation_expanded": False, # развёрнутый сайдбар по умолчанию
|
||||
"sidebar_nav_styles": {
|
||||
# Пример: добавляем отступ для вложенных элементов
|
||||
"default": {
|
||||
"indent": 20, # отступ в пикселях
|
||||
}
|
||||
},
|
||||
|
||||
# Иконки для моделей
|
||||
"icons": {
|
||||
"bot" : "fa-solid fa-robot",
|
||||
"bot.BotConfig" : "fa-solid fa-wrench",
|
||||
"bot.WelcomeMessage" : "fa-solid fa-message",
|
||||
"auth": "fas fa-user",
|
||||
"auth.user": "fas fa-user",
|
||||
"auth.Group": "fas fa-users",
|
||||
"draw" : "fa-solid fa-dice",
|
||||
"draw.lottery": "fas fa-ticket-alt",
|
||||
"draw.prize": "fas fa-gift",
|
||||
"draw.lotteryparticipant": "fas fa-user-check",
|
||||
"draw.drawresult": "fas fa-trophy",
|
||||
"webapp" : "fas fa-globe",
|
||||
"webapp.client": "fas fa-address-card",
|
||||
"webapp.invoice": "fas fa-file-invoice-dollar",
|
||||
"webapp.BindingRequest" : "fas fa-link",
|
||||
},
|
||||
|
||||
# Формат представления форм (если нужно)
|
||||
"changeform_format": "horizontal_tabs",
|
||||
|
||||
# Дополнительные настройки (можно добавить свои CSS/JS файлы)
|
||||
"custom_css": "css/custom.css",
|
||||
"custom_js": None,
|
||||
"show_ui_builder": False,
|
||||
}
|
||||
25
lottery/lottery/urls.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
URL configuration for lottery project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/5.1/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.shortcuts import redirect
|
||||
|
||||
urlpatterns = [
|
||||
path('', lambda request: redirect('admin:index')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('invoices/', include('webapp.urls'))
|
||||
]
|
||||
16
lottery/lottery/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for lottery project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottery.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
22
lottery/manage.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottery.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
20
lottery/requirements.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
anyio==4.9.0
|
||||
asgiref==3.8.1
|
||||
certifi==2025.1.31
|
||||
charset-normalizer==3.4.1
|
||||
Django==5.1.6
|
||||
django-jazzmin==3.0.1
|
||||
exceptiongroup==1.2.2
|
||||
h11==0.14.0
|
||||
httpcore==1.0.7
|
||||
httpx==0.28.1
|
||||
idna==3.10
|
||||
pillow==11.1.0
|
||||
python-dotenv==1.0.1
|
||||
python-telegram-bot==22.0
|
||||
requests==2.32.3
|
||||
sniffio==1.3.1
|
||||
sqlparse==0.5.3
|
||||
typing_extensions==4.12.2
|
||||
urllib3==2.3.0
|
||||
mysqlclient
|
||||
5
lottery/static/css/custom.css
Normal file
@@ -0,0 +1,5 @@
|
||||
.nav-treeview .nav-link {
|
||||
padding-left: 30px !important;
|
||||
font-size: 0.9em;
|
||||
color: #6c757d;
|
||||
}
|
||||
2
lottery/static/js/jquery.min.js
vendored
Normal file
BIN
lottery/static/upload_image/photo_2024-12-17_12-48-31.jpg
Normal file
|
After Width: | Height: | Size: 101 KiB |
279
lottery/staticfiles/admin/css/autocomplete.css
Normal file
@@ -0,0 +1,279 @@
|
||||
select.admin-autocomplete {
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container {
|
||||
min-height: 30px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single,
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple {
|
||||
min-height: 30px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--focus .select2-selection,
|
||||
.select2-container--admin-autocomplete.select2-container--open .select2-selection {
|
||||
border-color: var(--body-quiet-color);
|
||||
min-height: 30px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--focus .select2-selection.select2-selection--single,
|
||||
.select2-container--admin-autocomplete.select2-container--open .select2-selection.select2-selection--single {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--focus .select2-selection.select2-selection--multiple,
|
||||
.select2-container--admin-autocomplete.select2-container--open .select2-selection.select2-selection--multiple {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single {
|
||||
background-color: var(--body-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__rendered {
|
||||
color: var(--body-fg);
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__placeholder {
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
left: 1px;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--single {
|
||||
background-color: var(--darkened-bg);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple {
|
||||
background-color: var(--body-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__rendered {
|
||||
box-sizing: border-box;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 10px 5px 5px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__rendered li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__placeholder {
|
||||
color: var(--body-quiet-color);
|
||||
margin-top: 5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: var(--darkened-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: var(--body-quiet-color);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--admin-autocomplete[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--admin-autocomplete[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--focus .select2-selection--multiple {
|
||||
border: solid var(--body-quiet-color) 1px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--multiple {
|
||||
background-color: var(--darkened-bg);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection__choice__remove {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--open.select2-container--above .select2-selection--single, .select2-container--admin-autocomplete.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete.select2-container--open.select2-container--below .select2-selection--single, .select2-container--admin-autocomplete.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-search--dropdown {
|
||||
background: var(--darkened-bg);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-search--dropdown .select2-search__field {
|
||||
background: var(--body-bg);
|
||||
color: var(--body-fg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-search--inline .select2-search__field {
|
||||
background: transparent;
|
||||
color: var(--body-fg);
|
||||
border: none;
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
color: var(--body-fg);
|
||||
background: var(--body-bg);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option[role=group] {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option[aria-disabled=true] {
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option[aria-selected=true] {
|
||||
background-color: var(--selected-bg);
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__group {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -1em;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -2em;
|
||||
padding-left: 3em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -3em;
|
||||
padding-left: 4em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -4em;
|
||||
padding-left: 5em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -5em;
|
||||
padding-left: 6em;
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: var(--primary);
|
||||
color: var(--primary-fg);
|
||||
}
|
||||
|
||||
.select2-container--admin-autocomplete .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.errors .select2-selection {
|
||||
border: 1px solid var(--error-fg);
|
||||
}
|
||||
1179
lottery/staticfiles/admin/css/base.css
Normal file
343
lottery/staticfiles/admin/css/changelists.css
Normal file
@@ -0,0 +1,343 @@
|
||||
/* CHANGELISTS */
|
||||
|
||||
#changelist {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#changelist .changelist-form-container {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
#changelist table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.change-list .hiddenfields { display:none; }
|
||||
|
||||
.change-list .filtered table {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.change-list .filtered {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.change-list .filtered .results, .change-list .filtered .paginator,
|
||||
.filtered #toolbar, .filtered div.xfull {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.change-list .filtered table tbody th {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
#changelist-form .results {
|
||||
overflow-x: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#changelist .toplinks {
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
#changelist .paginator {
|
||||
color: var(--body-quiet-color);
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
background: var(--body-bg);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* CHANGELIST TABLES */
|
||||
|
||||
#changelist table thead th {
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#changelist table thead th.action-checkbox-column {
|
||||
width: 1.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#changelist table tbody td.action-checkbox {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#changelist table tfoot {
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
/* TOOLBAR */
|
||||
|
||||
#toolbar {
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 15px;
|
||||
border-top: 1px solid var(--hairline-color);
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
background: var(--darkened-bg);
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
#toolbar form input {
|
||||
border-radius: 4px;
|
||||
font-size: 0.875rem;
|
||||
padding: 5px;
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
#toolbar #searchbar {
|
||||
height: 1.1875rem;
|
||||
border: 1px solid var(--border-color);
|
||||
padding: 2px 5px;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
font-size: 0.8125rem;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#toolbar #searchbar:focus {
|
||||
border-color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
#toolbar form input[type="submit"] {
|
||||
border: 1px solid var(--border-color);
|
||||
font-size: 0.8125rem;
|
||||
padding: 4px 8px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
background: var(--body-bg);
|
||||
box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
|
||||
cursor: pointer;
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
#toolbar form input[type="submit"]:focus,
|
||||
#toolbar form input[type="submit"]:hover {
|
||||
border-color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
#changelist-search img {
|
||||
vertical-align: middle;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
#changelist-search .help {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* FILTER COLUMN */
|
||||
|
||||
#changelist-filter {
|
||||
flex: 0 0 240px;
|
||||
order: 1;
|
||||
background: var(--darkened-bg);
|
||||
border-left: none;
|
||||
margin: 0 0 0 30px;
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
#changelist-filter {
|
||||
border: 1px solid;
|
||||
}
|
||||
}
|
||||
|
||||
#changelist-filter h2 {
|
||||
font-size: 0.875rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
padding: 5px 15px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#changelist-filter h3,
|
||||
#changelist-filter details summary {
|
||||
font-weight: 400;
|
||||
padding: 0 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#changelist-filter details summary > * {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#changelist-filter details > summary {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#changelist-filter details > summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#changelist-filter details > summary::before {
|
||||
content: '→';
|
||||
font-weight: bold;
|
||||
color: var(--link-hover-color);
|
||||
}
|
||||
|
||||
#changelist-filter details[open] > summary::before {
|
||||
content: '↓';
|
||||
}
|
||||
|
||||
#changelist-filter ul {
|
||||
margin: 5px 0;
|
||||
padding: 0 15px 15px;
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
#changelist-filter ul:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#changelist-filter li {
|
||||
list-style-type: none;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
#changelist-filter a {
|
||||
display: block;
|
||||
color: var(--body-quiet-color);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
#changelist-filter li.selected {
|
||||
border-left: 5px solid var(--hairline-color);
|
||||
padding-left: 10px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
#changelist-filter li.selected a {
|
||||
color: var(--link-selected-fg);
|
||||
}
|
||||
|
||||
#changelist-filter a:focus, #changelist-filter a:hover,
|
||||
#changelist-filter li.selected a:focus,
|
||||
#changelist-filter li.selected a:hover {
|
||||
color: var(--link-hover-color);
|
||||
}
|
||||
|
||||
#changelist-filter #changelist-filter-extra-actions {
|
||||
font-size: 0.8125rem;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
/* DATE DRILLDOWN */
|
||||
|
||||
.change-list .toplinks {
|
||||
display: flex;
|
||||
padding-bottom: 5px;
|
||||
flex-wrap: wrap;
|
||||
gap: 3px 17px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.change-list .toplinks a {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.change-list .toplinks .date-back {
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.change-list .toplinks .date-back:focus,
|
||||
.change-list .toplinks .date-back:hover {
|
||||
color: var(--link-hover-color);
|
||||
}
|
||||
|
||||
/* ACTIONS */
|
||||
|
||||
.filtered .actions {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
#changelist table input {
|
||||
margin: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/* Once the :has() pseudo-class is supported by all browsers, the tr.selected
|
||||
selector and the JS adding the class can be removed. */
|
||||
#changelist tbody tr.selected {
|
||||
background-color: var(--selected-row);
|
||||
}
|
||||
|
||||
#changelist tbody tr:has(.action-select:checked) {
|
||||
background-color: var(--selected-row);
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
#changelist tbody tr.selected {
|
||||
background-color: SelectedItem;
|
||||
}
|
||||
#changelist tbody tr:has(.action-select:checked) {
|
||||
background-color: SelectedItem;
|
||||
}
|
||||
}
|
||||
|
||||
#changelist .actions {
|
||||
padding: 10px;
|
||||
background: var(--body-bg);
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
line-height: 1.5rem;
|
||||
color: var(--body-quiet-color);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#changelist .actions span.all,
|
||||
#changelist .actions span.action-counter,
|
||||
#changelist .actions span.clear,
|
||||
#changelist .actions span.question {
|
||||
font-size: 0.8125rem;
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
|
||||
#changelist .actions:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#changelist .actions select {
|
||||
vertical-align: top;
|
||||
height: 1.5rem;
|
||||
color: var(--body-fg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
font-size: 0.875rem;
|
||||
padding: 0 0 0 4px;
|
||||
margin: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#changelist .actions select:focus {
|
||||
border-color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
#changelist .actions label {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
#changelist .actions .button {
|
||||
font-size: 0.8125rem;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
background: var(--body-bg);
|
||||
box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
|
||||
cursor: pointer;
|
||||
height: 1.5rem;
|
||||
line-height: 1;
|
||||
padding: 4px 8px;
|
||||
margin: 0;
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
#changelist .actions .button:focus, #changelist .actions .button:hover {
|
||||
border-color: var(--body-quiet-color);
|
||||
}
|
||||
12
lottery/staticfiles/admin/css/custom.css
Normal file
@@ -0,0 +1,12 @@
|
||||
/* custom.css */
|
||||
|
||||
/* Пример отступа для вложенных пунктов сайдбара */
|
||||
.sidebar-nav .nav-child {
|
||||
padding-left: 50px !important;
|
||||
}
|
||||
|
||||
/* Дополнительный стиль для более яркого визуального разделения вложенных элементов */
|
||||
.sidebar-nav .nav-child > a {
|
||||
font-size: 0.9em;
|
||||
color: #6c757d;
|
||||
}
|
||||
130
lottery/staticfiles/admin/css/dark_mode.css
Normal file
@@ -0,0 +1,130 @@
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--primary: #264b5d;
|
||||
--primary-fg: #f7f7f7;
|
||||
|
||||
--body-fg: #eeeeee;
|
||||
--body-bg: #121212;
|
||||
--body-quiet-color: #d0d0d0;
|
||||
--body-medium-color: #e0e0e0;
|
||||
--body-loud-color: #ffffff;
|
||||
|
||||
--breadcrumbs-link-fg: #e0e0e0;
|
||||
--breadcrumbs-bg: var(--primary);
|
||||
|
||||
--link-fg: #81d4fa;
|
||||
--link-hover-color: #4ac1f7;
|
||||
--link-selected-fg: #6f94c6;
|
||||
|
||||
--hairline-color: #272727;
|
||||
--border-color: #353535;
|
||||
|
||||
--error-fg: #e35f5f;
|
||||
--message-success-bg: #006b1b;
|
||||
--message-warning-bg: #583305;
|
||||
--message-error-bg: #570808;
|
||||
|
||||
--darkened-bg: #212121;
|
||||
--selected-bg: #1b1b1b;
|
||||
--selected-row: #00363a;
|
||||
|
||||
--close-button-bg: #333333;
|
||||
--close-button-hover-bg: #666666;
|
||||
|
||||
color-scheme: dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
html[data-theme="dark"] {
|
||||
--primary: #264b5d;
|
||||
--primary-fg: #f7f7f7;
|
||||
|
||||
--body-fg: #eeeeee;
|
||||
--body-bg: #121212;
|
||||
--body-quiet-color: #d0d0d0;
|
||||
--body-medium-color: #e0e0e0;
|
||||
--body-loud-color: #ffffff;
|
||||
|
||||
--breadcrumbs-link-fg: #e0e0e0;
|
||||
--breadcrumbs-bg: var(--primary);
|
||||
|
||||
--link-fg: #81d4fa;
|
||||
--link-hover-color: #4ac1f7;
|
||||
--link-selected-fg: #6f94c6;
|
||||
|
||||
--hairline-color: #272727;
|
||||
--border-color: #353535;
|
||||
|
||||
--error-fg: #e35f5f;
|
||||
--message-success-bg: #006b1b;
|
||||
--message-warning-bg: #583305;
|
||||
--message-error-bg: #570808;
|
||||
|
||||
--darkened-bg: #212121;
|
||||
--selected-bg: #1b1b1b;
|
||||
--selected-row: #00363a;
|
||||
|
||||
--close-button-bg: #333333;
|
||||
--close-button-hover-bg: #666666;
|
||||
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
/* THEME SWITCH */
|
||||
.theme-toggle {
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 5px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.theme-toggle svg {
|
||||
vertical-align: middle;
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Fully hide screen reader text so we only show the one matching the current
|
||||
theme.
|
||||
*/
|
||||
.theme-toggle .visually-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[data-theme="auto"] .theme-toggle .theme-label-when-auto {
|
||||
display: block;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .theme-toggle .theme-label-when-dark {
|
||||
display: block;
|
||||
}
|
||||
|
||||
html[data-theme="light"] .theme-toggle .theme-label-when-light {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
.theme-toggle svg.theme-icon-when-auto,
|
||||
.theme-toggle svg.theme-icon-when-dark,
|
||||
.theme-toggle svg.theme-icon-when-light {
|
||||
fill: var(--header-link-color);
|
||||
color: var(--header-bg);
|
||||
}
|
||||
|
||||
html[data-theme="auto"] .theme-toggle svg.theme-icon-when-auto {
|
||||
display: block;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .theme-toggle svg.theme-icon-when-dark {
|
||||
display: block;
|
||||
}
|
||||
|
||||
html[data-theme="light"] .theme-toggle svg.theme-icon-when-light {
|
||||
display: block;
|
||||
}
|
||||
29
lottery/staticfiles/admin/css/dashboard.css
Normal file
@@ -0,0 +1,29 @@
|
||||
/* DASHBOARD */
|
||||
.dashboard td, .dashboard th {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.dashboard .module table th {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dashboard .module table td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dashboard .module table td a {
|
||||
display: block;
|
||||
padding-right: .6em;
|
||||
}
|
||||
|
||||
/* RECENT ACTIONS MODULE */
|
||||
|
||||
.module ul.actionlist {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
ul.actionlist li {
|
||||
list-style-type: none;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
512
lottery/staticfiles/admin/css/forms.css
Normal file
@@ -0,0 +1,512 @@
|
||||
@import url('widgets.css');
|
||||
|
||||
/* FORM ROWS */
|
||||
|
||||
.form-row {
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
font-size: 0.8125rem;
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
.form-row img, .form-row input {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.form-row label input[type="checkbox"] {
|
||||
margin-top: 0;
|
||||
vertical-align: 0;
|
||||
}
|
||||
|
||||
form .form-row p {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.form-multiline {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.form-multiline > div {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* FORM LABELS */
|
||||
|
||||
label {
|
||||
font-weight: normal;
|
||||
color: var(--body-quiet-color);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.required label, label.required {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* RADIO BUTTONS */
|
||||
|
||||
form div.radiolist div {
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
form div.radiolist.inline div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
form div.radiolist label {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
form div.radiolist input[type="radio"] {
|
||||
margin: -2px 4px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form ul.inline {
|
||||
margin-left: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form ul.inline li {
|
||||
float: left;
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
/* FIELDSETS */
|
||||
|
||||
fieldset .fieldset-heading,
|
||||
fieldset .inline-heading,
|
||||
:not(.inline-related) .collapse summary {
|
||||
border: 1px solid var(--header-bg);
|
||||
margin: 0;
|
||||
padding: 8px;
|
||||
font-weight: 400;
|
||||
font-size: 0.8125rem;
|
||||
background: var(--header-bg);
|
||||
color: var(--header-link-color);
|
||||
}
|
||||
|
||||
/* ALIGNED FIELDSETS */
|
||||
|
||||
.aligned label {
|
||||
display: block;
|
||||
padding: 4px 10px 0 0;
|
||||
min-width: 160px;
|
||||
width: 160px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.aligned label:not(.vCheckboxLabel):after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.aligned label + p, .aligned .checkbox-row + div.help, .aligned label + div.readonly {
|
||||
padding: 6px 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.aligned ul label {
|
||||
display: inline;
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.aligned .form-row input {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.colMS .aligned .vLargeTextField, .colMS .aligned .vXMLLargeTextField {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
form .aligned ul {
|
||||
margin-left: 160px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
form .aligned div.radiolist {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form .aligned p.help,
|
||||
form .aligned div.help {
|
||||
margin-top: 0;
|
||||
margin-left: 160px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
form .aligned p.date div.help.timezonewarning,
|
||||
form .aligned p.datetime div.help.timezonewarning,
|
||||
form .aligned p.time div.help.timezonewarning {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
form .aligned p.help:last-child,
|
||||
form .aligned div.help:last-child {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
form .aligned input + p.help,
|
||||
form .aligned textarea + p.help,
|
||||
form .aligned select + p.help,
|
||||
form .aligned input + div.help,
|
||||
form .aligned textarea + div.help,
|
||||
form .aligned select + div.help {
|
||||
margin-left: 160px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
form .aligned select option:checked {
|
||||
background-color: var(--selected-row);
|
||||
}
|
||||
|
||||
form .aligned ul li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
form .aligned table p {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.aligned .vCheckboxLabel {
|
||||
padding: 1px 0 0 5px;
|
||||
}
|
||||
|
||||
.aligned .vCheckboxLabel + p.help,
|
||||
.aligned .vCheckboxLabel + div.help {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField {
|
||||
width: 610px;
|
||||
}
|
||||
|
||||
fieldset .fieldBox {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
/* WIDE FIELDSETS */
|
||||
|
||||
.wide label {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
form .wide p.help,
|
||||
form .wide ul.errorlist,
|
||||
form .wide div.help {
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
form div.help ul {
|
||||
padding-left: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField {
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
/* COLLAPSIBLE FIELDSETS */
|
||||
|
||||
.collapse summary .fieldset-heading,
|
||||
.collapse summary .inline-heading {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: currentColor;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* MONOSPACE TEXTAREAS */
|
||||
|
||||
fieldset.monospace textarea {
|
||||
font-family: var(--font-family-monospace);
|
||||
}
|
||||
|
||||
/* SUBMIT ROW */
|
||||
|
||||
.submit-row {
|
||||
padding: 12px 14px 12px;
|
||||
margin: 0 0 20px;
|
||||
background: var(--darkened-bg);
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
body.popup .submit-row {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.submit-row input {
|
||||
height: 2.1875rem;
|
||||
line-height: 0.9375rem;
|
||||
}
|
||||
|
||||
.submit-row input, .submit-row a {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.submit-row input.default {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.submit-row a.deletelink {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.submit-row a.deletelink {
|
||||
display: block;
|
||||
background: var(--delete-button-bg);
|
||||
border-radius: 4px;
|
||||
padding: 0.625rem 0.9375rem;
|
||||
height: 0.9375rem;
|
||||
line-height: 0.9375rem;
|
||||
color: var(--button-fg);
|
||||
}
|
||||
|
||||
.submit-row a.closelink {
|
||||
display: inline-block;
|
||||
background: var(--close-button-bg);
|
||||
border-radius: 4px;
|
||||
padding: 10px 15px;
|
||||
height: 0.9375rem;
|
||||
line-height: 0.9375rem;
|
||||
color: var(--button-fg);
|
||||
}
|
||||
|
||||
.submit-row a.deletelink:focus,
|
||||
.submit-row a.deletelink:hover,
|
||||
.submit-row a.deletelink:active {
|
||||
background: var(--delete-button-hover-bg);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.submit-row a.closelink:focus,
|
||||
.submit-row a.closelink:hover,
|
||||
.submit-row a.closelink:active {
|
||||
background: var(--close-button-hover-bg);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* CUSTOM FORM FIELDS */
|
||||
|
||||
.vSelectMultipleField {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.vCheckboxField {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.vDateField, .vTimeField {
|
||||
margin-right: 2px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.vDateField {
|
||||
min-width: 6.85em;
|
||||
}
|
||||
|
||||
.vTimeField {
|
||||
min-width: 4.7em;
|
||||
}
|
||||
|
||||
.vURLField {
|
||||
width: 30em;
|
||||
}
|
||||
|
||||
.vLargeTextField, .vXMLLargeTextField {
|
||||
width: 48em;
|
||||
}
|
||||
|
||||
.flatpages-flatpage #id_content {
|
||||
height: 40.2em;
|
||||
}
|
||||
|
||||
.module table .vPositiveSmallIntegerField {
|
||||
width: 2.2em;
|
||||
}
|
||||
|
||||
.vIntegerField {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
.vBigIntegerField {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
.vForeignKeyRawIdAdminField {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
.vTextField, .vUUIDField {
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
/* INLINES */
|
||||
|
||||
.inline-group {
|
||||
padding: 0;
|
||||
margin: 0 0 30px;
|
||||
}
|
||||
|
||||
.inline-group thead th {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.inline-group .aligned label {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.inline-related {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.inline-related h4,
|
||||
.inline-related:not(.tabular) .collapse summary {
|
||||
margin: 0;
|
||||
color: var(--body-medium-color);
|
||||
padding: 5px;
|
||||
font-size: 0.8125rem;
|
||||
background: var(--darkened-bg);
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-left-color: var(--darkened-bg);
|
||||
border-right-color: var(--darkened-bg);
|
||||
}
|
||||
|
||||
.inline-related h3 span.delete {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.inline-related h3 span.delete label {
|
||||
margin-left: 2px;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.inline-related fieldset {
|
||||
margin: 0;
|
||||
background: var(--body-bg);
|
||||
border: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inline-group .tabular fieldset.module {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.inline-related.tabular fieldset.module table {
|
||||
width: 100%;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
.last-related fieldset {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.inline-group .tabular tr.has_original td {
|
||||
padding-top: 2em;
|
||||
}
|
||||
|
||||
.inline-group .tabular tr td.original {
|
||||
padding: 2px 0 0 0;
|
||||
width: 0;
|
||||
_position: relative;
|
||||
}
|
||||
|
||||
.inline-group .tabular th.original {
|
||||
width: 0px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.inline-group .tabular td.original p {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 1.1em;
|
||||
padding: 2px 9px;
|
||||
overflow: hidden;
|
||||
font-size: 0.5625rem;
|
||||
font-weight: bold;
|
||||
color: var(--body-quiet-color);
|
||||
_width: 700px;
|
||||
}
|
||||
|
||||
.inline-group ul.tools {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.inline-group ul.tools li {
|
||||
display: inline;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.inline-group div.add-row,
|
||||
.inline-group .tabular tr.add-row td {
|
||||
color: var(--body-quiet-color);
|
||||
background: var(--darkened-bg);
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
.inline-group .tabular tr.add-row td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
.inline-group ul.tools a.add,
|
||||
.inline-group div.add-row a,
|
||||
.inline-group .tabular tr.add-row td a {
|
||||
background: url(../img/icon-addlink.svg) 0 1px no-repeat;
|
||||
padding-left: 16px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.empty-form {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* RELATED FIELD ADD ONE / LOOKUP */
|
||||
|
||||
.related-lookup {
|
||||
margin-left: 5px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 14px;
|
||||
}
|
||||
|
||||
.related-lookup {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
background-image: url(../img/search.svg);
|
||||
}
|
||||
|
||||
form .related-widget-wrapper ul {
|
||||
display: inline-block;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.clearable-file-input input {
|
||||
margin-top: 0;
|
||||
}
|
||||
61
lottery/staticfiles/admin/css/login.css
Normal file
@@ -0,0 +1,61 @@
|
||||
/* LOGIN FORM */
|
||||
|
||||
.login {
|
||||
background: var(--darkened-bg);
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.login #header {
|
||||
height: auto;
|
||||
padding: 15px 16px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.login #header h1 {
|
||||
font-size: 1.125rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.login #header h1 a {
|
||||
color: var(--header-link-color);
|
||||
}
|
||||
|
||||
.login #content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.login #container {
|
||||
background: var(--body-bg);
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
width: 28em;
|
||||
min-width: 300px;
|
||||
margin: 100px auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.login .form-row {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.login .form-row label {
|
||||
display: block;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
.login .form-row #id_username, .login .form-row #id_password {
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.login .submit-row {
|
||||
padding: 1em 0 0 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login .password-reset-link {
|
||||
text-align: center;
|
||||
}
|
||||
150
lottery/staticfiles/admin/css/nav_sidebar.css
Normal file
@@ -0,0 +1,150 @@
|
||||
.sticky {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
max-height: 100vh;
|
||||
}
|
||||
|
||||
.toggle-nav-sidebar {
|
||||
z-index: 20;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 23px;
|
||||
width: 23px;
|
||||
border: 0;
|
||||
border-right: 1px solid var(--hairline-color);
|
||||
background-color: var(--body-bg);
|
||||
cursor: pointer;
|
||||
font-size: 1.25rem;
|
||||
color: var(--link-fg);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] .toggle-nav-sidebar {
|
||||
border-left: 1px solid var(--hairline-color);
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.toggle-nav-sidebar:hover,
|
||||
.toggle-nav-sidebar:focus {
|
||||
background-color: var(--darkened-bg);
|
||||
}
|
||||
|
||||
#nav-sidebar {
|
||||
z-index: 15;
|
||||
flex: 0 0 275px;
|
||||
left: -276px;
|
||||
margin-left: -276px;
|
||||
border-top: 1px solid transparent;
|
||||
border-right: 1px solid var(--hairline-color);
|
||||
background-color: var(--body-bg);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
[dir="rtl"] #nav-sidebar {
|
||||
border-left: 1px solid var(--hairline-color);
|
||||
border-right: 0;
|
||||
left: 0;
|
||||
margin-left: 0;
|
||||
right: -276px;
|
||||
margin-right: -276px;
|
||||
}
|
||||
|
||||
.toggle-nav-sidebar::before {
|
||||
content: '\00BB';
|
||||
}
|
||||
|
||||
.main.shifted .toggle-nav-sidebar::before {
|
||||
content: '\00AB';
|
||||
}
|
||||
|
||||
.main > #nav-sidebar {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.main.shifted > #nav-sidebar {
|
||||
margin-left: 0;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
[dir="rtl"] .main.shifted > #nav-sidebar {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
#nav-sidebar .module th {
|
||||
width: 100%;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
#nav-sidebar .module th,
|
||||
#nav-sidebar .module caption {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
#nav-sidebar .module td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
[dir="rtl"] #nav-sidebar .module th,
|
||||
[dir="rtl"] #nav-sidebar .module caption {
|
||||
padding-left: 8px;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
#nav-sidebar .current-app .section:link,
|
||||
#nav-sidebar .current-app .section:visited {
|
||||
color: var(--header-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#nav-sidebar .current-model {
|
||||
background: var(--selected-row);
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
#nav-sidebar .current-model {
|
||||
background-color: SelectedItem;
|
||||
}
|
||||
}
|
||||
|
||||
.main > #nav-sidebar + .content {
|
||||
max-width: calc(100% - 23px);
|
||||
}
|
||||
|
||||
.main.shifted > #nav-sidebar + .content {
|
||||
max-width: calc(100% - 299px);
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
#nav-sidebar, #toggle-nav-sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.main > #nav-sidebar + .content,
|
||||
.main.shifted > #nav-sidebar + .content {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
#nav-filter {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 2px 5px;
|
||||
margin: 5px 0;
|
||||
border: 1px solid var(--border-color);
|
||||
background-color: var(--darkened-bg);
|
||||
color: var(--body-fg);
|
||||
}
|
||||
|
||||
#nav-filter:focus {
|
||||
border-color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
#nav-filter.no-results {
|
||||
background: var(--message-error-bg);
|
||||
}
|
||||
|
||||
#nav-sidebar table {
|
||||
width: 100%;
|
||||
}
|
||||
967
lottery/staticfiles/admin/css/responsive.css
Normal file
@@ -0,0 +1,967 @@
|
||||
/* Tablets */
|
||||
|
||||
input[type="submit"], button {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
/* Basic */
|
||||
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 10px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
|
||||
#container {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 15px 20px 20px;
|
||||
}
|
||||
|
||||
div.breadcrumbs {
|
||||
padding: 10px 30px;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
#header {
|
||||
flex-direction: column;
|
||||
padding: 15px 30px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
#site-name {
|
||||
margin: 0 0 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
#user-tools {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
line-height: 1.85;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#user-tools a {
|
||||
display: inline-block;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* Dashboard */
|
||||
|
||||
.dashboard #content {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#content-related {
|
||||
margin-right: -290px;
|
||||
}
|
||||
|
||||
.colSM #content-related {
|
||||
margin-left: -290px;
|
||||
}
|
||||
|
||||
.colMS {
|
||||
margin-right: 290px;
|
||||
}
|
||||
|
||||
.colSM {
|
||||
margin-left: 290px;
|
||||
}
|
||||
|
||||
.dashboard .module table td a {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
td .changelink, td .addlink {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
/* Changelist */
|
||||
|
||||
#toolbar {
|
||||
border: none;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
#changelist-search > div {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
#changelist-search label {
|
||||
line-height: 1.375rem;
|
||||
}
|
||||
|
||||
#toolbar form #searchbar {
|
||||
flex: 1 0 auto;
|
||||
width: 0;
|
||||
height: 1.375rem;
|
||||
margin: 0 10px 0 6px;
|
||||
}
|
||||
|
||||
#toolbar form input[type=submit] {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
#changelist-search .quiet {
|
||||
width: 0;
|
||||
flex: 1 0 auto;
|
||||
margin: 5px 0 0 25px;
|
||||
}
|
||||
|
||||
#changelist .actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
#changelist .actions label {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#changelist .actions select {
|
||||
background: var(--body-bg);
|
||||
}
|
||||
|
||||
#changelist .actions .button {
|
||||
min-width: 48px;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
#changelist .actions span.all,
|
||||
#changelist .actions span.clear,
|
||||
#changelist .actions span.question,
|
||||
#changelist .actions span.action-counter {
|
||||
font-size: 0.6875rem;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
|
||||
#changelist-filter {
|
||||
flex-basis: 200px;
|
||||
}
|
||||
|
||||
.change-list .filtered .results,
|
||||
.change-list .filtered .paginator,
|
||||
.filtered #toolbar,
|
||||
.filtered .actions,
|
||||
|
||||
#changelist .paginator {
|
||||
border-top-color: var(--hairline-color); /* XXX Is this used at all? */
|
||||
}
|
||||
|
||||
#changelist .results + .paginator {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
|
||||
label {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/*
|
||||
Minifiers remove the default (text) "type" attribute from "input" HTML
|
||||
tags. Add input:not([type]) to make the CSS stylesheet work the same.
|
||||
*/
|
||||
.form-row input:not([type]),
|
||||
.form-row input[type=text],
|
||||
.form-row input[type=password],
|
||||
.form-row input[type=email],
|
||||
.form-row input[type=url],
|
||||
.form-row input[type=tel],
|
||||
.form-row input[type=number],
|
||||
.form-row textarea,
|
||||
.form-row select,
|
||||
.form-row .vTextField {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 6px 8px;
|
||||
min-height: 2.25rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.form-row select {
|
||||
height: 2.25rem;
|
||||
}
|
||||
|
||||
.form-row select[multiple] {
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
fieldset .fieldBox + .fieldBox {
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid var(--hairline-color);
|
||||
}
|
||||
|
||||
textarea {
|
||||
max-width: 100%;
|
||||
max-height: 120px;
|
||||
}
|
||||
|
||||
.aligned label {
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
.aligned .related-lookup,
|
||||
.aligned .datetimeshortcuts,
|
||||
.aligned .related-lookup + strong {
|
||||
align-self: center;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
form .aligned div.radiolist {
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.submit-row {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.submit-row a.deletelink {
|
||||
padding: 10px 7px;
|
||||
}
|
||||
|
||||
.button, input[type=submit], input[type=button], .submit-row input, a.button {
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
/* Selector */
|
||||
|
||||
.selector {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.selector .selector-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.selector .selector-filter label {
|
||||
margin: 0 8px 0 0;
|
||||
}
|
||||
|
||||
.selector .selector-filter input {
|
||||
width: 100%;
|
||||
min-height: 0;
|
||||
flex: 1 1;
|
||||
}
|
||||
|
||||
.selector-available, .selector-chosen {
|
||||
width: auto;
|
||||
flex: 1 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.selector select {
|
||||
width: 100%;
|
||||
flex: 1 0 auto;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.selector ul.selector-chooser {
|
||||
width: 26px;
|
||||
height: 52px;
|
||||
padding: 2px 0;
|
||||
border-radius: 20px;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
.selector-add, .selector-remove {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-size: 20px auto;
|
||||
}
|
||||
|
||||
.selector-add {
|
||||
background-position: 0 -120px;
|
||||
}
|
||||
|
||||
.selector-remove {
|
||||
background-position: 0 -80px;
|
||||
}
|
||||
|
||||
a.selector-chooseall, a.selector-clearall {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.stacked {
|
||||
flex-direction: column;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
.stacked > * {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.stacked select {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.stacked .selector-available, .stacked .selector-chosen {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.stacked ul.selector-chooser {
|
||||
width: 52px;
|
||||
height: 26px;
|
||||
padding: 0 2px;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.stacked .selector-chooser li {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.stacked .selector-add, .stacked .selector-remove {
|
||||
background-size: 20px auto;
|
||||
}
|
||||
|
||||
.stacked .selector-add {
|
||||
background-position: 0 -40px;
|
||||
}
|
||||
|
||||
.stacked .active.selector-add {
|
||||
background-position: 0 -40px;
|
||||
}
|
||||
|
||||
.active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -140px;
|
||||
}
|
||||
|
||||
.stacked .active.selector-add:focus, .stacked .active.selector-add:hover {
|
||||
background-position: 0 -60px;
|
||||
}
|
||||
|
||||
.stacked .selector-remove {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.stacked .active.selector-remove {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -100px;
|
||||
}
|
||||
|
||||
.stacked .active.selector-remove:focus, .stacked .active.selector-remove:hover {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
|
||||
.help-tooltip, .selector .help-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.datetime input {
|
||||
width: 50%;
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.datetime span {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.datetime .timezonewarning {
|
||||
display: block;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.datetimeshortcuts {
|
||||
color: var(--border-color); /* XXX Redundant, .datetime span also sets #ccc */
|
||||
}
|
||||
|
||||
.form-row .datetime input.vDateField, .form-row .datetime input.vTimeField {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.inline-group {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
|
||||
ul.messagelist li {
|
||||
padding-left: 55px;
|
||||
background-position: 30px 12px;
|
||||
}
|
||||
|
||||
ul.messagelist li.error {
|
||||
background-position: 30px 12px;
|
||||
}
|
||||
|
||||
ul.messagelist li.warning {
|
||||
background-position: 30px 14px;
|
||||
}
|
||||
|
||||
/* Login */
|
||||
|
||||
.login #header {
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.login #site-name {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* GIS */
|
||||
|
||||
div.olMap {
|
||||
max-width: calc(100vw - 30px);
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
.olMap + .clear_features {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* Docs */
|
||||
|
||||
.module table.xfull {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
pre.literal-block {
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
|
||||
@media (max-width: 767px) {
|
||||
/* Layout */
|
||||
|
||||
#header, #content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
div.breadcrumbs {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
/* Dashboard */
|
||||
|
||||
.colMS, .colSM {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#content-related, .colSM #content-related {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#content-related .module {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#content-related .module h2 {
|
||||
padding: 10px 15px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Changelist */
|
||||
|
||||
#changelist {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#changelist-filter {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#changelist .actions label {
|
||||
flex: 1 1;
|
||||
}
|
||||
|
||||
#changelist .actions select {
|
||||
flex: 1 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#changelist .actions span {
|
||||
flex: 1 0 100%;
|
||||
}
|
||||
|
||||
#changelist-filter {
|
||||
position: static;
|
||||
width: auto;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.object-tools {
|
||||
float: none;
|
||||
margin: 0 0 15px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.object-tools li {
|
||||
height: auto;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.object-tools li + li {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
|
||||
.form-row {
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.aligned .form-row,
|
||||
.aligned .form-row > div {
|
||||
max-width: 100vw;
|
||||
}
|
||||
|
||||
.aligned .form-row > div {
|
||||
width: calc(100vw - 30px);
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
flex-flow: column;
|
||||
}
|
||||
|
||||
.flex-container.checkbox-row {
|
||||
flex-flow: row;
|
||||
}
|
||||
|
||||
textarea {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.vURLField {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
fieldset .fieldBox + .fieldBox {
|
||||
margin-top: 15px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.aligned label {
|
||||
width: 100%;
|
||||
min-width: auto;
|
||||
padding: 0 0 10px;
|
||||
}
|
||||
|
||||
.aligned label:after {
|
||||
max-height: 0;
|
||||
}
|
||||
|
||||
.aligned .form-row input,
|
||||
.aligned .form-row select,
|
||||
.aligned .form-row textarea {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.aligned .checkbox-row input {
|
||||
flex: 0 1 auto;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.aligned .vCheckboxLabel {
|
||||
flex: 1 0;
|
||||
padding: 1px 0 0 5px;
|
||||
}
|
||||
|
||||
.aligned label + p,
|
||||
.aligned label + div.help,
|
||||
.aligned label + div.readonly {
|
||||
padding: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.aligned p.file-upload {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
span.clearable-file-input {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
span.clearable-file-input label {
|
||||
font-size: 0.8125rem;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.aligned .timezonewarning {
|
||||
flex: 1 0 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
form .aligned .form-row div.help {
|
||||
width: 100%;
|
||||
margin: 5px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form .aligned ul,
|
||||
form .aligned ul.errorlist {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
form .aligned div.radiolist {
|
||||
margin-top: 5px;
|
||||
margin-right: 15px;
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
|
||||
form .aligned div.radiolist:not(.inline) div + div {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* Related widget */
|
||||
|
||||
.related-widget-wrapper {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.related-widget-wrapper .selector {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.related-widget-wrapper > a {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.related-widget-wrapper .radiolist ~ a {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.related-widget-wrapper > select ~ a {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
/* Selector */
|
||||
|
||||
.selector {
|
||||
flex-direction: column;
|
||||
gap: 10px 0;
|
||||
}
|
||||
|
||||
.selector-available, .selector-chosen {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.selector select {
|
||||
max-height: 96px;
|
||||
}
|
||||
|
||||
.selector ul.selector-chooser {
|
||||
display: block;
|
||||
width: 52px;
|
||||
height: 26px;
|
||||
padding: 0 2px;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.selector ul.selector-chooser li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.selector-remove {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
|
||||
.selector-add {
|
||||
background-position: 0 -40px;
|
||||
}
|
||||
|
||||
.active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -60px;
|
||||
}
|
||||
|
||||
/* Inlines */
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related {
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-radius: 4px;
|
||||
margin-top: 15px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related > * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related .module {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related .module .form-row {
|
||||
border-top: 1px solid var(--hairline-color);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related .module .form-row:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related h3 {
|
||||
padding: 10px;
|
||||
border-top-width: 0;
|
||||
border-bottom-width: 2px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related h3 .inline_label {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .inline-related h3 span.delete {
|
||||
float: none;
|
||||
flex: 1 1 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .aligned .form-row > div:not([class]) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] .aligned label {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inline-group[data-inline-type="stacked"] div.add-row {
|
||||
margin-top: 15px;
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.inline-group div.add-row,
|
||||
.inline-group .tabular tr.add-row td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.inline-group div.add-row a,
|
||||
.inline-group .tabular tr.add-row td a {
|
||||
display: block;
|
||||
padding: 8px 10px 8px 26px;
|
||||
background-position: 8px 9px;
|
||||
}
|
||||
|
||||
/* Submit row */
|
||||
|
||||
.submit-row {
|
||||
padding: 10px;
|
||||
margin: 0 0 15px;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.submit-row input, .submit-row input.default, .submit-row a {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.submit-row a.closelink {
|
||||
padding: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.submit-row a.deletelink {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
|
||||
ul.messagelist li {
|
||||
padding-left: 40px;
|
||||
background-position: 15px 12px;
|
||||
}
|
||||
|
||||
ul.messagelist li.error {
|
||||
background-position: 15px 12px;
|
||||
}
|
||||
|
||||
ul.messagelist li.warning {
|
||||
background-position: 15px 14px;
|
||||
}
|
||||
|
||||
/* Paginator */
|
||||
|
||||
.paginator .this-page, .paginator a:link, .paginator a:visited {
|
||||
padding: 4px 10px;
|
||||
}
|
||||
|
||||
/* Login */
|
||||
|
||||
body.login {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.login #container {
|
||||
width: auto;
|
||||
max-width: 480px;
|
||||
margin: 50px auto;
|
||||
}
|
||||
|
||||
.login #header,
|
||||
.login #content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.login #content-main {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.login .form-row {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.login .form-row + .form-row {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.login .form-row label {
|
||||
margin: 0 0 5px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.login .submit-row {
|
||||
padding: 15px 0 0;
|
||||
}
|
||||
|
||||
.login br {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.login .submit-row input {
|
||||
margin: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.errornote {
|
||||
margin: 0 0 20px;
|
||||
padding: 8px 12px;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
/* Calendar and clock */
|
||||
|
||||
.calendarbox, .clockbox {
|
||||
position: fixed !important;
|
||||
top: 50% !important;
|
||||
left: 50% !important;
|
||||
transform: translate(-50%, -50%);
|
||||
margin: 0;
|
||||
border: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.calendarbox:before, .clockbox:before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.calendarbox > *, .clockbox > * {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.calendarbox > div:first-child {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.calendarbox .calendar, .clockbox h2 {
|
||||
border-radius: 4px 4px 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.calendarbox .calendar-cancel, .clockbox .calendar-cancel {
|
||||
border-radius: 0 0 4px 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.calendar-shortcuts {
|
||||
padding: 10px 0;
|
||||
font-size: 0.75rem;
|
||||
line-height: 0.75rem;
|
||||
}
|
||||
|
||||
.calendar-shortcuts a {
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
.timelist a {
|
||||
background: var(--body-bg);
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.calendar-cancel {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.clockbox h2 {
|
||||
padding: 8px 15px;
|
||||
}
|
||||
|
||||
.calendar caption {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.calendarbox .calendarnav-previous, .calendarbox .calendarnav-next {
|
||||
z-index: 1;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
/* History */
|
||||
|
||||
table#change-history tbody th, table#change-history tbody td {
|
||||
font-size: 0.8125rem;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
table#change-history tbody th {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* Docs */
|
||||
|
||||
table.model tbody th, table.model tbody td {
|
||||
font-size: 0.8125rem;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
111
lottery/staticfiles/admin/css/responsive_rtl.css
Normal file
@@ -0,0 +1,111 @@
|
||||
/* TABLETS */
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
[dir="rtl"] .colMS {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] #user-tools {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
[dir="rtl"] #changelist .actions label {
|
||||
padding-left: 10px;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] #changelist .actions select {
|
||||
margin-left: 0;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .change-list .filtered .results,
|
||||
[dir="rtl"] .change-list .filtered .paginator,
|
||||
[dir="rtl"] .filtered #toolbar,
|
||||
[dir="rtl"] .filtered div.xfull,
|
||||
[dir="rtl"] .filtered .actions,
|
||||
[dir="rtl"] #changelist-filter {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] .inline-group ul.tools a.add,
|
||||
[dir="rtl"] .inline-group div.add-row a,
|
||||
[dir="rtl"] .inline-group .tabular tr.add-row td a {
|
||||
padding: 8px 26px 8px 10px;
|
||||
background-position: calc(100% - 8px) 9px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .selector .selector-filter label {
|
||||
margin-right: 0;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .object-tools li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
[dir="rtl"] .object-tools li + li {
|
||||
margin-left: 0;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .dashboard .module table td a {
|
||||
padding-left: 0;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .selector-add {
|
||||
background-position: 0 -80px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .selector-remove {
|
||||
background-position: 0 -120px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -100px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -140px;
|
||||
}
|
||||
}
|
||||
|
||||
/* MOBILE */
|
||||
|
||||
@media (max-width: 767px) {
|
||||
[dir="rtl"] .aligned .related-lookup,
|
||||
[dir="rtl"] .aligned .datetimeshortcuts {
|
||||
margin-left: 0;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .aligned ul,
|
||||
[dir="rtl"] form .aligned ul.errorlist {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] #changelist-filter {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
[dir="rtl"] .aligned .vCheckboxLabel {
|
||||
padding: 1px 5px 0 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] .selector-remove {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
[dir="rtl"] .active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .selector-add {
|
||||
background-position: 0 -40px;
|
||||
}
|
||||
|
||||
[dir="rtl"] .active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -60px;
|
||||
}
|
||||
}
|
||||
291
lottery/staticfiles/admin/css/rtl.css
Normal file
@@ -0,0 +1,291 @@
|
||||
/* GLOBAL */
|
||||
|
||||
th {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.module h2, .module caption {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.module ul, .module ol {
|
||||
margin-left: 0;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
|
||||
.viewlink, .addlink, .changelink, .hidelink {
|
||||
padding-left: 0;
|
||||
padding-right: 16px;
|
||||
background-position: 100% 1px;
|
||||
}
|
||||
|
||||
.deletelink {
|
||||
padding-left: 0;
|
||||
padding-right: 16px;
|
||||
background-position: 100% 1px;
|
||||
}
|
||||
|
||||
.object-tools {
|
||||
float: left;
|
||||
}
|
||||
|
||||
thead th:first-child,
|
||||
tfoot td:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
/* LAYOUT */
|
||||
|
||||
#user-tools {
|
||||
right: auto;
|
||||
left: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.breadcrumbs {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#content-main {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#content-related {
|
||||
float: left;
|
||||
margin-left: -300px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.colMS {
|
||||
margin-left: 300px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
/* SORTABLE TABLES */
|
||||
|
||||
table thead th.sorted .sortoptions {
|
||||
float: left;
|
||||
}
|
||||
|
||||
thead th.sorted .text {
|
||||
padding-right: 0;
|
||||
padding-left: 42px;
|
||||
}
|
||||
|
||||
/* dashboard styles */
|
||||
|
||||
.dashboard .module table td a {
|
||||
padding-left: .6em;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
/* changelists styles */
|
||||
|
||||
.change-list .filtered table {
|
||||
border-left: none;
|
||||
border-right: 0px none;
|
||||
}
|
||||
|
||||
#changelist-filter {
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
margin-left: 0;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
#changelist-filter li.selected {
|
||||
border-left: none;
|
||||
padding-left: 10px;
|
||||
margin-left: 0;
|
||||
border-right: 5px solid var(--hairline-color);
|
||||
padding-right: 10px;
|
||||
margin-right: -15px;
|
||||
}
|
||||
|
||||
#changelist table tbody td:first-child, #changelist table tbody th:first-child {
|
||||
border-right: none;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.paginator .end {
|
||||
margin-left: 6px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.paginator input {
|
||||
margin-left: 0;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* FORMS */
|
||||
|
||||
.aligned label {
|
||||
padding: 0 0 3px 1em;
|
||||
}
|
||||
|
||||
.submit-row a.deletelink {
|
||||
margin-left: 0;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.vDateField, .vTimeField {
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.aligned .form-row input {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
form .aligned ul {
|
||||
margin-right: 163px;
|
||||
padding-right: 10px;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
form ul.inline li {
|
||||
float: right;
|
||||
padding-right: 0;
|
||||
padding-left: 7px;
|
||||
}
|
||||
|
||||
form .aligned p.help,
|
||||
form .aligned div.help {
|
||||
margin-left: 0;
|
||||
margin-right: 160px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
form div.help ul,
|
||||
form .aligned .checkbox-row + .help,
|
||||
form .aligned p.date div.help.timezonewarning,
|
||||
form .aligned p.datetime div.help.timezonewarning,
|
||||
form .aligned p.time div.help.timezonewarning {
|
||||
margin-right: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
form .wide p.help,
|
||||
form .wide ul.errorlist,
|
||||
form .wide div.help {
|
||||
padding-left: 0;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.submit-row {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
fieldset .fieldBox {
|
||||
margin-left: 20px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.errorlist li {
|
||||
background-position: 100% 12px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.errornote {
|
||||
background-position: 100% 12px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
/* WIDGETS */
|
||||
|
||||
.calendarnav-previous {
|
||||
top: 0;
|
||||
left: auto;
|
||||
right: 10px;
|
||||
background: url(../img/calendar-icons.svg) 0 -15px no-repeat;
|
||||
}
|
||||
|
||||
.calendarnav-next {
|
||||
top: 0;
|
||||
right: auto;
|
||||
left: 10px;
|
||||
background: url(../img/calendar-icons.svg) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.calendar caption, .calendarbox h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.selector {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.selector .selector-filter {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.selector-add {
|
||||
background: url(../img/selector-icons.svg) 0 -64px no-repeat;
|
||||
}
|
||||
|
||||
.active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -80px;
|
||||
}
|
||||
|
||||
.selector-remove {
|
||||
background: url(../img/selector-icons.svg) 0 -96px no-repeat;
|
||||
}
|
||||
|
||||
.active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -112px;
|
||||
}
|
||||
|
||||
a.selector-chooseall {
|
||||
background: url(../img/selector-icons.svg) right -128px no-repeat;
|
||||
}
|
||||
|
||||
a.active.selector-chooseall:focus, a.active.selector-chooseall:hover {
|
||||
background-position: 100% -144px;
|
||||
}
|
||||
|
||||
a.selector-clearall {
|
||||
background: url(../img/selector-icons.svg) 0 -160px no-repeat;
|
||||
}
|
||||
|
||||
a.active.selector-clearall:focus, a.active.selector-clearall:hover {
|
||||
background-position: 0 -176px;
|
||||
}
|
||||
|
||||
.inline-deletelink {
|
||||
float: left;
|
||||
}
|
||||
|
||||
form .form-row p.datetime {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.related-widget-wrapper {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* MISC */
|
||||
|
||||
.inline-related h2, .inline-group h2 {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.inline-related h3 span.delete {
|
||||
padding-right: 20px;
|
||||
padding-left: inherit;
|
||||
left: 10px;
|
||||
right: inherit;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.inline-related h3 span.delete label {
|
||||
margin-left: inherit;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.inline-group .tabular td.original p {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.selector .selector-chooser {
|
||||
margin: 0;
|
||||
}
|
||||
19
lottery/staticfiles/admin/css/unusable_password_field.css
Normal file
@@ -0,0 +1,19 @@
|
||||
/* Hide warnings fields if usable password is selected */
|
||||
form:has(#id_usable_password input[value="true"]:checked) .messagelist {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Hide password fields if unusable password is selected */
|
||||
form:has(#id_usable_password input[value="false"]:checked) .field-password1,
|
||||
form:has(#id_usable_password input[value="false"]:checked) .field-password2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Select appropriate submit button */
|
||||
form:has(#id_usable_password input[value="true"]:checked) input[type="submit"].unset-password {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form:has(#id_usable_password input[value="false"]:checked) input[type="submit"].set-password {
|
||||
display: none;
|
||||
}
|
||||
21
lottery/staticfiles/admin/css/vendor/select2/LICENSE-SELECT2.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
481
lottery/staticfiles/admin/css/vendor/select2/select2.css
vendored
Normal file
@@ -0,0 +1,481 @@
|
||||
.select2-container {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
vertical-align: middle; }
|
||||
.select2-container .select2-selection--single {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 28px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
display: block;
|
||||
padding-left: 8px;
|
||||
padding-right: 20px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-selection--single .select2-selection__clear {
|
||||
position: relative; }
|
||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 8px;
|
||||
padding-left: 20px; }
|
||||
.select2-container .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 32px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding-left: 8px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-search--inline {
|
||||
float: left; }
|
||||
.select2-container .select2-search--inline .select2-search__field {
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 0; }
|
||||
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
|
||||
.select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -100000px;
|
||||
width: 100%;
|
||||
z-index: 1051; }
|
||||
|
||||
.select2-results {
|
||||
display: block; }
|
||||
|
||||
.select2-results__options {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
.select2-results__option {
|
||||
padding: 6px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-results__option[aria-selected] {
|
||||
cursor: pointer; }
|
||||
|
||||
.select2-container--open .select2-dropdown {
|
||||
left: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--above {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--below {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-search--dropdown {
|
||||
display: block;
|
||||
padding: 4px; }
|
||||
.select2-search--dropdown .select2-search__field {
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
.select2-search--dropdown.select2-search--hide {
|
||||
display: none; }
|
||||
|
||||
.select2-close-mask {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: auto;
|
||||
width: auto;
|
||||
opacity: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
filter: alpha(opacity=0); }
|
||||
|
||||
.select2-hidden-accessible {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
-webkit-clip-path: inset(50%) !important;
|
||||
clip-path: inset(50%) !important;
|
||||
height: 1px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
white-space: nowrap !important; }
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
background-color: #fff;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
||||
box-sizing: border-box;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
width: 100%; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
||||
list-style: none; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
margin-right: 10px;
|
||||
padding: 1px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #333; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
||||
float: right; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: solid black 1px;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa; }
|
||||
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
-webkit-appearance: textfield; }
|
||||
|
||||
.select2-container--default .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--default .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
||||
color: #999; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #ddd; }
|
||||
|
||||
.select2-container--default .select2-results__option .select2-results__option {
|
||||
padding-left: 1em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
||||
padding-left: 0; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -1em;
|
||||
padding-left: 2em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -2em;
|
||||
padding-left: 3em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -3em;
|
||||
padding-left: 4em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -4em;
|
||||
padding-left: 5em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -5em;
|
||||
padding-left: 6em; }
|
||||
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #5897fb;
|
||||
color: white; }
|
||||
|
||||
.select2-container--default .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic .select2-selection--single {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
outline: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-right: 10px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
||||
background-color: #ddd;
|
||||
border: none;
|
||||
border-left: 1px solid #aaa;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
border: none;
|
||||
border-right: 1px solid #aaa;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--single {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
||||
background: transparent;
|
||||
border: none; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
||||
|
||||
.select2-container--classic .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text;
|
||||
outline: 0; }
|
||||
.select2-container--classic .select2-selection--multiple:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
||||
display: none; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #555; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
||||
border: 1px solid #5897fb; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--inline .select2-search__field {
|
||||
outline: 0;
|
||||
box-shadow: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid transparent; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--above {
|
||||
border-bottom: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--below {
|
||||
border-top: none; }
|
||||
|
||||
.select2-container--classic .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--classic .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
||||
color: grey; }
|
||||
|
||||
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #3875d7;
|
||||
color: white; }
|
||||
|
||||
.select2-container--classic .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-dropdown {
|
||||
border-color: #5897fb; }
|
||||
1
lottery/staticfiles/admin/css/vendor/select2/select2.min.css
vendored
Normal file
593
lottery/staticfiles/admin/css/widgets.css
Normal file
@@ -0,0 +1,593 @@
|
||||
/* SELECTOR (FILTER INTERFACE) */
|
||||
|
||||
.selector {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
gap: 0 10px;
|
||||
}
|
||||
|
||||
.selector select {
|
||||
height: 17.2em;
|
||||
flex: 1 0 auto;
|
||||
overflow: scroll;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.selector-available, .selector-chosen {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1;
|
||||
}
|
||||
|
||||
.selector-available h2, .selector-chosen h2 {
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.selector-chosen .list-footer-display {
|
||||
border: 1px solid var(--border-color);
|
||||
border-top: none;
|
||||
border-radius: 0 0 4px 4px;
|
||||
margin: 0 0 10px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
background: var(--primary);
|
||||
color: var(--header-link-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
.selector-chosen .list-footer-display__clear {
|
||||
color: var(--breadcrumbs-fg);
|
||||
}
|
||||
|
||||
.selector-chosen h2 {
|
||||
background: var(--secondary);
|
||||
color: var(--header-link-color);
|
||||
}
|
||||
|
||||
.selector .selector-available h2 {
|
||||
background: var(--darkened-bg);
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.selector .selector-filter {
|
||||
border: 1px solid var(--border-color);
|
||||
border-width: 0 1px;
|
||||
padding: 8px;
|
||||
color: var(--body-quiet-color);
|
||||
font-size: 0.625rem;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.selector .selector-filter label,
|
||||
.inline-group .aligned .selector .selector-filter label {
|
||||
float: left;
|
||||
margin: 7px 0 0;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
line-height: 1;
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.selector-filter input {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.selector .selector-available input,
|
||||
.selector .selector-chosen input {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.selector ul.selector-chooser {
|
||||
align-self: center;
|
||||
width: 22px;
|
||||
background-color: var(--selected-bg);
|
||||
border-radius: 10px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
transform: translateY(-17px);
|
||||
}
|
||||
|
||||
.selector-chooser li {
|
||||
margin: 0;
|
||||
padding: 3px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.selector select {
|
||||
padding: 0 10px;
|
||||
margin: 0 0 10px;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
.selector .selector-chosen--with-filtered select {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
height: 14em;
|
||||
}
|
||||
|
||||
.selector .selector-chosen:not(.selector-chosen--with-filtered) .list-footer-display {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.selector-add, .selector-remove {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: block;
|
||||
text-indent: -3000px;
|
||||
overflow: hidden;
|
||||
cursor: default;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.active.selector-add, .active.selector-remove {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.active.selector-add:hover, .active.selector-remove:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.selector-add {
|
||||
background: url(../img/selector-icons.svg) 0 -96px no-repeat;
|
||||
}
|
||||
|
||||
.active.selector-add:focus, .active.selector-add:hover {
|
||||
background-position: 0 -112px;
|
||||
}
|
||||
|
||||
.selector-remove {
|
||||
background: url(../img/selector-icons.svg) 0 -64px no-repeat;
|
||||
}
|
||||
|
||||
.active.selector-remove:focus, .active.selector-remove:hover {
|
||||
background-position: 0 -80px;
|
||||
}
|
||||
|
||||
a.selector-chooseall, a.selector-clearall {
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
text-align: left;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
line-height: 16px;
|
||||
color: var(--body-quiet-color);
|
||||
text-decoration: none;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
a.active.selector-chooseall:focus, a.active.selector-clearall:focus,
|
||||
a.active.selector-chooseall:hover, a.active.selector-clearall:hover {
|
||||
color: var(--link-fg);
|
||||
}
|
||||
|
||||
a.active.selector-chooseall, a.active.selector-clearall {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
a.active.selector-chooseall:hover, a.active.selector-clearall:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a.selector-chooseall {
|
||||
padding: 0 18px 0 0;
|
||||
background: url(../img/selector-icons.svg) right -160px no-repeat;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
a.active.selector-chooseall:focus, a.active.selector-chooseall:hover {
|
||||
background-position: 100% -176px;
|
||||
}
|
||||
|
||||
a.selector-clearall {
|
||||
padding: 0 0 0 18px;
|
||||
background: url(../img/selector-icons.svg) 0 -128px no-repeat;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
a.active.selector-clearall:focus, a.active.selector-clearall:hover {
|
||||
background-position: 0 -144px;
|
||||
}
|
||||
|
||||
/* STACKED SELECTORS */
|
||||
|
||||
.stacked {
|
||||
float: left;
|
||||
width: 490px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.stacked select {
|
||||
width: 480px;
|
||||
height: 10.1em;
|
||||
}
|
||||
|
||||
.stacked .selector-available, .stacked .selector-chosen {
|
||||
width: 480px;
|
||||
}
|
||||
|
||||
.stacked .selector-available {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.stacked .selector-available input {
|
||||
width: 422px;
|
||||
}
|
||||
|
||||
.stacked ul.selector-chooser {
|
||||
height: 22px;
|
||||
width: 50px;
|
||||
margin: 0 0 10px 40%;
|
||||
background-color: #eee;
|
||||
border-radius: 10px;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.stacked .selector-chooser li {
|
||||
float: left;
|
||||
padding: 3px 3px 3px 5px;
|
||||
}
|
||||
|
||||
.stacked .selector-chooseall, .stacked .selector-clearall {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stacked .selector-add {
|
||||
background: url(../img/selector-icons.svg) 0 -32px no-repeat;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.stacked .active.selector-add {
|
||||
background-position: 0 -32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stacked .active.selector-add:focus, .stacked .active.selector-add:hover {
|
||||
background-position: 0 -48px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stacked .selector-remove {
|
||||
background: url(../img/selector-icons.svg) 0 0 no-repeat;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.stacked .active.selector-remove {
|
||||
background-position: 0 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stacked .active.selector-remove:focus, .stacked .active.selector-remove:hover {
|
||||
background-position: 0 -16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.selector .help-icon {
|
||||
background: url(../img/icon-unknown.svg) 0 0 no-repeat;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: -2px 0 0 2px;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
.selector .selector-chosen .help-icon {
|
||||
background: url(../img/icon-unknown-alt.svg) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.selector .search-label-icon {
|
||||
background: url(../img/search.svg) 0 0 no-repeat;
|
||||
display: inline-block;
|
||||
height: 1.125rem;
|
||||
width: 1.125rem;
|
||||
}
|
||||
|
||||
/* DATE AND TIME */
|
||||
|
||||
p.datetime {
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--body-quiet-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.datetime span {
|
||||
white-space: nowrap;
|
||||
font-weight: normal;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.datetime input, .form-row .datetime input.vDateField, .form-row .datetime input.vTimeField {
|
||||
margin-left: 5px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
table p.datetime {
|
||||
font-size: 0.6875rem;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.datetimeshortcuts .clock-icon, .datetimeshortcuts .date-icon {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.datetimeshortcuts .clock-icon {
|
||||
background: url(../img/icon-clock.svg) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.datetimeshortcuts a:focus .clock-icon,
|
||||
.datetimeshortcuts a:hover .clock-icon {
|
||||
background-position: 0 -16px;
|
||||
}
|
||||
|
||||
.datetimeshortcuts .date-icon {
|
||||
background: url(../img/icon-calendar.svg) 0 0 no-repeat;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
.datetimeshortcuts a:focus .date-icon,
|
||||
.datetimeshortcuts a:hover .date-icon {
|
||||
background-position: 0 -16px;
|
||||
}
|
||||
|
||||
.timezonewarning {
|
||||
font-size: 0.6875rem;
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
/* URL */
|
||||
|
||||
p.url {
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--body-quiet-color);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.url a {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* FILE UPLOADS */
|
||||
|
||||
p.file-upload {
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--body-quiet-color);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.file-upload a {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.file-upload .deletelink {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
span.clearable-file-input label {
|
||||
color: var(--body-fg);
|
||||
font-size: 0.6875rem;
|
||||
display: inline;
|
||||
float: none;
|
||||
}
|
||||
|
||||
/* CALENDARS & CLOCKS */
|
||||
|
||||
.calendarbox, .clockbox {
|
||||
margin: 5px auto;
|
||||
font-size: 0.75rem;
|
||||
width: 19em;
|
||||
text-align: center;
|
||||
background: var(--body-bg);
|
||||
color: var(--body-fg);
|
||||
border: 1px solid var(--hairline-color);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.clockbox {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.calendar {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.calendar table {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-collapse: collapse;
|
||||
background: white;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.calendar caption, .calendarbox h2 {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
border-top: none;
|
||||
font-weight: 700;
|
||||
font-size: 0.75rem;
|
||||
color: #333;
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
.calendar th {
|
||||
padding: 8px 5px;
|
||||
background: var(--darkened-bg);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
font-weight: 400;
|
||||
font-size: 0.75rem;
|
||||
text-align: center;
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.calendar td {
|
||||
font-weight: 400;
|
||||
font-size: 0.75rem;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
border-top: 1px solid var(--hairline-color);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.calendar td.selected a {
|
||||
background: var(--secondary);
|
||||
color: var(--button-fg);
|
||||
}
|
||||
|
||||
.calendar td.nonday {
|
||||
background: var(--darkened-bg);
|
||||
}
|
||||
|
||||
.calendar td.today a {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.calendar td a, .timelist a {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
padding: 6px;
|
||||
text-decoration: none;
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.calendar td a:focus, .timelist a:focus,
|
||||
.calendar td a:hover, .timelist a:hover {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calendar td a:active, .timelist a:active {
|
||||
background: var(--header-bg);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calendarnav {
|
||||
font-size: 0.625rem;
|
||||
text-align: center;
|
||||
color: #ccc;
|
||||
margin: 0;
|
||||
padding: 1px 3px;
|
||||
}
|
||||
|
||||
.calendarnav a:link, #calendarnav a:visited,
|
||||
#calendarnav a:focus, #calendarnav a:hover {
|
||||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
.calendar-shortcuts {
|
||||
background: var(--body-bg);
|
||||
color: var(--body-quiet-color);
|
||||
font-size: 0.6875rem;
|
||||
line-height: 0.6875rem;
|
||||
border-top: 1px solid var(--hairline-color);
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.calendarbox .calendarnav-previous, .calendarbox .calendarnav-next {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
text-indent: -9999px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.calendarnav-previous {
|
||||
left: 10px;
|
||||
background: url(../img/calendar-icons.svg) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.calendarnav-next {
|
||||
right: 10px;
|
||||
background: url(../img/calendar-icons.svg) 0 -15px no-repeat;
|
||||
}
|
||||
|
||||
.calendar-cancel {
|
||||
margin: 0;
|
||||
padding: 4px 0;
|
||||
font-size: 0.75rem;
|
||||
background: var(--close-button-bg);
|
||||
border-top: 1px solid var(--border-color);
|
||||
color: var(--button-fg);
|
||||
}
|
||||
|
||||
.calendar-cancel:focus, .calendar-cancel:hover {
|
||||
background: var(--close-button-hover-bg);
|
||||
}
|
||||
|
||||
.calendar-cancel a {
|
||||
color: var(--button-fg);
|
||||
display: block;
|
||||
}
|
||||
|
||||
ul.timelist, .timelist li {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.timelist a {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/* EDIT INLINE */
|
||||
|
||||
.inline-deletelink {
|
||||
float: right;
|
||||
text-indent: -9999px;
|
||||
background: url(../img/inline-delete.svg) 0 0 no-repeat;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 0px none;
|
||||
}
|
||||
|
||||
.inline-deletelink:focus, .inline-deletelink:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* RELATED WIDGET WRAPPER */
|
||||
.related-widget-wrapper {
|
||||
display: flex;
|
||||
gap: 0 10px;
|
||||
flex-grow: 1;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.related-widget-wrapper-link {
|
||||
opacity: .6;
|
||||
filter: grayscale(1);
|
||||
}
|
||||
|
||||
.related-widget-wrapper-link:link {
|
||||
opacity: 1;
|
||||
filter: grayscale(0);
|
||||
}
|
||||
|
||||
/* GIS MAPS */
|
||||
.dj_map {
|
||||
width: 600px;
|
||||
height: 400px;
|
||||
}
|
||||
20
lottery/staticfiles/admin/img/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Code Charm Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
7
lottery/staticfiles/admin/img/README.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
All icons are taken from Font Awesome (https://fontawesome.com/) project.
|
||||
The Font Awesome font is licensed under the SIL OFL 1.1:
|
||||
- https://scripts.sil.org/OFL
|
||||
|
||||
SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG
|
||||
Font-Awesome-SVG-PNG is licensed under the MIT license (see file license
|
||||
in current folder).
|
||||
63
lottery/staticfiles/admin/img/calendar-icons.svg
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="15"
|
||||
height="30"
|
||||
viewBox="0 0 1792 3584"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
sodipodi:docname="calendar-icons.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview5"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="13.3"
|
||||
inkscape:cx="15.526316"
|
||||
inkscape:cy="20.977444"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg5" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<g
|
||||
id="previous">
|
||||
<path
|
||||
d="m 1037,1395 102,-102 q 19,-19 19,-45 0,-26 -19,-45 L 832,896 1139,589 q 19,-19 19,-45 0,-26 -19,-45 L 1037,397 q -19,-19 -45,-19 -26,0 -45,19 L 493,851 q -19,19 -19,45 0,26 19,45 l 454,454 q 19,19 45,19 26,0 45,-19 z m 627,-499 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 Z"
|
||||
id="path1" />
|
||||
</g>
|
||||
<g
|
||||
id="next">
|
||||
<path
|
||||
d="m 845,1395 454,-454 q 19,-19 19,-45 0,-26 -19,-45 L 845,397 q -19,-19 -45,-19 -26,0 -45,19 L 653,499 q -19,19 -19,45 0,26 19,45 l 307,307 -307,307 q -19,19 -19,45 0,26 19,45 l 102,102 q 19,19 45,19 26,0 45,-19 z m 819,-499 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 Z"
|
||||
id="path2" />
|
||||
</g>
|
||||
</defs>
|
||||
<use
|
||||
xlink:href="#next"
|
||||
x="0"
|
||||
y="5376"
|
||||
fill="#000000"
|
||||
id="use5"
|
||||
transform="translate(0,-3584)" />
|
||||
<use
|
||||
xlink:href="#previous"
|
||||
x="0"
|
||||
y="0"
|
||||
fill="#333333"
|
||||
id="use2"
|
||||
style="fill:#000000;fill-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
1
lottery/staticfiles/admin/img/gis/move_vertex_off.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="24" height="22" viewBox="0 0 847 779" xmlns="http://www.w3.org/2000/svg"><g><path fill="#EBECE6" d="M120 1h607c66 0 120 54 120 120v536c0 66-54 120-120 120h-607c-66 0-120-54-120-120v-536c0-66 54-120 120-120z"/><path fill="#9E9E93" d="M120 1h607c66 0 120 54 120 120v536c0 66-54 120-120 120h-607c-66 0-120-54-120-120v-536c0-66 54-120 120-120zm607 25h-607c-26 0-50 11-67 28-17 18-28 41-28 67v536c0 27 11 50 28 68 17 17 41 27 67 27h607c26 0 49-10 67-27 17-18 28-41 28-68v-536c0-26-11-49-28-67-18-17-41-28-67-28z"/><path stroke="#A9A8A4" stroke-width="20" d="M706 295l-68 281"/><path stroke="#E47474" stroke-width="20" d="M316 648l390-353M141 435l175 213"/><path stroke="#C9C9C9" stroke-width="20" d="M319 151l-178 284M706 295l-387-144"/><g fill="#040405"><path d="M319 111c22 0 40 18 40 40s-18 40-40 40-40-18-40-40 18-40 40-40zM141 395c22 0 40 18 40 40s-18 40-40 40c-23 0-41-18-41-40s18-40 41-40zM316 608c22 0 40 18 40 40 0 23-18 41-40 41s-40-18-40-41c0-22 18-40 40-40zM706 254c22 0 40 18 40 41 0 22-18 40-40 40s-40-18-40-40c0-23 18-41 40-41zM638 536c22 0 40 18 40 40s-18 40-40 40-40-18-40-40 18-40 40-40z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
lottery/staticfiles/admin/img/gis/move_vertex_on.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="24" height="22" viewBox="0 0 847 779" xmlns="http://www.w3.org/2000/svg"><g><path fill="#F1C02A" d="M120 1h607c66 0 120 54 120 120v536c0 66-54 120-120 120h-607c-66 0-120-54-120-120v-536c0-66 54-120 120-120z"/><path fill="#9E9E93" d="M120 1h607c66 0 120 54 120 120v536c0 66-54 120-120 120h-607c-66 0-120-54-120-120v-536c0-66 54-120 120-120zm607 25h-607c-26 0-50 11-67 28-17 18-28 41-28 67v536c0 27 11 50 28 68 17 17 41 27 67 27h607c26 0 49-10 67-27 17-18 28-41 28-68v-536c0-26-11-49-28-67-18-17-41-28-67-28z"/><path stroke="#A9A8A4" stroke-width="20" d="M706 295l-68 281"/><path stroke="#E47474" stroke-width="20" d="M316 648l390-353M141 435l175 213"/><path stroke="#C9A741" stroke-width="20" d="M319 151l-178 284M706 295l-387-144"/><g fill="#040405"><path d="M319 111c22 0 40 18 40 40s-18 40-40 40-40-18-40-40 18-40 40-40zM141 395c22 0 40 18 40 40s-18 40-40 40c-23 0-41-18-41-40s18-40 41-40zM316 608c22 0 40 18 40 40 0 23-18 41-40 41s-40-18-40-41c0-22 18-40 40-40zM706 254c22 0 40 18 40 41 0 22-18 40-40 40s-40-18-40-40c0-23 18-41 40-41zM638 536c22 0 40 18 40 40s-18 40-40 40-40-18-40-40 18-40 40-40z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
lottery/staticfiles/admin/img/icon-addlink.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#5fa225" d="M1600 796v192q0 40-28 68t-68 28h-416v416q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-416h-416q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h416v-416q0-40 28-68t68-28h192q40 0 68 28t28 68v416h416q40 0 68 28t28 68z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 331 B |
3
lottery/staticfiles/admin/img/icon-alert.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#efb80b" d="M1024 1375v-190q0-14-9.5-23.5t-22.5-9.5h-192q-13 0-22.5 9.5t-9.5 23.5v190q0 14 9.5 23.5t22.5 9.5h192q13 0 22.5-9.5t9.5-23.5zm-2-374l18-459q0-12-10-19-13-11-24-11h-220q-11 0-24 11-10 7-10 21l17 457q0 10 10 16.5t24 6.5h185q14 0 23.5-6.5t10.5-16.5zm-14-934l768 1408q35 63-2 126-17 29-46.5 46t-63.5 17h-1536q-34 0-63.5-17t-46.5-46q-37-63-2-126l768-1408q17-31 47-49t65-18 65 18 47 49z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 504 B |
9
lottery/staticfiles/admin/img/icon-calendar.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg width="16" height="32" viewBox="0 0 1792 3584" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<g id="icon">
|
||||
<path d="M192 1664h288v-288h-288v288zm352 0h320v-288h-320v288zm-352-352h288v-320h-288v320zm352 0h320v-320h-320v320zm-352-384h288v-288h-288v288zm736 736h320v-288h-320v288zm-384-736h320v-288h-320v288zm768 736h288v-288h-288v288zm-384-352h320v-320h-320v320zm-352-864v-288q0-13-9.5-22.5t-22.5-9.5h-64q-13 0-22.5 9.5t-9.5 22.5v288q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5-9.5t9.5-22.5zm736 864h288v-320h-288v320zm-384-384h320v-288h-320v288zm384 0h288v-288h-288v288zm32-480v-288q0-13-9.5-22.5t-22.5-9.5h-64q-13 0-22.5 9.5t-9.5 22.5v288q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5-9.5t9.5-22.5zm384-64v1280q0 52-38 90t-90 38h-1408q-52 0-90-38t-38-90v-1280q0-52 38-90t90-38h128v-96q0-66 47-113t113-47h64q66 0 113 47t47 113v96h384v-96q0-66 47-113t113-47h64q66 0 113 47t47 113v96h128q52 0 90 38t38 90z"/>
|
||||
</g>
|
||||
</defs>
|
||||
<use xlink:href="#icon" x="0" y="0" fill="#447e9b" />
|
||||
<use xlink:href="#icon" x="0" y="1792" fill="#003366" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
lottery/staticfiles/admin/img/icon-changelink.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#b48c08" d="M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 380 B |
9
lottery/staticfiles/admin/img/icon-clock.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg width="16" height="32" viewBox="0 0 1792 3584" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<g id="icon">
|
||||
<path d="M1024 544v448q0 14-9 23t-23 9h-320q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h224v-352q0-14 9-23t23-9h64q14 0 23 9t9 23zm416 352q0-148-73-273t-198-198-273-73-273 73-198 198-73 273 73 273 198 198 273 73 273-73 198-198 73-273zm224 0q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
</defs>
|
||||
<use xlink:href="#icon" x="0" y="0" fill="#447e9b" />
|
||||
<use xlink:href="#icon" x="0" y="1792" fill="#003366" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 677 B |
3
lottery/staticfiles/admin/img/icon-deletelink.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#dd4646" d="M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 392 B |
3
lottery/staticfiles/admin/img/icon-hidelink.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#2b70bf" d="m555 1335 78-141q-87-63-136-159t-49-203q0-121 61-225-229 117-381 353 167 258 427 375zm389-759q0-20-14-34t-34-14q-125 0-214.5 89.5T592 832q0 20 14 34t34 14 34-14 14-34q0-86 61-147t147-61q20 0 34-14t14-34zm363-191q0 7-1 9-105 188-315 566t-316 567l-49 89q-10 16-28 16-12 0-134-70-16-10-16-28 0-12 44-87-143-65-263.5-173T20 1029Q0 998 0 960t20-69q153-235 380-371t496-136q89 0 180 17l54-97q10-16 28-16 5 0 18 6t31 15.5 33 18.5 31.5 18.5T1291 358q16 10 16 27zm37 447q0 139-79 253.5T1056 1250l280-502q8 45 8 84zm448 128q0 35-20 69-39 64-109 145-150 172-347.5 267T896 1536l74-132q212-18 392.5-137T1664 960q-115-179-282-294l63-112q95 64 182.5 153T1772 891q20 34 20 69z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 784 B |
3
lottery/staticfiles/admin/img/icon-no.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#dd4646" d="M1277 1122q0-26-19-45l-181-181 181-181q19-19 19-45 0-27-19-46l-90-90q-19-19-46-19-26 0-45 19l-181 181-181-181q-19-19-45-19-27 0-46 19l-90 90q-19 19-19 46 0 26 19 45l181 181-181 181q-19 19-19 45 0 27 19 46l90 90q19 19 46 19 26 0 45-19l181-181 181 181q19 19 45 19 27 0 46-19l90-90q19-19 19-46zm387-226q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 560 B |
3
lottery/staticfiles/admin/img/icon-unknown-alt.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#ffffff" d="M1024 1376v-192q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23-9t9-23zm256-672q0-88-55.5-163t-138.5-116-170-41q-243 0-371 213-15 24 8 42l132 100q7 6 19 6 16 0 25-12 53-68 86-92 34-24 86-24 48 0 85.5 26t37.5 59q0 38-20 61t-68 45q-63 28-115.5 86.5t-52.5 125.5v36q0 14 9 23t23 9h192q14 0 23-9t9-23q0-19 21.5-49.5t54.5-49.5q32-18 49-28.5t46-35 44.5-48 28-60.5 12.5-81zm384 192q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 655 B |
3
lottery/staticfiles/admin/img/icon-unknown.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#666666" d="M1024 1376v-192q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23-9t9-23zm256-672q0-88-55.5-163t-138.5-116-170-41q-243 0-371 213-15 24 8 42l132 100q7 6 19 6 16 0 25-12 53-68 86-92 34-24 86-24 48 0 85.5 26t37.5 59q0 38-20 61t-68 45q-63 28-115.5 86.5t-52.5 125.5v36q0 14 9 23t23 9h192q14 0 23-9t9-23q0-19 21.5-49.5t54.5-49.5q32-18 49-28.5t46-35 44.5-48 28-60.5 12.5-81zm384 192q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 655 B |
3
lottery/staticfiles/admin/img/icon-viewlink.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#2b70bf" d="M1664 960q-152-236-381-353 61 104 61 225 0 185-131.5 316.5t-316.5 131.5-316.5-131.5-131.5-316.5q0-121 61-225-229 117-381 353 133 205 333.5 326.5t434.5 121.5 434.5-121.5 333.5-326.5zm-720-384q0-20-14-34t-34-14q-125 0-214.5 89.5t-89.5 214.5q0 20 14 34t34 14 34-14 14-34q0-86 61-147t147-61q20 0 34-14t14-34zm848 384q0 34-20 69-140 230-376.5 368.5t-499.5 138.5-499.5-139-376.5-368q-20-35-20-69t20-69q140-229 376.5-368t499.5-139 499.5 139 376.5 368q20 35 20 69z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 581 B |
3
lottery/staticfiles/admin/img/icon-yes.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#70bf2b" d="M1412 734q0-28-18-46l-91-90q-19-19-45-19t-45 19l-408 407-226-226q-19-19-45-19t-45 19l-91 90q-18 18-18 46 0 27 18 45l362 362q19 19 45 19 27 0 46-19l543-543q18-18 18-45zm252 162q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 436 B |
3
lottery/staticfiles/admin/img/inline-delete.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#999999" d="M1277 1122q0-26-19-45l-181-181 181-181q19-19 19-45 0-27-19-46l-90-90q-19-19-46-19-26 0-45 19l-181 181-181-181q-19-19-45-19-27 0-46 19l-90 90q-19 19-19 46 0 26 19 45l181 181-181 181q-19 19-19 45 0 27 19 46l90 90q19 19 46 19 26 0 45-19l181-181 181 181q19 19 45 19 27 0 46-19l90-90q19-19 19-46zm387-226q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 560 B |
3
lottery/staticfiles/admin/img/search.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="15" height="15" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#555555" d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 458 B |
34
lottery/staticfiles/admin/img/selector-icons.svg
Normal file
@@ -0,0 +1,34 @@
|
||||
<svg width="16" height="192" viewBox="0 0 1792 21504" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<g id="up">
|
||||
<path d="M1412 895q0-27-18-45l-362-362-91-91q-18-18-45-18t-45 18l-91 91-362 362q-18 18-18 45t18 45l91 91q18 18 45 18t45-18l189-189v502q0 26 19 45t45 19h128q26 0 45-19t19-45v-502l189 189q19 19 45 19t45-19l91-91q18-18 18-45zm252 1q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
<g id="down">
|
||||
<path d="M1412 897q0-27-18-45l-91-91q-18-18-45-18t-45 18l-189 189v-502q0-26-19-45t-45-19h-128q-26 0-45 19t-19 45v502l-189-189q-19-19-45-19t-45 19l-91 91q-18 18-18 45t18 45l362 362 91 91q18 18 45 18t45-18l91-91 362-362q18-18 18-45zm252-1q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
<g id="left">
|
||||
<path d="M1408 960v-128q0-26-19-45t-45-19h-502l189-189q19-19 19-45t-19-45l-91-91q-18-18-45-18t-45 18l-362 362-91 91q-18 18-18 45t18 45l91 91 362 362q18 18 45 18t45-18l91-91q18-18 18-45t-18-45l-189-189h502q26 0 45-19t19-45zm256-64q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
<g id="right">
|
||||
<path d="M1413 896q0-27-18-45l-91-91-362-362q-18-18-45-18t-45 18l-91 91q-18 18-18 45t18 45l189 189h-502q-26 0-45 19t-19 45v128q0 26 19 45t45 19h502l-189 189q-19 19-19 45t19 45l91 91q18 18 45 18t45-18l362-362 91-91q18-18 18-45zm251 0q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
<g id="clearall">
|
||||
<path transform="translate(336, 336) scale(0.75)" d="M1037 1395l102-102q19-19 19-45t-19-45l-307-307 307-307q19-19 19-45t-19-45l-102-102q-19-19-45-19t-45 19l-454 454q-19 19-19 45t19 45l454 454q19 19 45 19t45-19zm627-499q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
<g id="chooseall">
|
||||
<path transform="translate(336, 336) scale(0.75)" d="M845 1395l454-454q19-19 19-45t-19-45l-454-454q-19-19-45-19t-45 19l-102 102q-19 19-19 45t19 45l307 307-307 307q-19 19-19 45t19 45l102 102q19 19 45 19t45-19zm819-499q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/>
|
||||
</g>
|
||||
</defs>
|
||||
<use xlink:href="#up" x="0" y="0" fill="#666666" />
|
||||
<use xlink:href="#up" x="0" y="1792" fill="#447e9b" />
|
||||
<use xlink:href="#down" x="0" y="3584" fill="#666666" />
|
||||
<use xlink:href="#down" x="0" y="5376" fill="#447e9b" />
|
||||
<use xlink:href="#left" x="0" y="7168" fill="#666666" />
|
||||
<use xlink:href="#left" x="0" y="8960" fill="#447e9b" />
|
||||
<use xlink:href="#right" x="0" y="10752" fill="#666666" />
|
||||
<use xlink:href="#right" x="0" y="12544" fill="#447e9b" />
|
||||
<use xlink:href="#clearall" x="0" y="14336" fill="#666666" />
|
||||
<use xlink:href="#clearall" x="0" y="16128" fill="#447e9b" />
|
||||
<use xlink:href="#chooseall" x="0" y="17920" fill="#666666" />
|
||||
<use xlink:href="#chooseall" x="0" y="19712" fill="#447e9b" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
19
lottery/staticfiles/admin/img/sorting-icons.svg
Normal file
@@ -0,0 +1,19 @@
|
||||
<svg width="14" height="84" viewBox="0 0 1792 10752" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<g id="sort">
|
||||
<path d="M1408 1088q0 26-19 45l-448 448q-19 19-45 19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45zm0-384q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45 19-45l448-448q19-19 45-19t45 19l448 448q19 19 19 45z"/>
|
||||
</g>
|
||||
<g id="ascending">
|
||||
<path d="M1408 1216q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45 19-45l448-448q19-19 45-19t45 19l448 448q19 19 19 45z"/>
|
||||
</g>
|
||||
<g id="descending">
|
||||
<path d="M1408 704q0 26-19 45l-448 448q-19 19-45 19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z"/>
|
||||
</g>
|
||||
</defs>
|
||||
<use xlink:href="#sort" x="0" y="0" fill="#999999" />
|
||||
<use xlink:href="#sort" x="0" y="1792" fill="#447e9b" />
|
||||
<use xlink:href="#ascending" x="0" y="3584" fill="#999999" />
|
||||
<use xlink:href="#ascending" x="0" y="5376" fill="#447e9b" />
|
||||
<use xlink:href="#descending" x="0" y="7168" fill="#999999" />
|
||||
<use xlink:href="#descending" x="0" y="8960" fill="#447e9b" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
lottery/staticfiles/admin/img/tooltag-add.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#ffffff" d="M1600 736v192q0 40-28 68t-68 28h-416v416q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-416h-416q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h416v-416q0-40 28-68t68-28h192q40 0 68 28t28 68v416h416q40 0 68 28t28 68z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 331 B |
3
lottery/staticfiles/admin/img/tooltag-arrowright.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="13" height="13" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#ffffff" d="M1363 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45l166-166q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 280 B |
116
lottery/staticfiles/admin/js/SelectBox.js
Normal file
@@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
{
|
||||
const SelectBox = {
|
||||
cache: {},
|
||||
init: function(id) {
|
||||
const box = document.getElementById(id);
|
||||
SelectBox.cache[id] = [];
|
||||
const cache = SelectBox.cache[id];
|
||||
for (const node of box.options) {
|
||||
cache.push({value: node.value, text: node.text, displayed: 1});
|
||||
}
|
||||
},
|
||||
redisplay: function(id) {
|
||||
// Repopulate HTML select box from cache
|
||||
const box = document.getElementById(id);
|
||||
const scroll_value_from_top = box.scrollTop;
|
||||
box.innerHTML = '';
|
||||
for (const node of SelectBox.cache[id]) {
|
||||
if (node.displayed) {
|
||||
const new_option = new Option(node.text, node.value, false, false);
|
||||
// Shows a tooltip when hovering over the option
|
||||
new_option.title = node.text;
|
||||
box.appendChild(new_option);
|
||||
}
|
||||
}
|
||||
box.scrollTop = scroll_value_from_top;
|
||||
},
|
||||
filter: function(id, text) {
|
||||
// Redisplay the HTML select box, displaying only the choices containing ALL
|
||||
// the words in text. (It's an AND search.)
|
||||
const tokens = text.toLowerCase().split(/\s+/);
|
||||
for (const node of SelectBox.cache[id]) {
|
||||
node.displayed = 1;
|
||||
const node_text = node.text.toLowerCase();
|
||||
for (const token of tokens) {
|
||||
if (!node_text.includes(token)) {
|
||||
node.displayed = 0;
|
||||
break; // Once the first token isn't found we're done
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectBox.redisplay(id);
|
||||
},
|
||||
get_hidden_node_count(id) {
|
||||
const cache = SelectBox.cache[id] || [];
|
||||
return cache.filter(node => node.displayed === 0).length;
|
||||
},
|
||||
delete_from_cache: function(id, value) {
|
||||
let delete_index = null;
|
||||
const cache = SelectBox.cache[id];
|
||||
for (const [i, node] of cache.entries()) {
|
||||
if (node.value === value) {
|
||||
delete_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cache.splice(delete_index, 1);
|
||||
},
|
||||
add_to_cache: function(id, option) {
|
||||
SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
|
||||
},
|
||||
cache_contains: function(id, value) {
|
||||
// Check if an item is contained in the cache
|
||||
for (const node of SelectBox.cache[id]) {
|
||||
if (node.value === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
move: function(from, to) {
|
||||
const from_box = document.getElementById(from);
|
||||
for (const option of from_box.options) {
|
||||
const option_value = option.value;
|
||||
if (option.selected && SelectBox.cache_contains(from, option_value)) {
|
||||
SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
|
||||
SelectBox.delete_from_cache(from, option_value);
|
||||
}
|
||||
}
|
||||
SelectBox.redisplay(from);
|
||||
SelectBox.redisplay(to);
|
||||
},
|
||||
move_all: function(from, to) {
|
||||
const from_box = document.getElementById(from);
|
||||
for (const option of from_box.options) {
|
||||
const option_value = option.value;
|
||||
if (SelectBox.cache_contains(from, option_value)) {
|
||||
SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
|
||||
SelectBox.delete_from_cache(from, option_value);
|
||||
}
|
||||
}
|
||||
SelectBox.redisplay(from);
|
||||
SelectBox.redisplay(to);
|
||||
},
|
||||
sort: function(id) {
|
||||
SelectBox.cache[id].sort(function(a, b) {
|
||||
a = a.text.toLowerCase();
|
||||
b = b.text.toLowerCase();
|
||||
if (a > b) {
|
||||
return 1;
|
||||
}
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} );
|
||||
},
|
||||
select_all: function(id) {
|
||||
const box = document.getElementById(id);
|
||||
for (const option of box.options) {
|
||||
option.selected = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
window.SelectBox = SelectBox;
|
||||
}
|
||||