+
+ className="inline-flex items-center px-2.5 py-0.5 m-0.5 rounded-full text-sm font-medium bg-gray-100 text-gray-800">
{order._id}
+ className="inline-flex items-center px-2.5 py-0.5 m-0.5 rounded-full text-sm font-medium bg-gray-100 text-gray-800">
{order.name}
@@ -182,6 +184,10 @@ const Page = () => {
+
diff --git a/src/app/page.jsx b/src/app/page.jsx
index 01afaba..12a9dc2 100644
--- a/src/app/page.jsx
+++ b/src/app/page.jsx
@@ -160,10 +160,10 @@ const Page = () => {
/**
* Set the name of the order
- * @param e
+ * @param name
*/
- const setName = (e) => {
- updateOrder({name: e.target.value});
+ const setName = (name) => {
+ updateOrder({name: name});
};
/**
diff --git a/src/model/order.ts b/src/model/order.ts
index b71ee9c..069eddd 100644
--- a/src/model/order.ts
+++ b/src/model/order.ts
@@ -1,29 +1,10 @@
import { type Document, Model, model, Schema } from "mongoose";
import { FoodDocument } from "./food";
-import { ORDER } from "@/config";
-export type OrderStatus = 'pending' | 'paid' | 'baking' | 'ready' | 'delivered' | 'cancelled';
-export const ORDER_STATES: OrderStatus[] = ['pending', 'paid', 'baking', 'ready', 'delivered', 'cancelled'];
+export type OrderStatus = 'pending' | 'baking' | 'ready' | 'delivered' | 'cancelled';
+export const ORDER_STATES: OrderStatus[] = ['pending', 'baking', 'ready', 'delivered', 'cancelled'];
-export const statusToText = (status: string) => {
- if (status === 'ready') {
- return 'Your order is ready for pickup!';
- } else if (status === 'pending') {
- return 'Please pay at the counter.';
- } else if (status === 'baking') {
- return 'Its getting hot 🔥:)';
- } else if (status === 'paid') {
- return 'Your order is being prepared...';
- } else if (status === 'delivered') {
- return 'Your order has been delivered!';
- } else if (status === 'cancelled') {
- return 'Your order has been cancelled.';
- } else {
- return 'Unknown status';
- }
-}
-
export interface OrderDocument extends Document {
_id: string;
name: string;
@@ -33,6 +14,7 @@ export interface OrderDocument extends Document {
timeslot: string;
totalPrice: number;
finishedAt?: Date;
+ isPaid: boolean;
status: OrderStatus;
}
@@ -68,6 +50,10 @@ const orderSchema = new Schema
({
finishedAt: {
type: Date,
},
+ isPaid: {
+ type: Boolean,
+ default: false,
+ },
status: {
type: String,
enum: ORDER_STATES,