from django.db import models
from django.contrib.auth.models import User
import os
from tinymce import models as tinymce_models
from model_utils import Choices
from inventarioalmacen.models import *
from datetime import datetime


# Create your models here.

class bitreporte(models.Model):
    STATUS = Choices('Bitacora', 'Pendiente', 'Realizado')
    n_reporte = models.IntegerField(verbose_name='No. Reporte')
    n_year = models.CharField(max_length=4, null=False, verbose_name='Año')
    fecha = models.DateField(auto_now_add=True, verbose_name='Fecha')
    area = models.ForeignKey(area, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Area')
    reporte = models.CharField(max_length=250, null=False, verbose_name='Reporte')
    quien_reporta = models.CharField(max_length=250, null=False, verbose_name='Quien Reporta')
    asignado = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='Asignado', verbose_name='Asignado A')
    recibido_por = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='Recibio', verbose_name='Recibido Por')
    hora = models.CharField(max_length=50, null=False, verbose_name='Hora')
    realizado = models.CharField(max_length=250, null=True, blank=True, verbose_name='Realizado')
    pendiente = models.CharField(choices=STATUS, null=True, blank=True, default=STATUS.Bitacora, max_length=20, verbose_name='Bitacora')
    control_bit = models.CharField(max_length=250, unique=True, null=True, blank=True, verbose_name='Control Bitacora')
        
    def __str__(self):
        return str(self.n_reporte)
    
    class Meta:
        verbose_name = 'Bitacora Reporte'
        verbose_name_plural = 'Bitacora Reportes'
        ordering = ['-id']



