pass user when printing, add checkboxes
This commit is contained in:
parent
ba2f7fb612
commit
5fde9f667b
@ -40,8 +40,8 @@ export const CREATE_STEP = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const PRINT_TASK = gql`
|
export const PRINT_TASK = gql`
|
||||||
mutation PrintTask($id: ID!) {
|
mutation PrintTask($id: ID!, $userId: ID!) {
|
||||||
printTask(id: $id) {
|
printTask(id: $id, userId: $userId) {
|
||||||
id
|
id
|
||||||
print_count
|
print_count
|
||||||
}
|
}
|
||||||
@ -49,8 +49,8 @@ export const PRINT_TASK = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const PRINT_STEP = gql`
|
export const PRINT_STEP = gql`
|
||||||
mutation PrintStep($id: ID!) {
|
mutation PrintStep($id: ID!, $userId: ID!) {
|
||||||
printStep(id: $id) {
|
printStep(id: $id, userId: $userId) {
|
||||||
id
|
id
|
||||||
print_count
|
print_count
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { Box, Typography, IconButton, TextField, Button } from '@mui/material';
|
|||||||
import PrintIcon from '@mui/icons-material/Print';
|
import PrintIcon from '@mui/icons-material/Print';
|
||||||
import type { GroupWithTasks, TaskWithSteps, StepWithNotes } from '../types';
|
import type { GroupWithTasks, TaskWithSteps, StepWithNotes } from '../types';
|
||||||
import { CreateButtons } from '../components/CreateButtons';
|
import { CreateButtons } from '../components/CreateButtons';
|
||||||
|
import { useUserSelection } from '../hooks/useUserSelection';
|
||||||
|
|
||||||
interface DesktopLayoutProps {
|
interface DesktopLayoutProps {
|
||||||
groups: GroupWithTasks[];
|
groups: GroupWithTasks[];
|
||||||
@ -28,11 +29,14 @@ export function DesktopLayout({
|
|||||||
onPrintStep,
|
onPrintStep,
|
||||||
onAddNote,
|
onAddNote,
|
||||||
}: DesktopLayoutProps) {
|
}: DesktopLayoutProps) {
|
||||||
|
const { selectedUser } = useUserSelection();
|
||||||
|
|
||||||
console.log('DesktopLayout render:', {
|
console.log('DesktopLayout render:', {
|
||||||
groups,
|
groups,
|
||||||
selectedGroup,
|
selectedGroup,
|
||||||
selectedTask,
|
selectedTask,
|
||||||
selectedStep
|
selectedStep,
|
||||||
|
selectedUser
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -84,12 +88,12 @@ export function DesktopLayout({
|
|||||||
<Box onClick={() => onTaskSelect(task)} sx={{ flex: 1 }}>
|
<Box onClick={() => onTaskSelect(task)} sx={{ flex: 1 }}>
|
||||||
<Typography>{task.name}</Typography>
|
<Typography>{task.name}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
{onPrintTask && (
|
{onPrintTask && selectedUser && (
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onPrintTask(String(task.id), '1'); // TODO: Get real user ID
|
onPrintTask(String(task.id), String(selectedUser.id));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PrintIcon />
|
<PrintIcon />
|
||||||
@ -123,12 +127,12 @@ export function DesktopLayout({
|
|||||||
<Box onClick={() => onStepSelect(step)} sx={{ flex: 1 }}>
|
<Box onClick={() => onStepSelect(step)} sx={{ flex: 1 }}>
|
||||||
<Typography>{step.name}</Typography>
|
<Typography>{step.name}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
{onPrintStep && (
|
{onPrintStep && selectedUser && (
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onPrintStep(String(step.id), '1'); // TODO: Get real user ID
|
onPrintStep(String(step.id), String(selectedUser.id));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PrintIcon />
|
<PrintIcon />
|
||||||
@ -144,9 +148,9 @@ export function DesktopLayout({
|
|||||||
<Box sx={{ flex: 1, p: 2, overflow: 'auto' }}>
|
<Box sx={{ flex: 1, p: 2, overflow: 'auto' }}>
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
|
||||||
<Typography variant="h6">{selectedStep.name}</Typography>
|
<Typography variant="h6">{selectedStep.name}</Typography>
|
||||||
{onPrintStep && (
|
{onPrintStep && selectedUser && (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => onPrintStep(String(selectedStep.id), '1')} // TODO: Get real user ID
|
onClick={() => onPrintStep(String(selectedStep.id), String(selectedUser.id))}
|
||||||
>
|
>
|
||||||
<PrintIcon />
|
<PrintIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
@ -101,7 +101,7 @@ export const typeDefs = gql`
|
|||||||
createImage(stepId: ID!, originalPath: String!, bwPath: String!, order: Int!): Image!
|
createImage(stepId: ID!, originalPath: String!, bwPath: String!, order: Int!): Image!
|
||||||
createUser(name: String!): User!
|
createUser(name: String!): User!
|
||||||
createNote(content: String!, stepId: ID!): Note!
|
createNote(content: String!, stepId: ID!): Note!
|
||||||
printTask(id: ID!): Task!
|
printTask(id: ID!, userId: ID!): Task!
|
||||||
printStep(id: ID!): Step!
|
printStep(id: ID!, userId: ID!): Step!
|
||||||
}
|
}
|
||||||
`;
|
`;
|
@ -57,7 +57,7 @@ export class SerialPrinter implements PrinterInterface {
|
|||||||
.align('ct')
|
.align('ct')
|
||||||
.style('b')
|
.style('b')
|
||||||
.size(1, 1) // Normal size (0.08 x 2.13 mm)
|
.size(1, 1) // Normal size (0.08 x 2.13 mm)
|
||||||
.text(`Task: ${task.name}`)
|
.text(`[ ] Task: ${task.name}`)
|
||||||
.text('='.repeat(32))
|
.text('='.repeat(32))
|
||||||
.text('')
|
.text('')
|
||||||
.align('lt');
|
.align('lt');
|
||||||
@ -73,7 +73,7 @@ export class SerialPrinter implements PrinterInterface {
|
|||||||
const step = taskSteps[i];
|
const step = taskSteps[i];
|
||||||
await this.printer
|
await this.printer
|
||||||
.size(1, 1) // Normal size for step header
|
.size(1, 1) // Normal size for step header
|
||||||
.text(`Step ${i + 1}: ${step.name}`)
|
.text(`[ ] Step ${i + 1}: ${step.name}`)
|
||||||
.text('-'.repeat(32))
|
.text('-'.repeat(32))
|
||||||
.size(0, 0) // Smaller size for instructions (0.08 x 2.13 mm)
|
.size(0, 0) // Smaller size for instructions (0.08 x 2.13 mm)
|
||||||
.text(step.instructions)
|
.text(step.instructions)
|
||||||
@ -115,7 +115,7 @@ export class SerialPrinter implements PrinterInterface {
|
|||||||
.align('ct')
|
.align('ct')
|
||||||
.style('b')
|
.style('b')
|
||||||
.size(1, 1) // Normal size (0.08 x 2.13 mm)
|
.size(1, 1) // Normal size (0.08 x 2.13 mm)
|
||||||
.text(`Step: ${step.name}`)
|
.text(`[ ] Step: ${step.name}`)
|
||||||
.text('='.repeat(32))
|
.text('='.repeat(32))
|
||||||
.text('')
|
.text('')
|
||||||
.align('lt')
|
.align('lt')
|
||||||
|
@ -35,11 +35,11 @@ export class TestPrinter implements Printer {
|
|||||||
const filename = path.join(this.outputDir, `task-${task.id}-${timestamp}.txt`);
|
const filename = path.join(this.outputDir, `task-${task.id}-${timestamp}.txt`);
|
||||||
|
|
||||||
const content = [
|
const content = [
|
||||||
`Task: ${task.name}`,
|
`[ ] Task: ${task.name}`,
|
||||||
'='.repeat(40),
|
'='.repeat(40),
|
||||||
'',
|
'',
|
||||||
...taskSteps.map((step, index) => [
|
...taskSteps.map((step, index) => [
|
||||||
`Step ${index + 1}: ${step.name}`,
|
`[ ] Step ${index + 1}: ${step.name}`,
|
||||||
'-'.repeat(40),
|
'-'.repeat(40),
|
||||||
step.instructions,
|
step.instructions,
|
||||||
'',
|
'',
|
||||||
@ -62,7 +62,7 @@ export class TestPrinter implements Printer {
|
|||||||
const filename = path.join(this.outputDir, `step-${step.id}-${timestamp}.txt`);
|
const filename = path.join(this.outputDir, `step-${step.id}-${timestamp}.txt`);
|
||||||
|
|
||||||
const content = [
|
const content = [
|
||||||
`Step: ${step.name}`,
|
`[ ] Step: ${step.name}`,
|
||||||
'='.repeat(40),
|
'='.repeat(40),
|
||||||
'',
|
'',
|
||||||
step.instructions,
|
step.instructions,
|
||||||
|
Loading…
Reference in New Issue
Block a user