from django.db import models class User(models.Model): UserTypeList = [ ('admin', 'admin'), ('office', 'office'), ('operator', 'operator'), ] user_name = models.CharField(max_length=50) password = models.CharField(max_length=50) user_type = models.CharField( max_length=10, choices=UserTypeList ) name_family = models.CharField(max_length=200) create_date = models.DateTimeField(auto_now_add=True) class Customer(models.Model): name_family = models.CharField(max_length=200) address = models.CharField(max_length=200) create_date = models.DateTimeField(auto_now_add=True) class PhoneNumber(models.Model): customer = models.ForeignKey(Customer, on_delete=models.CASCADE) phone_number = models.CharField(max_length=11) class StoreRoom(models.Model): store_name = models.CharField(max_length=200) class ProductCategory(models.Model): category_name = models.CharField(max_length=50) class Product(models.Model): ProductCategory = models.ForeignKey(ProductCategory, on_delete=models.CASCADE) product_name = models.CharField(max_length=50) product_price = models.IntegerField() class ProductInStore(models.Model): StoreRoom = models.ForeignKey(StoreRoom, on_delete=models.CASCADE) Product = models.ForeignKey(Product, on_delete=models.CASCADE) inventory = models.IntegerField() class Factor(models.Model): customer = models.ForeignKey(Customer, on_delete=models.CASCADE) create_date = models.DateTimeField(auto_now_add=True) amount = models.IntegerField() discount = models.IntegerField() deadline = models.DateTimeField() statusList = [ ('unpaid', 'unpaid'), ('paid', 'paid'), ('cancell', 'cancell'), ] pay_status = models.CharField( max_length=10, choices=statusList ) FactorType = [ ('Nasb', 'Nasb'), ('Khadamat', 'Khadamat'), ('Garranty', 'Garranty'), ] FactorType = models.CharField( max_length=10, choices=FactorType ) class FactorIteam(models.Model): factor = models.ForeignKey(Factor, on_delete=models.CASCADE) product = models.ForeignKey(Product, on_delete=models.CASCADE) product_name = models.DateTimeField(auto_now_add=True) num = models.IntegerField() amount = models.IntegerField() class VisitQueue(models.Model): customer = models.ForeignKey(Customer, on_delete=models.CASCADE) dateTime = models.DateTimeField() statusList = [ ('waiting', 'waiting'), ('finish', 'finish'), ('cancell', 'cancell'), ] status = models.CharField( max_length=10, choices=statusList, default='waiting', ) user = models.ForeignKey(User, on_delete=models.CASCADE) GradeList = [ ('3', '3'), ('2', '2'), ('1', '1'), ] grade = models.CharField( max_length=1, choices=GradeList, ) grade_desc = models.CharField(max_length=200)