Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const commonFields = `
`;

export const types = `

extend type Customer @key(fields: "_id") {
_id: String! @external
}
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

eniig ustgah empty state iig icon ashiglaj shiideh

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/plugins/tourism_ui/src/config.ts
Copy link
Collaborator

Choose a reason for hiding this comment

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

ene hediig false bolgoh

Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export const CONFIG: IUIConfig = {
icon: IconSandbox,
path: 'pms',
hasSettings: true,
hasRelationWidget: true,
hasWidgets: true,
},
{
name: 'tms',
icon: IconBox,
path: 'tms',
hasSettings: true,
hasRelationWidget: true,
hasWidgets: true,
// submenus: [
// {
// name: 'submenu1',
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

~modules/ -> @/ bolgoh

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import BranchCard from '~/modules/pms/components/ui/branchCard';

const PmsBranchList = () => {
return (
<div className="h-full grid lg:grid-cols-3 xl:grid-cols-4 gap-4 p-5">
<BranchCard />
</div>
);
};
export default PmsBranchList;
Comment on lines +1 to +10
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Component renders single card instead of a list.

The component name PmsBranchList suggests it should render multiple branch cards, but it only renders a single BranchCard without any props or data. This seems inconsistent with the expected list functionality.

Consider implementing proper list functionality:

-const PmsBranchList = () => {
+interface PmsBranchListProps {
+  branches?: Branch[];
+}
+
+const PmsBranchList = ({ branches = [] }: PmsBranchListProps) => {
   return (
     <div className="h-full grid lg:grid-cols-3 xl:grid-cols-4 gap-4 p-5">
-      <BranchCard />
+      {branches.map((branch) => (
+        <BranchCard key={branch._id} branch={branch} />
+      ))}
     </div>
   );
 };

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In frontend/plugins/tourism_ui/src/modules/pms/components/pmsBranchList.tsx
lines 1 to 10, the PmsBranchList component currently renders only a single
BranchCard, which contradicts its name implying a list. To fix this, modify the
component to accept an array of branch data as props or fetch it internally,
then map over this array to render multiple BranchCard components, passing
appropriate props to each card to display distinct branch information.

Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,9 @@ import PmsFormFieldsLayout from '../PmsFormFieldsLayout';
import Heading from '../../ui/heading';
import { IconPlus, IconTrash } from '@tabler/icons-react';
import { PmsBranchFormType } from '@/pms/constants/formSchema';
import { SelectMember } from 'ui-modules';

const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
const options: MultiSelectOption[] = [
{ value: 'apple', label: 'Apple' },
{ value: 'banana', label: 'Banana' },
{ value: 'orange', label: 'Orange' },
{ value: 'grape', label: 'Grape' },
{ value: 'strawberry', label: 'Strawberry' },
{ value: 'watermelon', label: 'Watermelon' },
{ value: 'kiwi', label: 'Kiwi' },
{ value: 'mango', label: 'Mango' },
{ value: 'pineapple', label: 'Pineapple' },
{ value: 'peach', label: 'Peach' },
];

return (
<PmsFormFieldsLayout>
<Heading>Admins</Heading>
Expand All @@ -29,12 +17,10 @@ const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Item>
<Form.Label>General Managers</Form.Label>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose team member"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectMember
value={field.value}
onValueChange={field.onChange}
mode="multiple"
/>
</Form.Control>
<Form.Message className="text-destructive" />
Expand All @@ -48,12 +34,10 @@ const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Item>
<Form.Label>Managers</Form.Label>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose team member"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectMember
value={field.value}
onValueChange={field.onChange}
mode="multiple"
/>
</Form.Control>
<Form.Message className="text-destructive" />
Expand All @@ -67,12 +51,10 @@ const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Item>
<Form.Label>Reservation Managers</Form.Label>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose team member"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectMember
value={field.value}
onValueChange={field.onChange}
mode="multiple"
/>
</Form.Control>
<Form.Message className="text-destructive" />
Expand All @@ -86,12 +68,10 @@ const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Item>
<Form.Label>Reception</Form.Label>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose team member"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectMember
value={field.value}
onValueChange={field.onChange}
mode="multiple"
/>
</Form.Control>
<Form.Message className="text-destructive" />
Expand All @@ -105,21 +85,19 @@ const Admins = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Item>
<Form.Label>Housekeeper</Form.Label>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose team member"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectMember
value={field.value}
onValueChange={field.onChange}
mode="multiple"
/>
</Form.Control>
<Form.Message className="text-destructive" />
</Form.Item>
)}
/>
<Button className="w-fit">
{/* <Button className="w-fit">
<IconPlus /> Add team member
</Button>
</Button> */}
</PmsFormFieldsLayout>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Control } from 'react-hook-form';
import { Button, Form, Input, Upload } from 'erxes-ui';
import { Button, ColorPicker, Form, Input, Upload } from 'erxes-ui';
import PmsFormFieldsLayout from '../PmsFormFieldsLayout';
import Heading from '../../ui/heading';
import { IconPlus, IconTrash, IconUpload } from '@tabler/icons-react';
import { IconTrash, IconUpload, IconX } from '@tabler/icons-react';
import { PmsBranchFormType } from '@/pms/constants/formSchema';

const Appearance = ({ control }: { control: Control<PmsBranchFormType> }) => {
return (
<PmsFormFieldsLayout>
<Heading>Logo and favicon</Heading>
<div className="xl:grid grid-cols-3">
<div className="grid-cols-3 xl:grid">
Copy link

Choose a reason for hiding this comment

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

Consider adding the 'grid' class before 'grid-cols-3' to ensure the container is set to display grid.

Suggested change
<div className="grid-cols-3 xl:grid">
<div className="grid grid-cols-3 xl:grid">

<Form.Field
control={control}
name="logo"
Expand All @@ -20,20 +20,44 @@ const Appearance = ({ control }: { control: Control<PmsBranchFormType> }) => {
Image can be shown on the top of the post also{' '}
</Form.Description>
<Form.Control>
<Upload.Root {...field} value={field.value ?? ''}>
<Upload.Preview className="hidden" />
<Upload.Button
size="sm"
variant="secondary"
type="button"
className="flex flex-col gap-3 items-center justify-center w-full h-52 border border-dashed text-muted-foreground"
>
<IconUpload />
<Button variant={'outline'}>Upload Logo</Button>
<span className="text-sm font-medium">
Max size: 15MB, File type: PNG
</span>
</Upload.Button>
<Upload.Root
value={field.value ?? ''}
onChange={field.onChange}
>
{field.value ? (
<div className="relative w-full">
<div className="flex justify-center items-center w-full h-52 rounded-md border bg-accent">
<Upload.Preview className="object-contain max-w-full max-h-full" />
</div>
<Button
size="sm"
variant="outline"
type="button"
className="absolute bottom-2 right-2 size-6"
onClick={() => {
field.onChange('');
}}
>
<IconTrash size={12} color="red" />
</Button>
</div>
) : (
<>
<Upload.Preview className="hidden" />
<Upload.Button
size="sm"
variant="secondary"
type="button"
className="flex flex-col items-center justify-center w-full gap-3 border border-dashed h-52 text-muted-foreground"
>
<IconUpload />
<Button variant={'outline'}>Upload Logo</Button>
<span className="text-sm font-medium">
Max size: 15MB, File type: PNG
</span>
</Upload.Button>
</>
)}
</Upload.Root>
</Form.Control>
<Form.Message className="text-destructive" />
Expand All @@ -51,16 +75,11 @@ const Appearance = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Form.Label>Color</Form.Label>

<Form.Control>
<div
className="relative w-8 h-8 overflow-hidden rounded-full"
style={{ backgroundColor: field.value || '#4F46E5' }}
>
<Input
type="color"
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
{...field}
/>
</div>
<ColorPicker
value={field.value}
onValueChange={field.onChange}
className="w-24"
/>
</Form.Control>
<Form.Message className="text-destructive" />
</Form.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const Discount = ({ control }: { control: Control<PmsBranchFormType> }) => {
</Button>

{fields.map((field, index) => (
<div className="flex gap-6 items-end">
<div className="w-full grid grid-cols-3 gap-6">
<div className="flex items-end gap-6">
<div className="grid w-full grid-cols-3 gap-6">
<Form.Field
control={control}
name={`discounts.${index}.type`}
Expand Down Expand Up @@ -62,7 +62,7 @@ const Discount = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Button
variant={'destructive'}
size={'icon'}
className="h-8 w-8"
className="w-8 h-8"
Copy link
Collaborator

Choose a reason for hiding this comment

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

size-8 gej class baigaa

onClick={() => remove(index)}
>
<IconTrash />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const Payments = ({ control }: { control: Control<PmsBranchFormType> }) => {
</Button>

{fields.map((field, index) => (
<div className="flex gap-6 items-end">
<div className="w-full grid grid-cols-3 gap-6">
<div className="flex items-end gap-6">
<div className="grid w-full grid-cols-3 gap-6">
<Form.Field
control={control}
name={`otherPayments.${index}.type`}
Expand Down Expand Up @@ -116,7 +116,7 @@ const Payments = ({ control }: { control: Control<PmsBranchFormType> }) => {
<Button
variant={'destructive'}
size={'icon'}
className="h-8 w-8"
className="w-8 h-8"
onClick={() => remove(index)}
>
<IconTrash />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PmsFormFieldsLayout from '../PmsFormFieldsLayout';
import { IconPlus } from '@tabler/icons-react';
import { PmsBranchFormType } from '@/pms/constants/formSchema';
import Heading from '../../ui/heading';
import { SelectCategory, SelectProduct } from 'ui-modules';

const PipelineConfig = ({
control,
Expand Down Expand Up @@ -118,28 +119,15 @@ const PipelineConfig = ({
render={({ field }) => (
<Form.Item>
<Form.Control>
<Select value={field.value} onValueChange={field.onChange}>
<Select.Trigger>
<Select.Value placeholder="Choose room category" />
</Select.Trigger>
<Select.Content className="max-h-52">
{['roomCategory1', 'roomCategory2', 'roomCategory3'].map(
(test, index) => (
<Select.Item value={test} key={index}>
{test}
</Select.Item>
),
)}
</Select.Content>
</Select>
<SelectProduct
value={field.value}
onValueChange={field.onChange}
/>
</Form.Control>
<Form.Message className="text-destructive" />
</Form.Item>
)}
/>
<Button className="w-fit">
<IconPlus /> Add room
</Button>

<Heading>Extra product categories</Heading>
<Form.Field
Expand All @@ -148,21 +136,15 @@ const PipelineConfig = ({
render={({ field }) => (
<Form.Item>
<Form.Control>
<MultipleSelector
hidePlaceholderWhenSelected
placeholder="Choose product categories"
defaultOptions={options}
onChange={(values: MultiSelectOption[]) => console.log(values)}
className="placeholder:text-accent-foreground/70"
<SelectProduct
value={field.value}
onValueChange={field.onChange}
/>
</Form.Control>
<Form.Message className="text-destructive" />
</Form.Item>
)}
/>
<Button className="w-fit">
<IconPlus /> Add extra product
</Button>
</PmsFormFieldsLayout>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Form, useToast } from 'erxes-ui';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { ApolloError } from '@apollo/client';
import { usePmsCreateBranch } from '../hooks/usePmsCreateBranch';
import { usePmsCreateBranch } from '../../hooks/usePmsCreateBranch';
import {
PmsBranchFormSchema,
PmsBranchFormType,
} from '../constants/formSchema';
} from '../../constants/formSchema';
import {
CreatePmsSheetContentLayout,
PmsCreateSheetFooter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { UseFormReturn } from 'react-hook-form';
import { PmsBranchFormType } from '../constants/formSchema';
import { PmsBranchFormType } from '../../constants/formSchema';
import { useAtomValue } from 'jotai';
import { stepState } from '../states/stepStates';
import General from './pmsFormFields/general/General';
import Payments from './pmsFormFields/payments/payments';
import Admins from './pmsFormFields/admins/admins';
import Appearance from './pmsFormFields/appearance/appearance';
import PipelineConfig from './pmsFormFields/pipelineConfig/pipelineConfig';
import { stepState } from '../../states/stepStates';
import General from '../pmsFormFields/general/General';
import Payments from '../pmsFormFields/payments/payments';
import Admins from '../pmsFormFields/admins/admins';
import Appearance from '../pmsFormFields/appearance/appearance';
import PipelineConfig from '../pmsFormFields/pipelineConfig/pipelineConfig';

export const CreatePmsFormContent = ({
form,
Expand Down
Loading