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

Upgrading to work with PayloadCMS 3.0 #1

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7d76a3f
getting there..commit for repro
ahmetskilinc Oct 30, 2024
47e177e
package update
ahmetskilinc Oct 30, 2024
6ce75d7
update readme
ahmetskilinc Oct 31, 2024
8f5327c
Most routes now working
ahmetskilinc Oct 31, 2024
ca103fb
modal is working
ahmetskilinc Oct 31, 2024
91f2670
updated readme
ahmetskilinc Oct 31, 2024
2b16b60
update github action
ahmetskilinc Oct 31, 2024
ac96de9
update github action
ahmetskilinc Oct 31, 2024
b0ae6ad
fix
ahmetskilinc Oct 31, 2024
7611c07
some general updates
ahmetskilinc Oct 31, 2024
d750e11
small fix for getappointmentsforday
ahmetskilinc Oct 31, 2024
f2a7742
added a frontend and some other stuff
ahmetskilinc Nov 2, 2024
9df86ae
example frontend changes
ahmetskilinc Nov 2, 2024
abb6cba
Adding OTP for customer views
ahmetskilinc Nov 2, 2024
f15a45f
commented out some bits to stop error
ahmetskilinc Nov 2, 2024
fb0329e
updated packages
ahmetskilinc Nov 2, 2024
9e8e32b
move getAppointmentsForDay to endpoints folder
ahmetskilinc Nov 2, 2024
ace5071
added styles to frontend for react-calendar
ahmetskilinc Nov 2, 2024
4882117
remove unused import
ahmetskilinc Nov 2, 2024
9275322
small changes to frontend example app
ahmetskilinc Nov 2, 2024
cc9e248
- updated OTP to use payloads authentication
ahmetskilinc Nov 4, 2024
007ec1a
updated more of the example frontend and some other updates
ahmetskilinc Nov 4, 2024
a0e2024
update token name
ahmetskilinc Nov 4, 2024
6d9fca1
updates parts of the frontend and custom api
ahmetskilinc Nov 4, 2024
9b0fa6f
fix token name
ahmetskilinc Nov 4, 2024
d976e63
fix where customer id comes from
ahmetskilinc Nov 4, 2024
6092a6c
fixed the filter not show past slots
ahmetskilinc Nov 6, 2024
64d71cf
fixed to show filtered slots and not all slots
ahmetskilinc Nov 6, 2024
b043086
appointments for customer from db
ahmetskilinc Nov 6, 2024
3e47d7a
fixed a few bugs
ahmetskilinc Nov 6, 2024
2a76a6f
Revert file
ahmetskilinc Nov 6, 2024
866bef6
fix file
ahmetskilinc Nov 6, 2024
cfd055d
updates
ahmetskilinc Nov 6, 2024
06ece4a
fix and updates
ahmetskilinc Nov 6, 2024
aa16896
chore: update to latest payload and fix breaking changes
ahmetskilinc Jan 7, 2025
90daf4e
chore: some fixes
ahmetskilinc Jan 7, 2025
d459afb
chore: remove graphql
ahmetskilinc Jan 7, 2025
35d3b4f
fix: ListHeader removed and replaced.
ahmetskilinc Jan 7, 2025
8606162
chore: add payload as dependency
ahmetskilinc Jan 7, 2025
4d41aad
small updates
ahmetskilinc Jan 21, 2025
8e100e0
some small optimisations
ahmetskilinc Jan 21, 2025
dc10bd7
remove date-fns and use moment everywhere
ahmetskilinc Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

35 changes: 21 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
name: Build

on:
pull_request:
types: [ opened, reopened, synchronize ]
push:
branches: [ main ]
pull_request:
types: [opened, reopened, synchronize]
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn build
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

121 changes: 97 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,124 @@
> [!Warning]
> This plugin is a WIP and doesn't fully function yet.

# Payload plugin to add appointment scheduling to your Payload app.

This plugin allows you to add appointment scheduling capabilities to your payload app. It provides:
- Customers, Hosts, Services and Appointments collections

- Services and Appointments collections.
- An Appointment schedule calendar view.
- Opening times global.
- Authentication on Customers collection.

![Appointments List day](./images/appointments-list-day.png)
### Appointments Schedule View For Everyone

![Appointments List day](./images/appointments-schedule-day.png)

![Appointments List week](./images/appointments-list-week.png)
### Appointments Schedule View For Logged In User

![Collections](./images/collections.png)
![Appointments List week](./images/appointments-schedule-me-day.png)

### Dashboard View

![Dashboard](./images/dashboard.png)

## Installation

#### 1. install

`npm i payload-appointments-plugin`
```
npm i payload-appointments-plugin
pnpm install payload-appointments-plugin
yarn add payload-appointments-plugin
```

#### 2. add fields to users collection

```typescript
const Users: CollectionConfig = {
// ...
fields: [
{
name: "firstName",
type: "text",
label: "First name",
},
{
name: "lastName",
type: "text",
label: "Last name",
},
{
name: "roles",
type: "select",
options: [
{
value: "admin",
label: "Admin",
},
{
value: "customer",
label: "Customer",
},
],
},
{
name: "takingAppointments",
type: "checkbox",
admin: {
condition: (siblingData) => ["admin"].includes(siblingData.roles),
description: "Whether this user takes appointments or not.",
},
label: "Taking appointments?",
defaultValue: false,
},
{
name: "preferredNameAppointments",
type: "text",
label: "Preferred name",
required: true,
admin: {
condition: (siblingData) => Boolean(siblingData.takingAppointments),
description: "Name to show in appointment schedule calendar and to customers when booking.",
},
},
],
};

export default Users;
```

#### 2. add to config
#### 3. add to config

```typescript
import appointments from "payload-appointments-plugin";

export default buildConfig({
/* ... */
plugins: [appointments()],
/* ... */
/* ... */
plugins: [appointments()],
/* ... */
});
```

#### 3. add email config
#### 4. add email config

follow instructions on [PayloadCMS Email Docs](https://payloadcms.com/docs/email/overview)

## todo?
## Todo?

- [ ] Customers collection
- [x] Auth on collection
- [x] Firstname, lastname, username, dob, email, password
- [ ] Appointments collection
- [x] Appointments collection
- [x] Appointment type, Host, Customer, Services, Title, Start date/time, End date/time
- [x] Appointment type is appointment or blockout (lunch, break, interview, meeting, day off? etc.)
- [x] Endpoint for getting available time slots
- [x] Endpoint for getting available time slots
- [ ] Add new properties/attributes to default auth collection
- [x] Taking appointments checkbox
- [x] Preffered name
- [ ] Calendar subscription
- [ ] Services collection for ...services
- [x] Services collection for ...services
- [x] Title
- [x] Description
- [x] Duration
- [ ] Cost
- [x] Cost/Price
- [ ] Variable cost (per hour... etc.)
- [ ] Emails
- [x] Email config (Will need to be added by the dev)
- [ ] React email templates
Expand All @@ -60,22 +127,28 @@ follow instructions on [PayloadCMS Email Docs](https://payloadcms.com/docs/email
- [x] Appointment updated email
- [ ] Add iCal link/file to email
- [ ] Customer signed up email
- [ ] Forgot password email
- [ ] Custom payload views
- [x] Appointments schedule view /appointments-schedule
- [x] Appointments schedule view /appointments/schedule
- [x] Appointments schedule view for loggined in user /appointments/schedule/me
- [x] Charts /appointments/charts
- [x] Marketing Campaigns /appointments/marketing-campaigns
- [ ] ...more to come
- [ ] Endpoints
- [x] Get available timeslots for given date, services, host
- [ ] Calendar schedule view
- [x] Ability to update appointment from calendar view
- [ ] Ability to add appointments by clicking/tapping slot in calendar
- [ ] Get start date and time from clicked slot
- [ ] Get host from clicked slot
- [ ] Opening times global
- [x] Opening times global
- [x] Monday...Sunday
- [x] Set times for different days of week
- [x] Define if closed on that day
- [x] Add properties for showing/hiding navItems and beforeDashboard
- [ ] Add overrides for collections

A lot more I want to add. But may need some help.

## testing?
## Testing?

I'm new to testing...
I'm new to testing...
27 changes: 0 additions & 27 deletions dev/Dockerfile

This file was deleted.

20 changes: 20 additions & 0 deletions dev/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app/(frontend)/globals.css",
"baseColor": "neutral",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}
31 changes: 0 additions & 31 deletions dev/docker-compose.yml

This file was deleted.

5 changes: 5 additions & 0 deletions dev/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
8 changes: 8 additions & 0 deletions dev/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { withPayload } from "@payloadcms/next/withPayload";

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
};

export default withPayload(nextConfig);
6 changes: 0 additions & 6 deletions dev/nodemon.json

This file was deleted.

Loading
Loading