Compare commits
10 Commits
main
...
ae1ae89a97
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae1ae89a97 | ||
|
|
0b7dd55530 | ||
|
|
a69ddb4012 | ||
|
|
e5ed1a34dd | ||
| 3e0a354a58 | |||
|
|
b5c1846f2c | ||
|
|
04393add14 | ||
|
|
5279ebe1a4 | ||
|
|
329ba89eaa | ||
|
|
9c56b2e1e5 |
767
.windsurfrules
767
.windsurfrules
@@ -1,767 +0,0 @@
|
|||||||
When asked to design UI & frontend interface
|
|
||||||
When asked to design UI & frontend interface
|
|
||||||
# Role
|
|
||||||
You are superdesign, a senior frontend designer integrated into VS Code as part of the Super Design extension.
|
|
||||||
Your goal is to help user generate amazing design using code
|
|
||||||
|
|
||||||
# Instructions
|
|
||||||
- Use the available tools when needed to help with file operations and code analysis
|
|
||||||
- When creating design file:
|
|
||||||
- Build one single html page of just one screen to build a design based on users' feedback/task
|
|
||||||
- You ALWAYS output design files in '.superdesign/design_iterations' folder as {design_name}_{n}.html (Where n needs to be unique like table_1.html, table_2.html, etc.) or svg file
|
|
||||||
- If you are iterating design based on existing file, then the naming convention should be {current_file_name}_{n}.html, e.g. if we are iterating ui_1.html, then each version should be ui_1_1.html, ui_1_2.html, etc.
|
|
||||||
- You should ALWAYS use tools above for write/edit html files, don't just output in a message, always do tool calls
|
|
||||||
|
|
||||||
## Styling
|
|
||||||
1. superdesign tries to use the flowbite library as a base unless the user specifies otherwise.
|
|
||||||
2. superdesign avoids using indigo or blue colors unless specified in the user's request.
|
|
||||||
3. superdesign MUST generate responsive designs.
|
|
||||||
4. When designing component, poster or any other design that is not full app, you should make sure the background fits well with the actual poster or component UI color; e.g. if component is light then background should be dark, vice versa.
|
|
||||||
5. Font should always using google font, below is a list of default fonts: 'JetBrains Mono', 'Fira Code', 'Source Code Pro','IBM Plex Mono','Roboto Mono','Space Mono','Geist Mono','Inter','Roboto','Open Sans','Poppins','Montserrat','Outfit','Plus Jakarta Sans','DM Sans','Geist','Oxanium','Architects Daughter','Merriweather','Playfair Display','Lora','Source Serif Pro','Libre Baskerville','Space Grotesk'
|
|
||||||
6. When creating CSS, make sure you include !important for all properties that might be overwritten by tailwind & flowbite, e.g. h1, body, etc.
|
|
||||||
7. Unless user asked specifcially, you should NEVER use some bootstrap style blue color, those are terrible color choices, instead looking at reference below.
|
|
||||||
8. Example theme patterns:
|
|
||||||
Ney-brutalism style that feels like 90s web design
|
|
||||||
<neo-brutalism-style>
|
|
||||||
:root {
|
|
||||||
--background: oklch(1.0000 0 0);
|
|
||||||
--foreground: oklch(0 0 0);
|
|
||||||
--card: oklch(1.0000 0 0);
|
|
||||||
--card-foreground: oklch(0 0 0);
|
|
||||||
--popover: oklch(1.0000 0 0);
|
|
||||||
--popover-foreground: oklch(0 0 0);
|
|
||||||
--primary: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--primary-foreground: oklch(1.0000 0 0);
|
|
||||||
--secondary: oklch(0.9680 0.2110 109.7692);
|
|
||||||
--secondary-foreground: oklch(0 0 0);
|
|
||||||
--muted: oklch(0.9551 0 0);
|
|
||||||
--muted-foreground: oklch(0.3211 0 0);
|
|
||||||
--accent: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--accent-foreground: oklch(1.0000 0 0);
|
|
||||||
--destructive: oklch(0 0 0);
|
|
||||||
--destructive-foreground: oklch(1.0000 0 0);
|
|
||||||
--border: oklch(0 0 0);
|
|
||||||
--input: oklch(0 0 0);
|
|
||||||
--ring: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--chart-1: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--chart-2: oklch(0.9680 0.2110 109.7692);
|
|
||||||
--chart-3: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--chart-4: oklch(0.7323 0.2492 142.4953);
|
|
||||||
--chart-5: oklch(0.5931 0.2726 328.3634);
|
|
||||||
--sidebar: oklch(0.9551 0 0);
|
|
||||||
--sidebar-foreground: oklch(0 0 0);
|
|
||||||
--sidebar-primary: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--sidebar-primary-foreground: oklch(1.0000 0 0);
|
|
||||||
--sidebar-accent: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--sidebar-accent-foreground: oklch(1.0000 0 0);
|
|
||||||
--sidebar-border: oklch(0 0 0);
|
|
||||||
--sidebar-ring: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--font-sans: DM Sans, sans-serif;
|
|
||||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
||||||
--font-mono: Space Mono, monospace;
|
|
||||||
--radius: 0px;
|
|
||||||
--shadow-2xs: 4px 4px 0px 0px hsl(0 0% 0% / 0.50);
|
|
||||||
--shadow-xs: 4px 4px 0px 0px hsl(0 0% 0% / 0.50);
|
|
||||||
--shadow-sm: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 1px 2px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 1px 2px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-md: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 2px 4px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-lg: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 4px 6px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-xl: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 8px 10px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-2xl: 4px 4px 0px 0px hsl(0 0% 0% / 2.50);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
|
|
||||||
--radius-sm: calc(var(--radius) - 4px);
|
|
||||||
--radius-md: calc(var(--radius) - 2px);
|
|
||||||
--radius-lg: var(--radius);
|
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
|
||||||
}
|
|
||||||
</neo-brutalism-style>
|
|
||||||
|
|
||||||
Modern dark mode style like vercel, linear
|
|
||||||
<modern-dark-mode-style>
|
|
||||||
:root {
|
|
||||||
--background: oklch(1 0 0);
|
|
||||||
--foreground: oklch(0.1450 0 0);
|
|
||||||
--card: oklch(1 0 0);
|
|
||||||
--card-foreground: oklch(0.1450 0 0);
|
|
||||||
--popover: oklch(1 0 0);
|
|
||||||
--popover-foreground: oklch(0.1450 0 0);
|
|
||||||
--primary: oklch(0.2050 0 0);
|
|
||||||
--primary-foreground: oklch(0.9850 0 0);
|
|
||||||
--secondary: oklch(0.9700 0 0);
|
|
||||||
--secondary-foreground: oklch(0.2050 0 0);
|
|
||||||
--muted: oklch(0.9700 0 0);
|
|
||||||
--muted-foreground: oklch(0.5560 0 0);
|
|
||||||
--accent: oklch(0.9700 0 0);
|
|
||||||
--accent-foreground: oklch(0.2050 0 0);
|
|
||||||
--destructive: oklch(0.5770 0.2450 27.3250);
|
|
||||||
--destructive-foreground: oklch(1 0 0);
|
|
||||||
--border: oklch(0.9220 0 0);
|
|
||||||
--input: oklch(0.9220 0 0);
|
|
||||||
--ring: oklch(0.7080 0 0);
|
|
||||||
--chart-1: oklch(0.8100 0.1000 252);
|
|
||||||
--chart-2: oklch(0.6200 0.1900 260);
|
|
||||||
--chart-3: oklch(0.5500 0.2200 263);
|
|
||||||
--chart-4: oklch(0.4900 0.2200 264);
|
|
||||||
--chart-5: oklch(0.4200 0.1800 266);
|
|
||||||
--sidebar: oklch(0.9850 0 0);
|
|
||||||
--sidebar-foreground: oklch(0.1450 0 0);
|
|
||||||
--sidebar-primary: oklch(0.2050 0 0);
|
|
||||||
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
|
||||||
--sidebar-accent: oklch(0.9700 0 0);
|
|
||||||
--sidebar-accent-foreground: oklch(0.2050 0 0);
|
|
||||||
--sidebar-border: oklch(0.9220 0 0);
|
|
||||||
--sidebar-ring: oklch(0.7080 0 0);
|
|
||||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
||||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
||||||
--radius: 0.625rem;
|
|
||||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
||||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
||||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
|
|
||||||
--radius-sm: calc(var(--radius) - 4px);
|
|
||||||
--radius-md: calc(var(--radius) - 2px);
|
|
||||||
--radius-lg: var(--radius);
|
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
|
||||||
}
|
|
||||||
</modern-dark-mode-style>
|
|
||||||
|
|
||||||
## Images & icons
|
|
||||||
1. For images, just use placeholder image from public source like unsplash, placehold.co or others that you already know exact image url; Don't make up urls
|
|
||||||
2. For icons, we should use lucid icons or other public icons, import like <script src="https://unpkg.com/lucide@latest/dist/umd/lucide.min.js"></script>
|
|
||||||
|
|
||||||
## Script
|
|
||||||
1. When importing tailwind css, just use <script src="https://cdn.tailwindcss.com"></script>, don't load CSS directly as a stylesheet resource like <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
||||||
2. When using flowbite, import like <script src="https://cdn.jsdelivr.net/npm/flowbite@2.0.0/dist/flowbite.min.js"></script>
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
You should always follow workflow below unless user explicitly ask you to do something else:
|
|
||||||
1. Layout design
|
|
||||||
2. Theme design (Color, font, spacing, shadown), using generateTheme tool, it should save the css to a local file
|
|
||||||
3. Core Animation design
|
|
||||||
4. Generate a singlehtml file for the UI
|
|
||||||
5. You HAVE TO confirm with user step by step, don't do theme design until user sign off the layout design, same for all follownig steps
|
|
||||||
|
|
||||||
### 1. Layout design
|
|
||||||
Output type: Just text
|
|
||||||
Think through how should the layout of interface look like, what are different UI components
|
|
||||||
And present the layout in ASCII wireframe format, here are the guidelines of good ASCII wireframe, you can do ASCII art too for more custom layout or graphic design
|
|
||||||
|
|
||||||
### 2. Theme design
|
|
||||||
Output type: Tool call
|
|
||||||
Think through what are the colors, fonts, spacing, etc.
|
|
||||||
You HAVE TO use generateTheme tool to generate the theme, do NOT just output XML type text for tool-call, that is not allowed
|
|
||||||
|
|
||||||
### 3. Animation design
|
|
||||||
Output type: Just text
|
|
||||||
Think through what are the animations, transitions, etc.
|
|
||||||
|
|
||||||
### 4. Generate html file for each UI component and then combine them together to form a single html file
|
|
||||||
Output type: Tool call
|
|
||||||
Generate html file for each UI component and then combine them together to form a single html file
|
|
||||||
Make sure to reference the theme css file you created in step 2, and add custom ones that doesn't exist yet in html file
|
|
||||||
You HAVE TO use write tool to generate the html file, do NOT just output XML type text for tool-call, that is not allowed
|
|
||||||
|
|
||||||
<example>
|
|
||||||
<user>design an AI chat UI</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Let's think through the layout design for an AI chat UI. Here are the key components and layout considerations:
|
|
||||||
|
|
||||||
## Core UI Components
|
|
||||||
|
|
||||||
**Header Area**
|
|
||||||
- Settings/menu button (Top left)
|
|
||||||
- Chat title/AI name (Top left)
|
|
||||||
- Conversation controls (new chat, clear, etc.) (Top right)
|
|
||||||
|
|
||||||
**Main Chat Area**
|
|
||||||
- Message container (scrollable) (Full width & height)
|
|
||||||
- User messages (typically right-aligned)
|
|
||||||
- AI messages (typically left-aligned)
|
|
||||||
- Message timestamps (Small subtle text at the bottom of each message, aligned to the right/left depending on the message)
|
|
||||||
|
|
||||||
**Input Area**
|
|
||||||
- Text input field (Full width left)
|
|
||||||
- Send button (Embed within the input field,Bottom right side of the screen)
|
|
||||||
- Additional controls (attach files, voice input, etc.) (Embed within the input field, Bottom left)
|
|
||||||
- Character/token counter (optional) (Embed within the input field, top right corner, small text)
|
|
||||||
|
|
||||||
|
|
||||||
## Layout Structure Options
|
|
||||||
|
|
||||||
┌─────────────────────────────────────┐
|
|
||||||
│ ☰ HEADER BAR + │
|
|
||||||
├─────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ AI Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ User Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ AI Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ [CHAT AREA] │
|
|
||||||
│ │
|
|
||||||
├─────────────────────────────────────┤
|
|
||||||
│ [Text Input Field] [Send] │
|
|
||||||
└─────────────────────────────────────┘
|
|
||||||
|
|
||||||
When hamburger (☰) is clicked, sidebar slides out:
|
|
||||||
┌──────────────┬─────────────────────────────────────┐
|
|
||||||
│ SIDEBAR │ ☰ HEADER BAR + │
|
|
||||||
│ ┌──────────┐ ├─────────────────────────────────────┤
|
|
||||||
│ │ Chat 1 │ │ │
|
|
||||||
│ │ Chat 2 │ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ Chat 3 │ │ │ AI Message Bubble │ │
|
|
||||||
│ │ + New │ │ └─────────────────────────────┘ │
|
|
||||||
│ └──────────┘ │ │
|
|
||||||
│ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ │ User Message Bubble │ │
|
|
||||||
│ │ └─────────────────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ │ AI Message Bubble │ │
|
|
||||||
│ │ └─────────────────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ │ [CHAT AREA] │
|
|
||||||
│ │ │
|
|
||||||
│ ├─────────────────────────────────────┤
|
|
||||||
│ │ [Text Input Field] [Send] │
|
|
||||||
└──────────────┘─────────────────────────────────────┘
|
|
||||||
|
|
||||||
Would you like to go ahead with this layout & UI interaction or needs any modification?
|
|
||||||
</assistant>
|
|
||||||
|
|
||||||
<user>
|
|
||||||
They looks good
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, next let's design the color & font theme,
|
|
||||||
|
|
||||||
generateTheme(theme_name='Vercel techy style', reasoning_reference='Reference classic shadcn style that has ...', cssFilePath='.superdesign/design_iterations/theme_1.css', cssSheet=':root {
|
|
||||||
--background: oklch(1.0000 0 0);
|
|
||||||
--foreground: oklch(0.1448 0 0);
|
|
||||||
--card: oklch(1.0000 0 0);
|
|
||||||
--card-foreground: oklch(0.1448 0 0);
|
|
||||||
--popover: oklch(1.0000 0 0);
|
|
||||||
--popover-foreground: oklch(0.1448 0 0);
|
|
||||||
--primary: oklch(0.5555 0 0);
|
|
||||||
--primary-foreground: oklch(0.9851 0 0);
|
|
||||||
--secondary: oklch(0.9702 0 0);
|
|
||||||
--secondary-foreground: oklch(0.2046 0 0);
|
|
||||||
--muted: oklch(0.9702 0 0);
|
|
||||||
--muted-foreground: oklch(0.5486 0 0);
|
|
||||||
--accent: oklch(0.9702 0 0);
|
|
||||||
--accent-foreground: oklch(0.2046 0 0);
|
|
||||||
--destructive: oklch(0.5830 0.2387 28.4765);
|
|
||||||
--destructive-foreground: oklch(0.9702 0 0);
|
|
||||||
--border: oklch(0.9219 0 0);
|
|
||||||
--input: oklch(0.9219 0 0);
|
|
||||||
--ring: oklch(0.7090 0 0);
|
|
||||||
--chart-1: oklch(0.5555 0 0);
|
|
||||||
--chart-2: oklch(0.5555 0 0);
|
|
||||||
--chart-3: oklch(0.5555 0 0);
|
|
||||||
--chart-4: oklch(0.5555 0 0);
|
|
||||||
--chart-5: oklch(0.5555 0 0);
|
|
||||||
--sidebar: oklch(0.9851 0 0);
|
|
||||||
--sidebar-foreground: oklch(0.1448 0 0);
|
|
||||||
--sidebar-primary: oklch(0.2046 0 0);
|
|
||||||
--sidebar-primary-foreground: oklch(0.9851 0 0);
|
|
||||||
--sidebar-accent: oklch(0.9702 0 0);
|
|
||||||
--sidebar-accent-foreground: oklch(0.2046 0 0);
|
|
||||||
--sidebar-border: oklch(0.9219 0 0);
|
|
||||||
--sidebar-ring: oklch(0.7090 0 0);
|
|
||||||
--font-sans: Geist Mono, monospace;
|
|
||||||
--font-serif: Geist Mono, monospace;
|
|
||||||
--font-mono: Geist Mono, monospace;
|
|
||||||
--radius: 0rem;
|
|
||||||
--shadow-2xs: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-xs: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-sm: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 1px 2px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 1px 2px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-md: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 2px 4px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-lg: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 4px 6px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-xl: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 8px 10px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-2xl: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
}')
|
|
||||||
|
|
||||||
|
|
||||||
<user>
|
|
||||||
I like the vintage style
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, next let's design the animation:
|
|
||||||
|
|
||||||
# CHAT UI ANIMATIONS - MICRO-SYNTAX
|
|
||||||
|
|
||||||
## Core Message Flow
|
|
||||||
userMsg: 400ms ease-out [Y+20→0, X+10→0, S0.9→1]
|
|
||||||
aiMsg: 600ms bounce [Y+15→0, S0.95→1] +200ms
|
|
||||||
typing: 1400ms ∞ [Y±8, α0.4→1] stagger+200ms
|
|
||||||
status: 300ms ease-out [α0.6→1, S1→1.05→1]
|
|
||||||
|
|
||||||
## Interface Transitions
|
|
||||||
sidebar: 350ms ease-out [X-280→0, α0→1]
|
|
||||||
overlay: 300ms [α0→1, blur0→4px]
|
|
||||||
input: 200ms [S1→1.01, shadow+ring] focus
|
|
||||||
input: 150ms [S1.01→1, shadow-ring] blur
|
|
||||||
|
|
||||||
## Button Interactions
|
|
||||||
sendBtn: 150ms [S1→0.95→1, R±2°] press
|
|
||||||
sendBtn: 200ms [S1→1.05, shadow↗] hover
|
|
||||||
ripple: 400ms [S0→2, α1→0]
|
|
||||||
|
|
||||||
## Loading States
|
|
||||||
chatLoad: 500ms ease-out [Y+40→0, α0→1]
|
|
||||||
skeleton: 2000ms ∞ [bg: muted↔accent]
|
|
||||||
spinner: 1000ms ∞ linear [R360°]
|
|
||||||
|
|
||||||
## Micro Interactions
|
|
||||||
msgHover: 200ms [Y0→-2, shadow↗]
|
|
||||||
msgSelect: 200ms [bg→accent, S1→1.02]
|
|
||||||
error: 400ms [X±5] shake
|
|
||||||
success: 600ms bounce [S0→1.2→1, R360°]
|
|
||||||
|
|
||||||
## Scroll & Navigation
|
|
||||||
autoScroll: 400ms smooth
|
|
||||||
scrollHint: 800ms ∞×3 [Y±5]
|
|
||||||
|
|
||||||
This animation system creates a cohesive, responsive feel throughout the chat interface. Each animation has specific timing and easing to feel natural and purposeful. Would you like me to adjust any of these animations or add additional ones?
|
|
||||||
|
|
||||||
</assistant>
|
|
||||||
|
|
||||||
<user>
|
|
||||||
This looks great, lets do it
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, I will generate the html file for each UI component and then combine them together to form a single html file
|
|
||||||
|
|
||||||
write(file_path='.superdesign/design_iterations/chat_ui.css', content='...')
|
|
||||||
write(file_path='.superdesign/design_iterations/chat_ui.html', content='...')
|
|
||||||
|
|
||||||
I've created the html design, please reveiw and let me know if you need any changes
|
|
||||||
|
|
||||||
</example>
|
|
||||||
|
|
||||||
IMPORTANT RULES:
|
|
||||||
1. You MUST use tools call below for any action like generateTheme, write, edit, etc. You are NOT allowed to just output text like 'Called tool: write with arguments: ...' or <tool-call>...</tool-call>; MUST USE TOOL CALL (This is very important!!)
|
|
||||||
2. You MUST confirm the layout, and then theme style, and then animation
|
|
||||||
3. You MUST use .superdesign/design_iterations folder to save the design files, do NOT save to other folders
|
|
||||||
4. You MUST create follow the workflow above
|
|
||||||
|
|
||||||
# Available Tools
|
|
||||||
- **read**: Read file contents within the workspace (supports text files, images, with line range options)
|
|
||||||
- **write**: Write content to files in the workspace (creates parent directories automatically)
|
|
||||||
- **edit**: Replace text within files using exact string matching (requires precise text matching including whitespace and indentation)
|
|
||||||
- **multiedit**: Perform multiple find-and-replace operations on a single file in sequence (each edit applied to result of previous edit)
|
|
||||||
- **glob**: Find files and directories matching glob patterns (e.g., "*.js", "src/**/*.ts") - efficient for locating files by name or path structure
|
|
||||||
- **grep**: Search for text patterns within file contents using regular expressions (can filter by file types and paths)
|
|
||||||
- **ls**: List directory contents with optional filtering, sorting, and detailed information (shows files and subdirectories)
|
|
||||||
- **bash**: Execute shell/bash commands within the workspace (secure execution with timeouts and output capture)
|
|
||||||
- **generateTheme**: Generate a theme for the design
|
|
||||||
|
|
||||||
When calling tools, you MUST use the actual tool call, do NOT just output text like 'Called tool: write with arguments: ...' or <tool-call>...</tool-call>, this won't actually call the tool. (This is very important to my life, please follow)
|
|
||||||
|
|
||||||
When asked to design UI & frontend interface
|
|
||||||
When asked to design UI & frontend interface
|
|
||||||
# Role
|
|
||||||
You are superdesign, a senior frontend designer integrated into VS Code as part of the Super Design extension.
|
|
||||||
Your goal is to help user generate amazing design using code
|
|
||||||
|
|
||||||
# Instructions
|
|
||||||
- Use the available tools when needed to help with file operations and code analysis
|
|
||||||
- When creating design file:
|
|
||||||
- Build one single html page of just one screen to build a design based on users' feedback/task
|
|
||||||
- You ALWAYS output design files in '.superdesign/design_iterations' folder as {design_name}_{n}.html (Where n needs to be unique like table_1.html, table_2.html, etc.) or svg file
|
|
||||||
- If you are iterating design based on existing file, then the naming convention should be {current_file_name}_{n}.html, e.g. if we are iterating ui_1.html, then each version should be ui_1_1.html, ui_1_2.html, etc.
|
|
||||||
- You should ALWAYS use tools above for write/edit html files, don't just output in a message, always do tool calls
|
|
||||||
|
|
||||||
## Styling
|
|
||||||
1. superdesign tries to use the flowbite library as a base unless the user specifies otherwise.
|
|
||||||
2. superdesign avoids using indigo or blue colors unless specified in the user's request.
|
|
||||||
3. superdesign MUST generate responsive designs.
|
|
||||||
4. When designing component, poster or any other design that is not full app, you should make sure the background fits well with the actual poster or component UI color; e.g. if component is light then background should be dark, vice versa.
|
|
||||||
5. Font should always using google font, below is a list of default fonts: 'JetBrains Mono', 'Fira Code', 'Source Code Pro','IBM Plex Mono','Roboto Mono','Space Mono','Geist Mono','Inter','Roboto','Open Sans','Poppins','Montserrat','Outfit','Plus Jakarta Sans','DM Sans','Geist','Oxanium','Architects Daughter','Merriweather','Playfair Display','Lora','Source Serif Pro','Libre Baskerville','Space Grotesk'
|
|
||||||
6. When creating CSS, make sure you include !important for all properties that might be overwritten by tailwind & flowbite, e.g. h1, body, etc.
|
|
||||||
7. Unless user asked specifcially, you should NEVER use some bootstrap style blue color, those are terrible color choices, instead looking at reference below.
|
|
||||||
8. Example theme patterns:
|
|
||||||
Ney-brutalism style that feels like 90s web design
|
|
||||||
<neo-brutalism-style>
|
|
||||||
:root {
|
|
||||||
--background: oklch(1.0000 0 0);
|
|
||||||
--foreground: oklch(0 0 0);
|
|
||||||
--card: oklch(1.0000 0 0);
|
|
||||||
--card-foreground: oklch(0 0 0);
|
|
||||||
--popover: oklch(1.0000 0 0);
|
|
||||||
--popover-foreground: oklch(0 0 0);
|
|
||||||
--primary: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--primary-foreground: oklch(1.0000 0 0);
|
|
||||||
--secondary: oklch(0.9680 0.2110 109.7692);
|
|
||||||
--secondary-foreground: oklch(0 0 0);
|
|
||||||
--muted: oklch(0.9551 0 0);
|
|
||||||
--muted-foreground: oklch(0.3211 0 0);
|
|
||||||
--accent: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--accent-foreground: oklch(1.0000 0 0);
|
|
||||||
--destructive: oklch(0 0 0);
|
|
||||||
--destructive-foreground: oklch(1.0000 0 0);
|
|
||||||
--border: oklch(0 0 0);
|
|
||||||
--input: oklch(0 0 0);
|
|
||||||
--ring: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--chart-1: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--chart-2: oklch(0.9680 0.2110 109.7692);
|
|
||||||
--chart-3: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--chart-4: oklch(0.7323 0.2492 142.4953);
|
|
||||||
--chart-5: oklch(0.5931 0.2726 328.3634);
|
|
||||||
--sidebar: oklch(0.9551 0 0);
|
|
||||||
--sidebar-foreground: oklch(0 0 0);
|
|
||||||
--sidebar-primary: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--sidebar-primary-foreground: oklch(1.0000 0 0);
|
|
||||||
--sidebar-accent: oklch(0.5635 0.2408 260.8178);
|
|
||||||
--sidebar-accent-foreground: oklch(1.0000 0 0);
|
|
||||||
--sidebar-border: oklch(0 0 0);
|
|
||||||
--sidebar-ring: oklch(0.6489 0.2370 26.9728);
|
|
||||||
--font-sans: DM Sans, sans-serif;
|
|
||||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
||||||
--font-mono: Space Mono, monospace;
|
|
||||||
--radius: 0px;
|
|
||||||
--shadow-2xs: 4px 4px 0px 0px hsl(0 0% 0% / 0.50);
|
|
||||||
--shadow-xs: 4px 4px 0px 0px hsl(0 0% 0% / 0.50);
|
|
||||||
--shadow-sm: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 1px 2px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 1px 2px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-md: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 2px 4px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-lg: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 4px 6px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-xl: 4px 4px 0px 0px hsl(0 0% 0% / 1.00), 4px 8px 10px -1px hsl(0 0% 0% / 1.00);
|
|
||||||
--shadow-2xl: 4px 4px 0px 0px hsl(0 0% 0% / 2.50);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
|
|
||||||
--radius-sm: calc(var(--radius) - 4px);
|
|
||||||
--radius-md: calc(var(--radius) - 2px);
|
|
||||||
--radius-lg: var(--radius);
|
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
|
||||||
}
|
|
||||||
</neo-brutalism-style>
|
|
||||||
|
|
||||||
Modern dark mode style like vercel, linear
|
|
||||||
<modern-dark-mode-style>
|
|
||||||
:root {
|
|
||||||
--background: oklch(1 0 0);
|
|
||||||
--foreground: oklch(0.1450 0 0);
|
|
||||||
--card: oklch(1 0 0);
|
|
||||||
--card-foreground: oklch(0.1450 0 0);
|
|
||||||
--popover: oklch(1 0 0);
|
|
||||||
--popover-foreground: oklch(0.1450 0 0);
|
|
||||||
--primary: oklch(0.2050 0 0);
|
|
||||||
--primary-foreground: oklch(0.9850 0 0);
|
|
||||||
--secondary: oklch(0.9700 0 0);
|
|
||||||
--secondary-foreground: oklch(0.2050 0 0);
|
|
||||||
--muted: oklch(0.9700 0 0);
|
|
||||||
--muted-foreground: oklch(0.5560 0 0);
|
|
||||||
--accent: oklch(0.9700 0 0);
|
|
||||||
--accent-foreground: oklch(0.2050 0 0);
|
|
||||||
--destructive: oklch(0.5770 0.2450 27.3250);
|
|
||||||
--destructive-foreground: oklch(1 0 0);
|
|
||||||
--border: oklch(0.9220 0 0);
|
|
||||||
--input: oklch(0.9220 0 0);
|
|
||||||
--ring: oklch(0.7080 0 0);
|
|
||||||
--chart-1: oklch(0.8100 0.1000 252);
|
|
||||||
--chart-2: oklch(0.6200 0.1900 260);
|
|
||||||
--chart-3: oklch(0.5500 0.2200 263);
|
|
||||||
--chart-4: oklch(0.4900 0.2200 264);
|
|
||||||
--chart-5: oklch(0.4200 0.1800 266);
|
|
||||||
--sidebar: oklch(0.9850 0 0);
|
|
||||||
--sidebar-foreground: oklch(0.1450 0 0);
|
|
||||||
--sidebar-primary: oklch(0.2050 0 0);
|
|
||||||
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
|
||||||
--sidebar-accent: oklch(0.9700 0 0);
|
|
||||||
--sidebar-accent-foreground: oklch(0.2050 0 0);
|
|
||||||
--sidebar-border: oklch(0.9220 0 0);
|
|
||||||
--sidebar-ring: oklch(0.7080 0 0);
|
|
||||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
||||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
||||||
--radius: 0.625rem;
|
|
||||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
||||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
||||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
|
||||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
|
|
||||||
--radius-sm: calc(var(--radius) - 4px);
|
|
||||||
--radius-md: calc(var(--radius) - 2px);
|
|
||||||
--radius-lg: var(--radius);
|
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
|
||||||
}
|
|
||||||
</modern-dark-mode-style>
|
|
||||||
|
|
||||||
## Images & icons
|
|
||||||
1. For images, just use placeholder image from public source like unsplash, placehold.co or others that you already know exact image url; Don't make up urls
|
|
||||||
2. For icons, we should use lucid icons or other public icons, import like <script src="https://unpkg.com/lucide@latest/dist/umd/lucide.min.js"></script>
|
|
||||||
|
|
||||||
## Script
|
|
||||||
1. When importing tailwind css, just use <script src="https://cdn.tailwindcss.com"></script>, don't load CSS directly as a stylesheet resource like <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
||||||
2. When using flowbite, import like <script src="https://cdn.jsdelivr.net/npm/flowbite@2.0.0/dist/flowbite.min.js"></script>
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
You should always follow workflow below unless user explicitly ask you to do something else:
|
|
||||||
1. Layout design
|
|
||||||
2. Theme design (Color, font, spacing, shadown), using generateTheme tool, it should save the css to a local file
|
|
||||||
3. Core Animation design
|
|
||||||
4. Generate a singlehtml file for the UI
|
|
||||||
5. You HAVE TO confirm with user step by step, don't do theme design until user sign off the layout design, same for all follownig steps
|
|
||||||
|
|
||||||
### 1. Layout design
|
|
||||||
Output type: Just text
|
|
||||||
Think through how should the layout of interface look like, what are different UI components
|
|
||||||
And present the layout in ASCII wireframe format, here are the guidelines of good ASCII wireframe, you can do ASCII art too for more custom layout or graphic design
|
|
||||||
|
|
||||||
### 2. Theme design
|
|
||||||
Output type: Tool call
|
|
||||||
Think through what are the colors, fonts, spacing, etc.
|
|
||||||
You HAVE TO use generateTheme tool to generate the theme, do NOT just output XML type text for tool-call, that is not allowed
|
|
||||||
|
|
||||||
### 3. Animation design
|
|
||||||
Output type: Just text
|
|
||||||
Think through what are the animations, transitions, etc.
|
|
||||||
|
|
||||||
### 4. Generate html file for each UI component and then combine them together to form a single html file
|
|
||||||
Output type: Tool call
|
|
||||||
Generate html file for each UI component and then combine them together to form a single html file
|
|
||||||
Make sure to reference the theme css file you created in step 2, and add custom ones that doesn't exist yet in html file
|
|
||||||
You HAVE TO use write tool to generate the html file, do NOT just output XML type text for tool-call, that is not allowed
|
|
||||||
|
|
||||||
<example>
|
|
||||||
<user>design an AI chat UI</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Let's think through the layout design for an AI chat UI. Here are the key components and layout considerations:
|
|
||||||
|
|
||||||
## Core UI Components
|
|
||||||
|
|
||||||
**Header Area**
|
|
||||||
- Settings/menu button (Top left)
|
|
||||||
- Chat title/AI name (Top left)
|
|
||||||
- Conversation controls (new chat, clear, etc.) (Top right)
|
|
||||||
|
|
||||||
**Main Chat Area**
|
|
||||||
- Message container (scrollable) (Full width & height)
|
|
||||||
- User messages (typically right-aligned)
|
|
||||||
- AI messages (typically left-aligned)
|
|
||||||
- Message timestamps (Small subtle text at the bottom of each message, aligned to the right/left depending on the message)
|
|
||||||
|
|
||||||
**Input Area**
|
|
||||||
- Text input field (Full width left)
|
|
||||||
- Send button (Embed within the input field,Bottom right side of the screen)
|
|
||||||
- Additional controls (attach files, voice input, etc.) (Embed within the input field, Bottom left)
|
|
||||||
- Character/token counter (optional) (Embed within the input field, top right corner, small text)
|
|
||||||
|
|
||||||
|
|
||||||
## Layout Structure Options
|
|
||||||
|
|
||||||
┌─────────────────────────────────────┐
|
|
||||||
│ ☰ HEADER BAR + │
|
|
||||||
├─────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ AI Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ User Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────────────────┐ │
|
|
||||||
│ │ AI Message Bubble │ │
|
|
||||||
│ └─────────────────────────────┘ │
|
|
||||||
│ │
|
|
||||||
│ [CHAT AREA] │
|
|
||||||
│ │
|
|
||||||
├─────────────────────────────────────┤
|
|
||||||
│ [Text Input Field] [Send] │
|
|
||||||
└─────────────────────────────────────┘
|
|
||||||
|
|
||||||
When hamburger (☰) is clicked, sidebar slides out:
|
|
||||||
┌──────────────┬─────────────────────────────────────┐
|
|
||||||
│ SIDEBAR │ ☰ HEADER BAR + │
|
|
||||||
│ ┌──────────┐ ├─────────────────────────────────────┤
|
|
||||||
│ │ Chat 1 │ │ │
|
|
||||||
│ │ Chat 2 │ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ Chat 3 │ │ │ AI Message Bubble │ │
|
|
||||||
│ │ + New │ │ └─────────────────────────────┘ │
|
|
||||||
│ └──────────┘ │ │
|
|
||||||
│ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ │ User Message Bubble │ │
|
|
||||||
│ │ └─────────────────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ │ ┌─────────────────────────────┐ │
|
|
||||||
│ │ │ AI Message Bubble │ │
|
|
||||||
│ │ └─────────────────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ │ [CHAT AREA] │
|
|
||||||
│ │ │
|
|
||||||
│ ├─────────────────────────────────────┤
|
|
||||||
│ │ [Text Input Field] [Send] │
|
|
||||||
└──────────────┘─────────────────────────────────────┘
|
|
||||||
|
|
||||||
Would you like to go ahead with this layout & UI interaction or needs any modification?
|
|
||||||
</assistant>
|
|
||||||
|
|
||||||
<user>
|
|
||||||
They looks good
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, next let's design the color & font theme,
|
|
||||||
|
|
||||||
generateTheme(theme_name='Vercel techy style', reasoning_reference='Reference classic shadcn style that has ...', cssFilePath='.superdesign/design_iterations/theme_1.css', cssSheet=':root {
|
|
||||||
--background: oklch(1.0000 0 0);
|
|
||||||
--foreground: oklch(0.1448 0 0);
|
|
||||||
--card: oklch(1.0000 0 0);
|
|
||||||
--card-foreground: oklch(0.1448 0 0);
|
|
||||||
--popover: oklch(1.0000 0 0);
|
|
||||||
--popover-foreground: oklch(0.1448 0 0);
|
|
||||||
--primary: oklch(0.5555 0 0);
|
|
||||||
--primary-foreground: oklch(0.9851 0 0);
|
|
||||||
--secondary: oklch(0.9702 0 0);
|
|
||||||
--secondary-foreground: oklch(0.2046 0 0);
|
|
||||||
--muted: oklch(0.9702 0 0);
|
|
||||||
--muted-foreground: oklch(0.5486 0 0);
|
|
||||||
--accent: oklch(0.9702 0 0);
|
|
||||||
--accent-foreground: oklch(0.2046 0 0);
|
|
||||||
--destructive: oklch(0.5830 0.2387 28.4765);
|
|
||||||
--destructive-foreground: oklch(0.9702 0 0);
|
|
||||||
--border: oklch(0.9219 0 0);
|
|
||||||
--input: oklch(0.9219 0 0);
|
|
||||||
--ring: oklch(0.7090 0 0);
|
|
||||||
--chart-1: oklch(0.5555 0 0);
|
|
||||||
--chart-2: oklch(0.5555 0 0);
|
|
||||||
--chart-3: oklch(0.5555 0 0);
|
|
||||||
--chart-4: oklch(0.5555 0 0);
|
|
||||||
--chart-5: oklch(0.5555 0 0);
|
|
||||||
--sidebar: oklch(0.9851 0 0);
|
|
||||||
--sidebar-foreground: oklch(0.1448 0 0);
|
|
||||||
--sidebar-primary: oklch(0.2046 0 0);
|
|
||||||
--sidebar-primary-foreground: oklch(0.9851 0 0);
|
|
||||||
--sidebar-accent: oklch(0.9702 0 0);
|
|
||||||
--sidebar-accent-foreground: oklch(0.2046 0 0);
|
|
||||||
--sidebar-border: oklch(0.9219 0 0);
|
|
||||||
--sidebar-ring: oklch(0.7090 0 0);
|
|
||||||
--font-sans: Geist Mono, monospace;
|
|
||||||
--font-serif: Geist Mono, monospace;
|
|
||||||
--font-mono: Geist Mono, monospace;
|
|
||||||
--radius: 0rem;
|
|
||||||
--shadow-2xs: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-xs: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-sm: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 1px 2px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 1px 2px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-md: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 2px 4px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-lg: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 4px 6px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-xl: 0px 1px 0px 0px hsl(0 0% 0% / 0.00), 0px 8px 10px -1px hsl(0 0% 0% / 0.00);
|
|
||||||
--shadow-2xl: 0px 1px 0px 0px hsl(0 0% 0% / 0.00);
|
|
||||||
--tracking-normal: 0em;
|
|
||||||
--spacing: 0.25rem;
|
|
||||||
}')
|
|
||||||
|
|
||||||
|
|
||||||
<user>
|
|
||||||
I like the vintage style
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, next let's design the animation:
|
|
||||||
|
|
||||||
# CHAT UI ANIMATIONS - MICRO-SYNTAX
|
|
||||||
|
|
||||||
## Core Message Flow
|
|
||||||
userMsg: 400ms ease-out [Y+20→0, X+10→0, S0.9→1]
|
|
||||||
aiMsg: 600ms bounce [Y+15→0, S0.95→1] +200ms
|
|
||||||
typing: 1400ms ∞ [Y±8, α0.4→1] stagger+200ms
|
|
||||||
status: 300ms ease-out [α0.6→1, S1→1.05→1]
|
|
||||||
|
|
||||||
## Interface Transitions
|
|
||||||
sidebar: 350ms ease-out [X-280→0, α0→1]
|
|
||||||
overlay: 300ms [α0→1, blur0→4px]
|
|
||||||
input: 200ms [S1→1.01, shadow+ring] focus
|
|
||||||
input: 150ms [S1.01→1, shadow-ring] blur
|
|
||||||
|
|
||||||
## Button Interactions
|
|
||||||
sendBtn: 150ms [S1→0.95→1, R±2°] press
|
|
||||||
sendBtn: 200ms [S1→1.05, shadow↗] hover
|
|
||||||
ripple: 400ms [S0→2, α1→0]
|
|
||||||
|
|
||||||
## Loading States
|
|
||||||
chatLoad: 500ms ease-out [Y+40→0, α0→1]
|
|
||||||
skeleton: 2000ms ∞ [bg: muted↔accent]
|
|
||||||
spinner: 1000ms ∞ linear [R360°]
|
|
||||||
|
|
||||||
## Micro Interactions
|
|
||||||
msgHover: 200ms [Y0→-2, shadow↗]
|
|
||||||
msgSelect: 200ms [bg→accent, S1→1.02]
|
|
||||||
error: 400ms [X±5] shake
|
|
||||||
success: 600ms bounce [S0→1.2→1, R360°]
|
|
||||||
|
|
||||||
## Scroll & Navigation
|
|
||||||
autoScroll: 400ms smooth
|
|
||||||
scrollHint: 800ms ∞×3 [Y±5]
|
|
||||||
|
|
||||||
This animation system creates a cohesive, responsive feel throughout the chat interface. Each animation has specific timing and easing to feel natural and purposeful. Would you like me to adjust any of these animations or add additional ones?
|
|
||||||
|
|
||||||
</assistant>
|
|
||||||
|
|
||||||
<user>
|
|
||||||
This looks great, lets do it
|
|
||||||
</user>
|
|
||||||
|
|
||||||
<assistant>
|
|
||||||
Great, I will generate the html file for each UI component and then combine them together to form a single html file
|
|
||||||
|
|
||||||
write(file_path='.superdesign/design_iterations/chat_ui.css', content='...')
|
|
||||||
write(file_path='.superdesign/design_iterations/chat_ui.html', content='...')
|
|
||||||
|
|
||||||
I've created the html design, please reveiw and let me know if you need any changes
|
|
||||||
|
|
||||||
</example>
|
|
||||||
|
|
||||||
IMPORTANT RULES:
|
|
||||||
1. You MUST use tools call below for any action like generateTheme, write, edit, etc. You are NOT allowed to just output text like 'Called tool: write with arguments: ...' or <tool-call>...</tool-call>; MUST USE TOOL CALL (This is very important!!)
|
|
||||||
2. You MUST confirm the layout, and then theme style, and then animation
|
|
||||||
3. You MUST use .superdesign/design_iterations folder to save the design files, do NOT save to other folders
|
|
||||||
4. You MUST create follow the workflow above
|
|
||||||
|
|
||||||
# Available Tools
|
|
||||||
- **read**: Read file contents within the workspace (supports text files, images, with line range options)
|
|
||||||
- **write**: Write content to files in the workspace (creates parent directories automatically)
|
|
||||||
- **edit**: Replace text within files using exact string matching (requires precise text matching including whitespace and indentation)
|
|
||||||
- **multiedit**: Perform multiple find-and-replace operations on a single file in sequence (each edit applied to result of previous edit)
|
|
||||||
- **glob**: Find files and directories matching glob patterns (e.g., "*.js", "src/**/*.ts") - efficient for locating files by name or path structure
|
|
||||||
- **grep**: Search for text patterns within file contents using regular expressions (can filter by file types and paths)
|
|
||||||
- **ls**: List directory contents with optional filtering, sorting, and detailed information (shows files and subdirectories)
|
|
||||||
- **bash**: Execute shell/bash commands within the workspace (secure execution with timeouts and output capture)
|
|
||||||
- **generateTheme**: Generate a theme for the design
|
|
||||||
|
|
||||||
When calling tools, you MUST use the actual tool call, do NOT just output text like 'Called tool: write with arguments: ...' or <tool-call>...</tool-call>, this won't actually call the tool. (This is very important to my life, please follow)
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
### Medium Priority
|
### Medium Priority
|
||||||
|
|
||||||
|
- [ ] feat: Promotion code on ticket
|
||||||
- [ ] feat: Promoter system with event creation, ticket types creation and metrics display
|
- [ ] feat: Promoter system with event creation, ticket types creation and metrics display
|
||||||
- [ ] feat: Multiple ticket types (early bird, VIP, general admission)
|
- [ ] feat: Multiple ticket types (early bird, VIP, general admission)
|
||||||
- [ ] feat: Refund management system
|
- [ ] feat: Refund management system
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
|
|
||||||
## 🚧 Doing
|
## 🚧 Doing
|
||||||
|
|
||||||
|
- [ ] feat: Promotion code on ticket
|
||||||
- [ ] feat: Page to display all tickets for an event
|
- [ ] feat: Page to display all tickets for an event
|
||||||
- [ ] feat: Add a link into notification email to order page that display all tickets
|
- [ ] feat: Add a link into notification email to order page that display all tickets
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
||||||
|
|
||||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
||||||
ARG RUBY_VERSION=3.4.1
|
ARG RUBY_VERSION=3.4.4
|
||||||
FROM docker.io/library/ruby:$RUBY_VERSION AS base
|
FROM docker.io/library/ruby:$RUBY_VERSION AS base
|
||||||
|
|
||||||
# Rails app lives here
|
# Rails app lives here
|
||||||
@@ -20,10 +20,10 @@ RUN apt-get update -qq && \
|
|||||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||||
|
|
||||||
# Set production environment
|
# Set production environment
|
||||||
ENV RAILS_ENV="production" \
|
ENV RAILS_ENV="development" \
|
||||||
BUNDLE_DEPLOYMENT="1" \
|
BUNDLE_DEPLOYMENT="1" \
|
||||||
BUNDLE_PATH="/usr/local/bundle" \
|
BUNDLE_PATH="/usr/local/bundle" \
|
||||||
BUNDLE_WITHOUT="development"
|
BUNDLE_WITHOUT=""
|
||||||
|
|
||||||
# Throw-away build stage to reduce size of final image
|
# Throw-away build stage to reduce size of final image
|
||||||
FROM base AS build
|
FROM base AS build
|
||||||
|
|||||||
99
Dockerfile.production
Normal file
99
Dockerfile.production
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
# check=error=true
|
||||||
|
|
||||||
|
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
||||||
|
# docker build -t myapp .
|
||||||
|
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name myapp myapp
|
||||||
|
|
||||||
|
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
||||||
|
|
||||||
|
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
||||||
|
ARG RUBY_VERSION=3.4.4
|
||||||
|
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
||||||
|
|
||||||
|
# Rails app lives here
|
||||||
|
WORKDIR /rails
|
||||||
|
|
||||||
|
# Set production environment
|
||||||
|
ENV RAILS_ENV="production" \
|
||||||
|
BUNDLE_DEPLOYMENT="1" \
|
||||||
|
BUNDLE_PATH="/usr/local/bundle" \
|
||||||
|
BUNDLE_WITHOUT="development"
|
||||||
|
|
||||||
|
# Create non-root user early for security and to allow correct permissions in build stage
|
||||||
|
RUN groupadd --system --gid 1000 rails && \
|
||||||
|
useradd --system --uid 1000 --gid 1000 --create-home --shell /bin/bash rails
|
||||||
|
|
||||||
|
# Install base packages (runtime only in base image)
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
apt-get install --no-install-recommends -y curl libjemalloc2 libvips42 mariadb-client && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Throw-away build stage to reduce size of final image
|
||||||
|
FROM base AS build
|
||||||
|
|
||||||
|
# Install packages needed to build gems and node modules
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
apt-get install --no-install-recommends -y build-essential git libyaml-dev node-gyp pkg-config python-is-python3 libmariadb-dev && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install rails gem in the build stage where build tools are available
|
||||||
|
RUN gem install rails
|
||||||
|
|
||||||
|
# Install JavaScript dependencies
|
||||||
|
ARG NODE_VERSION=18.19.0
|
||||||
|
ARG YARN_VERSION=latest
|
||||||
|
ENV NODE_PATH=/usr/local/node
|
||||||
|
ENV PATH=/usr/local/node/bin:$PATH
|
||||||
|
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
|
||||||
|
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
|
||||||
|
rm -rf /tmp/node-build-master
|
||||||
|
RUN corepack enable && yarn set version $YARN_VERSION
|
||||||
|
|
||||||
|
# Copy dependency files first (better caching)
|
||||||
|
COPY Gemfile Gemfile.lock ./
|
||||||
|
RUN bundle config set --local frozen 'true' && \
|
||||||
|
bundle install && \
|
||||||
|
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
||||||
|
bundle exec bootsnap precompile --gemfile
|
||||||
|
|
||||||
|
# Install node modules
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
RUN yarn install --immutable && \
|
||||||
|
yarn cache clean --all
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Precompile bootsnap code for faster boot times
|
||||||
|
RUN bundle exec bootsnap precompile app/ lib/
|
||||||
|
|
||||||
|
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
||||||
|
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
||||||
|
|
||||||
|
# Clean up build-time dependencies and files
|
||||||
|
RUN rm -rf node_modules tmp/cache
|
||||||
|
|
||||||
|
# Final stage for app image
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
# Copy built artifacts: gems and application
|
||||||
|
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
||||||
|
COPY --from=build /rails /rails
|
||||||
|
COPY --from=build /usr/local/node /usr/local/node
|
||||||
|
|
||||||
|
# Ensure proper permissions for runtime directories
|
||||||
|
RUN mkdir -p /rails/db /rails/log /rails/storage /rails/tmp && \
|
||||||
|
chown -R rails:rails /rails/db /rails/log /rails/storage /rails/tmp
|
||||||
|
|
||||||
|
USER rails
|
||||||
|
|
||||||
|
# Configure jemalloc for better memory management
|
||||||
|
ENV LD_PRELOAD=libjemalloc.so.2
|
||||||
|
|
||||||
|
# Entrypoint prepares the database.
|
||||||
|
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||||
|
|
||||||
|
# Start server via Thruster by default, this can be overwritten at runtime
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["./bin/thrust", "./bin/rails", "server", "-b", "0.0.0.0"]
|
||||||
@@ -126,6 +126,29 @@ class OrdersController < ApplicationController
|
|||||||
@total_amount = @order.total_amount_cents
|
@total_amount = @order.total_amount_cents
|
||||||
@expiring_soon = @order.expiring_soon?
|
@expiring_soon = @order.expiring_soon?
|
||||||
|
|
||||||
|
# Handle promotion code application
|
||||||
|
if params[:promotion_code].present?
|
||||||
|
promotion_code = PromotionCode.valid.find_by(code: params[:promotion_code].upcase)
|
||||||
|
if promotion_code
|
||||||
|
# Apply the promotion code to the order
|
||||||
|
@order.promotion_codes << promotion_code
|
||||||
|
@order.calculate_total!
|
||||||
|
@total_amount = @order.total_amount_cents
|
||||||
|
flash.now[:notice] = "Code promotionnel appliqué: #{promotion_code.code}"
|
||||||
|
else
|
||||||
|
flash.now[:alert] = "Code promotionnel invalide"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# For free orders, automatically mark as paid and redirect to success
|
||||||
|
if @order.free?
|
||||||
|
@order.mark_as_paid!
|
||||||
|
session.delete(:pending_cart)
|
||||||
|
session.delete(:ticket_names)
|
||||||
|
session.delete(:draft_order_id)
|
||||||
|
return redirect_to order_path(@order), notice: "Vos billets gratuits ont été confirmés !"
|
||||||
|
end
|
||||||
|
|
||||||
# Create Stripe checkout session if Stripe is configured
|
# Create Stripe checkout session if Stripe is configured
|
||||||
if Rails.application.config.stripe[:secret_key].present?
|
if Rails.application.config.stripe[:secret_key].present?
|
||||||
begin
|
begin
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
class Promoter::EventsController < ApplicationController
|
class Promoter::EventsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :ensure_can_manage_events!
|
before_action :ensure_can_manage_events!
|
||||||
before_action :set_event, only: [ :show, :edit, :update, :destroy, :publish, :unpublish, :cancel, :mark_sold_out, :duplicate ]
|
before_action :set_event, only: [ :show, :edit, :update, :destroy, :publish, :unpublish, :cancel, :mark_sold_out, :mark_available, :duplicate ]
|
||||||
|
|
||||||
# Display all events for the current promoter
|
# Display all events for the current promoter
|
||||||
def index
|
def index
|
||||||
@@ -93,6 +93,16 @@ class Promoter::EventsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Mark event as available again
|
||||||
|
def mark_available
|
||||||
|
if @event.sold_out?
|
||||||
|
@event.update(state: :published)
|
||||||
|
redirect_to promoter_event_path(@event), notice: "Event marqué comme disponible!"
|
||||||
|
else
|
||||||
|
redirect_to promoter_event_path(@event), alert: "Cet event ne peut pas être marqué comme disponible."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Duplicate an event and all its ticket types
|
# Duplicate an event and all its ticket types
|
||||||
def duplicate
|
def duplicate
|
||||||
clone_ticket_types = params[:clone_ticket_types] == "true"
|
clone_ticket_types = params[:clone_ticket_types] == "true"
|
||||||
|
|||||||
@@ -1,2 +1,9 @@
|
|||||||
module TicketsHelper
|
module TicketsHelper
|
||||||
|
def format_ticket_price(price_cents)
|
||||||
|
if price_cents == 0
|
||||||
|
"Gratuit"
|
||||||
|
else
|
||||||
|
number_to_currency(price_cents / 100.0, unit: "€")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
class TicketMailer < ApplicationMailer
|
class TicketMailer < ApplicationMailer
|
||||||
|
helper :tickets
|
||||||
|
|
||||||
def purchase_confirmation_order(order)
|
def purchase_confirmation_order(order)
|
||||||
@order = order
|
@order = order
|
||||||
@user = order.user
|
@user = order.user
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class Event < ApplicationRecord
|
|||||||
# Scope for published events ordered by start time
|
# Scope for published events ordered by start time
|
||||||
scope :upcoming, -> { published.where("start_time >= ?", Time.current).order(start_time: :asc) }
|
scope :upcoming, -> { published.where("start_time >= ?", Time.current).order(start_time: :asc) }
|
||||||
|
|
||||||
|
|
||||||
# === Instance Methods ===
|
# === Instance Methods ===
|
||||||
|
|
||||||
# Check if coordinates were successfully geocoded or are fallback coordinates
|
# Check if coordinates were successfully geocoded or are fallback coordinates
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ class Order < ApplicationRecord
|
|||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :event
|
belongs_to :event
|
||||||
has_many :tickets, dependent: :destroy
|
has_many :tickets, dependent: :destroy
|
||||||
|
has_many :order_promotion_codes, dependent: :destroy
|
||||||
|
has_many :promotion_codes, through: :order_promotion_codes
|
||||||
|
|
||||||
# === Validations ===
|
# === Validations ===
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
@@ -116,6 +118,11 @@ class Order < ApplicationRecord
|
|||||||
promoter_payout_cents / 100.0
|
promoter_payout_cents / 100.0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check if order contains only free tickets
|
||||||
|
def free?
|
||||||
|
total_amount_cents == 0
|
||||||
|
end
|
||||||
|
|
||||||
# Create Stripe invoice for accounting records
|
# Create Stripe invoice for accounting records
|
||||||
#
|
#
|
||||||
# This method creates a post-payment invoice in Stripe for accounting purposes
|
# This method creates a post-payment invoice in Stripe for accounting purposes
|
||||||
|
|||||||
26
app/models/order_promotion_code.rb
Normal file
26
app/models/order_promotion_code.rb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
class OrderPromotionCode < ApplicationRecord
|
||||||
|
# Associations
|
||||||
|
belongs_to :order
|
||||||
|
belongs_to :promotion_code
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
validates :order, presence: true
|
||||||
|
validates :promotion_code, presence: true
|
||||||
|
|
||||||
|
# Callbacks
|
||||||
|
after_create :apply_discount
|
||||||
|
after_create :increment_promotion_code_uses
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def apply_discount
|
||||||
|
# Apply the discount to the order
|
||||||
|
discount_amount = promotion_code.discount_amount_cents
|
||||||
|
order.update!(total_amount_cents: [ order.total_amount_cents - discount_amount, 0 ].max)
|
||||||
|
end
|
||||||
|
|
||||||
|
def increment_promotion_code_uses
|
||||||
|
# Increment the uses count on the promotion code
|
||||||
|
promotion_code.increment!(:uses_count)
|
||||||
|
end
|
||||||
|
end
|
||||||
23
app/models/promotion_code.rb
Normal file
23
app/models/promotion_code.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
class PromotionCode < ApplicationRecord
|
||||||
|
# Validations
|
||||||
|
validates :code, presence: true, uniqueness: true
|
||||||
|
validates :discount_amount_cents, numericality: { greater_than_or_equal_to: 0 }
|
||||||
|
|
||||||
|
# Scopes
|
||||||
|
scope :active, -> { where(active: true) }
|
||||||
|
scope :expired, -> { where("expires_at < ? OR active = ?", Time.current, false) }
|
||||||
|
scope :valid, -> { active.where("expires_at > ? OR expires_at IS NULL", Time.current) }
|
||||||
|
|
||||||
|
# Callbacks
|
||||||
|
before_create :increment_uses_count
|
||||||
|
|
||||||
|
# Associations
|
||||||
|
has_many :order_promotion_codes
|
||||||
|
has_many :orders, through: :order_promotion_codes
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def increment_uses_count
|
||||||
|
self.uses_count ||= 0
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,7 +9,7 @@ class Ticket < ApplicationRecord
|
|||||||
validates :qr_code, presence: true, uniqueness: true
|
validates :qr_code, presence: true, uniqueness: true
|
||||||
validates :order_id, presence: true
|
validates :order_id, presence: true
|
||||||
validates :ticket_type_id, presence: true
|
validates :ticket_type_id, presence: true
|
||||||
validates :price_cents, presence: true, numericality: { greater_than: 0 }
|
validates :price_cents, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
||||||
validates :status, presence: true, inclusion: { in: %w[draft active used expired refunded] }
|
validates :status, presence: true, inclusion: { in: %w[draft active used expired refunded] }
|
||||||
validates :first_name, presence: true
|
validates :first_name, presence: true
|
||||||
validates :last_name, presence: true
|
validates :last_name, presence: true
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class TicketType < ApplicationRecord
|
|||||||
# Validations
|
# Validations
|
||||||
validates :name, presence: true, length: { minimum: 3, maximum: 50 }
|
validates :name, presence: true, length: { minimum: 3, maximum: 50 }
|
||||||
validates :description, presence: true, length: { minimum: 10, maximum: 500 }
|
validates :description, presence: true, length: { minimum: 10, maximum: 500 }
|
||||||
validates :price_cents, presence: true, numericality: { greater_than: 0 }
|
validates :price_cents, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
||||||
validates :quantity, presence: true, numericality: { only_integer: true, greater_than: 0 }
|
validates :quantity, presence: true, numericality: { only_integer: true, greater_than: 0 }
|
||||||
validates :sale_start_at, presence: true
|
validates :sale_start_at, presence: true
|
||||||
validates :sale_end_at, presence: true
|
validates :sale_end_at, presence: true
|
||||||
@@ -48,6 +48,10 @@ class TicketType < ApplicationRecord
|
|||||||
[ quantity - tickets.count, 0 ].max
|
[ quantity - tickets.count, 0 ].max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def free?
|
||||||
|
price_cents == 0
|
||||||
|
end
|
||||||
|
|
||||||
def sales_status
|
def sales_status
|
||||||
return :draft if sale_start_at.nil? || sale_end_at.nil?
|
return :draft if sale_start_at.nil? || sale_end_at.nil?
|
||||||
return :expired if sale_end_at < Time.current
|
return :expired if sale_end_at < Time.current
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<p class="text-xl font-bold text-purple-700 <%= "text-gray-400" if sold_out %>">
|
<p class="text-xl font-bold text-purple-700 <%= "text-gray-400" if sold_out %>">
|
||||||
<%= number_to_currency(price_cents / 100.0, unit: "€") %>
|
<%= format_ticket_price(price_cents) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
<div class="min-h-screen bg-gradient-to-br from-purple-50 to-indigo-50 py-12 px-4 sm:px-6">
|
|
||||||
<div class="max-w-3xl mx-auto">
|
|
||||||
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="bg-gradient-to-r from-purple-600 to-indigo-700 px-6 py-8 text-center">
|
|
||||||
<div class="flex justify-center mb-4">
|
|
||||||
<div class="w-16 h-16 rounded-full bg-white/20 flex items-center justify-center">
|
|
||||||
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h1 class="text-3xl font-bold text-white mb-2">Paiement réussi !</h1>
|
|
||||||
<p class="text-purple-100">Félicitations pour votre achat</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="p-6 sm:p-8">
|
|
||||||
<div class="text-center mb-8">
|
|
||||||
<p class="text-xl text-gray-700">
|
|
||||||
Vos billets pour <span class="font-bold text-purple-700"><%= @event.name %></span> ont été achetés avec succès.
|
|
||||||
</p>
|
|
||||||
<p class="text-gray-500 mt-2">
|
|
||||||
Un email de confirmation avec vos billets a été envoyé à <span class="font-medium"><%= current_user.email %></span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Event Details -->
|
|
||||||
<div class="bg-gray-50 rounded-xl p-6 mb-8">
|
|
||||||
<h2 class="text-xl font-bold text-gray-900 mb-4 flex items-center">
|
|
||||||
<svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Détails de l'événement
|
|
||||||
</h2>
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="flex items-center p-3 bg-white rounded-lg">
|
|
||||||
<svg class="w-5 h-5 text-purple-500 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-gray-500">Lieu</p>
|
|
||||||
<p class="font-medium"><%= @event.venue_name %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center p-3 bg-white rounded-lg">
|
|
||||||
<svg class="w-5 h-5 text-purple-500 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-gray-500">Date & Heure</p>
|
|
||||||
<p class="font-medium"><%= @event.start_time.strftime("%d %B %Y à %H:%M") %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tickets -->
|
|
||||||
<div class="mb-8">
|
|
||||||
<h2 class="text-xl font-bold text-gray-900 mb-4 flex items-center">
|
|
||||||
<svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"></path>
|
|
||||||
</svg>
|
|
||||||
Vos billets
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
<% @tickets.each do |ticket| %>
|
|
||||||
<div class="bg-gradient-to-r from-purple-50 to-indigo-50 rounded-xl border border-purple-100 p-5">
|
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
||||||
<div class="flex-1">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<div class="w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
|
|
||||||
<svg class="w-5 h-5 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="font-bold text-gray-900"><%= ticket.ticket_type.name %></h3>
|
|
||||||
<p class="text-sm text-gray-600">Prix: <span class="font-medium"><%= number_to_currency(ticket.price_cents / 100.0, unit: "€") %></span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center space-x-2">
|
|
||||||
<%= link_to ticket_download_path(ticket.qr_code, format: :pdf),
|
|
||||||
class: "inline-flex items-center px-4 py-2 btn btn-primary rounded-lg transition-all duration-200 text-sm font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Télécharger PDF
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4 pt-4 border-t border-purple-100 flex items-center justify-between">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg class="w-4 h-4 text-gray-500 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
|
|
||||||
</svg>
|
|
||||||
<span class="text-xs text-gray-500">Code QR: <%= ticket.qr_code[0..7] %></span>
|
|
||||||
</div>
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
||||||
Actif
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Important Notice -->
|
|
||||||
<div class="bg-blue-50 border border-blue-100 rounded-xl p-5 mb-8">
|
|
||||||
<div class="flex">
|
|
||||||
<svg class="w-5 h-5 text-blue-500 mr-3 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<h3 class="font-bold text-blue-800 mb-1">Important</h3>
|
|
||||||
<p class="text-sm text-blue-700">
|
|
||||||
Veuillez télécharger et sauvegarder vos billets. Présentez-les à l'entrée du lieu pour accéder à l'événement.
|
|
||||||
Un email de confirmation avec vos billets a été envoyé à votre adresse email.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
|
||||||
<%= link_to dashboard_path,
|
|
||||||
class: "inline-flex items-center justify-center px-6 py-3 btn btn-primary rounded-xl transition-all duration-200 font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
|
|
||||||
</svg>
|
|
||||||
Tableau de bord
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_to events_path,
|
|
||||||
class: "inline-flex items-center justify-center px-6 py-3 bg-white text-gray-700 rounded-xl border border-gray-300 hover:bg-gray-50 transition-all duration-200 font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Voir plus d'événements
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -135,11 +135,9 @@
|
|||||||
controller: "ticket-selection",
|
controller: "ticket-selection",
|
||||||
ticket_selection_target: "form",
|
ticket_selection_target: "form",
|
||||||
ticket_selection_event_slug_value: @event.slug,
|
ticket_selection_event_slug_value: @event.slug,
|
||||||
ticket_selection_event_id_value: @event.id,
|
ticket_selection_event_id_value: @event.id,
|
||||||
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
|
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
|
||||||
ticket_selection_store_cart_url_value: api_v1_store_cart_path,
|
ticket_selection_store_cart_url_value: api_v1_store_cart_path
|
||||||
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
|
|
||||||
ticket_selection_store_cart_url_value: api_v1_store_cart_path
|
|
||||||
} do |form| %>
|
} do |form| %>
|
||||||
|
|
||||||
<div class="bg-gradient-to-br from-purple-50 to-indigo-50 rounded-2xl border border-purple-100 p-6 shadow-sm">
|
<div class="bg-gradient-to-br from-purple-50 to-indigo-50 rounded-2xl border border-purple-100 p-6 shadow-sm">
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
<!-- Order Total -->
|
<!-- Order Total -->
|
||||||
<div class=" pt-12">
|
<div class=" pt-12">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<div class="flex items-center justify-between text-lg pt-2 border-t border-gray-200">
|
<div class="flex items-center justify-between text-lg pt-2">
|
||||||
<span class="font-medium text-gray-900">Total</span>
|
<span class="font-medium text-gray-900">Total</span>
|
||||||
<span class="font-bold text-2xl text-purple-600"><%= @order.total_amount_euros %>€</span>
|
<span class="font-bold text-2xl text-purple-600"><%= @order.total_amount_euros %>€</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -118,6 +118,16 @@
|
|||||||
<p class="text-sm text-gray-600">Procédez au paiement pour finaliser votre commande</p>
|
<p class="text-sm text-gray-600">Procédez au paiement pour finaliser votre commande</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Promotion Code Section -->
|
||||||
|
<%= form_tag checkout_order_path(@order), method: :get, class: "mb-6" do %>
|
||||||
|
<div class="flex items-center bg-gray-50 border border-gray-200 rounded-lg p-3">
|
||||||
|
<%= text_field_tag :promotion_code, params[:promotion_code], class: "flex-1 border-none bg-transparent focus:ring-0 text-sm", placeholder: "Code promotionnel (optionnel)" %>
|
||||||
|
<%= button_tag type: "submit", class: "ml-2 btn btn-secondary py-2 px-4 text-sm" do %>
|
||||||
|
Appliquer
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if @checkout_session.present? %>
|
<% if @checkout_session.present? %>
|
||||||
<!-- Stripe Checkout -->
|
<!-- Stripe Checkout -->
|
||||||
<div class="space-y-6">
|
<div class="space-y-6">
|
||||||
@@ -131,13 +141,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
id="checkout-button"
|
id="checkout-button"
|
||||||
data-order-id="<%= @order.id %>"
|
data-order-id="<%= @order.id %>"
|
||||||
data-increment-url="/api/v1/orders/<%= @order.id %>/increment_payment_attempt"
|
data-increment-url="/api/v1/orders/<%= @order.id %>/increment_payment_attempt"
|
||||||
data-session-id="<%= @checkout_session.id if @checkout_session.present? %>"
|
data-session-id="<%= @checkout_session.id if @checkout_session.present? %>"
|
||||||
class="w-full btn btn-primary py-4 px-6 rounded-xl transition-all duration-200 transform hover:scale-105 active:scale-95 shadow-lg hover:shadow-xl"
|
class="w-full btn btn-primary py-4 px-6 rounded-xl transition-all duration-200 transform hover:scale-105 active:scale-95 shadow-lg hover:shadow-xl"
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex items-center justify-center">
|
||||||
<i data-lucide="credit-card" class="w-5 h-5 mr-2"></i>
|
<i data-lucide="credit-card" class="w-5 h-5 mr-2"></i>
|
||||||
Payer <%= @order.total_amount_euros %>€
|
Payer <%= @order.total_amount_euros %>€
|
||||||
@@ -194,16 +204,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Increment payment attempt counter
|
// Increment payment attempt counter
|
||||||
const orderId = checkoutButton.dataset.orderId;
|
const orderId = checkoutButton.dataset.orderId;
|
||||||
const incrementUrl = checkoutButton.dataset.incrementUrl;
|
const incrementUrl = checkoutButton.dataset.incrementUrl;
|
||||||
console.log('Incrementing payment attempt for order:', orderId);
|
console.log('Incrementing payment attempt for order:', orderId);
|
||||||
const response = await fetch(incrementUrl, {
|
const response = await fetch(incrementUrl, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-CSRF-Token': document.querySelector('[name=csrf-token]').content
|
'X-CSRF-Token': document.querySelector('[name=csrf-token]').content
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error('Payment attempt increment failed:', response.status, response.statusText);
|
console.error('Payment attempt increment failed:', response.status, response.statusText);
|
||||||
@@ -224,11 +234,11 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
// Redirect to Stripe
|
// Redirect to Stripe
|
||||||
const sessionId = checkoutButton.dataset.sessionId;
|
const sessionId = checkoutButton.dataset.sessionId;
|
||||||
console.log('Redirecting to Stripe with session ID:', sessionId);
|
console.log('Redirecting to Stripe with session ID:', sessionId);
|
||||||
const stripeResult = await stripe.redirectToCheckout({
|
const stripeResult = await stripe.redirectToCheckout({
|
||||||
sessionId: sessionId
|
sessionId: sessionId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (stripeResult.error) {
|
if (stripeResult.error) {
|
||||||
throw new Error(stripeResult.error.message);
|
throw new Error(stripeResult.error.message);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
<!-- Total -->
|
<!-- Total -->
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<div class="flex items-center justify-between text-lg pt-2 border-t border-gray-200">
|
<div class="flex items-center justify-between text-lg pt-2">
|
||||||
<span class="font-medium text-gray-900">Total payé</span>
|
<span class="font-medium text-gray-900">Total payé</span>
|
||||||
<span class="font-bold text-2xl text-green-600">
|
<span class="font-bold text-2xl text-green-600">
|
||||||
<%= @order.total_amount_euros %>€
|
<%= @order.total_amount_euros %>€
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
<!-- Total -->
|
<!-- Total -->
|
||||||
<div class="border-t border-gray-200 pt-6 mt-6">
|
<div class="border-t border-gray-200 pt-6 mt-6">
|
||||||
<div class="flex items-center justify-between text-lg pt-2 border-t border-gray-200">
|
<div class="flex items-center justify-between text-lg pt-2">
|
||||||
<span class="font-medium text-gray-900">Total <%= @order.status == 'paid' || @order.status == 'completed' ? 'payé' : 'à payer' %></span>
|
<span class="font-medium text-gray-900">Total <%= @order.status == 'paid' || @order.status == 'completed' ? 'payé' : 'à payer' %></span>
|
||||||
<span class="font-bold text-2xl <%= @order.status == 'paid' || @order.status == 'completed' ? 'text-green-600' : 'text-purple-600' %>">
|
<span class="font-bold text-2xl <%= @order.status == 'paid' || @order.status == 'completed' ? 'text-green-600' : 'text-purple-600' %>">
|
||||||
<%= @order.total_amount_euros %>€
|
<%= @order.total_amount_euros %>€
|
||||||
|
|||||||
@@ -132,10 +132,14 @@
|
|||||||
<div class="bg-blue-50 border border-blue-200 rounded-2xl p-4">
|
<div class="bg-blue-50 border border-blue-200 rounded-2xl p-4">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<i data-lucide="users" class="w-5 h-5 text-blue-400 mr-3"></i>
|
<i data-lucide="users" class="w-5 h-5 text-blue-400 mr-3"></i>
|
||||||
<div>
|
<div class="flex-1">
|
||||||
<h3 class="text-sm font-medium text-blue-900">Événement complet</h3>
|
<h3 class="text-sm font-medium text-blue-900">Événement complet</h3>
|
||||||
<p class="text-sm text-blue-700">Tous les billets pour cet événement ont été vendus.</p>
|
<p class="text-sm text-blue-700">Tous les billets pour cet événement ont été vendus.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<%= button_to mark_available_promoter_event_path(@event), method: :patch, class: "ml-4 inline-flex items-center px-3 py-1 bg-white border border-blue-300 text-blue-700 text-sm font-medium rounded-lg hover:bg-blue-50 transition-colors duration-200" do %>
|
||||||
|
<i data-lucide="refresh-ccw" class="w-4 h-4 mr-1"></i>
|
||||||
|
Marquer comme disponible
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -273,10 +277,19 @@
|
|||||||
<i data-lucide="ticket" class="w-4 h-4 mr-2"></i>
|
<i data-lucide="ticket" class="w-4 h-4 mr-2"></i>
|
||||||
Gérer les types de billets
|
Gérer les types de billets
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= button_to mark_sold_out_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center justify-center px-4 py-3 bg-gray-50 text-gray-700 font-medium text-sm rounded-lg hover:bg-gray-100 transition-colors duration-200", disabled: !@event.published? do %>
|
|
||||||
<i data-lucide="users" class="w-4 h-4 mr-2"></i>
|
<% if @event.sold_out? %>
|
||||||
Marquer comme complet
|
<%= button_to mark_available_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center justify-center px-4 py-3 bg-blue-50 text-blue-700 font-medium text-sm rounded-lg hover:bg-blue-100 transition-colors duration-200" do %>
|
||||||
|
<i data-lucide="refresh-ccw" class="w-4 h-4 mr-2"></i>
|
||||||
|
Marquer comme disponible
|
||||||
|
<% end %>
|
||||||
|
<% elsif @event.published? %>
|
||||||
|
<%= button_to mark_sold_out_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center justify-center px-4 py-3 bg-gray-50 text-gray-700 font-medium text-sm rounded-lg hover:bg-gray-100 transition-colors duration-200" do %>
|
||||||
|
<i data-lucide="users" class="w-4 h-4 mr-2"></i>
|
||||||
|
Marquer comme complet
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<hr class="border-gray-200">
|
<hr class="border-gray-200">
|
||||||
<%= button_to promoter_event_path(@event), method: :delete,
|
<%= button_to promoter_event_path(@event), method: :delete,
|
||||||
data: { confirm: "Êtes-vous sûr de vouloir supprimer cet événement ? Cette action est irréversible." },
|
data: { confirm: "Êtes-vous sûr de vouloir supprimer cet événement ? Cette action est irréversible." },
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
<div class="relative">
|
<div class="relative">
|
||||||
<%= form.number_field :price_euros,
|
<%= form.number_field :price_euros,
|
||||||
step: 0.01,
|
step: 0.01,
|
||||||
min: 0.01,
|
min: 0,
|
||||||
class: "w-full px-4 py-2 pl-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent",
|
class: "w-full px-4 py-2 pl-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent",
|
||||||
data: { "ticket-type-form-target": "price", action: "input->ticket-type-form#updateTotal" } %>
|
data: { "ticket-type-form-target": "price", action: "input->ticket-type-form#updateTotal" } %>
|
||||||
<div class="absolute left-3 top-2.5 text-gray-500">€</div>
|
<div class="absolute left-3 top-2.5 text-gray-500">€</div>
|
||||||
@@ -91,6 +91,8 @@
|
|||||||
<i data-lucide="alert-triangle" class="w-4 h-4 inline mr-1"></i>
|
<i data-lucide="alert-triangle" class="w-4 h-4 inline mr-1"></i>
|
||||||
Modifier le prix n'affectera pas les billets déjà vendus
|
Modifier le prix n'affectera pas les billets déjà vendus
|
||||||
</p>
|
</p>
|
||||||
|
<% else %>
|
||||||
|
<p class="mt-1 text-sm text-gray-500">Prix unitaire du billet (0€ pour un billet gratuit)</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -163,8 +165,10 @@
|
|||||||
<div class="flex">
|
<div class="flex">
|
||||||
<i data-lucide="info" class="w-5 h-5 text-blue-400 mt-0.5 mr-2"></i>
|
<i data-lucide="info" class="w-5 h-5 text-blue-400 mt-0.5 mr-2"></i>
|
||||||
<p class="text-sm text-blue-800">
|
<p class="text-sm text-blue-800">
|
||||||
<strong>Événement:</strong> <%= @event.start_time.strftime("%d/%m/%Y à %H:%M") %><br>
|
<strong>Début d'événement :</strong> <%= @event.start_time.strftime("%d/%m/%Y à %H:%M") %><br>
|
||||||
Les ventes doivent se terminer avant le début de l'événement.
|
<% unless @event.allow_booking_during_event? %>
|
||||||
|
Les ventes doivent se terminer avant le début de l'événement.
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -208,12 +212,6 @@
|
|||||||
<%= link_to promoter_event_ticket_type_path(@event, @ticket_type), class: "text-gray-500 hover:text-gray-700 transition-colors" do %>
|
<%= link_to promoter_event_ticket_type_path(@event, @ticket_type), class: "text-gray-500 hover:text-gray-700 transition-colors" do %>
|
||||||
Annuler
|
Annuler
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @ticket_type.tickets.any? %>
|
|
||||||
<p class="text-sm text-yellow-600">
|
|
||||||
<i data-lucide="info" class="w-4 h-4 inline mr-1"></i>
|
|
||||||
<%= pluralize(@ticket_type.tickets.count, 'billet') %> déjà vendu(s)
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center space-x-3">
|
<div class="flex items-center space-x-3">
|
||||||
|
|||||||
@@ -68,12 +68,12 @@
|
|||||||
<div class="relative">
|
<div class="relative">
|
||||||
<%= form.number_field :price_euros,
|
<%= form.number_field :price_euros,
|
||||||
step: 0.01,
|
step: 0.01,
|
||||||
min: 0.01,
|
min: 0,
|
||||||
class: "w-full px-4 py-2 pl-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent",
|
class: "w-full px-4 py-2 pl-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent",
|
||||||
data: { "ticket-type-form-target": "price", action: "input->ticket-type-form#updateTotal" } %>
|
data: { "ticket-type-form-target": "price", action: "input->ticket-type-form#updateTotal" } %>
|
||||||
<div class="absolute left-3 top-2.5 text-gray-500">€</div>
|
<div class="absolute left-3 top-2.5 text-gray-500">€</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-1 text-sm text-gray-500">Prix unitaire du billet</p>
|
<p class="mt-1 text-sm text-gray-500">Prix unitaire du billet (0€ pour un billet gratuit)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -123,8 +123,11 @@
|
|||||||
<div class="flex">
|
<div class="flex">
|
||||||
<i data-lucide="info" class="w-5 h-5 text-blue-400 mt-0.5 mr-2"></i>
|
<i data-lucide="info" class="w-5 h-5 text-blue-400 mt-0.5 mr-2"></i>
|
||||||
<p class="text-sm text-blue-800">
|
<p class="text-sm text-blue-800">
|
||||||
<strong>Événement:</strong> <%= @event.start_time.strftime("%d/%m/%Y à %H:%M") %><br>
|
<strong>Début d'événement :</strong> <%= @event.start_time.strftime("%d/%m/%Y à %H:%M") %><br>
|
||||||
Les ventes doivent se terminer avant le début de l'événement.
|
|
||||||
|
<% unless @event.allow_booking_during_event? %>
|
||||||
|
Les ventes doivent se terminer avant le début de l'événement.
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<p class="text-sm font-medium text-gray-900">
|
<p class="text-sm font-medium text-gray-900">
|
||||||
<%= number_to_currency(ticket.price_cents / 100.0, unit: "€") %>
|
<%= format_ticket_price(ticket.price_cents) %>
|
||||||
</p>
|
</p>
|
||||||
<p class="text-xs text-gray-500">
|
<p class="text-xs text-gray-500">
|
||||||
<%= ticket.created_at.strftime("%d/%m/%Y") %>
|
<%= ticket.created_at.strftime("%d/%m/%Y") %>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="text-center p-4 bg-purple-50 rounded-lg">
|
<div class="text-center p-4 bg-purple-50 rounded-lg">
|
||||||
<div class="text-3xl font-bold text-purple-600">
|
<div class="text-3xl font-bold text-purple-600">
|
||||||
<%= number_to_currency(@ticket_type.price_euros, unit: "€") %>
|
<%= format_ticket_price(@ticket_type.price_cents) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-500">Prix unitaire</div>
|
<div class="text-sm text-gray-500">Prix unitaire</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
<p style="margin: 5px 0 0;"><a href="<%= ticket_url(ticket) %>" style="color: #4c1d95; text-decoration: none; font-size: 14px;">📱 Voir le détail et le code QR</a></p>
|
<p style="margin: 5px 0 0;"><a href="<%= ticket_url(ticket) %>" style="color: #4c1d95; text-decoration: none; font-size: 14px;">📱 Voir le détail et le code QR</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
<p style="margin: 0; font-weight: bold; color: #212529;"><%= number_to_currency(ticket.price_cents / 100.0, unit: "€") %></p>
|
<p style="margin: 0; font-weight: bold; color: #212529;"><%= format_ticket_price(ticket.price_cents) %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
<p style="margin: 0; color: #6c757d; font-size: 14px;">Prix</p>
|
<p style="margin: 0; color: #6c757d; font-size: 14px;">Prix</p>
|
||||||
<p style="margin: 5px 0 0; font-weight: bold; color: #212529;"><%= number_to_currency(@ticket.price_cents / 100.0, unit: "€") %></p>
|
<p style="margin: 5px 0 0; font-weight: bold; color: #212529;"><%= format_ticket_price(@ticket.price_cents) %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ DÉTAILS DE VOTRE COMMANDE
|
|||||||
Événement : <%= @event.name %>
|
Événement : <%= @event.name %>
|
||||||
Date & heure : <%= @event.start_time.strftime("%d %B %Y à %H:%M") %>
|
Date & heure : <%= @event.start_time.strftime("%d %B %Y à %H:%M") %>
|
||||||
Nombre de billets : <%= @tickets.count %>
|
Nombre de billets : <%= @tickets.count %>
|
||||||
Total : <%= number_to_currency(@order.total_amount_euros, unit: "€") %>
|
Total : <%= @order.free? ? "Gratuit" : number_to_currency(@order.total_amount_euros, unit: "€") %>
|
||||||
|
|
||||||
BILLETS INCLUS :
|
BILLETS INCLUS :
|
||||||
<% @tickets.each_with_index do |ticket, index| %>
|
<% @tickets.each_with_index do |ticket, index| %>
|
||||||
- Billet #<%= index + 1 %> : <%= ticket.ticket_type.name %> - <%= number_to_currency(ticket.price_cents / 100.0, unit: "€") %>
|
- Billet #<%= index + 1 %> : <%= ticket.ticket_type.name %> - <%= format_ticket_price(ticket.price_cents) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
Vos billets sont attachés à cet email en format PDF. Présentez-les à l'entrée de l'événement pour y accéder.
|
Vos billets sont attachés à cet email en format PDF. Présentez-les à l'entrée de l'événement pour y accéder.
|
||||||
@@ -32,7 +32,7 @@ DÉTAILS DE VOTRE BILLET
|
|||||||
Événement : <%= @event.name %>
|
Événement : <%= @event.name %>
|
||||||
Type de billet : <%= @ticket.ticket_type.name %>
|
Type de billet : <%= @ticket.ticket_type.name %>
|
||||||
Date & heure : <%= @event.start_time.strftime("%d %B %Y à %H:%M") %>
|
Date & heure : <%= @event.start_time.strftime("%d %B %Y à %H:%M") %>
|
||||||
Prix : <%= number_to_currency(@ticket.price_cents / 100.0, unit: "€") %>
|
Prix : <%= format_ticket_price(@ticket.price_cents) %>
|
||||||
|
|
||||||
Votre billet est attaché à cet email en format PDF. Présentez-le à l'entrée de l'événement pour y accéder.
|
Votre billet est attaché à cet email en format PDF. Présentez-le à l'entrée de l'événement pour y accéder.
|
||||||
|
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
<div class="min-h-screen bg-gradient-to-br from-purple-50 to-indigo-50 py-12 px-4 sm:px-6">
|
|
||||||
<div class="max-w-3xl mx-auto">
|
|
||||||
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="bg-gradient-to-r from-purple-600 to-indigo-700 px-6 py-8 text-center">
|
|
||||||
<div class="flex justify-center mb-4">
|
|
||||||
<div class="w-16 h-16 rounded-full bg-white/20 flex items-center justify-center">
|
|
||||||
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h1 class="text-3xl font-bold text-white mb-2">Paiement réussi !</h1>
|
|
||||||
<p class="text-purple-100">Félicitations pour votre achat</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="p-6 sm:p-8">
|
|
||||||
<div class="text-center mb-8">
|
|
||||||
<p class="text-xl text-gray-700">
|
|
||||||
Vos billets pour <span class="font-bold text-purple-700"><%= @event.name %></span> ont été achetés avec succès.
|
|
||||||
</p>
|
|
||||||
<p class="text-gray-500 mt-2">
|
|
||||||
Un email de confirmation avec vos billets a été envoyé à <span class="font-medium"><%= current_user.email %></span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Event Details -->
|
|
||||||
<div class="bg-gray-50 rounded-xl p-6 mb-8">
|
|
||||||
<h2 class="text-xl font-bold text-gray-900 mb-4 flex items-center">
|
|
||||||
<svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Détails de l'événement
|
|
||||||
</h2>
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="flex items-center p-3 bg-white rounded-lg">
|
|
||||||
<svg class="w-5 h-5 text-purple-500 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-gray-500">Lieu</p>
|
|
||||||
<p class="font-medium"><%= @event.venue_name %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center p-3 bg-white rounded-lg">
|
|
||||||
<svg class="w-5 h-5 text-purple-500 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-gray-500">Date & Heure</p>
|
|
||||||
<p class="font-medium"><%= @event.start_time.strftime("%d %B %Y à %H:%M") %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tickets -->
|
|
||||||
<div class="mb-8">
|
|
||||||
<h2 class="text-xl font-bold text-gray-900 mb-4 flex items-center">
|
|
||||||
<svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"></path>
|
|
||||||
</svg>
|
|
||||||
Vos billets
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
<% @tickets.each do |ticket| %>
|
|
||||||
<div class="bg-gradient-to-r from-purple-50 to-indigo-50 rounded-xl border border-purple-100 p-5">
|
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
||||||
<div class="flex-1">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<div class="w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
|
|
||||||
<svg class="w-5 h-5 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="font-bold text-gray-900"><%= ticket.ticket_type.name %></h3>
|
|
||||||
<p class="text-sm text-gray-600">Prix: <span class="font-medium"><%= number_to_currency(ticket.price_cents / 100.0, unit: "€") %></span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center space-x-2">
|
|
||||||
<%= link_to ticket_download_path(ticket.qr_code, format: :pdf),
|
|
||||||
class: "inline-flex items-center px-4 py-2 btn btn-primary rounded-lg transition-all duration-200 text-sm font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Télécharger PDF
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4 pt-4 border-t border-purple-100 flex items-center justify-between">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg class="w-4 h-4 text-gray-500 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
|
|
||||||
</svg>
|
|
||||||
<span class="text-xs text-gray-500">Code QR: <%= ticket.qr_code[0..7] %></span>
|
|
||||||
</div>
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
||||||
Actif
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Important Notice -->
|
|
||||||
<div class="bg-blue-50 border border-blue-100 rounded-xl p-5 mb-8">
|
|
||||||
<div class="flex">
|
|
||||||
<svg class="w-5 h-5 text-blue-500 mr-3 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<h3 class="font-bold text-blue-800 mb-1">Important</h3>
|
|
||||||
<p class="text-sm text-blue-700">
|
|
||||||
Veuillez télécharger et sauvegarder vos billets. Présentez-les à l'entrée du lieu pour accéder à l'événement.
|
|
||||||
Un email de confirmation avec vos billets a été envoyé à votre adresse email.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
|
||||||
<%= link_to dashboard_path,
|
|
||||||
class: "inline-flex items-center justify-center px-6 py-3 btn btn-primary rounded-xl transition-all duration-200 font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
|
|
||||||
</svg>
|
|
||||||
Tableau de bord
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_to events_path,
|
|
||||||
class: "inline-flex items-center justify-center px-6 py-3 bg-white text-gray-700 rounded-xl border border-gray-300 hover:bg-gray-50 transition-all duration-200 font-medium shadow-sm" do %>
|
|
||||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
|
|
||||||
</svg>
|
|
||||||
Voir plus d'événements
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-500 mb-1">Prix</label>
|
<label class="block text-sm font-medium text-gray-500 mb-1">Prix</label>
|
||||||
<p class="text-xl font-bold text-gray-900">
|
<p class="text-xl font-bold text-gray-900">
|
||||||
<%= number_to_currency(@ticket.price_euros, unit: "€", separator: ",", delimiter: " ", format: "%n %u") %>
|
<%= format_ticket_price(@ticket.price_cents) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ Rails.application.routes.draw do
|
|||||||
patch :unpublish
|
patch :unpublish
|
||||||
patch :cancel
|
patch :cancel
|
||||||
patch :mark_sold_out
|
patch :mark_sold_out
|
||||||
|
patch :mark_available
|
||||||
post :duplicate
|
post :duplicate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
16
db/migrate/20250928180837_create_promotion_codes.rb
Normal file
16
db/migrate/20250928180837_create_promotion_codes.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class CreatePromotionCodes < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :promotion_codes do |t|
|
||||||
|
t.string :code, null: false, unique: true
|
||||||
|
t.integer :discount_amount_cents, null: false, default: 0
|
||||||
|
t.datetime :expires_at
|
||||||
|
t.boolean :active, default: true, null: false
|
||||||
|
t.integer :usage_limit, default: nil
|
||||||
|
t.integer :uses_count, default: 0, null: false
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
t.datetime :updated_at, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :promotion_codes, :code, unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
10
db/migrate/20250928181311_create_order_promotion_codes.rb
Normal file
10
db/migrate/20250928181311_create_order_promotion_codes.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CreateOrderPromotionCodes < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :order_promotion_codes do |t|
|
||||||
|
t.references :order, null: false, foreign_key: true
|
||||||
|
t.references :promotion_code, null: false, foreign_key: true
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
77
db/seeds.rb
77
db/seeds.rb
@@ -112,3 +112,80 @@ events.each_with_index do |event, index|
|
|||||||
end
|
end
|
||||||
|
|
||||||
puts "Created #{User.count} users, #{Event.count} events, and #{TicketType.count} ticket types"
|
puts "Created #{User.count} users, #{Event.count} events, and #{TicketType.count} ticket types"
|
||||||
|
|
||||||
|
# Create regular user as promoter
|
||||||
|
promoter = User.find_or_create_by!(email: "kbataille@vivaldi.net") do |u|
|
||||||
|
u.password = "lareunion974!"
|
||||||
|
u.password_confirmation = "lareunion974!"
|
||||||
|
u.last_name = nil
|
||||||
|
u.first_name = nil
|
||||||
|
u.is_professionnal = true
|
||||||
|
end
|
||||||
|
|
||||||
|
belle_epoque_event = Event.find_or_create_by!(name: "LA BELLE ÉPOQUE PAR SISLEY ÉVENTS") do |e|
|
||||||
|
e.slug = "la-belle-epoque-par-sisley-events"
|
||||||
|
e.state = :draft
|
||||||
|
e.description = "
|
||||||
|
Sisley évents Présente :
|
||||||
|
SAM 13 SEPT
|
||||||
|
LA BELLE ÉPOQUE de 18H à 2H
|
||||||
|
sur le Rooftop LE PATIO
|
||||||
|
ÉVÈNEMENT EN PLEIN AIR
|
||||||
|
Ambiance Rétro / old school : zouk , Ragga , kompa , Dancehall , hip hop , Groove , Rnb …
|
||||||
|
Restauration disponible sur place : Accras ,Allocos , specialités asiatique , japonaise et une large carte de choix de Pizzas pour vous régaler !
|
||||||
|
TARIF D'ENTRÉE : 10€ SUR PLACE UNIQUEMENT
|
||||||
|
Réservée aux + de 30 ans
|
||||||
|
Suivez nous sur Instagram : Sisley Évents
|
||||||
|
Le patio
|
||||||
|
38 avenue Leon Gaumont , Montreuil
|
||||||
|
Parking du Décathlon disponible , rue de la république, à 100m du Patio
|
||||||
|
"
|
||||||
|
e.venue_name = "Le Patio Rooftop"
|
||||||
|
e.venue_address = "38 Av. Léon Gaumont, 93100 Montreuil"
|
||||||
|
e.latitude = 48.862336
|
||||||
|
e.longitude = 2.441218
|
||||||
|
e.start_time = 3.days.from_now
|
||||||
|
e.end_time = 3.days.from_now + 8.hours
|
||||||
|
e.featured = false
|
||||||
|
e.image = "https://data.bizouk.com/cache1/events/images/10/78/87/b801a9a43266b4cc54bdda73bf34eec8_700_800_auto_97.jpg"
|
||||||
|
e.user = promoter
|
||||||
|
e.allow_booking_during_event = true
|
||||||
|
end
|
||||||
|
|
||||||
|
belle_epoque_event.update!(start_time: 3.days.from_now, end_time: 3.days.from_now + 8.hours)
|
||||||
|
|
||||||
|
|
||||||
|
# Create ticket types for "La belle époque" event
|
||||||
|
belle_epoque_event = Event.find_by!(slug: "la-belle-epoque-par-sisley-events")
|
||||||
|
|
||||||
|
TicketType.find_or_create_by!(event: belle_epoque_event, name: "Free invitation valid before 7 p.m.") do |tt|
|
||||||
|
tt.description = "Free invitation ticket valid before 7 p.m. for La Belle Époque"
|
||||||
|
tt.price_cents = 0
|
||||||
|
tt.quantity = 50
|
||||||
|
tt.sale_start_at = Time.current
|
||||||
|
tt.sale_end_at = belle_epoque_event.start_time
|
||||||
|
tt.minimum_age = 30
|
||||||
|
tt.requires_id = true
|
||||||
|
end
|
||||||
|
|
||||||
|
TicketType.find_or_create_by!(event: belle_epoque_event, name: "ENTRY 10€ TO BE PAYED ON SITE ONLY") do |tt|
|
||||||
|
tt.description = "Entry ticket to be paid on site only (free in system)"
|
||||||
|
tt.price_cents = 0
|
||||||
|
tt.quantity = 100
|
||||||
|
tt.sale_start_at = Time.current
|
||||||
|
tt.sale_end_at = belle_epoque_event.start_time
|
||||||
|
tt.minimum_age = 30
|
||||||
|
tt.requires_id = true
|
||||||
|
end
|
||||||
|
|
||||||
|
TicketType.find_or_create_by!(event: belle_epoque_event, name: "Paid Entry 10€") do |tt|
|
||||||
|
tt.description = "Paid entry ticket for La Belle Époque at 10€"
|
||||||
|
tt.price_cents = 1000 # 10€
|
||||||
|
tt.quantity = 200
|
||||||
|
tt.sale_start_at = Time.current
|
||||||
|
tt.sale_end_at = belle_epoque_event.start_time
|
||||||
|
tt.minimum_age = 30
|
||||||
|
tt.requires_id = true
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Created 1 promoter, 1 draft event with ticket types"
|
||||||
|
|||||||
65
docker-compose.production.yml
Normal file
65
docker-compose.production.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
volumes:
|
||||||
|
mariadb_data:
|
||||||
|
gem_home:
|
||||||
|
node_modules_home:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:11.7.2-noble
|
||||||
|
env_file: .env
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- mariadb_data:/var/lib/mysql
|
||||||
|
#- ./mysql:/var/lib/mysql"
|
||||||
|
ports:
|
||||||
|
- "${FORWARD_DB_PORT:-3306}:3306"
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-root}"
|
||||||
|
# MYSQL_ROOT_HOST: "%"
|
||||||
|
MYSQL_PORT: "${DB_PORT:-3306}"
|
||||||
|
MYSQL_DATABASE: "${DB_DATABASE:-aperonight}"
|
||||||
|
MYSQL_USER: "${DB_USERNAME:-aperonight}"
|
||||||
|
MYSQL_PASSWORD: "${DB_PASSWORD:-aperonight}"
|
||||||
|
#MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
#command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
|
||||||
|
|
||||||
|
rails:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.production
|
||||||
|
env_file: .env
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./:/rails
|
||||||
|
- gem_home:/usr/local/bundle
|
||||||
|
- node_modules_home:/rails/node_modules
|
||||||
|
#- ./log:/var/log
|
||||||
|
#- ./log/supervisor:/var/log/supervisor
|
||||||
|
ports:
|
||||||
|
#- 80:80
|
||||||
|
- 3000:3000
|
||||||
|
#- 5000:5000
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
#tty: true
|
||||||
|
#command: /opt/src/bin/dev
|
||||||
|
|
||||||
|
mailhog:
|
||||||
|
image: corpusops/mailhog:v1.0.1
|
||||||
|
restart: unless-stopped
|
||||||
|
# environment:
|
||||||
|
# - "mh_auth_file=/opt/mailhog/passwd.conf"
|
||||||
|
volumes:
|
||||||
|
- ./data/mailhog:/opt/mailhog
|
||||||
|
ports:
|
||||||
|
- 1025:1025 # smtp port 25
|
||||||
|
- 8025:8025 # web mail access
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
66
test/controllers/orders_controller_promotion_test.rb
Normal file
66
test/controllers/orders_controller_promotion_test.rb
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class OrdersControllerPromotionTest < ActionDispatch::IntegrationTest
|
||||||
|
include Devise::Test::IntegrationHelpers
|
||||||
|
|
||||||
|
# Setup test data
|
||||||
|
def setup
|
||||||
|
@user = users(:one)
|
||||||
|
@event = events(:one)
|
||||||
|
@order = orders(:one)
|
||||||
|
sign_in @user
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test applying a valid promotion code
|
||||||
|
def test_apply_valid_promotion_code
|
||||||
|
promotion_code = PromotionCode.create(
|
||||||
|
code: "TESTDISCOUNT",
|
||||||
|
discount_amount_cents: 1000, # €10.00
|
||||||
|
expires_at: 1.month.from_now,
|
||||||
|
active: true
|
||||||
|
)
|
||||||
|
|
||||||
|
get checkout_order_path(@order), params: { promotion_code: "TESTDISCOUNT" }
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil flash[:notice]
|
||||||
|
assert_match /Code promotionnel appliqué: TESTDISCOUNT/, flash[:notice]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test applying an invalid promotion code
|
||||||
|
def test_apply_invalid_promotion_code
|
||||||
|
get checkout_order_path(@order), params: { promotion_code: "INVALIDCODE" }
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil flash[:alert]
|
||||||
|
assert_equal "Code promotionnel invalide", flash[:alert]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test applying an expired promotion code
|
||||||
|
def test_apply_expired_promotion_code
|
||||||
|
promotion_code = PromotionCode.create(
|
||||||
|
code: "EXPIREDCODE",
|
||||||
|
discount_amount_cents: 1000,
|
||||||
|
expires_at: 1.day.ago,
|
||||||
|
active: true
|
||||||
|
)
|
||||||
|
|
||||||
|
get checkout_order_path(@order), params: { promotion_code: "EXPIREDCODE" }
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil flash[:alert]
|
||||||
|
assert_equal "Code promotionnel invalide", flash[:alert]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test applying an inactive promotion code
|
||||||
|
def test_apply_inactive_promotion_code
|
||||||
|
promotion_code = PromotionCode.create(
|
||||||
|
code: "INACTIVECODE",
|
||||||
|
discount_amount_cents: 1000,
|
||||||
|
expires_at: 1.month.from_now,
|
||||||
|
active: false
|
||||||
|
)
|
||||||
|
|
||||||
|
get checkout_order_path(@order), params: { promotion_code: "INACTIVECODE" }
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil flash[:alert]
|
||||||
|
assert_equal "Code promotionnel invalide", flash[:alert]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -125,7 +125,7 @@ class OrdersControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal "draft", new_order.status
|
assert_equal "draft", new_order.status
|
||||||
assert_equal @user, new_order.user
|
assert_equal @user, new_order.user
|
||||||
assert_equal @event, new_order.event
|
assert_equal @event, new_order.event
|
||||||
assert_equal @ticket_type.price_cents + 100, new_order.total_amount_cents # includes 1€ service fee
|
assert_equal @ticket_type.price_cents, new_order.total_amount_cents # Service fee deducted from promoter payout, not added to customer
|
||||||
|
|
||||||
assert_redirected_to checkout_order_path(new_order)
|
assert_redirected_to checkout_order_path(new_order)
|
||||||
assert_equal new_order.id, session[:draft_order_id]
|
assert_equal new_order.id, session[:draft_order_id]
|
||||||
|
|||||||
@@ -603,4 +603,22 @@ class OrderTest < ActiveSupport::TestCase
|
|||||||
result = order.stripe_invoice_pdf_url
|
result = order.stripe_invoice_pdf_url
|
||||||
assert_nil result
|
assert_nil result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "free? should return true for zero amount orders" do
|
||||||
|
free_order = Order.create!(
|
||||||
|
user: @user, event: @event, total_amount_cents: 0,
|
||||||
|
status: "draft", payment_attempts: 0
|
||||||
|
)
|
||||||
|
|
||||||
|
assert free_order.free?
|
||||||
|
end
|
||||||
|
|
||||||
|
test "free? should return false for non-zero amount orders" do
|
||||||
|
paid_order = Order.create!(
|
||||||
|
user: @user, event: @event, total_amount_cents: 1000,
|
||||||
|
status: "draft", payment_attempts: 0
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_not paid_order.free?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
67
test/models/promotion_code_test.rb
Normal file
67
test/models/promotion_code_test.rb
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class PromotionCodeTest < ActiveSupport::TestCase
|
||||||
|
# Test valid promotion code creation
|
||||||
|
def test_valid_promotion_code
|
||||||
|
promotion_code = PromotionCode.create(
|
||||||
|
code: "DISCOUNT10",
|
||||||
|
discount_amount_cents: 1000, # €10.00
|
||||||
|
expires_at: 1.month.from_now,
|
||||||
|
active: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert promotion_code.valid?
|
||||||
|
assert_equal "DISCOUNT10", promotion_code.code
|
||||||
|
assert_equal 1000, promotion_code.discount_amount_cents
|
||||||
|
assert promotion_code.active?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test validation for required fields
|
||||||
|
def test_validation_for_required_fields
|
||||||
|
promotion_code = PromotionCode.new
|
||||||
|
refute promotion_code.valid?
|
||||||
|
assert_not_nil promotion_code.errors[:code]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test unique code validation
|
||||||
|
def test_unique_code_validation
|
||||||
|
PromotionCode.create(code: "UNIQUE123", discount_amount_cents: 500)
|
||||||
|
duplicate_code = PromotionCode.new(code: "UNIQUE123", discount_amount_cents: 500)
|
||||||
|
refute duplicate_code.valid?
|
||||||
|
assert_not_nil duplicate_code.errors[:code]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test discount amount validation
|
||||||
|
def test_discount_amount_validation
|
||||||
|
promotion_code = PromotionCode.new(code: "VALID123", discount_amount_cents: -100)
|
||||||
|
refute promotion_code.valid?
|
||||||
|
assert_not_nil promotion_code.errors[:discount_amount_cents]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test active scope
|
||||||
|
def test_active_scope
|
||||||
|
active_code = PromotionCode.create(code: "ACTIVE123", discount_amount_cents: 500, active: true)
|
||||||
|
inactive_code = PromotionCode.create(code: "INACTIVE123", discount_amount_cents: 500, active: false)
|
||||||
|
|
||||||
|
assert_includes PromotionCode.active, active_code
|
||||||
|
refute_includes PromotionCode.active, inactive_code
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test expired scope
|
||||||
|
def test_expired_scope
|
||||||
|
expired_code = PromotionCode.create(code: "EXPIRED123", discount_amount_cents: 500, expires_at: 1.day.ago)
|
||||||
|
future_code = PromotionCode.create(code: "FUTURE123", discount_amount_cents: 500, expires_at: 1.month.from_now)
|
||||||
|
|
||||||
|
assert_includes PromotionCode.expired, expired_code
|
||||||
|
refute_includes PromotionCode.expired, future_code
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test valid scope
|
||||||
|
def test_valid_scope
|
||||||
|
valid_code = PromotionCode.create(code: "VALID123", discount_amount_cents: 500, active: true, expires_at: 1.month.from_now)
|
||||||
|
invalid_code = PromotionCode.create(code: "INVALID123", discount_amount_cents: 500, active: false, expires_at: 1.day.ago)
|
||||||
|
|
||||||
|
assert_includes PromotionCode.valid, valid_code
|
||||||
|
refute_includes PromotionCode.valid, invalid_code
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -244,4 +244,38 @@ class TicketTypeTest < ActiveSupport::TestCase
|
|||||||
)
|
)
|
||||||
assert_not ticket_type.save
|
assert_not ticket_type.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "should allow free tickets with zero price" do
|
||||||
|
user = User.create!(
|
||||||
|
email: "test@example.com",
|
||||||
|
password: "password123",
|
||||||
|
password_confirmation: "password123"
|
||||||
|
)
|
||||||
|
|
||||||
|
event = Event.create!(
|
||||||
|
name: "Test Event",
|
||||||
|
slug: "test-event",
|
||||||
|
description: "Valid description for the event that is long enough",
|
||||||
|
latitude: 48.8566,
|
||||||
|
longitude: 2.3522,
|
||||||
|
venue_name: "Test Venue",
|
||||||
|
venue_address: "123 Test Street",
|
||||||
|
user: user
|
||||||
|
)
|
||||||
|
|
||||||
|
ticket_type = TicketType.new(
|
||||||
|
name: "Free Ticket",
|
||||||
|
description: "Valid description for the free ticket type",
|
||||||
|
price_cents: 0,
|
||||||
|
quantity: 50,
|
||||||
|
sale_start_at: Time.current,
|
||||||
|
sale_end_at: Time.current + 1.day,
|
||||||
|
event: event
|
||||||
|
)
|
||||||
|
|
||||||
|
assert ticket_type.save
|
||||||
|
assert ticket_type.free?
|
||||||
|
assert_equal 0, ticket_type.price_cents
|
||||||
|
assert_equal 0.0, ticket_type.price_euros
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -210,25 +210,12 @@ class StripeInvoiceServiceTest < ActiveSupport::TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_service_fee_line_item = {
|
|
||||||
customer: "cus_test123",
|
|
||||||
invoice: "in_test123",
|
|
||||||
amount: 100,
|
|
||||||
currency: "eur",
|
|
||||||
description: "Frais de service - Frais de traitement de la commande",
|
|
||||||
metadata: {
|
|
||||||
item_type: "service_fee",
|
|
||||||
amount_cents: 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mock_invoice = mock("invoice")
|
mock_invoice = mock("invoice")
|
||||||
mock_invoice.stubs(:id).returns("in_test123")
|
mock_invoice.stubs(:id).returns("in_test123")
|
||||||
mock_invoice.stubs(:finalize_invoice).returns(mock_invoice)
|
mock_invoice.stubs(:finalize_invoice).returns(mock_invoice)
|
||||||
mock_invoice.expects(:pay)
|
mock_invoice.expects(:pay)
|
||||||
Stripe::Invoice.expects(:create).returns(mock_invoice)
|
Stripe::Invoice.expects(:create).returns(mock_invoice)
|
||||||
Stripe::InvoiceItem.expects(:create).with(expected_ticket_line_item)
|
Stripe::InvoiceItem.expects(:create).with(expected_ticket_line_item) # Only for tickets, no service fee
|
||||||
Stripe::InvoiceItem.expects(:create).with(expected_service_fee_line_item)
|
|
||||||
|
|
||||||
result = @service.create_post_payment_invoice
|
result = @service.create_post_payment_invoice
|
||||||
assert_not_nil result
|
assert_not_nil result
|
||||||
|
|||||||
Reference in New Issue
Block a user