Skip to content

feat(tourism): add tour crew assignments (leader/driver/guide)#7606

Merged
uuganaa1007 merged 1 commit into
mainfrom
feat/tourism-tour-crew-assignments
May 6, 2026
Merged

feat(tourism): add tour crew assignments (leader/driver/guide)#7606
uuganaa1007 merged 1 commit into
mainfrom
feat/tourism-tour-crew-assignments

Conversation

@tsebaa0310
Copy link
Copy Markdown
Collaborator

@tsebaa0310 tsebaa0310 commented May 5, 2026

Summary by Sourcery

Add support for assigning and managing tour crew roles (leader, driver, guide, etc.) on tours across create, edit, view, and duplicate flows.

New Features:

  • Introduce a Tour Crew form section allowing multiple team members to be assigned to a tour with explicit roles.
  • Add predefined guide/crew role types and labels for use across the tourism UI.

Enhancements:

  • Normalize and validate tour guide/crew data structures in schemas, hooks, and duplication logic to consistently use guideId and role type fields.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added crew member management to tour creation and editing workflows
    • Team members can now be assigned with role types (Leader, Guide, Driver, Assistant, Translator, Cook, Porter, Other)
    • Crew information is now properly preserved when editing or duplicating tours

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 5, 2026

Reviewer's Guide

Implements tour crew assignments by adding a reusable TourGuidesField form section, wiring it into create/edit/duplicate flows, extending the tour detail type and GraphQL query to include guides, and enforcing validation of crew role and member selections.

Sequence diagram for creating a tour with crew assignments

sequenceDiagram
  actor User
  participant TourCreateForm
  participant TourGuidesField
  participant ZodValidator
  participant GraphQLClient
  participant BackendAPI

  User->>TourCreateForm: Open create tour page
  TourCreateForm->>TourGuidesField: Render with control

  User->>TourGuidesField: Click Add Crew Member
  TourGuidesField->>TourGuidesField: useFieldArray.append { guideId: '', type: 'guide' }

  User->>TourGuidesField: Select role (type)
  TourGuidesField->>TourGuidesField: Update guides[index].type

  User->>TourGuidesField: Select team member
  TourGuidesField->>TourGuidesField: Update guides[index].guideId

  User->>TourCreateForm: Submit form
  TourCreateForm->>ZodValidator: Validate TourCreateFormSchema with guides
  ZodValidator-->>TourCreateForm: guides[] valid or errors

  alt Validation_fails
    ZodValidator-->>TourGuidesField: Errors for role or team member
    TourGuidesField-->>User: Show Role_is_required and Team_member_is_required
  else Validation_succeeds
    TourCreateForm->>GraphQLClient: mutate createTour with guides[{ guideId, type }]
    GraphQLClient->>BackendAPI: POST createTour variables
    BackendAPI-->>GraphQLClient: Created tour with guides
    GraphQLClient-->>TourCreateForm: Response data
    TourCreateForm-->>User: Navigate or show success
  end
Loading

Sequence diagram for duplicating a tour including crew assignments

sequenceDiagram
  actor User
  participant TourDuplicateSheet
  participant cloneTourGuides
  participant GraphQLClient
  participant BackendAPI

  User->>TourDuplicateSheet: Open duplicate tour sheet
  TourDuplicateSheet->>BackendAPI: Fetch existing tour detail (includes guides)
  BackendAPI-->>TourDuplicateSheet: ITourDetail with guides[]

  TourDuplicateSheet->>cloneTourGuides: Prepare guides for duplication
  cloneTourGuides-->>TourDuplicateSheet: Array<{ guideId, type }>

  User->>TourDuplicateSheet: Adjust crew assignments if needed

  User->>TourDuplicateSheet: Confirm duplicate
  TourDuplicateSheet->>GraphQLClient: mutate createTour with guides from cloneTourGuides
  GraphQLClient->>BackendAPI: POST createTour variables including guides
  BackendAPI-->>GraphQLClient: New duplicated tour with guides
  GraphQLClient-->>TourDuplicateSheet: Response data
  TourDuplicateSheet-->>User: Show duplicated tour
Loading

Class diagram for updated tour guide and crew assignment types

classDiagram
  class ITourGuide {
    +string guideId
    +string type
  }

  class ITourDetail {
    +string _id
    +string branchId
    +string name
    +number advancePercent
    +string content
    +number cost
    +ITourGuide[] guides
  }

  class GuideFormValue {
    +string guideId
    +string type
  }

  class GuideSchema {
  }

  class GuideType {
  }

  class GUIDE_TYPES {
    <<constant>>
    +GuideType value
    +string label
  }

  class GUIDE_TYPE_LABELS {
    <<constant>>
    +Record~string,string~ entries
  }

  class ICreateTourVariables {
    +string branchId
    +string name
    +number groupSize
    +number duration
    +number cost
    +Array guides
  }

  class IEditTourVariables {
    +string _id
    +string name
    +number groupSize
    +number duration
    +number cost
    +Array guides
  }

  class CreateTourGuideItem {
    +string guideId
    +string type
  }

  class EditTourGuideItem {
    +string guideId
    +string type
  }

  class TourGuidesField {
    +Control control
    +handleAdd()
  }

  class TourCreateForm {
    +TourFormValues defaultValues
  }

  class TourEditForm {
    +TourFormValues defaultValues
  }

  class TourFormValues {
    +ITourGuide[] guides
  }

  ITourDetail "0..1" --> "0..*" ITourGuide : guides
  GuideSchema <|-- GuideFormValue
  GUIDE_TYPES --> GuideType
  GUIDE_TYPE_LABELS --> GuideType

  ICreateTourVariables "0..1" --> "0..*" CreateTourGuideItem : guides
  IEditTourVariables "0..1" --> "0..*" EditTourGuideItem : guides

  TourFormValues "0..1" --> "0..*" ITourGuide : guides
  TourCreateForm --> TourFormValues
  TourEditForm --> TourFormValues
  TourCreateForm --> TourGuidesField
  TourEditForm --> TourGuidesField
Loading

File-Level Changes

Change Details Files
Add reusable TourGuidesField component to manage tour crew assignments within the tour form UI.
  • Introduce TourGuidesField React component using useFieldArray over the guides field in the tour form values
  • Render a dynamic list of crew entries with required role and team member selectors, backed by GUIDE_TYPES options
  • Provide UI affordances to add and remove crew members, including empty-state messaging and accessibility labels
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourFormFields.tsx
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts
Wire tour crew field into tour create, edit, and duplicate workflows, including data normalization.
  • Include TourGuidesField in TourCreateForm and TourEditForm layouts under a new Crew section separator
  • Initialize form guides state in TourEditForm from tour.guides, filtering invalid entries and defaulting role type to guide
  • Add cloneTourGuides helper in TourDuplicateSheet and pass normalized guides into both fixed and flexible duplicate mutations
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourEditForm.tsx
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourCreateForm.tsx
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourDuplicateSheet.tsx
Extend tour data model, validation schema, and API contracts to support typed tour guides with roles instead of names.
  • Tighten GuideSchema to require non-empty guideId and type fields and export GuideFormValue for form typing
  • Add ITourGuide interface and guides property to ITourDetail to model crew assignments in tour detail hook
  • Update GraphQL GET_TOUR_DETAIL query to fetch guides with guideId and type
  • Adjust create and edit tour variable typings so guides entries carry type instead of name
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/formSchema.ts
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useTourDetail.ts
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/graphql/queries.ts
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useCreateTour.ts
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useEditTour.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

📝 Walkthrough

Walkthrough

This PR adds guide and crew member management to the tour creation and editing workflows. It introduces a new TourGuidesField component, updates form schemas to capture guide role assignments, normalizes guide data across create/edit/duplicate operations, and extends the GraphQL query to fetch guide information from the backend.

Changes

Tour Guide Management

Layer / File(s) Summary
Type Definitions & Constants
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts, frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useTourDetail.ts
New ITourGuide interface with guideId and type fields; GUIDE_TYPES constant array defines available guide roles (leader, guide, driver, etc.); GUIDE_TYPE_LABELS provides a lookup map.
Form Schema & Variables
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/formSchema.ts, frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useCreateTour.ts, frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useEditTour.ts
GuideSchema redefined to require guideId and type (removing optional name); ICreateTourVariables and IEditTourVariables updated to expect guides with { guideId, type } shape.
GraphQL Query
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/graphql/queries.ts
GET_TOUR_DETAIL query extended to fetch guides { guideId type } from the bmsTourDetail selection set.
UI Component
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourFormFields.tsx
New exported TourGuidesField component manages a guides field array with "Add Crew Member" button, role selector (via GUIDE_TYPES), team member picker (via SelectMember), and remove controls per guide.
Form Integration & Data Normalization
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourCreateForm.tsx, frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourEditForm.tsx, frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourDuplicateSheet.tsx
Render TourGuidesField in "Crew" section; TourEditForm initializes guides from tour.guides (filtering and normalizing to { guideId, type }); TourDuplicateSheet applies cloneTourGuides helper to normalize guides in duplication payloads.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • erxes/erxes#7283: Modifies the same tour form schema and component files to add guide-related fields alongside pricing and language fields.

Poem

🐰 A crew comes together with types so bright,
Guides, drivers, leaders—all in sight!
Form fields dance and guides align,
Tours now crew together, oh so fine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding crew assignments (leader/driver/guide types) to tours, which is reflected across all file modifications including new TourGuidesField component, guide type constants, and schema updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tourism-tour-crew-assignments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • Consider reusing the cloneTourGuides helper (or a shared normalizer) in TourEditForm when mapping tour.guides so the normalization logic for guides/crew stays consistent in one place.
  • You introduced a GuideType union but the GuideSchema, ITourGuide, and form fields still use plain string for type; tightening these to GuideType (and possibly a z.enum) would make role handling more type-safe and aligned with GUIDE_TYPES.
  • The guides/crew-related types in useCreateTour and useEditTour are manually duplicated; you might reduce drift by reusing a shared guide/crew type (e.g., derived from GuideSchema or ITourGuide).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider reusing the `cloneTourGuides` helper (or a shared normalizer) in `TourEditForm` when mapping `tour.guides` so the normalization logic for guides/crew stays consistent in one place.
- You introduced a `GuideType` union but the `GuideSchema`, `ITourGuide`, and form fields still use plain `string` for `type`; tightening these to `GuideType` (and possibly a `z.enum`) would make role handling more type-safe and aligned with `GUIDE_TYPES`.
- The guides/crew-related types in `useCreateTour` and `useEditTour` are manually duplicated; you might reduce drift by reusing a shared guide/crew type (e.g., derived from `GuideSchema` or `ITourGuide`).

## Individual Comments

### Comment 1
<location path="frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/formSchema.ts" line_range="111-113" />
<code_context>
 /* ================= GUIDE ================= */

 const GuideSchema = z.object({
-  guideId: z.string(),
-  name: z.string().optional(),
+  guideId: z.string().min(1, 'Team member is required'),
+  type: z.string().min(1, 'Role is required'),
 });

</code_context>
<issue_to_address>
**suggestion (bug_risk):** Constrain guide `type` to the known guide type values instead of any string

`type` is currently `z.string().min(1, ...)`, so any non-empty string passes. Since guide types are fixed in `GUIDE_TYPES`, use `z.enum([...])` (or a union derived from `GUIDE_TYPES`) so validation only accepts valid types and stays aligned with the select options.

Suggested implementation:

```typescript
  guideId: z.string().min(1, 'Team member is required'),
  type: z.enum(GUIDE_TYPES, {
    required_error: 'Role is required',
    invalid_type_error: 'Role is required',
  }),

```

1. Ensure `GUIDE_TYPES` is imported into this file, e.g.:
   `import { GUIDE_TYPES } from './path/to/guideConstants';`
   (adjust the import path to match your existing constants).
2. `GUIDE_TYPES` must be a readonly tuple or array of string literals compatible with `z.enum`, e.g.
   `export const GUIDE_TYPES = ['LEAD', 'ASSISTANT'] as const;`
   so that `z.enum(GUIDE_TYPES, ...)` works correctly.
</issue_to_address>

### Comment 2
<location path="frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts" line_range="14-19" />
<code_context>
+
+export type GuideType = (typeof GUIDE_TYPES)[number]['value'];
+
+export const GUIDE_TYPE_LABELS: Record<string, string> = GUIDE_TYPES.reduce(
+  (acc, opt) => {
+    acc[opt.value] = opt.label;
+    return acc;
+  },
+  {} as Record<string, string>,
+);
</code_context>
<issue_to_address>
**suggestion:** Tighten the typing of `GUIDE_TYPE_LABELS` to the specific guide type union

You already export `GuideType = (typeof GUIDE_TYPES)[number]['value']`, but `GUIDE_TYPE_LABELS` is typed as `Record<string, string>`. Use `Record<GuideType, string>` for both the constant and the reducer accumulator so missing or extra keys are flagged at compile time.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 111 to +113
const GuideSchema = z.object({
guideId: z.string(),
name: z.string().optional(),
guideId: z.string().min(1, 'Team member is required'),
type: z.string().min(1, 'Role is required'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Constrain guide type to the known guide type values instead of any string

type is currently z.string().min(1, ...), so any non-empty string passes. Since guide types are fixed in GUIDE_TYPES, use z.enum([...]) (or a union derived from GUIDE_TYPES) so validation only accepts valid types and stays aligned with the select options.

Suggested implementation:

  guideId: z.string().min(1, 'Team member is required'),
  type: z.enum(GUIDE_TYPES, {
    required_error: 'Role is required',
    invalid_type_error: 'Role is required',
  }),
  1. Ensure GUIDE_TYPES is imported into this file, e.g.:
    import { GUIDE_TYPES } from './path/to/guideConstants';
    (adjust the import path to match your existing constants).
  2. GUIDE_TYPES must be a readonly tuple or array of string literals compatible with z.enum, e.g.
    export const GUIDE_TYPES = ['LEAD', 'ASSISTANT'] as const;
    so that z.enum(GUIDE_TYPES, ...) works correctly.

Comment on lines +14 to +19
export const GUIDE_TYPE_LABELS: Record<string, string> = GUIDE_TYPES.reduce(
(acc, opt) => {
acc[opt.value] = opt.label;
return acc;
},
{} as Record<string, string>,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Tighten the typing of GUIDE_TYPE_LABELS to the specific guide type union

You already export GuideType = (typeof GUIDE_TYPES)[number]['value'], but GUIDE_TYPE_LABELS is typed as Record<string, string>. Use Record<GuideType, string> for both the constant and the reducer accumulator so missing or extra keys are flagged at compile time.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

🌗 Pull Request Overview

This PR implements tour crew assignment functionality for the tourism plugin, allowing users to assign team members (leaders, drivers, guides, etc.) to tours. It adds a new TourGuidesField component, updates form schemas, and ensures crew data is properly handled during tour creation, editing, and duplication.

Reviewed Changes
Kimi performed full review on 10 changed files and found 1 issue.

Show a summary per file
File Description
TourCreateForm.tsx Added TourGuidesField import and rendered crew section in create form
TourDuplicateSheet.tsx Added cloneTourGuides helper to preserve crew assignments when duplicating tours
TourEditForm.tsx Added crew field import and initialization logic for editing tours with crew data
TourFormFields.tsx New TourGuidesField component with role selection and team member assignment
formSchema.ts Updated GuideSchema to make guideId and type required fields with validation
guideTypes.ts New constant file defining crew role types (leader, guide, driver, etc.)
queries.ts Added guides field to GraphQL tour detail query
useCreateTour.ts Updated guide type definition to use type field instead of optional name
useEditTour.ts Updated guide type definition to use type field instead of optional name
useTourDetail.ts Added ITourGuide interface and guides property to tour detail type

📋 Review Findings

📄 TourFormFields.tsx

🟡 MEDIUM code-quality: Inconsistent margin class for delete button

Line 796 (in the TourGuidesField component)

The delete button uses a hardcoded mt-7 class to align with the form fields above. This creates a fragile layout that breaks if label heights or spacing change.

💡 Suggested fix:

Use flexbox alignment on the parent container instead of hardcoded margin:

// Current:
<div className="grid grid-cols-[1fr_1fr_auto] gap-3 items-start p-3 border rounded-lg bg-card">
  {/* ... fields ... */}
  <Button className="mt-7">...</Button>
</div>

// Improved:
<div className="grid grid-cols-[1fr_1fr_auto] gap-3 items-stretch p-3 border rounded-lg bg-card">
  {/* Form.Field wrappers should flex properly */}
  <Button className="self-center">...</Button>
</div>

Or alternatively, use a consistent layout pattern with the existing form fields by wrapping the button in a flex container:

<div className="flex flex-col justify-end h-full pt-6">
  <Button variant="ghost" size="icon" onClick={() => remove(index)}>
    <IconTrash size={16} />
  </Button>
</div>

📄 TourDuplicateSheet.tsx

🟢 INFO code-quality: Type guard pattern

Lines 29-33

The cloneTourGuides function correctly uses a type guard with Boolean(g?.guideId) to filter out invalid entries. Good defensive programming.


📄 TourEditForm.tsx

🟢 INFO `code-quality**: Consistent data transformation

Lines 245-250

The filtering and mapping logic for initial form values matches the pattern in TourDuplicateSheet.tsx, ensuring data consistency. The type guard usage is appropriate here.


📄 guideTypes.ts

🟢 INFO: No issues

Clean constant definition with proper TypeScript const assertions and derived type generation.


📄 Remaining Files (TourCreateForm.tsx, formSchema.ts, queries.ts, useCreateTour.ts, useEditTour.ts, useTourDetail.ts)

No issues found - All changes are straightforward and well-implemented:

  • Schema validation properly enforces required fields
  • GraphQL query correctly requests the new fields
  • Type definitions are consistent across hooks
  • Form integration follows existing patterns


Powered by Kimi | Model: kimi-k2.5

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
8.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts (1)

1-20: 💤 Low value

LGTM – clean centralized definition; as const + indexed access type for GuideType is idiomatic.

One optional improvement worth noting: GuideType is exported but never applied back to ITourGuide.type, the mutation variable guides[].type, or GUIDE_TYPE_LABELS — narrowing those to GuideType / Record<GuideType, string> would catch accidental invalid role strings at compile time.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts`
around lines 1 - 20, Update usages to tighten types: change the ITourGuide.type
property and any mutable guides[].type to use the exported GuideType, and change
GUIDE_TYPE_LABELS to Record<GuideType, string> so invalid role strings are
caught at compile time; when updating GUIDE_TYPE_LABELS also adjust the reduce
accumulator typing from Record<string,string> to Record<GuideType,string> (or
initialize with an empty object cast as that type) to keep type safety
consistent with GUIDE_TYPES.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourCreateForm.tsx`:
- Around line 485-488: This component currently renders three hardcoded labels
("Crew", "Pricing Info", "More Info"); import useTranslation from
'react-i18next' at the top and call const { t } = useTranslation() inside the
TourCreateForm component, then replace the literal strings in the JSX with
translation calls (e.g., replace "Crew" with t('tms.tour.crew'), "Pricing Info"
with t('tms.tour.pricingInfo'), and "More Info" with t('tms.tour.moreInfo'));
ensure the import and const are added near existing imports and component
initialization so the references in the JSX (the div containing Form.Label and
the other label locations) resolve correctly.

---

Nitpick comments:
In
`@frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts`:
- Around line 1-20: Update usages to tighten types: change the ITourGuide.type
property and any mutable guides[].type to use the exported GuideType, and change
GUIDE_TYPE_LABELS to Record<GuideType, string> so invalid role strings are
caught at compile time; when updating GUIDE_TYPE_LABELS also adjust the reduce
accumulator typing from Record<string,string> to Record<GuideType,string> (or
initialize with an empty object cast as that type) to keep type safety
consistent with GUIDE_TYPES.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a02756ca-d326-4914-a1ce-72eb006d8bd3

📥 Commits

Reviewing files that changed from the base of the PR and between 4ec3bac and f202c97.

📒 Files selected for processing (10)
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourCreateForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourDuplicateSheet.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourEditForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/_components/TourFormFields.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/formSchema.ts
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/constants/guideTypes.ts
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/graphql/queries.ts
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useCreateTour.ts
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useEditTour.ts
  • frontend/plugins/tourism_ui/src/modules/tms/branch-detail/dashboard/tours/hooks/useTourDetail.ts

@uuganaa1007 uuganaa1007 merged commit a79abbf into main May 6, 2026
18 of 21 checks passed
@uuganaa1007 uuganaa1007 deleted the feat/tourism-tour-crew-assignments branch May 6, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants