# Generated by Django 2.2.6 on 2020-05-07 16:14

import datetime
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import easy_thumbnails.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('common', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('first_name', models.CharField(blank=True, max_length=30, null=True, verbose_name='Имя')),
                ('last_name', models.CharField(blank=True, max_length=30, null=True, verbose_name='Фамилия')),
                ('middle_name', models.CharField(blank=True, max_length=30, null=True, verbose_name='Отчество')),
                ('email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='Адрес электронной почты')),
                ('avatar', easy_thumbnails.fields.ThumbnailerImageField(blank=True, null=True, upload_to='avatars/', verbose_name='Аватарка')),
                ('password_change_date', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0), verbose_name='Дата изменения пароля')),
            ],
            options={
                'verbose_name': 'Пользователь',
                'verbose_name_plural': 'Пользователи',
                'db_table': 'auth_user',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='AssessmentCard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('card_number', models.CharField(default='', max_length=50, verbose_name='Номер карты')),
                ('signing_date', models.DateField(blank=True, null=True, verbose_name='Дата подписания карты')),
                ('next_assessment_date', models.DateField(blank=True, null=True, verbose_name='Дата следующей оценки')),
                ('medical_inspection', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=1, verbose_name='Проведение медицинских осмотров')),
                ('increased_pay', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Повышенная оплата труда')),
                ('extra_vacation', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Дополнительный отпуск')),
                ('reduced_working_hours', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Сокращенная продолжительность рабочего дня')),
                ('milk', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Молоко')),
                ('therapeutic_nutrition', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Лечебно-профилактическое питание')),
                ('early_retirement', models.PositiveIntegerField(choices=[(0, 'Нет'), (1, 'Да')], default=0, verbose_name='Право на досрочное назначение страховой пенсии')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'db_table': 'assessment_card',
            },
        ),
        migrations.CreateModel(
            name='Certificate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('num', models.PositiveIntegerField(default=1, verbose_name='Номер п.п')),
                ('certificate_number', models.CharField(default='', max_length=255, verbose_name='Номер сертификата')),
                ('description', models.CharField(blank=True, max_length=2000, null=True, verbose_name='Примечание')),
            ],
            options={
                'db_table': 'certificate',
            },
        ),
        migrations.CreateModel(
            name='CertificationType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('education_date', models.DateField(default=datetime.date.today, verbose_name='Дата обучения')),
                ('id_number', models.CharField(default='', max_length=50, verbose_name='Номер удостоверения')),
                ('next_education_date', models.DateField(default=datetime.date.today, verbose_name='Контрольная дата очередной аттестации')),
                ('days_to_education', models.PositiveIntegerField(blank=True, null=True, verbose_name='Дней до очередной аттестации')),
            ],
            options={
                'db_table': 'certification_type',
            },
        ),
        migrations.CreateModel(
            name='Commission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('num', models.PositiveIntegerField(default=1, verbose_name='№ п/п')),
                ('commission_type', models.PositiveIntegerField(choices=[(1, 'Медицинское обследование'), (2, 'Инструктаж')], default=1, verbose_name='Вид комиссии')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
                ('decree', models.CharField(blank=True, max_length=255, null=True, verbose_name='Приказ')),
                ('decree_date', models.DateField(blank=True, null=True, verbose_name='Дата приказа')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Комиссия',
                'verbose_name_plural': 'Комиссии',
                'db_table': 'commission',
            },
        ),
        migrations.CreateModel(
            name='CommissionEmployee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('member_status', models.PositiveIntegerField(choices=[(1, 'Председатель'), (2, 'Секретарь'), (3, 'Участник')], default=3, verbose_name='Статус участника')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Комиссия - Сотрудник',
                'verbose_name_plural': 'Комиссии - Сотрудники',
                'db_table': 'commission_employee',
            },
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=255, verbose_name='Название')),
                ('short_name', models.CharField(default='', max_length=255, verbose_name='Краткое название')),
                ('inn', models.CharField(default='', max_length=20, verbose_name='ИНН')),
                ('badge', easy_thumbnails.fields.ThumbnailerImageField(blank=True, null=True, upload_to='badges/', verbose_name='Логотип')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Компания',
                'verbose_name_plural': 'Компании',
                'db_table': 'company',
            },
        ),
        migrations.CreateModel(
            name='Department',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Код подразделения')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Название')),
                ('order_num', models.PositiveIntegerField(default=1, verbose_name='Порядок')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Подразделение',
                'verbose_name_plural': 'Подразделения',
                'db_table': 'department',
            },
        ),
        migrations.CreateModel(
            name='DepartmentType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=255, verbose_name='Название')),
                ('order_num', models.PositiveIntegerField(default=1, verbose_name='Порядок')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Тип подразделения',
                'verbose_name_plural': 'Типы подразделений',
                'db_table': 'department_type',
            },
        ),
        migrations.CreateModel(
            name='EducationType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
                ('frequency', models.CharField(default='', max_length=50, verbose_name='Периодичность')),
            ],
            options={
                'db_table': 'education_type',
            },
        ),
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('last_name', models.CharField(default='', max_length=255, verbose_name='Фамилия')),
                ('first_name', models.CharField(default='', max_length=255, verbose_name='Имя')),
                ('middle_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Отчество')),
                ('address', models.CharField(blank=True, max_length=2000, null=True, verbose_name='Адрес проживания')),
                ('birth_date', models.DateField(default=datetime.date.today, verbose_name='Дата рождения')),
                ('gender', models.CharField(blank=True, choices=[('m', 'мужчина'), ('f', 'женщина')], max_length=1, null=True, verbose_name='Пол')),
                ('disability', models.BooleanField(blank=True, null=True, verbose_name='Инвалидность')),
                ('employment_date', models.DateField(default=datetime.date.today, verbose_name='Дата приема на работу')),
                ('pers_number', models.CharField(default='', max_length=255, verbose_name='Табельный номер')),
                ('avatar', easy_thumbnails.fields.ThumbnailerImageField(blank=True, null=True, upload_to='avatars/', verbose_name='Аватарка')),
                ('insurance_number', models.CharField(default='', max_length=255, verbose_name='Страховой номер (СНИЛС)')),
                ('fire_date', models.DateField(blank=True, null=True, verbose_name='Дата увольнения')),
            ],
            options={
                'verbose_name': 'Сотрудник',
                'verbose_name_plural': 'Сотрудники',
                'db_table': 'employee',
            },
        ),
        migrations.CreateModel(
            name='Equipment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Код инструмента')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Название')),
                ('inventory_number', models.CharField(default='', max_length=255, verbose_name='Инвентарный номер')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Инструмент',
                'verbose_name_plural': 'Инструменты',
                'db_table': 'equipment',
            },
        ),
        migrations.CreateModel(
            name='EquipmentGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Название')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Группа инструментов',
                'verbose_name_plural': 'Группы инструментов',
                'db_table': 'equipment_group',
            },
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('entity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='common.Entity')),
                ('event_type', models.PositiveIntegerField(choices=[(1, 'Медицинское обследование'), (2, 'Инструктаж'), (3, 'Обучение')], default=1, verbose_name='Тип мероприятия')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
                ('event_date', models.DateField(default=datetime.date.today, verbose_name='Дата мероприятия')),
                ('frequency', models.CharField(choices=[('1/t', 'Единоразово'), ('1/m', 'Раз в месяц'), ('1/q', 'Раз в квартал'), ('2/y', 'Два раза в год'), ('1/y', 'Раз в год'), ('1/2y', 'Раз в два года'), ('1/w', 'Раз в неделю')], default='1/t', max_length=20, verbose_name='Периодичность')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Мероприятие',
                'verbose_name_plural': 'Мероприятия',
                'db_table': 'event',
            },
            bases=('common.entity',),
        ),
        migrations.CreateModel(
            name='EventDocumentTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('apply_to', models.CharField(choices=[('event', 'Мероприятие'), ('commission', 'Комиссия'), ('employee', 'Участник')], default='event', max_length=20, verbose_name='Применить')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'verbose_name': 'Мероприятие - Документ',
                'verbose_name_plural': 'Мероприятия - Документы',
                'db_table': 'event_document_template',
            },
        ),
        migrations.CreateModel(
            name='HarmfulFactor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Номер')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
                ('inspection_frequency', models.CharField(default='', max_length=50, verbose_name='Периодичность осмотра')),
            ],
            options={
                'db_table': 'harmful_factor',
            },
        ),
        migrations.CreateModel(
            name='MedicalType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
            ],
            options={
                'db_table': 'medical_type',
            },
        ),
        migrations.CreateModel(
            name='MemberStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
            ],
            options={
                'db_table': 'member_status',
            },
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Код должности')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Название')),
                ('boss', models.BooleanField(default=False, verbose_name='Руководящая позиция')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='companies.Company', verbose_name='Компания')),
            ],
            options={
                'verbose_name': 'Должность',
                'verbose_name_plural': 'Должности',
                'db_table': 'position',
            },
        ),
        migrations.CreateModel(
            name='Ppe',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=255, verbose_name='Наименование')),
                ('description', models.CharField(blank=True, max_length=2000, null=True, verbose_name='Описание')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
            ],
            options={
                'db_table': 'ppe',
            },
        ),
        migrations.CreateModel(
            name='PsychiatricType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
            ],
            options={
                'db_table': 'psychiatric_type',
            },
        ),
        migrations.CreateModel(
            name='WorkingConditionClass',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=255, verbose_name='Класс')),
            ],
            options={
                'db_table': 'working_condition_class',
            },
        ),
        migrations.CreateModel(
            name='WorkType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Номер')),
                ('name', models.CharField(default='', max_length=2000, verbose_name='Наименование')),
                ('inspection_frequency', models.CharField(default='', max_length=50, verbose_name='Периодичность осмотра')),
            ],
            options={
                'db_table': 'work_type',
            },
        ),
        migrations.CreateModel(
            name='Workplace',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='', max_length=30, verbose_name='Код рабочего места')),
                ('instruction_required', models.BooleanField(default=True, verbose_name='Необходимость проходить инструктаж по электробезопасности')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
                ('department', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='companies.Department', verbose_name='Подразделение')),
                ('equipment', models.ManyToManyField(to='companies.Equipment', verbose_name='Инструмент')),
                ('position', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='companies.Position', verbose_name='Должность')),
            ],
            options={
                'verbose_name': 'Рабочее место',
                'verbose_name_plural': 'Рабочие места',
                'db_table': 'workplace',
            },
        ),
        migrations.CreateModel(
            name='PpeStandard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('decree', models.CharField(default='', max_length=2000, verbose_name='Основание')),
                ('paragraph', models.CharField(blank=True, max_length=30, null=True, verbose_name='Номер пункта')),
                ('item_count', models.PositiveIntegerField(default=0, verbose_name='Количество')),
                ('ppe', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='companies.Ppe', verbose_name='СИЗ')),
            ],
            options={
                'db_table': 'ppe_standard',
            },
        ),
        migrations.CreateModel(
            name='EventEmployee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event_date', models.DateField(blank=True, null=True, verbose_name='Дата мероприятия')),
                ('certificate', models.CharField(blank=True, max_length=255, null=True, verbose_name='Сертификат')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
                ('employee', models.ForeignKey(db_column='employee_id', on_delete=django.db.models.deletion.PROTECT, to='companies.Employee', verbose_name='Сотрудник')),
                ('event', models.ForeignKey(db_column='event_id', on_delete=django.db.models.deletion.PROTECT, to='companies.Event', verbose_name='Мероприятие')),
            ],
            options={
                'verbose_name': 'Мероприятие - Сотрудник',
                'verbose_name_plural': 'Мероприятия - Сотрудники',
                'db_table': 'event_employee',
            },
        ),
    ]
