diff --git a/client/src/graphql/mutations.ts b/client/src/graphql/mutations.ts
index 43ad416..4b7c152 100644
--- a/client/src/graphql/mutations.ts
+++ b/client/src/graphql/mutations.ts
@@ -40,8 +40,8 @@ export const CREATE_STEP = gql`
`;
export const PRINT_TASK = gql`
- mutation PrintTask($id: ID!) {
- printTask(id: $id) {
+ mutation PrintTask($id: ID!, $userId: ID!) {
+ printTask(id: $id, userId: $userId) {
id
print_count
}
@@ -49,8 +49,8 @@ export const PRINT_TASK = gql`
`;
export const PRINT_STEP = gql`
- mutation PrintStep($id: ID!) {
- printStep(id: $id) {
+ mutation PrintStep($id: ID!, $userId: ID!) {
+ printStep(id: $id, userId: $userId) {
id
print_count
}
diff --git a/client/src/layouts/DesktopLayout.tsx b/client/src/layouts/DesktopLayout.tsx
index fbcb4de..7c45da0 100644
--- a/client/src/layouts/DesktopLayout.tsx
+++ b/client/src/layouts/DesktopLayout.tsx
@@ -2,6 +2,7 @@ import { Box, Typography, IconButton, TextField, Button } from '@mui/material';
import PrintIcon from '@mui/icons-material/Print';
import type { GroupWithTasks, TaskWithSteps, StepWithNotes } from '../types';
import { CreateButtons } from '../components/CreateButtons';
+import { useUserSelection } from '../hooks/useUserSelection';
interface DesktopLayoutProps {
groups: GroupWithTasks[];
@@ -28,11 +29,14 @@ export function DesktopLayout({
onPrintStep,
onAddNote,
}: DesktopLayoutProps) {
+ const { selectedUser } = useUserSelection();
+
console.log('DesktopLayout render:', {
groups,
selectedGroup,
selectedTask,
- selectedStep
+ selectedStep,
+ selectedUser
});
return (
@@ -84,12 +88,12 @@ export function DesktopLayout({
onTaskSelect(task)} sx={{ flex: 1 }}>
{task.name}
- {onPrintTask && (
+ {onPrintTask && selectedUser && (
{
e.stopPropagation();
- onPrintTask(String(task.id), '1'); // TODO: Get real user ID
+ onPrintTask(String(task.id), String(selectedUser.id));
}}
>
@@ -123,12 +127,12 @@ export function DesktopLayout({
onStepSelect(step)} sx={{ flex: 1 }}>
{step.name}
- {onPrintStep && (
+ {onPrintStep && selectedUser && (
{
e.stopPropagation();
- onPrintStep(String(step.id), '1'); // TODO: Get real user ID
+ onPrintStep(String(step.id), String(selectedUser.id));
}}
>
@@ -144,9 +148,9 @@ export function DesktopLayout({
{selectedStep.name}
- {onPrintStep && (
+ {onPrintStep && selectedUser && (
onPrintStep(String(selectedStep.id), '1')} // TODO: Get real user ID
+ onClick={() => onPrintStep(String(selectedStep.id), String(selectedUser.id))}
>
diff --git a/server/src/graphql/schema.ts b/server/src/graphql/schema.ts
index 16ba1be..5258fb5 100644
--- a/server/src/graphql/schema.ts
+++ b/server/src/graphql/schema.ts
@@ -101,7 +101,7 @@ export const typeDefs = gql`
createImage(stepId: ID!, originalPath: String!, bwPath: String!, order: Int!): Image!
createUser(name: String!): User!
createNote(content: String!, stepId: ID!): Note!
- printTask(id: ID!): Task!
- printStep(id: ID!): Step!
+ printTask(id: ID!, userId: ID!): Task!
+ printStep(id: ID!, userId: ID!): Step!
}
`;
\ No newline at end of file
diff --git a/server/src/printer/serial-printer.ts b/server/src/printer/serial-printer.ts
index 48fca0f..97db9a8 100644
--- a/server/src/printer/serial-printer.ts
+++ b/server/src/printer/serial-printer.ts
@@ -57,7 +57,7 @@ export class SerialPrinter implements PrinterInterface {
.align('ct')
.style('b')
.size(1, 1) // Normal size (0.08 x 2.13 mm)
- .text(`Task: ${task.name}`)
+ .text(`[ ] Task: ${task.name}`)
.text('='.repeat(32))
.text('')
.align('lt');
@@ -73,7 +73,7 @@ export class SerialPrinter implements PrinterInterface {
const step = taskSteps[i];
await this.printer
.size(1, 1) // Normal size for step header
- .text(`Step ${i + 1}: ${step.name}`)
+ .text(`[ ] Step ${i + 1}: ${step.name}`)
.text('-'.repeat(32))
.size(0, 0) // Smaller size for instructions (0.08 x 2.13 mm)
.text(step.instructions)
@@ -115,7 +115,7 @@ export class SerialPrinter implements PrinterInterface {
.align('ct')
.style('b')
.size(1, 1) // Normal size (0.08 x 2.13 mm)
- .text(`Step: ${step.name}`)
+ .text(`[ ] Step: ${step.name}`)
.text('='.repeat(32))
.text('')
.align('lt')
diff --git a/server/src/printer/test-printer.ts b/server/src/printer/test-printer.ts
index be7beb5..f191197 100644
--- a/server/src/printer/test-printer.ts
+++ b/server/src/printer/test-printer.ts
@@ -35,11 +35,11 @@ export class TestPrinter implements Printer {
const filename = path.join(this.outputDir, `task-${task.id}-${timestamp}.txt`);
const content = [
- `Task: ${task.name}`,
+ `[ ] Task: ${task.name}`,
'='.repeat(40),
'',
...taskSteps.map((step, index) => [
- `Step ${index + 1}: ${step.name}`,
+ `[ ] Step ${index + 1}: ${step.name}`,
'-'.repeat(40),
step.instructions,
'',
@@ -62,7 +62,7 @@ export class TestPrinter implements Printer {
const filename = path.join(this.outputDir, `step-${step.id}-${timestamp}.txt`);
const content = [
- `Step: ${step.name}`,
+ `[ ] Step: ${step.name}`,
'='.repeat(40),
'',
step.instructions,