Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(admin-dashboard): created recent orders functionality #92

Merged
merged 5 commits into from
Jun 22, 2024

Conversation

rohansen856
Copy link
Contributor

Overview

  1. This PR fixes or fixes part of [Feature Request]: Implement Admin Dashboard UI According to Figma Design #89 .
  2. This PR does the following: created recent orders details card with data fetching.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
  • The PR is made from a branch that's not called "main/master".

Proof that changes are correct

Screenshot 2024-06-16 232750
Screenshot 2024-06-16 232726

responsiveness:
Screenshot 2024-06-16 232508
Screenshot 2024-06-16 232534
Screenshot 2024-06-16 232523

works done in this pr:

frontend

  1. created a list view of the recent orders (orders done inn the same day).
  2. created order details card, viewable when clicked View Details

backend

  1. modified the orders.service.ts file to add the logic to get the data in required format
  2. modified the orders.controller.ts file to add the route handler to get the details.
  3. fixed the seed file to push the data in better format.

PR Pointers

  • If you need a review or an answer to a question, and don't have permissions to assign people, leave a comment like the following: "{{Question/comment}} @{{reviewer_username}} PTAL".
  • Never force push. If you do, your PR will be closed.

Copy link

vercel bot commented Jun 16, 2024

@rohansen856 is attempting to deploy a commit to the Busify Team on Vercel.

A member of the Team first needs to authorize it.

@RISHIKESHk07
Copy link
Collaborator

@rohansen856 we will be having relationship between tickets and orders as well , it make it easier for the other issue for data fetching , please make changes according to this schema
WhatsApp Image 2024-06-17 at 9 46 09 AM

@rohansen856
Copy link
Contributor Author

rohansen856 commented Jun 17, 2024

@RISHIKESHk07 i will fix the issue and update the schema with the correct relationships, and also check if there is any need to change the data fetching method using prisma with the updated relationship.

@rohansen856
Copy link
Contributor Author

rohansen856 commented Jun 17, 2024

@RISHIKESHk07 @Pratik2026 i have updated the schema.prisma file to make relations between orders, tickets and schedule schma. also updated the data fetching method in order.service.ts in my latest pr.
the current relationship is:

model Schedule {
    id            String   @id
    busNumber     String
    bus           Bus      @relation(fields: [busNumber], references: [number])
    checkpoints   String[]
    from          String
    to            String
    departureTime String
    days          String[]
    ticketPrice   Int
    orders        Order[]
}

model Ticket {
    id             Int @id @default(autoincrement())
    orderId        String @unique
    passengerEmail String[]
    order          Order @relation(fields: [orderId], references: [id])
}

model Order {
    id         String     @id
    userId     String
    scheduleId String
    status     String     @default("pending") // how to make this enum
    amount     Int
    attempts   Int        @default(0)
    receipt    String     @unique
    createdAt  DateTime   @default(now())
    user       Users      @relation(fields: [userId], references: [id])
    ticket     Ticket?
    schedule   Schedule  @relation(fields: [scheduleId], references: [id])
}

the relationship are:

  1. order -> ticket: one-to-one
  2. schedule -> order: many to one

thank you.

@RISHIKESHk07
Copy link
Collaborator

@Pratik2026 LGTM codewise , any changes as per you ?

@@ -0,0 +1,253 @@
import { Typography, styled, Box, useTheme } from '@mui/material';
import Clear from "@mui/icons-material/clear"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohansen856 double check this line @mui/icons-material/clear"

Copy link
Contributor Author

@rohansen856 rohansen856 Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RISHIKESHk07 I will fix the issue with the formatting and add the semicolon(;) in this line.

Copy link
Collaborator

@RISHIKESHk07 RISHIKESHk07 Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohansen856 the probelm is the its "@mui/icons-material/Clear" , on my end i see it giving a error for ...../clear and it works for @mui/icons-material/Clear

Copy link
Collaborator

@RISHIKESHk07 RISHIKESHk07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohansen856 did you verify if page works when we add a ticket through the razorpay UI (dummy order) instead of seeding the data ? i tried it here (Left: Busify & Right:Ptisma Studio) , there is a ticket created but does not appear in the admin page , maybe its a date issue , you can test razorpay UPI with success@razorpay
image

@rohansen856
Copy link
Contributor Author

@rohansen856 did you verify if page works when we add a ticket through the razorpay UI (dummy order) instead of seeding the data ? i tried it here (Left: Busify & Right:Ptisma Studio) , there is a ticket created but does not appear in the admin page , maybe its a date issue , you can test razorpay UPI with success@razorpay image

@RISHIKESHk07 i will double check the payments issue with razorpay, and also check any issues with the data.

@rohansen856
Copy link
Contributor Author

@RISHIKESHk07 i have solved the following issues in the latest pr:

  1. updated the prisma Ticket schema with the discussed changes.
  2. updated the order of database seeding in prisma/seed.mjs.
  3. updated orders.service.ts to fix the issue with the date object in razorpay payment datetime.
  4. fixed the frontend issue with parsing the datetime by encapsulation the field in new Date().
  5. fixed the issue with formatting in frontend/src/components/AdminPanel/OrderDetailsCard/index.tsx.
    proof of work:
part1.split-video.com.1.mp4
part2.split-video.com.1.mp4

thank you.

@RISHIKESHk07 RISHIKESHk07 merged commit 728a3b6 into bsoc-bitbyte:main Jun 22, 2024
1 check failed
@Pratik2026 Pratik2026 linked an issue Jul 4, 2024 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Implement Admin Dashboard UI According to Figma Design
3 participants