Compare commits
16 Commits
ebb00ca2ed
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| ca2c61d8eb | |||
| 82496b6ce4 | |||
| 92832afebe | |||
| 2667c40086 | |||
| 0708ddd936 | |||
| 3ea6905e00 | |||
| d84c8b2c34 | |||
| 5f7bf5ce1b | |||
| a30c155282 | |||
| 0b125185f5 | |||
| cc905433d3 | |||
| cb4054e9e7 | |||
| 6a1a1ba263 | |||
| c6eeb3e62f | |||
| 984d257553 | |||
| 8fad245959 |
@@ -0,0 +1,13 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-front-common
|
||||
Source: .agent/consumer-references/change-and-verification.md
|
||||
-->
|
||||
|
||||
# KriFrontCommon Change and Verification
|
||||
|
||||
- Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes.
|
||||
- Review release notes and the actual affected API before upgrading.
|
||||
- Run the consumer's focused type-check, test, and build commands after an upgrade.
|
||||
- Keep `.agent/project.md` near 2-3 KiB as a routing document. Move conditional schemas, endpoint inventories, examples, and issue history to routed `.agent/references/` documents instead of deleting them.
|
||||
- Do not modify KriFrontCommon or another consumer repository unless it is explicitly included in the approved task scope.
|
||||
@@ -0,0 +1,15 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-front-common
|
||||
Source: .agent/consumer-references/package-and-runtime.md
|
||||
-->
|
||||
|
||||
# KriFrontCommon Package and Runtime Contract
|
||||
|
||||
- Use the package root for runtime-neutral object, URL, date, string, and shared type utilities.
|
||||
- Use a focused subpath such as `@kri/common/http`, `@kri/common/browser`, `@kri/common/server`, `@kri/common/security`, `@kri/common/hooks`, `@kri/common/query`, `@kri/common/config`, `@kri/common/jotai`, or `@kri/common/noti-hub` for the corresponding capability.
|
||||
- Keep browser, server, and runtime-neutral imports on their intended side of the application boundary.
|
||||
- A consumer that uses React hooks, TanStack Query, or Jotai integrations must provide the compatible optional peer dependency required by its selected entry point.
|
||||
- Preserve the project's established HTTP client, authentication, error-policy, query-client, storage, and environment conventions when adopting a shared helper.
|
||||
- Validate external data at runtime; a shared TypeScript type alone does not validate an API response or persisted value.
|
||||
- Prefer named public exports and retain the consumer project's current module system and bundler conventions.
|
||||
13
.agent-harness/references/kri-front-common/react-compiler.md
Normal file
13
.agent-harness/references/kri-front-common/react-compiler.md
Normal file
@@ -0,0 +1,13 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-front-common
|
||||
Source: .agent/consumer-references/react-compiler.md
|
||||
-->
|
||||
|
||||
# React Compiler and Manual Memoization
|
||||
|
||||
- `createKriNextConfig` enables `reactCompiler: true` unless the project overrides it; confirm the effective configuration.
|
||||
- When enabled, rely on React Compiler instead of adding `useMemo`, `useCallback`, or `React.memo` as a routine performance precaution.
|
||||
- Use manual memoization only for required reference stability, an Effect or third-party contract, compiler-incompatible code, or a measured performance problem.
|
||||
- Preserve existing memoization unless approved and verified for removal.
|
||||
- Use `"use memo"` or `"use no memo"` only for a documented compiler boundary.
|
||||
@@ -0,0 +1,11 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-ui-registry
|
||||
Source: .agent/consumer-references/editor-html-compatibility.md
|
||||
-->
|
||||
|
||||
# KriEditor HTML Compatibility
|
||||
|
||||
- `enableImageMap` opt-in preserves `map`, nested `area`, and `img.usemap` HTML in WYSIWYG mode; consumers remain responsible for sanitizing URLs and attributes according to their server policy.
|
||||
- Use `htmlSanitizer` when a consumer must apply a stricter HTML policy than the editor's default DOMPurify profile.
|
||||
- Use `getWysiwygCompatibility` to keep lossy HTML in HTML mode. The callback must return `compatible: false` when WYSIWYG parsing would remove or materially rewrite content.
|
||||
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-ui-registry
|
||||
Source: .agent/consumer-references/installation-and-adaptation.md
|
||||
-->
|
||||
|
||||
# KriUiRegistry Installation and Adaptation
|
||||
|
||||
## Installation and Ownership
|
||||
|
||||
- Inspect the registry item and its dependencies before installation. Use the shadcn CLI with the approved registry endpoint under `https://ui-registry.kric.com/r/` instead of copying files from `dist/r` manually.
|
||||
- `kri-data-table` uses the TanStack Table v8 API. Keep `@tanstack/react-table` within the supported `^8.21.3` range and do not upgrade it to v9 until KriUiRegistry provides an explicitly migrated component contract.
|
||||
- Respect the consumer project's component aliases, target paths, package manager, styling system, React version, and existing design tokens.
|
||||
- The shadcn workflow copies component source into the consumer repository. After installation, treat that copy as project-owned code; do not assume registry updates propagate automatically.
|
||||
- Do not overwrite an existing project component without reviewing the diff and confirming that local behavior and accessibility are preserved.
|
||||
- Keep package and lockfile changes produced by an installation within the approved scope.
|
||||
|
||||
## Adaptation and Verification
|
||||
|
||||
- Adapt business data and application behavior outside the shared component when possible. Avoid embedding project-specific API, route, authentication, or environment logic into a reusable component.
|
||||
- Preserve the installed component's public props, accessibility, keyboard behavior, responsive layout, and loading, empty, error, and disabled states unless the task explicitly changes them.
|
||||
- If the registry lacks a generally reusable capability, propose it in KriUiRegistry; do not modify that repository unless it is explicitly in scope.
|
||||
- Run the consumer repository's focused type-check, lint, tests, and build after installation or upgrade.
|
||||
18
.agent/profile.yml
Normal file
18
.agent/profile.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
schema_version: 1
|
||||
|
||||
project:
|
||||
id: gwcf-review-front
|
||||
name: GWCF Monitoring Frontend
|
||||
type: requested-project
|
||||
layer: frontend
|
||||
legacy: false
|
||||
|
||||
stack:
|
||||
- typescript
|
||||
- react
|
||||
- nextjs
|
||||
|
||||
shared_contracts:
|
||||
consumes:
|
||||
- kri-front-common
|
||||
- kri-ui-registry
|
||||
18
.agent/project.md
Normal file
18
.agent/project.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# GWCF Monitoring Frontend Project Instruction Router
|
||||
|
||||
## Required Project References
|
||||
|
||||
Before each related task, read the current contents of every matching reference below, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Any substantive analysis, planning, implementation, debugging, review, or documentation work in this repository | `.agent/references/repository-rules.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Do not assume remembered content is current.
|
||||
|
||||
## Harness Workflow
|
||||
|
||||
- `AGENTS.md` and `CLAUDE.md` are generated outputs. Never edit them directly.
|
||||
- Edit `.agent/project.md` only when routing changes. Store durable project detail in `.agent/references/`.
|
||||
- A reference-only content change does not require recomposition when its route is unchanged. Run harness verification to validate routing and UTF-8.
|
||||
- Recompose and verify after changing `.agent/project.md`, `.agent/profile.yml`, or another composed instruction source.
|
||||
22
.agent/references/repository-rules.md
Normal file
22
.agent/references/repository-rules.md
Normal file
@@ -0,0 +1,22 @@
|
||||
## GWCF Monitoring Frontend Repository Rules
|
||||
|
||||
### Deliverable and User Workflows
|
||||
|
||||
- This Next.js frontend supports GWCF performance records, monitoring assignments, schedules and visits, reviews, users, file preview, and related operational workflows.
|
||||
- Its product character is similar to KriContact, but its requirements, API, permissions, terminology, and deliverables remain project-specific.
|
||||
- Preserve selected performance context, assignment state, review state, visit information, filters, file-preview behavior, and user/role boundaries across navigation and mutations.
|
||||
- Keep personal information, monitoring details, uploaded documents, and exported data out of logs, fixtures, screenshots, and external services.
|
||||
|
||||
### Frontend and Local Next.js Guidance
|
||||
|
||||
- Use the consumed KRI frontend common and UI registry contracts. Prefer an existing shadcn/ui or registry component before creating a new foundational component.
|
||||
- Do not create new TypeScript type or interface names ending in `Dto` or `DTO`.
|
||||
- This repository may use Next.js APIs and conventions newer than model training data. Read the relevant local guide under `node_modules/next/dist/docs/` before changing a Next.js API, routing convention, or file structure, and follow deprecation notices.
|
||||
- Preserve accessibility, loading, empty, error, unauthorized, confirmation, success, and file-preview states.
|
||||
- Coordinate request, response, authentication, file, and error changes with the backend without requiring an unsafe simultaneous deployment.
|
||||
|
||||
### Harness and Verification
|
||||
|
||||
- The previous standalone `AGENTS.md` Next.js guidance has been preserved in this project source. `AGENTS.md` and `CLAUDE.md` are now harness-generated outputs.
|
||||
- Edit `.agent/profile.yml` or `.agent/project.md`, then recompose instead of editing generated files.
|
||||
- Use existing npm scripts and focused checks. Do not call production APIs, process customer documents, or submit real monitoring/review data during validation.
|
||||
41
.agents/skills/attention-aware-communication/SKILL.md
Normal file
41
.agents/skills/attention-aware-communication/SKILL.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: attention-aware-communication
|
||||
description: Shape substantive answers, progress updates, and completion reports for fast, accurate reading without reducing the underlying work.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/attention-aware-communication/SKILL.md
|
||||
-->
|
||||
# Attention-Aware Communication
|
||||
|
||||
This skill changes presentation only. Investigate, implement, and verify as deeply as the task requires.
|
||||
|
||||
## Default: Attention-kind
|
||||
|
||||
- Put the bottom line in the first sentence and use plain Korean.
|
||||
- Say the least that fully answers, then stop. Remove preambles, padding, repetition, and closing restatements.
|
||||
- Never omit a number, scope condition, risk, prerequisite, uncertainty, or other fact that could cause the user to act incorrectly.
|
||||
- For genuine breadth, explain the one or two most important points first, name the remaining areas, and let the user choose whether to expand them. Do not use this to defer required caveats or a complete focused answer.
|
||||
- When the user asks for a detailed explanation, walkthrough, rationale, or full picture, suspend brevity and provide the necessary detail in scannable sections.
|
||||
- When asked for a deliverable such as a command, message, snippet, or commit text, return the deliverable without unnecessary framing unless safety or correctness requires context.
|
||||
- Ask one blocking question at a time and put it last. Keep working when a non-blocking assumption is safe.
|
||||
|
||||
## Progress and Completion: Rundown
|
||||
|
||||
Use Rundown formatting when a task has multiple steps or mixed states:
|
||||
|
||||
- Start with a one-line outcome that includes any blocker.
|
||||
- Distinguish verified completion, work in progress, work not started, and unknown state. Omit empty categories.
|
||||
- Put each blocker or material risk on its own line.
|
||||
- Report only observed states. Mark an unknown as unknown and state what check would resolve it.
|
||||
- End with the next action or a small numbered choice only when the user must decide.
|
||||
|
||||
## Explicit-Only: Spartan
|
||||
|
||||
Use Spartan style only when the user explicitly asks for it:
|
||||
|
||||
- Lead with the complete answer in one sentence.
|
||||
- Be terse, blunt, and direct; remove warmth, hedging, transitions, narration, and summaries.
|
||||
- Keep all load-bearing facts, warnings, and conditions even when they make the answer longer.
|
||||
- If the user also asks for depth, provide the full detail in short, separated blocks.
|
||||
37
.agents/skills/karpathy-guidelines/SKILL.md
Normal file
37
.agents/skills/karpathy-guidelines/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: karpathy-guidelines
|
||||
description: Keep implementation, refactoring, and code review assumption-aware, simple, surgical, and tied to verifiable success criteria.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/karpathy-guidelines/SKILL.md
|
||||
-->
|
||||
# Karpathy Guidelines
|
||||
|
||||
Use these guidelines while implementing, refactoring, or reviewing code. They refine execution quality but do not expand the approved task scope.
|
||||
|
||||
## Think Before Coding
|
||||
|
||||
- Inspect the relevant code and repository conventions before choosing a solution.
|
||||
- Surface an assumption when different choices would materially change behavior, compatibility, data, or scope.
|
||||
- Ask only when the decision cannot be discovered safely and a reasonable assumption would be risky. Otherwise proceed with the smallest reasonable assumption and report it.
|
||||
|
||||
## Simplicity First
|
||||
|
||||
- Implement the smallest complete solution that satisfies the observable requirement.
|
||||
- Do not add speculative abstractions, extension points, configuration, fallback paths, or dependencies for hypothetical future use.
|
||||
- Prefer an existing repository pattern or standard-library capability over a new local framework.
|
||||
|
||||
## Surgical Changes
|
||||
|
||||
- Every changed line must trace to the approved objective, required validation, or a necessary compatibility adjustment.
|
||||
- Preserve existing naming, structure, public behavior, and formatting outside that boundary.
|
||||
- Do not mix the task with unrelated cleanup. Remove dead code, duplication, or ceremony introduced by the current change before finishing.
|
||||
|
||||
## Goal-Driven Execution
|
||||
|
||||
- Translate the request into observable success criteria before implementation.
|
||||
- Choose the narrowest check that can fail for the behavior being changed, then run broader repository checks when appropriate.
|
||||
- Iterate only within the approved scope until the criteria pass or a concrete blocker is established.
|
||||
- Before reporting completion, inspect the final diff for unnecessary code and use `verification-before-completion` for fresh evidence.
|
||||
29
.agents/skills/project-reference-loader/SKILL.md
Normal file
29
.agents/skills/project-reference-loader/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: project-reference-loader
|
||||
description: Load the current project-specific and shared reference documents routed by AGENTS.md before substantive repository analysis, implementation, debugging, review, or planning.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/project-reference-loader/SKILL.md
|
||||
-->
|
||||
# Project Reference Loader
|
||||
|
||||
Use the repository's generated `AGENTS.md` as the routing entrypoint.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Find the `Required Project References` and shared-contract reference routes that match the current task.
|
||||
2. Read the current contents of every matching file before relying on remembered project behavior, even when the file was read earlier in the session.
|
||||
3. If the task crosses multiple scopes, read every matching reference. Do not load unrelated references merely because they exist.
|
||||
4. Treat routed references as binding project instructions within their stated scope. Resolve conflicts using the precedence rules in `AGENTS.md`.
|
||||
5. If a required reference is missing, unreadable, outside the repository, or internally inconsistent, stop the affected work and report the exact problem instead of guessing.
|
||||
|
||||
## Change Handling
|
||||
|
||||
- Edit authored project detail under `.agent/references/` when the durable rule belongs only to that repository.
|
||||
- Edit the provider's `.agent/consumer-references/` when the rule is part of a shared consumer contract.
|
||||
- Never edit generated `.agent-harness/references/` copies directly.
|
||||
- Changing `.agent/references/` does not require recomposing `AGENTS.md` when its route is unchanged; changing routing, `project.md`, `consumer.md`, or shared reference sources does.
|
||||
|
||||
Before completion, confirm that the references used still exist and that the result does not contradict them. This skill does not expand authorization to edit, commit, push, deploy, connect to external systems, or perform destructive operations.
|
||||
38
.agents/skills/verification-before-completion/SKILL.md
Normal file
38
.agents/skills/verification-before-completion/SKILL.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: verification-before-completion
|
||||
description: Require fresh, claim-specific evidence before reporting work complete, fixed, passing, ready, or safe to commit or publish.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/verification-before-completion/SKILL.md
|
||||
-->
|
||||
# Verification Before Completion
|
||||
|
||||
No completion claim without fresh evidence. This workflow verifies status; it does not authorize a commit, push, deployment, database operation, or other protected action.
|
||||
|
||||
## Verification Gate
|
||||
|
||||
Before making a success claim:
|
||||
|
||||
1. State the exact claim internally and identify which observable check can prove or disprove it.
|
||||
2. Run the relevant command or inspection fresh after the final change. Use repository-defined commands; do not invent a substitute that proves a different property.
|
||||
3. Read the complete result needed for the claim, including the exit code, failure count, skipped checks, and generated changes.
|
||||
4. Compare the evidence with the claim and the approved acceptance criteria.
|
||||
5. Report only the status supported by that evidence.
|
||||
|
||||
## Evidence Rules
|
||||
|
||||
- A passing lint does not prove compilation, a passing build does not prove runtime behavior, and a passing narrow test does not prove unrelated requirements.
|
||||
- For a regression test, establish that it is capable of detecting the defect when practical; do not treat an always-passing test as proof.
|
||||
- Recheck the worktree or final diff after generators, formatters, tests, or builds that may create or alter files.
|
||||
- Separate verified results, failures, checks not run, and pre-existing failures. Never quietly merge them into a success statement.
|
||||
- For delegated work, inspect the returned changes and run the relevant verification yourself before accepting the completion claim.
|
||||
- For absence or universal claims such as “no occurrences” or “all projects,” use a check whose scope actually covers the claim.
|
||||
|
||||
## Reporting
|
||||
|
||||
- Cite the commands or inspections actually run and summarize their observed results.
|
||||
- If a required check cannot run, state the actual incomplete or blocked status and the exact reason.
|
||||
- Do not use “should work,” “probably passes,” “seems correct,” or similar language as a substitute for verification.
|
||||
- Do not claim completion while a required check is failing or while known correctness, encoding, security, or generated-output drift remains unresolved.
|
||||
41
.claude/skills/attention-aware-communication/SKILL.md
Normal file
41
.claude/skills/attention-aware-communication/SKILL.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: attention-aware-communication
|
||||
description: Shape substantive answers, progress updates, and completion reports for fast, accurate reading without reducing the underlying work.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/attention-aware-communication/SKILL.md
|
||||
-->
|
||||
# Attention-Aware Communication
|
||||
|
||||
This skill changes presentation only. Investigate, implement, and verify as deeply as the task requires.
|
||||
|
||||
## Default: Attention-kind
|
||||
|
||||
- Put the bottom line in the first sentence and use plain Korean.
|
||||
- Say the least that fully answers, then stop. Remove preambles, padding, repetition, and closing restatements.
|
||||
- Never omit a number, scope condition, risk, prerequisite, uncertainty, or other fact that could cause the user to act incorrectly.
|
||||
- For genuine breadth, explain the one or two most important points first, name the remaining areas, and let the user choose whether to expand them. Do not use this to defer required caveats or a complete focused answer.
|
||||
- When the user asks for a detailed explanation, walkthrough, rationale, or full picture, suspend brevity and provide the necessary detail in scannable sections.
|
||||
- When asked for a deliverable such as a command, message, snippet, or commit text, return the deliverable without unnecessary framing unless safety or correctness requires context.
|
||||
- Ask one blocking question at a time and put it last. Keep working when a non-blocking assumption is safe.
|
||||
|
||||
## Progress and Completion: Rundown
|
||||
|
||||
Use Rundown formatting when a task has multiple steps or mixed states:
|
||||
|
||||
- Start with a one-line outcome that includes any blocker.
|
||||
- Distinguish verified completion, work in progress, work not started, and unknown state. Omit empty categories.
|
||||
- Put each blocker or material risk on its own line.
|
||||
- Report only observed states. Mark an unknown as unknown and state what check would resolve it.
|
||||
- End with the next action or a small numbered choice only when the user must decide.
|
||||
|
||||
## Explicit-Only: Spartan
|
||||
|
||||
Use Spartan style only when the user explicitly asks for it:
|
||||
|
||||
- Lead with the complete answer in one sentence.
|
||||
- Be terse, blunt, and direct; remove warmth, hedging, transitions, narration, and summaries.
|
||||
- Keep all load-bearing facts, warnings, and conditions even when they make the answer longer.
|
||||
- If the user also asks for depth, provide the full detail in short, separated blocks.
|
||||
37
.claude/skills/karpathy-guidelines/SKILL.md
Normal file
37
.claude/skills/karpathy-guidelines/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: karpathy-guidelines
|
||||
description: Keep implementation, refactoring, and code review assumption-aware, simple, surgical, and tied to verifiable success criteria.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/karpathy-guidelines/SKILL.md
|
||||
-->
|
||||
# Karpathy Guidelines
|
||||
|
||||
Use these guidelines while implementing, refactoring, or reviewing code. They refine execution quality but do not expand the approved task scope.
|
||||
|
||||
## Think Before Coding
|
||||
|
||||
- Inspect the relevant code and repository conventions before choosing a solution.
|
||||
- Surface an assumption when different choices would materially change behavior, compatibility, data, or scope.
|
||||
- Ask only when the decision cannot be discovered safely and a reasonable assumption would be risky. Otherwise proceed with the smallest reasonable assumption and report it.
|
||||
|
||||
## Simplicity First
|
||||
|
||||
- Implement the smallest complete solution that satisfies the observable requirement.
|
||||
- Do not add speculative abstractions, extension points, configuration, fallback paths, or dependencies for hypothetical future use.
|
||||
- Prefer an existing repository pattern or standard-library capability over a new local framework.
|
||||
|
||||
## Surgical Changes
|
||||
|
||||
- Every changed line must trace to the approved objective, required validation, or a necessary compatibility adjustment.
|
||||
- Preserve existing naming, structure, public behavior, and formatting outside that boundary.
|
||||
- Do not mix the task with unrelated cleanup. Remove dead code, duplication, or ceremony introduced by the current change before finishing.
|
||||
|
||||
## Goal-Driven Execution
|
||||
|
||||
- Translate the request into observable success criteria before implementation.
|
||||
- Choose the narrowest check that can fail for the behavior being changed, then run broader repository checks when appropriate.
|
||||
- Iterate only within the approved scope until the criteria pass or a concrete blocker is established.
|
||||
- Before reporting completion, inspect the final diff for unnecessary code and use `verification-before-completion` for fresh evidence.
|
||||
29
.claude/skills/project-reference-loader/SKILL.md
Normal file
29
.claude/skills/project-reference-loader/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: project-reference-loader
|
||||
description: Load the current project-specific and shared reference documents routed by AGENTS.md before substantive repository analysis, implementation, debugging, review, or planning.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/project-reference-loader/SKILL.md
|
||||
-->
|
||||
# Project Reference Loader
|
||||
|
||||
Use the repository's generated `AGENTS.md` as the routing entrypoint.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Find the `Required Project References` and shared-contract reference routes that match the current task.
|
||||
2. Read the current contents of every matching file before relying on remembered project behavior, even when the file was read earlier in the session.
|
||||
3. If the task crosses multiple scopes, read every matching reference. Do not load unrelated references merely because they exist.
|
||||
4. Treat routed references as binding project instructions within their stated scope. Resolve conflicts using the precedence rules in `AGENTS.md`.
|
||||
5. If a required reference is missing, unreadable, outside the repository, or internally inconsistent, stop the affected work and report the exact problem instead of guessing.
|
||||
|
||||
## Change Handling
|
||||
|
||||
- Edit authored project detail under `.agent/references/` when the durable rule belongs only to that repository.
|
||||
- Edit the provider's `.agent/consumer-references/` when the rule is part of a shared consumer contract.
|
||||
- Never edit generated `.agent-harness/references/` copies directly.
|
||||
- Changing `.agent/references/` does not require recomposing `AGENTS.md` when its route is unchanged; changing routing, `project.md`, `consumer.md`, or shared reference sources does.
|
||||
|
||||
Before completion, confirm that the references used still exist and that the result does not contradict them. This skill does not expand authorization to edit, commit, push, deploy, connect to external systems, or perform destructive operations.
|
||||
38
.claude/skills/verification-before-completion/SKILL.md
Normal file
38
.claude/skills/verification-before-completion/SKILL.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: verification-before-completion
|
||||
description: Require fresh, claim-specific evidence before reporting work complete, fixed, passing, ready, or safe to commit or publish.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/verification-before-completion/SKILL.md
|
||||
-->
|
||||
# Verification Before Completion
|
||||
|
||||
No completion claim without fresh evidence. This workflow verifies status; it does not authorize a commit, push, deployment, database operation, or other protected action.
|
||||
|
||||
## Verification Gate
|
||||
|
||||
Before making a success claim:
|
||||
|
||||
1. State the exact claim internally and identify which observable check can prove or disprove it.
|
||||
2. Run the relevant command or inspection fresh after the final change. Use repository-defined commands; do not invent a substitute that proves a different property.
|
||||
3. Read the complete result needed for the claim, including the exit code, failure count, skipped checks, and generated changes.
|
||||
4. Compare the evidence with the claim and the approved acceptance criteria.
|
||||
5. Report only the status supported by that evidence.
|
||||
|
||||
## Evidence Rules
|
||||
|
||||
- A passing lint does not prove compilation, a passing build does not prove runtime behavior, and a passing narrow test does not prove unrelated requirements.
|
||||
- For a regression test, establish that it is capable of detecting the defect when practical; do not treat an always-passing test as proof.
|
||||
- Recheck the worktree or final diff after generators, formatters, tests, or builds that may create or alter files.
|
||||
- Separate verified results, failures, checks not run, and pre-existing failures. Never quietly merge them into a success statement.
|
||||
- For delegated work, inspect the returned changes and run the relevant verification yourself before accepting the completion claim.
|
||||
- For absence or universal claims such as “no occurrences” or “all projects,” use a check whose scope actually covers the claim.
|
||||
|
||||
## Reporting
|
||||
|
||||
- Cite the commands or inspections actually run and summarize their observed results.
|
||||
- If a required check cannot run, state the actual incomplete or blocked status and the exact reason.
|
||||
- Do not use “should work,” “probably passes,” “seems correct,” or similar language as a substitute for verification.
|
||||
- Do not claim completion while a required check is failing or while known correctness, encoding, security, or generated-output drift remains unresolved.
|
||||
@@ -1,6 +1,6 @@
|
||||
NEXT_PUBLIC_ENV=prod
|
||||
NEXT_PUBLIC_ENV=dev
|
||||
NEXT_PUBLIC_API_BASE=https://test-gwcf-review.kric.com/api
|
||||
|
||||
ENV=prod
|
||||
ENV=dev
|
||||
API_BACK_SERVER=http://127.0.0.1:6105/api/v1
|
||||
NOTI_HUB_SERVER=https://noti-hub.kric.com/api/v1
|
||||
@@ -4,3 +4,4 @@ NEXT_PUBLIC_API_BASE=http://localhost:6104/api
|
||||
ENV=local
|
||||
API_BACK_SERVER=http://localhost:6105/api/v1
|
||||
NOTI_HUB_SERVER=https://noti-hub.kric.com/api/v1
|
||||
#NOTI_HUB_SERVER=http://localhost:4011/api/v1
|
||||
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/.gitattributes text eol=lf
|
||||
/.agent/** text eol=lf
|
||||
/AGENTS.md text eol=lf
|
||||
/CLAUDE.md text eol=lf
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -39,3 +39,5 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
.idea
|
||||
361
AGENTS.md
361
AGENTS.md
@@ -1,5 +1,358 @@
|
||||
<!-- BEGIN:nextjs-agent-rules -->
|
||||
# This is NOT the Next.js you know
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Project: gwcf-review-front
|
||||
Schema version: 1
|
||||
Edit the source fragments or repository .agent files, then recompose.
|
||||
-->
|
||||
|
||||
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
|
||||
<!-- END:nextjs-agent-rules -->
|
||||
# KRI Development Base Instructions
|
||||
|
||||
This document defines the shared working rules for KRI development repositories.
|
||||
Keep project-specific facts and commands in the project profile and project rules.
|
||||
|
||||
## Instruction Resolution
|
||||
|
||||
Apply repository instructions in this order:
|
||||
|
||||
1. Base rules
|
||||
2. Project-type rules
|
||||
3. Technology-stack rules
|
||||
4. Shared consumer contracts
|
||||
5. Project-specific rules
|
||||
6. The explicitly approved task scope
|
||||
|
||||
Later and more specific instructions may override earlier general instructions only within their stated scope.
|
||||
|
||||
- Apply a shared consumer contract only when `.agent/profile.yml` declares it.
|
||||
- Do not silently resolve a material instruction conflict. Report the conflicting rules and request a decision before changing files.
|
||||
- Rules involving destructive actions, credentials, external systems, production, deployment, databases, or Git publication require explicit authorization even when a later rule is less restrictive.
|
||||
|
||||
## Communication
|
||||
|
||||
- Respond to the user in Korean unless the user requests another language.
|
||||
- Keep code identifiers, commands, paths, protocol names, and external API terms in their original form.
|
||||
- Follow the repository's existing language conventions for code comments and user-facing messages.
|
||||
- Lead with the result or decision, then provide only the detail needed to verify it.
|
||||
- Do not create or retain a full session transcript.
|
||||
|
||||
### Attention-Aware Response Style
|
||||
|
||||
- Use `attention-aware-communication` for substantive answers, progress updates, and completion reports.
|
||||
- Default to concise, bottom-line-first Korean without omitting a condition, risk, number, or uncertainty needed for a correct decision.
|
||||
- Give full detail when the user requests depth. Use Spartan style only when explicitly requested.
|
||||
- Presentation rules never reduce investigation, implementation, validation, or reporting obligations.
|
||||
|
||||
## Work Authorization
|
||||
|
||||
- The default workflow is discussion first and explicit execution approval second.
|
||||
- During discussion, perform only read-only investigation needed to understand the task and propose a concrete plan, unless the user prohibits inspection.
|
||||
- Read-only investigation may include file inspection, code search, encoding checks, `git status`, `git diff`, `git log`, and sanitized official-documentation lookup.
|
||||
- Before execution approval, do not edit files, install dependencies, run builds or tests, start services, connect to databases, or change local or external state.
|
||||
- Before requesting approval, describe the intended scope, affected areas, validation plan, and material risks.
|
||||
- Treat approval as limited to the presented scope. Pause and discuss again if the work materially expands.
|
||||
- If the user explicitly requests immediate execution without prior discussion, the discussion gate may be skipped for the stated scope.
|
||||
- Fast-track authorization does not implicitly authorize protected operations such as destructive commands, production changes, deployments, database mutations, Git publication, or external messages.
|
||||
|
||||
## Local Development Environment
|
||||
|
||||
- Primary OS: Windows 11.
|
||||
- Primary shell: PowerShell.
|
||||
- Use Git Bash only when the repository already depends on Bash or POSIX shell behavior.
|
||||
- Prefer repository-provided wrappers and scripts over globally installed commands.
|
||||
- Do not assume that GNU utilities, WSL, Docker, or a Unix-compatible shell are available unless the project profile confirms them.
|
||||
- Detect Java, Node.js, .NET, Python, package-manager, and database-tool versions from repository configuration.
|
||||
- Do not install or modify global toolchains as part of a project task.
|
||||
|
||||
Preferred human-facing tools:
|
||||
|
||||
- Classic ASP: Visual Studio Code
|
||||
- Java and Spring Boot: IntelliJ IDEA
|
||||
- C# and .NET: JetBrains Rider
|
||||
- JavaScript, TypeScript, and Next.js: JetBrains WebStorm
|
||||
- Python: JetBrains PyCharm
|
||||
- Microsoft SQL Server: SQL Server Management Studio
|
||||
- Other databases: JetBrains DataGrip
|
||||
|
||||
- These preferences do not authorize launching or controlling a GUI application.
|
||||
- Prefer IDE-independent commands that can also run in CI.
|
||||
- Do not modify global IDE settings.
|
||||
- Do not create or modify `.idea`, `.vscode`, workspace, or run-configuration files unless the approved task requires it.
|
||||
- Preserve existing shared IDE configuration when it is already tracked.
|
||||
|
||||
## PowerShell and Path Safety
|
||||
|
||||
- Quote paths containing spaces, brackets, parentheses, Korean characters, or PowerShell metacharacters.
|
||||
- Prefer `-LiteralPath` when operating on an exact filesystem path.
|
||||
- Use project-relative paths in committed configuration and documentation. Do not commit machine-specific paths such as `D:\_____Dev\...`.
|
||||
- Do not pass filesystem targets between PowerShell, `cmd.exe`, and Bash for destructive or recursive operations.
|
||||
- Keep a filesystem operation within one shell from target resolution through execution.
|
||||
- Before a recursive delete or move, resolve and verify every absolute target.
|
||||
- Never use a drive root, workspace root, user profile, unresolved variable, wildcard, or broad glob as a recursive delete target.
|
||||
- Prefer recoverable operations when practical.
|
||||
|
||||
## Change Discipline
|
||||
|
||||
- Preserve all existing user changes, including uncommitted and untracked work.
|
||||
- Keep changes minimal but complete for the approved objective.
|
||||
- Avoid unrelated cleanup, formatting, renaming, dependency upgrades, and architectural refactoring.
|
||||
- Do not overwrite or revert unrelated changes.
|
||||
- Stop and report when the requested change overlaps existing work in a way that cannot be handled safely.
|
||||
- Prefer changing an authoritative source over editing generated output.
|
||||
- Treat files marked as generated as read-only unless regeneration is part of the approved plan.
|
||||
- Do not edit vendored dependencies, build outputs, caches, or generated clients unless explicitly required.
|
||||
- Do not regenerate a broad set of files for a narrow change without first explaining the expected output scope.
|
||||
|
||||
## Text Encoding and Korean Content Safety
|
||||
|
||||
- Treat the existing file encoding, BOM state, and line-ending style as part of the file's contract.
|
||||
- Preserve Korean comments, user-facing messages, error messages, identifiers, and documentation exactly unless the task explicitly requires changing them.
|
||||
- Do not assume that garbled terminal output means the file itself is corrupted. Verify bytes and encoding before modifying suspicious text.
|
||||
- Before editing an existing text file, determine its current encoding and BOM state when repository configuration does not already guarantee them.
|
||||
- Do not convert encoding, add or remove a BOM, or normalize line endings as a side effect of an unrelated change.
|
||||
- Avoid whole-file rewrites for small changes.
|
||||
- Do not rewrite source files through `Get-Content | Set-Content`, `Out-File`, shell redirection, or another method whose encoding behavior is implicit.
|
||||
- Do not use a patching or formatting tool on a non-UTF-8 file unless it is known to preserve that file's encoding.
|
||||
- Treat a console display problem and an on-disk encoding problem as separate issues.
|
||||
- After editing Korean text, inspect the diff for replacement characters (`<60>`), mojibake, unexpected escapes, BOM changes, and unrelated line-ending changes.
|
||||
- Run `.agent/tools/check-encoding.ps1` when it is available and the change touches Korean text or a non-default encoding.
|
||||
- If encoding cannot be identified confidently, stop before writing and report the affected file and evidence.
|
||||
- For a new text file, follow repository configuration. If no rule exists, use UTF-8 without BOM.
|
||||
|
||||
## Git Safety
|
||||
|
||||
- Use `git status`, `git diff`, and `git log` for read-only investigation.
|
||||
- Do not run `commit`, `push`, `pull`, `fetch`, `merge`, `rebase`, `reset`, `checkout`, `switch`, `stash`, `clean`, `tag`, or force operations unless that specific operation is explicitly approved.
|
||||
- Source-edit approval does not include commit or push approval.
|
||||
- Never amend an existing commit unless explicitly requested.
|
||||
- Before an approved commit, show the intended files, validation results, and proposed commit message.
|
||||
- Never push directly to a protected branch unless the user names the target branch and explicitly authorizes the push.
|
||||
|
||||
## Dependencies and External Actions
|
||||
|
||||
- Use the package manager, lockfile, and toolchain already selected by the repository.
|
||||
- Do not install global packages.
|
||||
- Do not add, remove, or upgrade a dependency unless it was included in the approved plan.
|
||||
- Pause for approval if an unplanned dependency becomes necessary.
|
||||
- Keep lockfiles synchronized with approved dependency changes.
|
||||
- Do not deploy, publish packages, create releases, send messages or email, call business APIs, or modify external services unless explicitly requested.
|
||||
- Never upload proprietary source code, internal documents, credentials, customer data, or database contents to an external service.
|
||||
- Remove secrets and unnecessary internal identifiers from external search queries.
|
||||
|
||||
## Database Safety
|
||||
|
||||
- Treat writing or reviewing SQL as source code separately from executing SQL against a database.
|
||||
- SQL files, migrations, schema proposals, and query drafts may be created within an approved source-change scope.
|
||||
- Do not connect to a shared, staging, or production database without explicit authorization for that environment.
|
||||
- Read-only queries against a non-local database also require authorization because results may contain sensitive data.
|
||||
- Do not execute DDL, DML, stored procedures, migrations, administrative commands, or data-correction scripts against a non-disposable database without separate authorization for the exact target and operation.
|
||||
- Source-change approval does not authorize migration execution.
|
||||
- Use a disposable local or test database for approved validation only after verifying its identity and disposable nature.
|
||||
- Never place credentials, connection strings, or sensitive query results in source files, logs, generated documents, or chat output.
|
||||
|
||||
## Secrets and Sensitive Data
|
||||
|
||||
- Never add credentials, tokens, passwords, private keys, connection strings, session identifiers, or production data to source control.
|
||||
- Read sensitive files only when the approved task requires it and no safer source exists.
|
||||
- Prefer inspecting configuration keys and schemas without displaying secret values.
|
||||
- Never echo secrets into terminal output, chat responses, logs, diffs, generated documents, test fixtures, or screenshots.
|
||||
- Redact sensitive values when reporting errors or command output.
|
||||
- If a possible secret is discovered, do not repeat it. Report only its location, type, and recommended containment action.
|
||||
- Do not rotate, revoke, copy, or otherwise modify credentials unless that exact action is explicitly authorized.
|
||||
|
||||
## Workflow Skills
|
||||
|
||||
- Use `project-reference-loader` before substantive repository analysis, planning, implementation, debugging, or review. Read only the current project and shared references routed for that task, and reread them for each related task even if they were loaded earlier in the session.
|
||||
- Use `karpathy-guidelines` when implementing, refactoring, or reviewing code. It keeps assumptions visible, changes surgical, and success criteria verifiable.
|
||||
- Use `verification-before-completion` before claiming that work is complete, fixed, passing, ready, or safe to commit or publish.
|
||||
- A skill does not expand task scope or authorize Git publication, database execution, deployment, destructive actions, or external communication.
|
||||
|
||||
## Validation
|
||||
|
||||
- Discover supported build, test, lint, type-check, and formatting commands from repository files and project instructions. Do not invent commands.
|
||||
- Include intended validation in the discussion-phase plan.
|
||||
- After approved changes, run the narrowest relevant validation first, then broader checks when appropriate.
|
||||
- Limit formatting to files within the approved scope.
|
||||
- Do not run tests that require a shared database, production service, paid external API, or sensitive data unless separately authorized.
|
||||
- Do not claim that a check passed unless it was executed successfully.
|
||||
- If a check cannot be run, state the exact reason.
|
||||
- Distinguish a current-change failure from a pre-existing failure or an undetermined failure.
|
||||
- Do not fix unrelated failures without expanding the approved scope.
|
||||
- Inspect the worktree after validation for unexpected generated files, formatting churn, encoding changes, or lockfile changes.
|
||||
|
||||
## Artifacts and Session Records
|
||||
|
||||
- Do not create full-session transcripts, automatic HTML copies, analysis reports, or extra documentation unless explicitly requested.
|
||||
- Store durable information in the repository's existing documentation structure.
|
||||
- Do not place generated reports or temporary analysis files in the repository root.
|
||||
- Remove task-specific temporary files created by the current task after validation when removal is safe.
|
||||
|
||||
## Completion Report
|
||||
|
||||
When implementation is complete, report in Korean:
|
||||
|
||||
- what changed and why;
|
||||
- the main affected files or components;
|
||||
- validation commands actually executed and their results;
|
||||
- checks not executed and the reason;
|
||||
- remaining risks, assumptions, or follow-up work;
|
||||
- database, deployment, dependency, encoding, and compatibility impact when applicable.
|
||||
|
||||
- Do not report completion while required validation is failing or known encoding corruption is unresolved.
|
||||
- Keep the report concise and do not include a full session transcript.
|
||||
|
||||
## Requested Project Rules
|
||||
|
||||
- Treat the approved requirements, acceptance criteria, and recorded decisions as the primary scope boundary.
|
||||
- Do not infer a requirement solely from a file name, folder date, or apparently newer document.
|
||||
- When requirements conflict, report the exact sources and request a decision.
|
||||
- Preserve original customer, partner, and planning documents as read-only evidence unless document editing is explicitly approved.
|
||||
- Summarize durable implementation requirements inside the repository rather than relying only on files outside the repository.
|
||||
- Do not expand the deliverable with speculative features, infrastructure, or architectural changes.
|
||||
- Record material assumptions and unresolved decisions in the project-specific rules or existing project documentation.
|
||||
- Define observable acceptance criteria before implementation.
|
||||
- Treat separately managed Frontend and Backend repositories as independent deliverables with a coordinated contract.
|
||||
- Protect customer, partner, survey, and field data as sensitive information.
|
||||
- Keep handoff, operation, configuration, and validation instructions usable by the requesting team.
|
||||
- Report deviations from the requested scope and obtain approval before proceeding.
|
||||
|
||||
## TypeScript
|
||||
|
||||
- Treat the repository's current TypeScript version, `tsconfig` files, module system, path aliases, and package manager as authoritative.
|
||||
- Preserve or strengthen existing strictness. Do not weaken compiler options or hide errors with broad `any`, `@ts-ignore`, or unsafe assertions.
|
||||
- Prefer narrow domain types, discriminated unions, and explicit boundary types over duplicated or overly generic shapes.
|
||||
- Validate untrusted runtime input even when a compile-time type exists.
|
||||
- Keep imports, exports, aliases, and generated-code boundaries consistent with the repository.
|
||||
- Do not introduce a JavaScript-to-TypeScript conversion outside the approved scope.
|
||||
- Run the repository's focused type-check, lint, test, and build commands as applicable.
|
||||
|
||||
## React
|
||||
|
||||
- Treat the current React version, component style, state management, routing, styling, and test approach as authoritative.
|
||||
- Do not perform unrelated class-to-hook, JavaScript-to-TypeScript, state-library, styling-system, or React-to-Next.js migrations.
|
||||
- Keep components focused and follow the repository's established split between presentation, state, data access, and side effects.
|
||||
- Do not use nested ternary expressions. Use clear `if`/`else` branches, early returns, or well-named intermediate variables instead; a single, non-nested ternary is acceptable only when it remains immediately readable.
|
||||
- Keep effects dependency-correct and clean up subscriptions, timers, listeners, and in-flight work where applicable.
|
||||
- Use stable semantic keys and preserve accessibility, loading, empty, error, disabled, and success states.
|
||||
- Preserve public component props and shared UI contracts unless a coordinated breaking change is explicitly approved.
|
||||
- Treat any planned Next.js migration as a separate policy and task; the current React application remains authoritative until that migration slice is approved.
|
||||
|
||||
## Next.js
|
||||
|
||||
- Treat the repository's current Next.js and React versions, routing model, rendering model, and package manager as authoritative.
|
||||
- Preserve server and client component boundaries. Add `use client` only when browser APIs, state, effects, or client-only libraries require it.
|
||||
- Keep secrets, privileged data access, and server-only modules out of client bundles.
|
||||
- Preserve established route, layout, middleware, authentication, authorization, caching, revalidation, and error-handling conventions.
|
||||
- Validate request parameters, payloads, headers, cookies, and external responses at runtime.
|
||||
- Do not create new frontend TypeScript type or interface names ending in `Dto` or `DTO`. Use domain- or purpose-specific names such as `User`, `UserInput`, `UserRequest`, or `UserResponse`; do not rename existing types solely to enforce this rule outside the approved scope.
|
||||
- Use the approved KRI frontend and UI contracts when the project profile includes them; do not copy shared implementations into an application.
|
||||
- Avoid incidental routing-model or rendering-strategy migrations.
|
||||
- Run the repository's focused lint, type-check, test, and production build commands as applicable.
|
||||
|
||||
## KriFrontCommon Consumer Contract
|
||||
|
||||
- Consume the published `@kri/common` package only through entry points declared by its `package.json` `exports` map.
|
||||
- Do not import from `@kri/common/src/*`, `@kri/common/dist/*`, or another undeclared deep path.
|
||||
- Prefer a public shared helper or an approved backward-compatible library addition over copying or forking shared behavior locally.
|
||||
- Do not modify KriFrontCommon or another consumer repository unless it is explicitly included in the approved task scope.
|
||||
|
||||
### Required Shared References
|
||||
|
||||
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Package entry points, runtime boundaries, HTTP, authentication, state, storage, environment, or optional peer integrations | `.agent-harness/references/kri-front-common/package-and-runtime.md` |
|
||||
| React rendering performance, memoization, or React Compiler behavior | `.agent-harness/references/kri-front-common/react-compiler.md` |
|
||||
| Package upgrade, dependency changes, lockfile, or verification | `.agent-harness/references/kri-front-common/change-and-verification.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriFrontCommon's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead.
|
||||
|
||||
## Noti-hub SMS Types
|
||||
|
||||
- `MessageType.SMS = 21`, `LMS = 22`, `MMS = 23`; `ChannelType.SMS = 2` is unchanged. `SMS_TYPE_ARRAY` and `SmsType` include all three.
|
||||
- `LMS_MMS = 22` remains a deprecated source-compatibility alias for LMS only. It does not represent MMS. Enum reverse lookup for 22 returns LMS. Use numeric bulk-list paths; the server no longer accepts LMS_MMS in paths. Numeric 21/22/23 bulk-list requests all return the entire SMS channel, not type-filtered lists.
|
||||
- Requests retain their existing URLs/body shapes. The server chooses the actual type per recipient after substitution: attachment -> MMS; otherwise title or UTF-8 body >= 90 bytes -> LMS; otherwise SMS.
|
||||
- Refresh templates from the save response (`tmplatTy`); display actual delivery types from `sendTy`, not the template or result code. A bulk can contain multiple SMS types. LMS/MMS share result codes; use existing server result labels.
|
||||
- SMS, LMS, MMS and KKO use cancellation code 9998. Verify with `npm run typecheck`, `npm run build`, and `node --test tests/noti-hub-sms.test.mjs`.
|
||||
|
||||
## Noti-hub Reservation Cancellation
|
||||
|
||||
- Import cancellation types, constants, and helpers from `@kri/common/noti-hub` only. They are runtime-neutral and require no optional peers.
|
||||
- Individual current cancellation state is determined by resultCode via isReserveCanceledResult; bulk current state is cancellationStatus (NONE/PARTIAL/ALL). These describe current cancellation state, not cancellation eligibility. cancelDt and cancelUser are request history, not current state.
|
||||
- SendResultInfo, SendInfo, and BulkSendInfo expose optional cancelable. Use isSendCancelable(item), which returns true only for cancelable === true, for cancellation eligibility; missing values from older responses are treated as false. Never infer eligibility from cancelDt, result labels, or result codes.
|
||||
- cancelable reflects query-time state and may change before cancellation. Determine the final outcome from SendCancelResponse counts.
|
||||
- sendIdx is the single-cancel identifier, not cmid. It is absent from the latest abbreviated report (/api/v1/report/last/send/...). Request sendIdx must be a positive integer; bulkSendKey is required and at most 32 characters.
|
||||
- EMAIL_RESERVE_CANCELED_RESULT_CODE is 108 for EMAIL. SMS_KKO_RESERVE_CANCELED_RESULT_CODE is 9998 for SMS, LMS, MMS, and KKO. Unknown message types are not recognized as canceled.
|
||||
- Display the server's resultViewLabel/resultLabel ("예약 취소"). There is no separate result-code list API.
|
||||
- HTTP 200 can contain notCancelableCount. parseSendCancelResponse validates nonnegative integer counts and targetCount = canceledCount + alreadyCanceledCount + notCancelableCount, throwing TypeError on invalid data. Bulk targetCount counts currently registered detail rows; response canceledCount counts only cancellations made by that request.
|
||||
- Existing response fields are unchanged; all added fields on existing types are optional. Verify with npm run typecheck and npm run build.
|
||||
|
||||
## HTTP Streaming
|
||||
|
||||
- `@kri/common/http` HTTP clients expose streamGet/streamPost/streamPut/streamPatch/streamDel, returning HttpStreamResponse (status, statusText, headers, url, nullable body).
|
||||
- Streaming shares ordinary authentication, URL, body and HTTP-error policy. Read body incrementally; no automatic JSON/NDJSON/SSE parsing or reconnect is performed.
|
||||
- Streaming options accept an external AbortSignal. Caller cancellation raises AbortError without an HTTP error notification. Cancel the body when it will not be consumed.
|
||||
- timeoutMs covers connection/headers (and an HTTP error body); idleTimeoutMs covers inactivity after successful headers and resets on consumed chunks. Both default to the client's defaultTimeoutMs (60 seconds by default), and 0 disables that timer for streaming only.
|
||||
- Mid-stream transport/time-out errors reach the body reader. HTTP error statuses use existing HttpError handlers before a stream is returned. A 204 response has body=null.
|
||||
- See HTTP_STREAMING.md for examples and node --test tests/http-stream.test.mjs for focused validation after npm run build.
|
||||
|
||||
## KriUiRegistry Consumer Contract
|
||||
|
||||
When implementing or changing frontend UI, use this order:
|
||||
|
||||
1. Reuse an existing shared component in the project when it already meets the requirement.
|
||||
2. Prefer an approved component from KriUiRegistry.
|
||||
3. Otherwise, prefer a suitable shadcn/ui component.
|
||||
4. Create a custom component only when the preceding options cannot meet the requirement safely.
|
||||
|
||||
### KriAutoComplete Search Scroll
|
||||
|
||||
- `kri-auto-complete` exposes `resetScrollOnSearch?: boolean` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `false`, preserving existing behavior.
|
||||
- When enabled, a search value change (including clearing it) resets the option list scroll to the top on the next animation frame in both `filter` and `inputOnly` modes. Async result updates alone do not trigger another reset.
|
||||
|
||||
### KriAutoComplete Option Tooltip
|
||||
|
||||
- `kri-auto-complete` exposes `optionTooltip?: 'singleLine' | 'wrap'` and `optionTooltipClassName?: string` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It is off by default, preserving existing behavior.
|
||||
- When enabled, hovering an option shows its full `label` in a right-side tooltip. `singleLine` stays on one line until the available viewport width; `wrap` wraps at 28rem. The item depends on the shadcn `tooltip` component and provides its own `TooltipProvider`.
|
||||
|
||||
### KriAutoComplete Search Match
|
||||
|
||||
- `kri-auto-complete` exposes `searchMatch?: 'fuzzy' | 'contains'` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `fuzzy` (cmdk's default subsequence scoring), preserving existing behavior.
|
||||
- `contains` keeps only options whose label or value contains the search text as a case-insensitive substring, in the original option order. It applies only when `searchMode` is `filter`.
|
||||
|
||||
### KriEditor SMS Preview
|
||||
|
||||
- `changeSmsType` reports `SMS | LMS | MMS`. Update consumer callbacks to handle `MMS`; this widens the previous callback contract.
|
||||
- Attachment presence (`smsHasAttachment`) takes priority and reports MMS. Otherwise a title or UTF-8 preview size >= `smsMaxBytes` (default 90) reports LMS; the remainder reports SMS. LMS/MMS share `lmsMaxBytes` (default 2000).
|
||||
- UTF-8 byte counting includes `smsPreviewSuffix` and its separating newline, without storing the suffix in the body.
|
||||
- This is a preview. Use the template-save response for saved `tmplatTy` and delivery-result `sendTy` for actual per-recipient type after server substitution. Registry updates require updating installed consumer copies.
|
||||
|
||||
### Required Shared References
|
||||
|
||||
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Installing, upgrading, adapting, or verifying a registry component | `.agent-harness/references/kri-ui-registry/installation-and-adaptation.md` |
|
||||
| KriEditor HTML, image-map, sanitizer, or WYSIWYG compatibility | `.agent-harness/references/kri-ui-registry/editor-html-compatibility.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriUiRegistry's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead.
|
||||
|
||||
# GWCF Monitoring Frontend Project Instruction Router
|
||||
|
||||
## Required Project References
|
||||
|
||||
Before each related task, read the current contents of every matching reference below, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Any substantive analysis, planning, implementation, debugging, review, or documentation work in this repository | `.agent/references/repository-rules.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Do not assume remembered content is current.
|
||||
|
||||
## Harness Workflow
|
||||
|
||||
- `AGENTS.md` and `CLAUDE.md` are generated outputs. Never edit them directly.
|
||||
- Edit `.agent/project.md` only when routing changes. Store durable project detail in `.agent/references/`.
|
||||
- A reference-only content change does not require recomposition when its route is unchanged. Run harness verification to validate routing and UTF-8.
|
||||
- Recompose and verify after changing `.agent/project.md`, `.agent/profile.yml`, or another composed instruction source.
|
||||
|
||||
@@ -14,6 +14,7 @@ import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {
|
||||
useDeletePerformanceMutation,
|
||||
useDownloadAssignExcelTemplateMutation,
|
||||
useDownloadPerformanceExcelTemplateMutation,
|
||||
useExportPerformanceMutation,
|
||||
@@ -24,7 +25,15 @@ import {
|
||||
} from "@/query/performance";
|
||||
import {useUploadWrittenAssignExcelMutation} from "@/query/assign";
|
||||
import {useDownloadReviewOriginalByPerformanceMutation, useDownloadReviewOriginalMutation, useDownloadReviewPdfMutation} from "@/query/review";
|
||||
import {filterPerformance, getCodeLabel, isInternalRole, isWrittenReviewerRole} from "@/lib/gwcf/view";
|
||||
import {
|
||||
filterPerformance,
|
||||
getCodeLabel,
|
||||
includesText,
|
||||
isFoundationRole,
|
||||
isInternalRole,
|
||||
isResearcherRole,
|
||||
isWrittenReviewerRole
|
||||
} from "@/lib/gwcf/view";
|
||||
import {
|
||||
getMonitoringDisplayRow,
|
||||
getMonitoringDisplayStatus,
|
||||
@@ -114,12 +123,15 @@ const PerformancePage = () => {
|
||||
const userRole = auth.user?.userRole;
|
||||
const userId = auth.user?.userId;
|
||||
const canEdit = isInternalRole(userRole);
|
||||
const canEditNoticeAndStaff = isFoundationRole(userRole);
|
||||
const canDelete = isResearcherRole(userRole);
|
||||
const isWrittenReviewer = isWrittenReviewerRole(userRole);
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const updateMutation = useUpdatePerformanceMutation();
|
||||
const deleteMutation = useDeletePerformanceMutation();
|
||||
const performanceUploadMutation = useUploadPerformanceExcelMutation();
|
||||
const writtenAssignUploadMutation = useUploadWrittenAssignExcelMutation();
|
||||
const performanceTemplateMutation = useDownloadPerformanceExcelTemplateMutation();
|
||||
@@ -227,14 +239,18 @@ const PerformancePage = () => {
|
||||
const monitoring2Row = getMonitoringDisplayRow(item, 1);
|
||||
const monitoring2LatestVisit = monitoring2Row.slot.visit?.[0];
|
||||
|
||||
return (
|
||||
filterPerformance(item, {
|
||||
const baseFilters = {
|
||||
businessType: debouncedFilters.businessType,
|
||||
genre: debouncedFilters.genre,
|
||||
area: debouncedFilters.area,
|
||||
monitoringDate: debouncedFilters.monitoringDate,
|
||||
keyword: debouncedFilters.keyword,
|
||||
}) &&
|
||||
};
|
||||
|
||||
return (
|
||||
(
|
||||
filterPerformance(item, {...baseFilters, keyword: debouncedFilters.keyword}) ||
|
||||
(filterPerformance(item, baseFilters) && includesText(item.performanceDetail["NCAS"], debouncedFilters.keyword.trim()))
|
||||
) &&
|
||||
matchesStatus(debouncedFilters.startMonth, String(item.performanceStartMonth)) &&
|
||||
matchesStatus(debouncedFilters.monitoringAdd, item.id % 100 === 1 ? "0" : "1") &&
|
||||
matchesStatus(debouncedFilters.localReviewStatus, getReviewStatusFilterValue(
|
||||
@@ -270,6 +286,14 @@ const PerformancePage = () => {
|
||||
showDialog("performanceDetailDialog");
|
||||
};
|
||||
|
||||
const deletePerformance = async (performanceId: number) => {
|
||||
if (!performanceId) return;
|
||||
await deleteMutation.mutateAsync(performanceId);
|
||||
alert("삭제되었습니다.");
|
||||
|
||||
window.location.replace("/performance");
|
||||
};
|
||||
|
||||
const downloadReviewPdf = async (performanceId: number, review?: PerformanceReview) => {
|
||||
if (!review || !isReviewComplete(review)) return;
|
||||
if (!review.regUser) return;
|
||||
@@ -413,6 +437,10 @@ const PerformancePage = () => {
|
||||
cell: ({row}) => row.original.performanceDetail["performanceNo"] ?? "",
|
||||
},
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id},
|
||||
{id: "ncas", header: PERFORMANCE_FIELD_LABELS.NCAS,
|
||||
accessorFn: (row) => row.performanceDetail["NCAS"] ?? "",
|
||||
cell: ({row}) => row.original.performanceDetail["NCAS"] ?? "",
|
||||
},
|
||||
...(!isWrittenReviewer ? [
|
||||
{accessorKey: "monitoringAdd", header: PERFORMANCE_FIELD_LABELS.monitoringAdd,
|
||||
accessorFn: (row) => row.id % 100 !== 1? "추가" : "",
|
||||
@@ -575,7 +603,7 @@ const PerformancePage = () => {
|
||||
{!isWrittenReviewer && (
|
||||
<DatePicker value={filters.monitoringDate} onChange={(value) => updateFilters((prev) => ({...prev, monitoringDate: value}))} placeholder={PERFORMANCE_FIELD_LABELS.monitoringDate} />
|
||||
)}
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder={`${PERFORMANCE_FIELD_LABELS.id} or ${PERFORMANCE_FIELD_LABELS.performanceName}`} />
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder={`${PERFORMANCE_FIELD_LABELS.id}, ${PERFORMANCE_FIELD_LABELS.NCAS} or ${PERFORMANCE_FIELD_LABELS.performanceName}`} />
|
||||
<Button type="button" variant="outline" onClick={refreshPerformanceList}>
|
||||
<Search className="h-4 w-4" />
|
||||
검색
|
||||
@@ -630,7 +658,10 @@ const PerformancePage = () => {
|
||||
performance={detailData ?? data.find((item) => item.id === selectedId) ?? null}
|
||||
codes={codes}
|
||||
canEdit={canEdit}
|
||||
canEditNoticeAndStaff={canEditNoticeAndStaff}
|
||||
canDelete={canDelete}
|
||||
onSave={(draft) => updateMutation.mutate(draft)}
|
||||
onDelete={deletePerformance}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -638,6 +669,7 @@ const PerformancePage = () => {
|
||||
open={performanceRegisterOpen}
|
||||
onOpenChange={handlePerformanceRegisterOpenChange}
|
||||
title="사업 등록"
|
||||
notice={`${PERFORMANCE_FIELD_LABELS.NCAS} 열이 추가되었습니다. 새 양식을 다운로드해 사용해 주세요.`}
|
||||
onDownloadTemplate={downloadPerformanceTemplate}
|
||||
onUpload={(file) => performanceUploadMutation.mutateAsync(file)}
|
||||
isUploading={performanceUploadMutation.isPending}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {errorToResponse} from "@/lib/http-util";
|
||||
import {createNotiHubApi} from "@/lib/server-api";
|
||||
import {
|
||||
BulkSendResponse,
|
||||
CreateTemplateRequest,
|
||||
SaveTemplateRequest,
|
||||
SendSmsBulkRequest,
|
||||
Template,
|
||||
@@ -15,14 +16,31 @@ export const GET = async (
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action, templateIdx] = slug;
|
||||
const [action, second, third, fourth] = slug;
|
||||
|
||||
if (action !== "template" || !templateIdx) {
|
||||
if (action !== "template") {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const notiHubApi = await createNotiHubApi();
|
||||
const template = await notiHubApi.get<Template>(`/template/${encodeURIComponent(templateIdx)}`);
|
||||
let path: string;
|
||||
if (second === "list") {
|
||||
if (slug.length !== 4 || !third || !fourth) {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
path = `/template/list/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`;
|
||||
} else {
|
||||
if (slug.length !== 2 || !second) {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
path = `/template/${encodeURIComponent(second)}`;
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const template = await notiHubApi.get<Template | Template[]>(path);
|
||||
|
||||
return NextResponse.json(template, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
@@ -30,6 +48,35 @@ export const GET = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const PUT = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
if (slug.length !== 1 || slug[0] !== "template") {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const formData = await req.formData();
|
||||
const templatePart = formData.get("template");
|
||||
const body = templatePart instanceof Blob
|
||||
? JSON.parse(await templatePart.text()) as CreateTemplateRequest
|
||||
: null;
|
||||
if (!body || !body.itrntPrjctCd || body.tmplatTy == null || !body.tmplatNm || !body.tmplatBody || !body.sendTel || !body.sendNm) {
|
||||
return NextResponse.json({ message: "Template request body is invalid." }, { status: 400 });
|
||||
}
|
||||
|
||||
const notiHubApi = await createNotiHubApi();
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("template", new Blob([JSON.stringify(body)], {type: "application/json"}));
|
||||
const created = await notiHubApi.putForm<Template>("/template", backendForm);
|
||||
return NextResponse.json(created, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
@@ -42,7 +89,11 @@ export const PATCH = async (
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const body = await req.json().catch(() => null) as SaveTemplateRequest | null;
|
||||
const formData = await req.formData();
|
||||
const templatePart = formData.get("template");
|
||||
const body = templatePart instanceof Blob
|
||||
? JSON.parse(await templatePart.text()) as SaveTemplateRequest
|
||||
: null;
|
||||
if (!body || !body.tmplatIdx) {
|
||||
return NextResponse.json({ message: "Template request body is invalid." }, { status: 400 });
|
||||
}
|
||||
@@ -52,12 +103,19 @@ export const PATCH = async (
|
||||
const next: Template = {
|
||||
...current,
|
||||
tmplatNm: body.tmplatNm,
|
||||
tmplatPurpose: body.tmplatPurpose ?? current.tmplatPurpose ?? 0,
|
||||
tmplatTitle: body.tmplatTitle,
|
||||
tmplatBody: body.tmplatBody,
|
||||
sendTel: body.sendTel,
|
||||
};
|
||||
|
||||
await notiHubApi.patch<void>("/template", next);
|
||||
const backendForm = new FormData();
|
||||
backendForm.append(
|
||||
"template",
|
||||
new Blob([JSON.stringify(next)], {type: "application/json"})
|
||||
);
|
||||
|
||||
await notiHubApi.patchForm<void>("/template", backendForm);
|
||||
|
||||
return NextResponse.json(next, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -168,10 +168,12 @@ export const POST = async (
|
||||
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("file", file, file.name);
|
||||
const paramUserId = req.nextUrl.searchParams.get("paramUserId") ?? undefined;
|
||||
|
||||
const result = await backApi.postForm<PerformanceReview>(
|
||||
`/review/${encodeURIComponent(action)}/${encodeURIComponent(second)}`,
|
||||
backendForm
|
||||
backendForm,
|
||||
{ query: paramUserId ? { paramUserId } : undefined }
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
@@ -92,6 +92,14 @@ export function DataTable<TData>({
|
||||
}
|
||||
}, [rowSelection, selectMode])
|
||||
|
||||
useEffect(() => {
|
||||
setPagination(prev => ({
|
||||
...prev,
|
||||
pageIndex: 0,
|
||||
pageSize: Math.max(1, defaultPageSize),
|
||||
}))
|
||||
}, [defaultPageSize])
|
||||
|
||||
// selectMode에 따라 select column 추가
|
||||
const enhancedColumns: DataTableColumn<TData, any>[] = [
|
||||
...(isNotSelection
|
||||
|
||||
@@ -202,16 +202,18 @@ export function AssignMonitoringDialog({
|
||||
<div className="font-semibold">{confirmedCount}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="max-h-[50vh] overflow-auto [&_[data-slot=table-container]]:overflow-visible [&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background [&_th]:shadow-[inset_0_1px_0_var(--border),inset_0_-1px_0_var(--border)]">
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={applyUsers}
|
||||
getRowId={(row) => row.userId}
|
||||
defaultPageSize={applyUsers.length || 10}
|
||||
pageSizeOptions={[applyUsers.length || 10]}
|
||||
defaultPageSize={applyUsers.length}
|
||||
pageSizeOptions={[applyUsers.length]}
|
||||
showPagination={false}
|
||||
selectMode="click-event"
|
||||
onRowClick={toggleApplyUser}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export function ExcelRegisterDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
title,
|
||||
notice,
|
||||
onDownloadTemplate,
|
||||
onUpload,
|
||||
isUploading,
|
||||
@@ -24,6 +25,7 @@ export function ExcelRegisterDialog({
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
title: string;
|
||||
notice?: string;
|
||||
onDownloadTemplate: () => void;
|
||||
onUpload: (file: File) => Promise<ExcelUploadResult>;
|
||||
isUploading?: boolean;
|
||||
@@ -56,6 +58,7 @@ export function ExcelRegisterDialog({
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-3">
|
||||
{notice && <p className="text-xs text-red-500">* {notice}</p>}
|
||||
<Button type="button" variant="outline" className="w-full" onClick={onDownloadTemplate}>
|
||||
<Download className="h-4 w-4" />
|
||||
양식 다운로드
|
||||
|
||||
@@ -5,7 +5,7 @@ import {Download, ImageIcon, ScanSearch, Upload} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle} from "@/components/ui/dialog";
|
||||
import {StatusPill} from "@/components/gwcf/StatusPill";
|
||||
import {Code, PerformanceFull} from "@/types/gwcf";
|
||||
import {Code, PDF_CONVERT_STATUS, PdfConvertStatus, PerformanceFull} from "@/types/gwcf";
|
||||
import {CodeGroup} from "@/query/code";
|
||||
import {getCodeLabel} from "@/lib/gwcf/view";
|
||||
import {
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
downloadBlob,
|
||||
downloadFromUrl,
|
||||
getEvidenceZipDownloadName,
|
||||
getReviewOriginalDownloadName,
|
||||
getReviewPdfDownloadName,
|
||||
getReviewOriginalDownloadName, getReviewPdfDisabled,
|
||||
getReviewPdfDownloadName, getReviewPdfStatusLabel,
|
||||
openPreviewWindow,
|
||||
} from "@/lib/gwcf/file";
|
||||
import {PERFORMANCE_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||
@@ -73,6 +73,7 @@ function MonitoringReviewActions({
|
||||
reviewType,
|
||||
userId,
|
||||
uploadFileName,
|
||||
pdfConvert,
|
||||
pdfFileName,
|
||||
}: Readonly<{
|
||||
canUpload: boolean;
|
||||
@@ -80,6 +81,7 @@ function MonitoringReviewActions({
|
||||
reviewType: number;
|
||||
userId?: string;
|
||||
uploadFileName?: string;
|
||||
pdfConvert?: PdfConvertStatus;
|
||||
pdfFileName?: string;
|
||||
}>) {
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
@@ -116,12 +118,15 @@ function MonitoringReviewActions({
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
||||
<ActionButton icon="upload" disabled={!canUpload || uploadMutation.isPending} onClick={() => fileInputRef.current?.click()}>파일 업로드</ActionButton>
|
||||
<ActionButton disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</ActionButton>
|
||||
<ActionButton disabled={!userId || !pdfFileName || pdfMutation.isPending} onClick={downloadPdf}>PDF</ActionButton>
|
||||
<ActionButton icon="preview" disabled={!userId || !pdfFileName} onClick={previewPdf}>미리보기</ActionButton>
|
||||
<ActionButton disabled={getReviewPdfDisabled(userId, pdfFileName, pdfConvert) || pdfMutation.isPending} onClick={downloadPdf}>{getReviewPdfStatusLabel(pdfConvert)}</ActionButton>
|
||||
<ActionButton icon="preview" disabled={getReviewPdfDisabled(userId, pdfFileName, pdfConvert)} onClick={previewPdf}>미리보기</ActionButton>
|
||||
</div>
|
||||
<span className="text-xs text-red-500">* 파일 크기 및 형식에 따라 PDF 변환이 최대 5분까지 소요됩니다.</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -261,6 +266,7 @@ export function MonitoringPerformanceDetailDialog({
|
||||
userId={row.review?.regUser || row.userId}
|
||||
uploadFileName={row.review?.uploadFileName}
|
||||
pdfFileName={row.review?.pdfFileName}
|
||||
pdfConvert={row.review?.pdfConvert}
|
||||
/>
|
||||
) : (
|
||||
<div className="rounded-md bg-muted p-3 text-sm text-muted-foreground">나의 모니터링 배정 정보를 찾을 수 없습니다.</div>
|
||||
|
||||
@@ -8,7 +8,15 @@ import {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle} from "@/
|
||||
import {DatePicker} from "@/components/common/DatePicker";
|
||||
import {FilterSelect} from "@/components/gwcf/FilterSelect";
|
||||
import {StatusPill} from "@/components/gwcf/StatusPill";
|
||||
import {Code, PerformanceCompact, PerformanceFull, PerformanceMonitoringSchedule, PerformanceStaff, UserFull} from "@/types/gwcf";
|
||||
import {
|
||||
Code,
|
||||
PdfConvertStatus,
|
||||
PerformanceCompact,
|
||||
PerformanceFull,
|
||||
PerformanceMonitoringSchedule,
|
||||
PerformanceStaff,
|
||||
UserFull
|
||||
} from "@/types/gwcf";
|
||||
import {CodeGroup} from "@/query/code";
|
||||
import {getCodeLabel, getDetailValue, ROLE} from "@/lib/gwcf/view";
|
||||
import {
|
||||
@@ -37,17 +45,83 @@ import {
|
||||
downloadBlob,
|
||||
downloadFromUrl,
|
||||
getEvidenceZipDownloadName,
|
||||
getReviewOriginalDownloadName,
|
||||
getReviewPdfDownloadName,
|
||||
getReviewOriginalDownloadName, getReviewPdfDisabled,
|
||||
getReviewPdfDownloadName, getReviewPdfStatusLabel,
|
||||
openPreviewWindow,
|
||||
openWrittenReviewWindow,
|
||||
} from "@/lib/gwcf/file";
|
||||
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
|
||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||
type PerformanceDetail = PerformanceCompact["performanceDetail"];
|
||||
type MonitoringVisitResetStatus = "departure" | "arrival";
|
||||
|
||||
const DETAIL_TEXT_MAX_LENGTH = 2048;
|
||||
const ARTIST_NAME_MAX_LENGTH = 128;
|
||||
|
||||
type StaffTextField = "staffName" | "staffTel1" | "staffTel2" | "staffEmail";
|
||||
|
||||
// DB 컬럼 길이와 맞춘다.
|
||||
const STAFF_FIELD_MAX_LENGTH: Record<StaffTextField, number> = {
|
||||
staffName: 32,
|
||||
staffTel1: 32,
|
||||
staffTel2: 32,
|
||||
staffEmail: 128,
|
||||
};
|
||||
|
||||
const STAFF_TEXT_FIELDS: StaffTextField[] = ["staffName", "staffTel1", "staffTel2", "staffEmail"];
|
||||
|
||||
type StaffRow = {
|
||||
key: string;
|
||||
// null이면 유형 코드가 없어 입력할 수 없는 빈 행이다.
|
||||
staffType: number | null;
|
||||
staff: PerformanceStaff | null;
|
||||
index: number | null;
|
||||
};
|
||||
|
||||
const isBlankStaff = (staff: PerformanceStaff) => STAFF_TEXT_FIELDS.every((field) => (staff[field] ?? "").trim() === "");
|
||||
|
||||
// 관계자 유형 코드마다 행을 만들고, 데이터가 없는 유형은 빈 행으로 채운다.
|
||||
// 빈 행과 새로 입력한 관계자는 같은 key를 사용해 입력 중 포커스가 유지되게 한다.
|
||||
const buildStaffRows = (staffList: PerformanceStaff[], staffCodes: Code[]): StaffRow[] => {
|
||||
const toRow = (staff: PerformanceStaff, index: number): StaffRow => ({
|
||||
key: staff.id > 0 ? `staff-${staff.id}` : `new-${staff.staffType}`,
|
||||
staffType: staff.staffType,
|
||||
staff,
|
||||
index,
|
||||
});
|
||||
const rows: StaffRow[] = [];
|
||||
const usedIndexes = new Set<number>();
|
||||
|
||||
staffCodes.forEach((code) => {
|
||||
const matched = staffList
|
||||
.map((staff, index) => ({staff, index}))
|
||||
.filter(({staff}) => staff.staffType === code.codeValue);
|
||||
|
||||
if (matched.length === 0) {
|
||||
rows.push({key: `new-${code.codeValue}`, staffType: code.codeValue, staff: null, index: null});
|
||||
return;
|
||||
}
|
||||
matched.forEach(({staff, index}) => {
|
||||
usedIndexes.add(index);
|
||||
rows.push(toRow(staff, index));
|
||||
});
|
||||
});
|
||||
|
||||
staffList.forEach((staff, index) => {
|
||||
if (!usedIndexes.has(index)) rows.push(toRow(staff, index));
|
||||
});
|
||||
|
||||
if (rows.length === 0) {
|
||||
rows.push({key: "empty", staffType: null, staff: null, index: null});
|
||||
}
|
||||
return rows;
|
||||
};
|
||||
|
||||
// UpdateNoticeDt는 한국시간 ISO 문자열이므로 시간대 변환 없이 표시만 정리한다.
|
||||
const formatUpdateNoticeDt = (value?: string) => (value ?? "").replace("T", " ").replace(/\.\d+/, "");
|
||||
|
||||
function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
||||
return (
|
||||
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
||||
@@ -116,6 +190,7 @@ function ReviewFileActions({
|
||||
userId,
|
||||
uploadFileName,
|
||||
pdfFileName,
|
||||
pdfConvert,
|
||||
canUpload,
|
||||
canEdit,
|
||||
}: Readonly<{
|
||||
@@ -124,6 +199,7 @@ function ReviewFileActions({
|
||||
userId?: string;
|
||||
uploadFileName?: string;
|
||||
pdfFileName?: string;
|
||||
pdfConvert?: PdfConvertStatus
|
||||
canUpload: boolean;
|
||||
canEdit: boolean;
|
||||
}>) {
|
||||
@@ -136,7 +212,9 @@ function ReviewFileActions({
|
||||
const upload = async (file?: File) => {
|
||||
try {
|
||||
if (!file) return;
|
||||
await withLoadingAsync(() => uploadMutation.mutateAsync({performanceId, reviewType, file}));
|
||||
await withLoadingAsync(() =>
|
||||
uploadMutation.mutateAsync({performanceId, reviewType, file, paramUserId: userId})
|
||||
);
|
||||
alert("파일 업로드가 완료되었습니다.");
|
||||
} finally {
|
||||
if (fileInputRef.current) fileInputRef.current.value = "";
|
||||
@@ -169,15 +247,16 @@ function ReviewFileActions({
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{canEdit && (
|
||||
{canEdit && userId && (
|
||||
<>
|
||||
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
||||
<FileActionButton icon="upload" disabled={uploadMutation.isPending || !canUpload} onClick={() => fileInputRef.current?.click()}>파일 업로드</FileActionButton>
|
||||
</>
|
||||
)}
|
||||
<FileActionButton icon="download" disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</FileActionButton>
|
||||
<FileActionButton icon="download" disabled={!userId || !pdfFileName || pdfMutation.isPending} onClick={downloadPdf}>PDF</FileActionButton>
|
||||
<FileActionButton icon="preview" disabled={!userId || !pdfFileName} onClick={previewPdf}>미리보기</FileActionButton>
|
||||
<FileActionButton icon="download" disabled={getReviewPdfDisabled(userId, pdfFileName, pdfConvert) || pdfMutation.isPending} onClick={downloadPdf}>{getReviewPdfStatusLabel(pdfConvert)}</FileActionButton>
|
||||
<FileActionButton icon="preview" disabled={getReviewPdfDisabled(userId, pdfFileName, pdfConvert)} onClick={previewPdf}>미리보기</FileActionButton>
|
||||
<span className="text-xs text-red-500">* 파일 크기 및 형식에 따라 PDF 변환이 최대 5분까지 소요됩니다.</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -219,9 +298,11 @@ function EvidenceZipButton({performanceId, userId}: {performanceId: number; user
|
||||
function LocalGovernmentReviewRow({
|
||||
performance,
|
||||
codes,
|
||||
loginUserId,
|
||||
}: {
|
||||
performance: PerformanceFull | PerformanceCompact;
|
||||
codes: CodeMap;
|
||||
loginUserId: string | undefined;
|
||||
}) {
|
||||
const reviewType = LOCAL_GOVERNMENT_REVIEW_TYPE;
|
||||
const fallbackReviewRow = getReviewByType(performance as PerformanceFull, reviewType);
|
||||
@@ -244,9 +325,10 @@ function LocalGovernmentReviewRow({
|
||||
<ReviewFileActions
|
||||
performanceId={performance.id}
|
||||
reviewType={reviewType}
|
||||
userId={review?.regUser || userId}
|
||||
userId={review?.regUser || userId || loginUserId}
|
||||
uploadFileName={review?.uploadFileName}
|
||||
pdfFileName={review?.pdfFileName}
|
||||
pdfConvert={review?.pdfConvert}
|
||||
canUpload={true}
|
||||
canEdit={true}
|
||||
/>
|
||||
@@ -322,8 +404,11 @@ function MonitoringStatusRow({
|
||||
userId={row.review?.regUser || row.userId}
|
||||
uploadFileName={row.review?.uploadFileName}
|
||||
pdfFileName={row.review?.pdfFileName}
|
||||
canUpload={canEdit && isReviewComplete(row.review)}
|
||||
canEdit={canEdit}
|
||||
pdfConvert={row.review?.pdfConvert}
|
||||
//canUpload={canEdit && isReviewComplete(row.review)}
|
||||
//canEdit={canEdit}
|
||||
canUpload={true}
|
||||
canEdit={true}
|
||||
/>
|
||||
</div>
|
||||
{row.slot.visit?.length ? (
|
||||
@@ -409,17 +494,27 @@ export function PerformanceDetailDialog({
|
||||
performance,
|
||||
codes,
|
||||
canEdit,
|
||||
canEditNoticeAndStaff = false,
|
||||
canDelete,
|
||||
onSave,
|
||||
onDelete,
|
||||
}: Readonly<{
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
performance: PerformanceFull | PerformanceCompact | null;
|
||||
codes: CodeMap;
|
||||
canEdit: boolean;
|
||||
// 기본 정보는 표시만 하고 변경 정보, 관계자 정보만 수정할 수 있는 권한
|
||||
canEditNoticeAndStaff?: boolean;
|
||||
canDelete: boolean;
|
||||
onSave?: (performance: PerformanceCompact) => void;
|
||||
onDelete?: (performanceId: number) => void;
|
||||
}>) {
|
||||
const {auth} = useAuth();
|
||||
const [draft, setDraft] = useState<PerformanceCompact | null>(null);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const canModify = canEdit || canEditNoticeAndStaff;
|
||||
const isEditingBasic = isEditing && canEdit;
|
||||
const {data: monitoringUsers = []} = useUsersQuery(ROLE.MONITORING, open);
|
||||
const {data: writtenUsers = []} = useUsersQuery(ROLE.WRITTEN_REVIEWER, open);
|
||||
const monitoringUserMap = useMemo(
|
||||
@@ -431,6 +526,8 @@ export function PerformanceDetailDialog({
|
||||
[writtenUsers]
|
||||
);
|
||||
|
||||
const userId = auth.user?.userId;
|
||||
|
||||
useEffect(() => {
|
||||
if (!performance) {
|
||||
setDraft(null);
|
||||
@@ -491,6 +588,39 @@ export function PerformanceDetailDialog({
|
||||
});
|
||||
};
|
||||
|
||||
const updateStaffRow = (row: StaffRow, key: StaffTextField, value: string) => {
|
||||
if (row.index !== null) {
|
||||
updateStaff(row.index, key, value);
|
||||
return;
|
||||
}
|
||||
const staffType = row.staffType;
|
||||
if (staffType === null) return;
|
||||
|
||||
setDraft((prev) => {
|
||||
if (!prev) return prev;
|
||||
// id는 서버에서 새로 발급하므로 0으로 보낸다.
|
||||
const newStaff: PerformanceStaff = {
|
||||
id: 0,
|
||||
performanceId: prev.id,
|
||||
staffType,
|
||||
staffName: "",
|
||||
staffTel1: "",
|
||||
staffTel2: "",
|
||||
staffEmail: "",
|
||||
[key]: value,
|
||||
};
|
||||
return {...prev, performanceStaff: [...(prev.performanceStaff ?? []), newStaff]};
|
||||
});
|
||||
};
|
||||
|
||||
const renderStaffCell = (row: StaffRow, field: StaffTextField) => {
|
||||
const value = row.staff?.[field] ?? "";
|
||||
if (!isEditing || row.staffType === null) return value;
|
||||
return <Input maxLength={STAFF_FIELD_MAX_LENGTH[field]} value={value} onChange={(event) => updateStaffRow(row, field, event.target.value)} />;
|
||||
};
|
||||
|
||||
const staffRows = draft ? buildStaffRows(draft.performanceStaff ?? [], codes.staff_type ?? []) : [];
|
||||
|
||||
const resetDraft = () => {
|
||||
if (!performance) return;
|
||||
setDraft({
|
||||
@@ -514,10 +644,58 @@ export function PerformanceDetailDialog({
|
||||
|
||||
const save = () => {
|
||||
if (!draft) return;
|
||||
onSave?.(draft);
|
||||
|
||||
const detail = draft.performanceDetail ?? {};
|
||||
const ncas = detail["NCAS"] ?? "";
|
||||
const updateNoticeTarget = detail["UpdateNoticeTarget"] ?? "";
|
||||
const updateNoticeMemo = detail["UpdateNoticeMemo"] ?? "";
|
||||
|
||||
if (!/^\d*$/.test(ncas)) {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.NCAS}는 숫자만 입력할 수 있습니다.`);
|
||||
return;
|
||||
}
|
||||
if (ncas.length > DETAIL_TEXT_MAX_LENGTH || updateNoticeMemo.length > DETAIL_TEXT_MAX_LENGTH) {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.NCAS}와 ${PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}은 최대 2,048자까지 입력할 수 있습니다.`);
|
||||
return;
|
||||
}
|
||||
if (updateNoticeTarget !== "" && updateNoticeMemo.trim() === "") {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget}을 선택한 경우 ${PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}을 입력해 주세요.`);
|
||||
return;
|
||||
}
|
||||
// 기본 정보를 수정할 수 없는 권한은 기존 값을 고칠 수 없으므로 검사하지 않는다.
|
||||
if (canEdit && (draft.artistName ?? "").trim() === "") {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.artistName}을 입력해 주세요.`);
|
||||
return;
|
||||
}
|
||||
|
||||
// 모든 칸이 공란인 관계자는 저장하지 않는다.
|
||||
const performanceStaff = (draft.performanceStaff ?? []).filter((staff) => !isBlankStaff(staff));
|
||||
if (performanceStaff.some((staff) => (staff.staffName ?? "").trim() === "")) {
|
||||
alert("관계자 이름을 입력해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const performanceDetail: PerformanceDetail = {
|
||||
...detail,
|
||||
NCAS: ncas,
|
||||
UpdateNoticeTarget: updateNoticeTarget,
|
||||
UpdateNoticeMemo: updateNoticeMemo,
|
||||
};
|
||||
// 변경 일시는 서버에서 생성하므로 요청에서 제외한다.
|
||||
delete performanceDetail["UpdateNoticeDt"];
|
||||
|
||||
onSave?.({...draft, performanceDetail, performanceStaff});
|
||||
setIsEditing(false);
|
||||
};
|
||||
|
||||
const deletePerformance = () => {
|
||||
if(!draft) return;
|
||||
|
||||
if(confirm("삭제 되면 복구할 수 없습니다. 삭제를 진행 하시겠습니까?")){
|
||||
onDelete?.(draft.id);
|
||||
}
|
||||
}
|
||||
|
||||
const downloadTemplate = (reviewType: number, classification: number) => {
|
||||
downloadFromUrl(`/api/review/template/download/${reviewType}/${classification}`);
|
||||
};
|
||||
@@ -536,35 +714,62 @@ export function PerformanceDetailDialog({
|
||||
<section className="rounded-md border">
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.no}>{draft.performanceDetail["performanceNo"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.id}>{draft.id}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.NCAS}>{isEditingBasic ? <Input inputMode="numeric" maxLength={DETAIL_TEXT_MAX_LENGTH} value={draft.performanceDetail["NCAS"] ?? ""} onChange={(event) => updateDetail("NCAS", event.target.value.replace(/\D/g, ""))} /> : draft.performanceDetail["NCAS"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAdd}>{draft.id % 100 !== 1? "추가" : ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceArea}>
|
||||
{isEditing ? (
|
||||
{isEditingBasic ? (
|
||||
<FilterSelect value={String(draft.performanceArea ?? "")} onChange={(value) => updateDraft("performanceArea", Number(value))} options={codes.area ?? []} placeholder={PERFORMANCE_FIELD_LABELS.performanceArea} />
|
||||
) : getCodeLabel(codes, "area", draft.performanceArea)}
|
||||
</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceAreaDetail}>{isEditing ? <Input value={draft.performanceDetail["performanceAreaDetail"] ?? ""} onChange={(event) => updateDetail("performanceAreaDetail", event.target.value)} /> : draft.performanceDetail["performanceAreaDetail"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{draft.artistName}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{isEditing ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{isEditing ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceDtInfo}>{isEditing ? <Input value={draft.performanceDtInfo} onChange={(event) => updateDraft("performanceDtInfo", event.target.value)} /> : draft.performanceDtInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{isEditing ? <Input value={draft.performanceTimeInfo} onChange={(event) => updateDraft("performanceTimeInfo", event.target.value)} /> : draft.performanceTimeInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceAreaDetail}>{isEditingBasic ? <Input value={draft.performanceDetail["performanceAreaDetail"] ?? ""} onChange={(event) => updateDetail("performanceAreaDetail", event.target.value)} /> : draft.performanceDetail["performanceAreaDetail"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{isEditingBasic ? <Input maxLength={ARTIST_NAME_MAX_LENGTH} value={draft.artistName ?? ""} onChange={(event) => updateDraft("artistName", event.target.value)} /> : draft.artistName}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{isEditingBasic ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{isEditingBasic ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceDtInfo}>{isEditingBasic ? <Input value={draft.performanceDtInfo} onChange={(event) => updateDraft("performanceDtInfo", event.target.value)} /> : draft.performanceDtInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{isEditingBasic ? <Input value={draft.performanceTimeInfo} onChange={(event) => updateDraft("performanceTimeInfo", event.target.value)} /> : draft.performanceTimeInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationStatus}>
|
||||
{isEditing ? (
|
||||
{isEditingBasic ? (
|
||||
<FilterSelect value={String(draft.ticketReservationStatus ?? "")} onChange={(value) => updateDraft("ticketReservationStatus", Number(value))} options={codes.ticket_reservation_status ?? []} placeholder={PERFORMANCE_FIELD_LABELS.ticketReservationStatus} />
|
||||
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
||||
</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{isEditing ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{isEditing ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.needMonitoring}>{isEditing ? <Input value={draft.performanceDetail["needMonitoring"] ?? ""} onChange={(event) => updateDetail("needMonitoring", event.target.value)} /> : draft.performanceDetail["needMonitoring"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.needWrittenReview}>{isEditing ? <Input value={draft.performanceDetail["needWrittenReview"] ?? ""} onChange={(event) => updateDetail("needWrittenReview", event.target.value)} /> : draft.performanceDetail["needWrittenReview"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkDeliver}>{isEditing ? <Input value={draft.performanceDetail["checkDeliver"] ?? ""} onChange={(event) => updateDetail("checkDeliver", event.target.value)} /> : draft.performanceDetail["checkDeliver"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.timeTreeCheckDt}>{isEditing ? <DatePicker value={draft.performanceDetail["timeTreeCheckDt"] ?? ""} onChange={(value) => updateDetail("timeTreeCheckDt", value)} /> : draft.performanceDetail["timeTreeCheckDt"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{isEditing ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkReport}>{isEditing ? <Input value={draft.performanceDetail["checkReport"] ?? ""} onChange={(event) => updateDetail("checkReport", event.target.value)} /> : draft.performanceDetail["checkReport"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{isEditingBasic ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{isEditingBasic ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{isEditingBasic ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.needMonitoring}>{isEditingBasic ? <Input value={draft.performanceDetail["needMonitoring"] ?? ""} onChange={(event) => updateDetail("needMonitoring", event.target.value)} /> : draft.performanceDetail["needMonitoring"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.needWrittenReview}>{isEditingBasic ? <Input value={draft.performanceDetail["needWrittenReview"] ?? ""} onChange={(event) => updateDetail("needWrittenReview", event.target.value)} /> : draft.performanceDetail["needWrittenReview"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkDeliver}>{isEditingBasic ? <Input value={draft.performanceDetail["checkDeliver"] ?? ""} onChange={(event) => updateDetail("checkDeliver", event.target.value)} /> : draft.performanceDetail["checkDeliver"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.timeTreeCheckDt}>{isEditingBasic ? <DatePicker value={draft.performanceDetail["timeTreeCheckDt"] ?? ""} onChange={(value) => updateDetail("timeTreeCheckDt", value)} /> : draft.performanceDetail["timeTreeCheckDt"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{isEditingBasic ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{isEditingBasic ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkReport}>{isEditingBasic ? <Input value={draft.performanceDetail["checkReport"] ?? ""} onChange={(event) => updateDetail("checkReport", event.target.value)} /> : draft.performanceDetail["checkReport"] ?? ""}</DetailRow>
|
||||
</section>
|
||||
|
||||
<section className="rounded-md border">
|
||||
<div className="border-b bg-muted px-3 py-2 font-semibold">변경 정보</div>
|
||||
<div className="overflow-auto">
|
||||
<table className="w-full min-w-[620px] border-collapse text-sm">
|
||||
<thead>
|
||||
<tr className="bg-muted">
|
||||
<th className="w-[180px] border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget}</th>
|
||||
<th className="border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}</th>
|
||||
<th className="w-[170px] border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeDt}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="border p-2">
|
||||
{isEditing ? (
|
||||
<FilterSelect value={draft.performanceDetail["UpdateNoticeTarget"] ?? ""} onChange={(value) => updateDetail("UpdateNoticeTarget", value)} options={codes.update_notice_target ?? []} placeholder={PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget} clearLabel="선택 해제" />
|
||||
) : getCodeLabel(codes, "update_notice_target", draft.performanceDetail["UpdateNoticeTarget"])}
|
||||
</td>
|
||||
<td className="border p-2">{isEditing ? <Input maxLength={DETAIL_TEXT_MAX_LENGTH} value={draft.performanceDetail["UpdateNoticeMemo"] ?? ""} onChange={(event) => updateDetail("UpdateNoticeMemo", event.target.value)} /> : draft.performanceDetail["UpdateNoticeMemo"] ?? ""}</td>
|
||||
<td className="border p-2 text-center">{formatUpdateNoticeDt(draft.performanceDetail["UpdateNoticeDt"])}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-md border">
|
||||
@@ -581,13 +786,12 @@ export function PerformanceDetailDialog({
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{draft.performanceStaff?.map((staff, index) => (
|
||||
<tr key={staff.id}>
|
||||
<td className="border p-2">{getCodeLabel(codes, "staff_type", staff.staffType)}</td>
|
||||
<td className="border p-2">{isEditing ? <Input value={staff.staffName} onChange={(event) => updateStaff(index, "staffName", event.target.value)} /> : staff.staffName}</td>
|
||||
<td className="border p-2">{isEditing ? <Input value={staff.staffTel1} onChange={(event) => updateStaff(index, "staffTel1", event.target.value)} /> : staff.staffTel1}</td>
|
||||
<td className="border p-2">{isEditing ? <Input value={staff.staffTel2} onChange={(event) => updateStaff(index, "staffTel2", event.target.value)} /> : staff.staffTel2}</td>
|
||||
<td className="border p-2">{isEditing ? <Input value={staff.staffEmail} onChange={(event) => updateStaff(index, "staffEmail", event.target.value)} /> : staff.staffEmail}</td>
|
||||
{staffRows.map((row) => (
|
||||
<tr key={row.key}>
|
||||
<td className="h-9 border p-2">{getCodeLabel(codes, "staff_type", row.staffType)}</td>
|
||||
{STAFF_TEXT_FIELDS.map((field) => (
|
||||
<td key={field} className="border p-2">{renderStaffCell(row, field)}</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -606,7 +810,7 @@ export function PerformanceDetailDialog({
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<LocalGovernmentReviewRow performance={performance ?? draft} codes={codes} />
|
||||
<LocalGovernmentReviewRow performance={performance ?? draft} codes={codes} loginUserId={userId} />
|
||||
<MonitoringStatusRow performance={performance ?? draft} index={0} codes={codes} userMap={monitoringUserMap} canEdit={canEdit} />
|
||||
<MonitoringStatusRow performance={performance ?? draft} index={1} codes={codes} userMap={monitoringUserMap} canEdit={canEdit} />
|
||||
<WrittenReviewRows performance={performance ?? draft} codes={codes} userMap={writtenUserMap} canEdit={canEdit} />
|
||||
@@ -616,8 +820,9 @@ export function PerformanceDetailDialog({
|
||||
</div>
|
||||
|
||||
<DialogFooter className="shrink-0 border-t pt-4">
|
||||
{canEdit && draft && !isEditing && <Button type="button" onClick={() => setIsEditing(true)}>수정</Button>}
|
||||
{canEdit && draft && isEditing && (
|
||||
{canDelete && draft && <Button type="button" variant="destructive" onClick={deletePerformance}>삭제</Button>}
|
||||
{canModify && draft && !isEditing && <Button type="button" onClick={() => setIsEditing(true)}>수정</Button>}
|
||||
{canModify && draft && isEditing && (
|
||||
<>
|
||||
<Button type="button" onClick={save}>저장</Button>
|
||||
<Button type="button" variant="outline" onClick={() => { resetDraft(); setIsEditing(false); }}>취소</Button>
|
||||
|
||||
@@ -24,10 +24,11 @@ import {SaveTemplateRequest, Template} from "@/types/notification";
|
||||
import {UserCompact} from "@/types/gwcf";
|
||||
import {getDetailValue} from "@/lib/gwcf/view";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {buildUserMsgParam} from "@/lib/gwcf/notification";
|
||||
import { buildUserMsgParam, isPhoneVerificationSupported} from "@/lib/gwcf/notification";
|
||||
import {getSmsParamLabel} from "@/lib/gwcf/field-labels";
|
||||
import {TMPLAT_PURPOSE} from "@/types/notification";
|
||||
|
||||
type TemplateDraft = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
||||
type TemplateDraft = Pick<Template, "tmplatIdx" | "tmplatTy" | "tmplatPurpose" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
||||
|
||||
const EMPTY_DENY_PARAM_KEYS: string[] = [];
|
||||
|
||||
@@ -35,6 +36,8 @@ const toText = (value: string | null | undefined) => value ?? "";
|
||||
|
||||
const toDraft = (template: Template, isNewMessage = false): TemplateDraft => ({
|
||||
tmplatIdx: template.tmplatIdx,
|
||||
tmplatTy: template.tmplatTy,
|
||||
tmplatPurpose: isPhoneVerificationSupported(template) ? template.tmplatPurpose ?? TMPLAT_PURPOSE.NORMAL : TMPLAT_PURPOSE.NORMAL,
|
||||
tmplatNm: toText(template.tmplatNm),
|
||||
tmplatTitle: isNewMessage ? "" : toText(template.tmplatTitle),
|
||||
tmplatBody: isNewMessage ? "" : toText(template.tmplatBody),
|
||||
@@ -163,6 +166,7 @@ export function SmsSendDialog({
|
||||
|
||||
const payload: SaveTemplateRequest = {
|
||||
tmplatIdx: draft.tmplatIdx,
|
||||
tmplatPurpose: draft.tmplatPurpose,
|
||||
tmplatNm: draft.tmplatNm,
|
||||
tmplatTitle: draft.tmplatTitle,
|
||||
tmplatBody: draft.tmplatBody,
|
||||
@@ -205,6 +209,8 @@ export function SmsSendDialog({
|
||||
setDraft(null);
|
||||
};
|
||||
|
||||
const isSmsOrLms = draft ? isPhoneVerificationSupported(draft) : false;
|
||||
|
||||
const send = async () => {
|
||||
if (!draft) return;
|
||||
|
||||
@@ -306,6 +312,7 @@ export function SmsSendDialog({
|
||||
{templatesQuery.data.map((template) => (
|
||||
<SelectItem key={template.tmplatIdx} value={String(template.tmplatIdx)}>
|
||||
{toText(template.tmplatNm) || `${template.tmplatIdx}`}
|
||||
{template.tmplatPurpose === TMPLAT_PURPOSE.PHONE_VERIFICATION && " (인증)"}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
@@ -320,6 +327,24 @@ export function SmsSendDialog({
|
||||
<span className="font-medium">제목</span>
|
||||
<Input value={draft.tmplatTitle} disabled={!canEdit || isBusy} onChange={(event) => updateDraft("tmplatTitle", event.target.value)} />
|
||||
</label>
|
||||
{isSmsOrLms && (
|
||||
<label className="space-y-1 text-sm">
|
||||
<span className="font-medium">템플릿 용도</span>
|
||||
<Select
|
||||
value={String(draft.tmplatPurpose)}
|
||||
onValueChange={(value) => updateDraft("tmplatPurpose", Number(value))}
|
||||
disabled={!canEdit || isBusy}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={String(TMPLAT_PURPOSE.NORMAL)}>일반</SelectItem>
|
||||
<SelectItem value={String(TMPLAT_PURPOSE.PHONE_VERIFICATION)}>휴대전화번호 인증</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</label>
|
||||
)}
|
||||
<label className="space-y-1 text-sm">
|
||||
<span className="font-medium">내용</span>
|
||||
<textarea
|
||||
|
||||
@@ -10,6 +10,7 @@ export function FilterSelect({
|
||||
placeholder,
|
||||
className,
|
||||
useClear = true,
|
||||
clearLabel = "전체",
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
@@ -17,6 +18,7 @@ export function FilterSelect({
|
||||
placeholder: string;
|
||||
className?: string;
|
||||
useClear?: boolean;
|
||||
clearLabel?: string;
|
||||
}) {
|
||||
return (
|
||||
<KriSingleSelect
|
||||
@@ -27,7 +29,7 @@ export function FilterSelect({
|
||||
getValue={(item) => String(item.codeValue)}
|
||||
getLabel={(item) => item.codeLabel}
|
||||
useClear={useClear}
|
||||
clearLabel="전체"
|
||||
clearLabel={clearLabel}
|
||||
widthClassName={className}
|
||||
spanClassName="text-sm"
|
||||
badgeClassName="text-sm"
|
||||
|
||||
@@ -18,6 +18,7 @@ export const USER_FIELD_LABELS = {
|
||||
export const PERFORMANCE_FIELD_LABELS = {
|
||||
no: "No.",
|
||||
id: "연번",
|
||||
NCAS: "관리번호",
|
||||
monitoringAdd: "분류",
|
||||
businessType: "사업유형",
|
||||
performanceGenre: "분야(장르)",
|
||||
@@ -39,6 +40,9 @@ export const PERFORMANCE_FIELD_LABELS = {
|
||||
timeTreeCheckDt: "타임트리 확인일시",
|
||||
monitoringAddress: "방문 장소",
|
||||
checkReport: "보고서 확인여부",
|
||||
UpdateNoticeTarget: "변경 사항",
|
||||
UpdateNoticeMemo: "변경 내용",
|
||||
UpdateNoticeDt: "변경 일시",
|
||||
performanceId: "사업 ID",
|
||||
monitoringPaymentDate: "요원 비용지급일",
|
||||
} as const;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {downloadFile} from "@/lib/utils";
|
||||
import {buildWrittenReviewLink} from "@/config/gwcf.config";
|
||||
import {PDF_CONVERT_STATUS, PdfConvertStatus} from "@/types/gwcf";
|
||||
|
||||
const REVIEW_TIMESTAMP_PREFIX = /^\d{4}-\d{2}-\d{2}_\d{6}_/;
|
||||
|
||||
@@ -74,6 +75,27 @@ export const getReviewPdfDownloadName = (
|
||||
pdfFileName?: string
|
||||
) => removeTimestampPrefix(pdfFileName) || `review-pdf-${performanceId}-${reviewType}.pdf`;
|
||||
|
||||
export const getReviewPdfDisabled = (
|
||||
userId: string | undefined,
|
||||
pdfFileName?: string,
|
||||
pdfConvert?: PdfConvertStatus
|
||||
) => !userId || !pdfFileName || pdfConvert !== PDF_CONVERT_STATUS.COMPLETED;
|
||||
|
||||
export const getReviewPdfStatusLabel = (
|
||||
pdfConvert?: PdfConvertStatus
|
||||
) => {
|
||||
switch (pdfConvert) {
|
||||
case PDF_CONVERT_STATUS.COMPLETED:
|
||||
return "PDF";
|
||||
case PDF_CONVERT_STATUS.FAILED:
|
||||
case PDF_CONVERT_STATUS.NOT_TARGET:
|
||||
return "변환 실패";
|
||||
case PDF_CONVERT_STATUS.IN_PROGRESS:
|
||||
default:
|
||||
return "변환 중";
|
||||
}
|
||||
}
|
||||
|
||||
export const getEvidenceZipDownloadName = (performanceId: number, userId: string) =>
|
||||
`도착 증빙_${performanceId}_${userId}.zip`;
|
||||
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
import {PerformanceFull, UserCompact} from "@/types/gwcf";
|
||||
import {TMPLAT_PURPOSE, Template} from "@/types/notification";
|
||||
|
||||
export const PHONE_VERIFICATION_PREVIEW = "인증번호는 [######] 입니다.";
|
||||
|
||||
export const isPhoneVerificationSupported = (template: Pick<Template, "tmplatTy">) =>
|
||||
template.tmplatTy === 10 || template.tmplatTy === 20;
|
||||
|
||||
export const buildTemplatePreviewBody = (template: Pick<Template, "tmplatBody" | "tmplatPurpose">) =>
|
||||
template.tmplatPurpose === TMPLAT_PURPOSE.PHONE_VERIFICATION
|
||||
? `${template.tmplatBody}\n${PHONE_VERIFICATION_PREVIEW}`
|
||||
: template.tmplatBody;
|
||||
|
||||
export const getSmsByteLength = (value: string) =>
|
||||
Array.from(value).reduce((total, character) => total + (character.charCodeAt(0) > 0x7f ? 2 : 1), 0);
|
||||
|
||||
export const toNotificationParamValue = (value: unknown) => value == null ? "" : String(value);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export const getRoleGroup = (role?: number | null) => {
|
||||
return Math.floor(role / 1000) * 1000;
|
||||
};
|
||||
|
||||
export const isResearcherRole = (role?: number | null) => !role ? false : role <= ROLE.RESEARCHER;
|
||||
export const isInternalRole = (role?: number | null) => getRoleGroup(role) === 1000;
|
||||
export const isExternalRole = (role?: number | null) => getRoleGroup(role) === 2000;
|
||||
export const isMonitoringRole = (role?: number | null) => getRoleGroup(role) === 9000;
|
||||
|
||||
@@ -119,7 +119,7 @@ const getErrorMessage = (data: unknown) => {
|
||||
export const createHttpClient = (baseURL: string, opts: HttpClientOptions = {}) => {
|
||||
const {
|
||||
getToken,
|
||||
defaultTimeoutMs = 60_000,
|
||||
defaultTimeoutMs = 300_000,
|
||||
defaultHeaders = { "content-type": "application/json" },
|
||||
setErrorMessage,
|
||||
} = opts;
|
||||
@@ -305,7 +305,10 @@ export const createHttpClient = (baseURL: string, opts: HttpClientOptions = {})
|
||||
const putForm = <T = unknown>(path: string, form: FormData, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "PUT", form });
|
||||
|
||||
return { request, get, post, put, patch, del, postForm, putForm };
|
||||
const patchForm = <T = unknown>(path: string, form: FormData, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "PATCH", form });
|
||||
|
||||
return { request, get, post, put, patch, del, postForm, putForm, patchForm };
|
||||
};
|
||||
|
||||
export const nextApi = createHttpClient(clientEnv.API_BASE);
|
||||
|
||||
@@ -17,6 +17,7 @@ export const CODE_GROUPS = [
|
||||
"review_type",
|
||||
"staff_type",
|
||||
"ticket_reservation_status",
|
||||
"update_notice_target",
|
||||
"user_role",
|
||||
] as const;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import {useMutation, useQueries, useQuery} from "@tanstack/react-query";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {BulkSendResponse, SaveTemplateRequest, SendSmsBulkRequest, Template} from "@/types/notification";
|
||||
import {BulkSendResponse, CreateTemplateRequest, SaveTemplateRequest, SendSmsBulkRequest, Template, TemplateListItem} from "@/types/notification";
|
||||
|
||||
export const SMS_TEMPLATE_IDS = {
|
||||
ACCOUNT_MONITORING: 45,
|
||||
@@ -37,10 +37,39 @@ export function useNotificationTemplatesQuery(templateIdxList: number[], enabled
|
||||
});
|
||||
}
|
||||
|
||||
export function useNotificationTemplateListQuery(chnnlTy: number, itrntPrjctCd: string, enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: ["notification", "template-list", chnnlTy, itrntPrjctCd],
|
||||
queryFn: () => nextApi.get<TemplateListItem[]>(`/notification/template/list/${encodeURIComponent(chnnlTy)}/${encodeURIComponent(itrntPrjctCd)}`),
|
||||
enabled: enabled && Boolean(itrntPrjctCd),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreateNotificationTemplateMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (data: CreateTemplateRequest) => {
|
||||
const formData = new FormData();
|
||||
formData.append(
|
||||
"template",
|
||||
new Blob([JSON.stringify(data)], {type: "application/json"})
|
||||
);
|
||||
|
||||
return nextApi.putForm<Template>("/notification/template", formData);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useSaveNotificationTemplateMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (data: SaveTemplateRequest) =>
|
||||
nextApi.patch<Template>("/notification/template", data),
|
||||
mutationFn: (data: SaveTemplateRequest) => {
|
||||
const formData = new FormData();
|
||||
formData.append(
|
||||
"template",
|
||||
new Blob([JSON.stringify(data)], {type: "application/json"})
|
||||
);
|
||||
|
||||
return nextApi.patchForm<Template>("/notification/template", formData);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,24 @@ export function useUploadReviewFileMutation() {
|
||||
const qc = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({performanceId, reviewType, file}: {performanceId: number; reviewType: number; file: File}) => {
|
||||
mutationFn: ({
|
||||
performanceId,
|
||||
reviewType,
|
||||
file,
|
||||
paramUserId,
|
||||
}: {
|
||||
performanceId: number;
|
||||
reviewType: number;
|
||||
file: File;
|
||||
paramUserId?: string;
|
||||
}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file, file.name);
|
||||
return nextApi.postForm<PerformanceReview>(`/review/${performanceId}/${reviewType}`, formData);
|
||||
return nextApi.postForm<PerformanceReview>(
|
||||
`/review/${performanceId}/${reviewType}`,
|
||||
formData,
|
||||
{query: paramUserId ? {paramUserId} : undefined}
|
||||
);
|
||||
},
|
||||
onSuccess: (_res, {performanceId, reviewType}) => {
|
||||
qc.invalidateQueries({ queryKey: ["review", performanceId, reviewType] });
|
||||
|
||||
@@ -117,6 +117,15 @@ export type PerformanceMonitoringVisit = {
|
||||
gpsRaw: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export const PDF_CONVERT_STATUS = {
|
||||
IN_PROGRESS: 0,
|
||||
COMPLETED: 1,
|
||||
NOT_TARGET: 8,
|
||||
FAILED: 9,
|
||||
} as const;
|
||||
|
||||
export type PdfConvertStatus = typeof PDF_CONVERT_STATUS[keyof typeof PDF_CONVERT_STATUS];
|
||||
|
||||
export type PerformanceReview = {
|
||||
performanceId: number;
|
||||
reviewType: number;
|
||||
@@ -124,7 +133,7 @@ export type PerformanceReview = {
|
||||
reviewDt: string;
|
||||
reviewStatus: number;
|
||||
uploadFileName: string;
|
||||
pdfConvert: boolean;
|
||||
pdfConvert: PdfConvertStatus;
|
||||
pdfFileName: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export type Template = {
|
||||
itrntPrjctCd: string;
|
||||
tmplatTy: number;
|
||||
tmplatPurpose: number;
|
||||
tmplatNm: string;
|
||||
tmplatTitle: string;
|
||||
tmplatBody: string;
|
||||
@@ -15,6 +16,18 @@ export type Template = {
|
||||
tmplatIdx: number;
|
||||
};
|
||||
|
||||
export const TMPLAT_PURPOSE = {
|
||||
NORMAL: 0,
|
||||
PHONE_VERIFICATION: 1,
|
||||
} as const;
|
||||
|
||||
export type TemplatePurpose = (typeof TMPLAT_PURPOSE)[keyof typeof TMPLAT_PURPOSE];
|
||||
|
||||
export type CreateTemplateRequest = Pick<
|
||||
Template,
|
||||
"itrntPrjctCd" | "tmplatTy" | "tmplatPurpose" | "tmplatNm" | "tmplatBody" | "sendTel" | "sendNm"
|
||||
>;
|
||||
|
||||
export type SmsDestination = {
|
||||
sid?: string;
|
||||
destTel: string;
|
||||
@@ -22,7 +35,9 @@ export type SmsDestination = {
|
||||
msgParam?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type SaveTemplateRequest = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
||||
export type SaveTemplateRequest = Pick<Template, "tmplatIdx" | "tmplatPurpose" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
||||
|
||||
export type TemplateListItem = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatPurpose">;
|
||||
|
||||
export type SendSmsBulkRequest = {
|
||||
templateIdx: number;
|
||||
|
||||
Reference in New Issue
Block a user