Skip to content

Commit

Permalink
Initial commit of takeAwayMenuSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenr-CodeCrafter committed Nov 29, 2023
1 parent c4f1906 commit 923d633
Show file tree
Hide file tree
Showing 95 changed files with 13,055 additions and 0 deletions.
Empty file added mainFrame/__init__.py
Empty file.
Binary file added mainFrame/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/email.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/forms.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added mainFrame/__pycache__/views.cpython-311.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions mainFrame/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions mainFrame/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class MainframeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'mainFrame'
98 changes: 98 additions & 0 deletions mainFrame/email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from django.core.mail import send_mail
from django.conf import settings
from time import strftime

def sendForgetPassword(email, token, id):
subject = 'Password Reset Request for YummiLicious'
# f is a string
# message = f'Hello, Please click the following link to reset your password http://127.0.0.1:8000/passwordResetConfirm/{token}/{id}'
message = f'Hello,<br><br>Your YummiLicious password can be reset by clicking the button below.<br>'
message += f'<br><button style = "background-color: #037c21;"><a href="http://127.0.0.1:8000/passwordResetConfirm/{token}/{id}" style = "text-decoration:none; color: white;">Reset Password</a></button>'
emailFrom = settings.EMAIL_HOST_USER
print(emailFrom)
print(email)
print(token)
print(id)
recipient = [email]
send_mail(subject, '', emailFrom, recipient, html_message=message)
return True

def sendAdminKey(key):
time = strftime("%Y-%m-%d %H:%M:%S")
print('Admin key')
subject = "New Key Generated - Important Information Enclosed"
message = (f"The new key has been successfully generated for YummiLicious Admin. This key is vital for maintaining the security and integrity of our system.\n\nKey: {key} \nGenerated On: {time} \n\nKindly keep this key confidential and secure to ensure the safety of the associated assets or data.")
emailFrom = settings.EMAIL_HOST_USER
recipient = ["[email protected]"]
send_mail(subject, message, emailFrom, recipient)
return True

def enquries(fromMail, subjectContent, body):
print(fromMail)
print(subjectContent)
print(body)
subject = subjectContent
message = (f"Customer Mail ID : {fromMail}\n\n{body}")
emailFrom = settings.EMAIL_HOST_USER
recipient = ['[email protected]']
send_mail(subject, message, emailFrom, recipient)
return True

def pushNotification(getStatus, getRestaurantToAddress, getCustomerToAddress):
time = strftime("%Y-%m-%d %H:%M:%S")
print('PUSH NOTIFICATION')
print(getStatus)
print(getRestaurantToAddress)
print(getCustomerToAddress)
if getStatus == 'placed':
emailFrom = settings.EMAIL_HOST_USER
restaurantMailAddress = [getRestaurantToAddress]
restaurantMailSubject = (f"New Order Alert.! - {time}")
restaurantMailBody = "Hello Restaurant,\n\nWe're thrilled to inform you that a new order is on its way, and please get ready to create something extraordinary for our valued customer. Once the order is ready, kindly hand it over to our delivery team or inform the customer for pickup.\n\nRegards\nYummiLicious team"
send_mail(restaurantMailSubject, restaurantMailBody, emailFrom, restaurantMailAddress)
customerMailSubject = 'Confirmation - Your Food Order Has Been Placed'
customerMailBody = 'Hello, \n\nWe are delighted to inform you that your recent food order has been successfully placed and you can track the status of your order in real-time using our website.\n\nRegards\nYummiLicious team'
customerMailAddress = [getCustomerToAddress]
send_mail(customerMailSubject, customerMailBody, emailFrom, customerMailAddress)
return True
elif getStatus == 'in_kitchen':
emailFrom = settings.EMAIL_HOST_USER
delivererMailAddress = [getCustomerToAddress]
delivererMailSubject = "Order Status Update - In Kitchen"
delivererMailBody = "Hello, \n\nWe're excited to let you know that your order is currently in the kitchen, where our expert culinary team is passionately crafting your meal with the utmost care and precision and your satisfaction remains our highest priority.\n\nRegards\nYummiLicious team"
send_mail(delivererMailSubject, delivererMailBody, emailFrom, delivererMailAddress)
elif getStatus == 'en_route':
emailFrom = settings.EMAIL_HOST_USER
subject = 'Order Status Update - Enroute'
message = 'Hello, \n\nExciting news! Your order is now enroute to your location, and our dedicated delivery team is working diligently to ensure it reaches you as quickly and safely as possible. We understand how eager you must be to enjoy your meal, and we appreciate your patience.\n\nRegards\nYummiLicious team'
recipient = [getCustomerToAddress]
print('in enroute status')
send_mail(subject, message, emailFrom, recipient)

def sendApproveOrRejectedMail(delivererOrRestaurant, approveOrReject, toAddress):
emailFrom = settings.EMAIL_HOST_USER
if delivererOrRestaurant == 'deliverer':
if approveOrReject == 'approved':
print("rider")
subject = 'Approval Mail'
message = (f"Hello Rider,\n\nWelcome! Thank you for partening with YummiLicious.\nJoin the well connected network of professional riders who deliver food to the customer, fresh and on time.\n\nRegards\nYummiLicious team")
recipient = [toAddress]
send_mail(subject, message, emailFrom, recipient)
else:
print("")
subject = 'Rejected Mail'
message = (f"Hello Rider,\n\nUnfortunately! You are not going to be partening with YummiLicious.\n\nRegards\nYummiLicious team")
recipient = [toAddress]
send_mail(subject, message, emailFrom, recipient)
else:
if approveOrReject == 'approved':
print("restaurant APPRROOVVAALL")
subject = 'Approval Mail'
message = (f"Hello Restaurant,\n\nWelcome! Thank you for partening with YummiLicious.\nStart expanding your restaurant's reach and serve more clients than even before.\n\nRegards\nYummiLicious team")
recipient = [toAddress]
send_mail(subject, message, emailFrom, recipient)
else:
subject = 'Rejected Mail'
message = (f"Hello Restaurant,\n\nUnfortunately! You are not going to be partening with YummiLicious.\n\nRegards\nYummiLicious team")
recipient = [toAddress]
send_mail(subject, message, emailFrom, recipient)
7 changes: 7 additions & 0 deletions mainFrame/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django import forms
from .models import menu

class menuForm(forms.ModelForm):
class Meta:
model = menu
fields = ["itemName", "itemDescription", "itemType", "price", "itemImage"]
65 changes: 65 additions & 0 deletions mainFrame/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Generated by Django 4.2.2 on 2023-07-28 15:38

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='customer',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=20)),
('firstname', models.CharField(max_length=20)),
('lastname', models.CharField(max_length=20)),
('email', models.CharField(max_length=50)),
('password', models.CharField(max_length=50)),
('phone', models.CharField(max_length=50)),
],
options={
'db_table': 'customer',
},
),
migrations.CreateModel(
name='menu',
fields=[
('menu_id', models.IntegerField(primary_key=True, serialize=False)),
('itemName', models.CharField(max_length=20)),
('restaurant_id', models.IntegerField(null=True)),
('itemDescription', models.TextField()),
('itemType', models.CharField(max_length=20)),
('price', models.DecimalField(decimal_places=2, max_digits=5)),
('itemImage', models.CharField(max_length=50)),
('createdBy', models.CharField(max_length=50)),
],
options={
'db_table': 'menu',
},
),
migrations.CreateModel(
name='restaurantRegister',
fields=[
('restaurant_id', models.IntegerField(primary_key=True, serialize=False)),
('firstname', models.CharField(max_length=20)),
('lastname', models.CharField(max_length=20)),
('email', models.CharField(max_length=50)),
('password', models.CharField(max_length=128)),
('phoneNumber', models.CharField(max_length=50)),
('restaurantName', models.CharField(max_length=50)),
('restaurantAddress', models.CharField(max_length=50)),
('city', models.CharField(max_length=50)),
('postcode', models.CharField(max_length=50)),
('cuisineType', models.CharField(max_length=50)),
('createdBy', models.CharField(max_length=50)),
],
options={
'db_table': 'restaurant_info',
},
),
]
Empty file.
Binary file not shown.
Binary file not shown.
143 changes: 143 additions & 0 deletions mainFrame/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
from django.db import models
# from django.contrib.auth.models import User
# Create your models here.
# from cloudinary.models import CloudinaryField

class customer(models.Model):
id = models.IntegerField(primary_key=True)
username = models.CharField(max_length=20)
firstname = models.CharField(max_length=20)
lastname = models.CharField(max_length=20)
email = models.CharField(max_length=50)
password = models.CharField(max_length=50)
phone = models.CharField(max_length=50)
isActive = models.CharField(max_length=10)

class Meta:
db_table = "customer"

class admin(models.Model):
admin_id = models.IntegerField(primary_key=True)
passKey = models.CharField(max_length=100)

class Meta:
db_table = "admin_info"

class restaurantRegister(models.Model):
restaurant_id = models.IntegerField(primary_key=True)
firstname = models.CharField(max_length=20)
lastname = models.CharField(max_length=20)
email = models.CharField(max_length=50)
password = models.CharField(max_length=128)
phoneNumber = models.CharField(max_length=50)
restaurantName = models.CharField(max_length=50)
restaurantAddress = models.CharField(max_length=50)
city = models.CharField(max_length=50)
postcode = models.CharField(max_length=50)
cuisineType = models.CharField(max_length=50)
hygineRating = models.IntegerField()
isApproved = models.IntegerField()
isDelete = models.IntegerField()
foodTag = models.JSONField()
createdBy = models.CharField(max_length=50)
modifiedBy = models.CharField(max_length=50)

class Meta:
db_table = "restaurant_info"


class menu(models.Model):
menu_id = models.IntegerField(primary_key=True)
itemName = models.CharField(max_length=20)
restaurant_id = models.IntegerField(null=True)
itemDescription = models.CharField(max_length=150)
itemType = models.CharField(max_length=20)
price = models.DecimalField(max_digits=5, decimal_places=2)
calorie = models.IntegerField()
foodGroup = models.CharField(max_length=25)
itemImage = models.CharField(max_length=50)
# itemImage = CloudinaryField('image')
isDelete = models.IntegerField()
createdBy = models.CharField(max_length=50)

class Meta:
db_table = "menu"


class orders(models.Model):
order_id = models.IntegerField(primary_key=True)
customer_id = models.IntegerField()
restaurant_id = models.IntegerField()
deliverer_id = models.IntegerField(null=True)
orderNumber = models.CharField(max_length=25)
foodItems = models.CharField(max_length=150)
orderSubTotal = models.DecimalField(max_digits=5, decimal_places=2)
orderTotal = models.DecimalField(max_digits=5, decimal_places=2)
orderMode = models.CharField(max_length=20)
orderStatus = models.CharField(max_length=50)
riderTip = models.DecimalField(max_digits=5, decimal_places=2)
riderInstruction = models.CharField(max_length=50)
isActive = models.CharField(max_length=10)
orderDate = models.CharField(max_length=50)

class Meta:
db_table = "order_info"


class discounts(models.Model):
discount_id = models.IntegerField(primary_key=True)
restaurant_id = models.IntegerField()
isActive = models.IntegerField()
description = models.CharField(max_length=50)
couponCode = models.CharField(max_length=50)
offPrice = models.IntegerField()
discountType = models.CharField(max_length=25)
spendAmount = models.IntegerField()
operation = models.CharField(max_length=25)
createdDate = models.CharField(max_length=50)

class Meta:
db_table = "discount_info"

class customerAddress(models.Model):
address_id = models.IntegerField(primary_key=True)
customer_id = models.IntegerField()
street = models.CharField(max_length=25)
city = models.CharField(max_length=25)
postcode = models.CharField(max_length=25)
phoneNumber = models.CharField(max_length=25)
createdDate = models.CharField(max_length=25)

class Meta:
db_table = "customeraddress_info"

class deliverer(models.Model):
deliverer_id = models.IntegerField(primary_key=True)
firstname = models.CharField(max_length=25)
lastname = models.CharField(max_length=25)
email = models.CharField(max_length=50)
password = models.CharField(max_length=128)
phoneNumber = models.CharField(max_length=25)
postCode = models.CharField(max_length=25)
token = models.CharField(max_length=80)
location = models.CharField(max_length=25)
dob = models.CharField(max_length=25)
vehicleType = models.CharField(max_length=25)
isApproved = models.IntegerField()
isDelete = models.IntegerField()
createdBy = models.CharField(max_length=25)
modifiedBy = models.CharField(max_length=25)

class Meta:
db_table = "deliverer_info"

class ratingsInfo(models.Model):
rating_id = models.IntegerField(primary_key=True)
customer_id = models.IntegerField()
restaurant_id = models.IntegerField()
feedback = models.CharField(max_length=80)
rating = models.IntegerField()
createdBy = models.CharField(max_length=25)

class Meta:
db_table = "rating_info"
Loading

0 comments on commit 923d633

Please sign in to comment.