Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' of https://github.com/erxes/erxes-community into m…
Browse files Browse the repository at this point in the history
…eeting
  • Loading branch information
enkhtuvshinD committed Oct 17, 2023
2 parents 6babaa9 + 89809e6 commit 4d35cca
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/plugin-pos-api/src/graphql/schema/pos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const posCommonFields = `
allowTypes: [String]
isCheckRemainder: Boolean
checkExcludeCategoryIds: [String]
banFractions: Boolean
`;

const catProd = `
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-pos-api/src/models/definitions/pos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface IPos {
allowTypes: string[];
isCheckRemainder: boolean;
checkExcludeCategoryIds: string[];
banFractions: boolean;
}
export interface IPosDocument extends IPos, Document {
_id: string;
Expand Down Expand Up @@ -139,6 +140,7 @@ export const posSchema = schemaHooksWrapper(
type: [String],
label: 'Check Exclude Categories'
}),
banFractions: field({ type: Boolean, label: 'has Float count' }),
status: field({ type: String, label: 'Status', optional: true })
}),
'erxes_pos'
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-pos-ui/src/pos/components/Pos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ class Pos extends React.Component<Props, State> {
permissionConfig: pos.permissionConfig || {},
allowTypes: saveTypes,
isCheckRemainder: pos.isCheckRemainder,
checkExcludeCategoryIds: pos.checkExcludeCategoryIds || []
checkExcludeCategoryIds: pos.checkExcludeCategoryIds || [],
banFractions: pos.banFractions
};

if (!pos.isOnline) {
Expand Down
20 changes: 18 additions & 2 deletions packages/plugin-pos-ui/src/pos/components/step/ConfigStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type State = {
kioskExcludeProductIds: string[];
isCheckRemainder: boolean;
checkExcludeCategoryIds: string[];
banFractions: boolean;
};

export default class ConfigStep extends React.Component<Props, State> {
Expand All @@ -56,7 +57,8 @@ export default class ConfigStep extends React.Component<Props, State> {
kioskExcludeCategoryIds: (pos && pos.kioskExcludeCategoryIds) || [],
kioskExcludeProductIds: (pos && pos.kioskExcludeProductIds) || [],
isCheckRemainder: (pos && pos.isCheckRemainder) || false,
checkExcludeCategoryIds: (pos && pos.checkExcludeCategoryIds) || []
checkExcludeCategoryIds: (pos && pos.checkExcludeCategoryIds) || [],
banFractions: (pos && pos.banFractions) || false
};
}

Expand Down Expand Up @@ -202,7 +204,8 @@ export default class ConfigStep extends React.Component<Props, State> {
kioskExcludeCategoryIds,
kioskExcludeProductIds,
isCheckRemainder,
checkExcludeCategoryIds
checkExcludeCategoryIds,
banFractions
} = this.state;

const groupTrigger = (
Expand Down Expand Up @@ -327,6 +330,19 @@ export default class ConfigStep extends React.Component<Props, State> {
multi={true}
/>
</FormGroup>
<FormGroup>
<ControlLabel>Ban Fractions</ControlLabel>
<FormControl
checked={banFractions}
componentClass="checkbox"
onChange={e => {
this.onChangeValue(
'banFractions',
(e.target as any).checked
);
}}
/>
</FormGroup>
</Block>
</LeftItem>
</FlexColumn>
Expand Down
25 changes: 24 additions & 1 deletion packages/plugin-pos-ui/src/pos/components/step/Screens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,39 @@ class ScreensConfig extends React.Component<
if (pos) {
kitchenScreen = pos.kitchenScreen || {
isActive: false,
isPrint: false,
showType: '',
type: 'time',
value: 0
};
}

if (!kitchenScreen.isActive) {
const onChangeSwitchIsPrint = e => {
const { pos } = this.props;

this.props.onChange('pos', {
...pos,
kitchenScreen: { ...pos.kitchenScreen, isPrint: e.target.checked }
});
};

return (
<FormGroup>
<DomainRow></DomainRow>
<DomainRow>
<ControlLabel>Print</ControlLabel>
<Toggle
id={'isPrint'}
checked={
pos && pos.kitchenScreen ? pos.kitchenScreen.isPrint : false
}
onChange={onChangeSwitchIsPrint}
icons={{
checked: <span>Yes</span>,
unchecked: <span>No</span>
}}
/>
</DomainRow>
</FormGroup>
);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-pos-ui/src/pos/graphql/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const commonFields = `
$allowTypes: [String]
$isCheckRemainder: Boolean
$checkExcludeCategoryIds: [String]
$banFractions: Boolean
`;

const commonVariables = `
Expand Down Expand Up @@ -70,6 +71,7 @@ const commonVariables = `
allowTypes: $allowTypes
isCheckRemainder: $isCheckRemainder
checkExcludeCategoryIds: $checkExcludeCategoryIds
banFractions: $banFractions
`;

const posAdd = `
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-pos-ui/src/pos/graphql/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const posCommonFields = `
allowTypes
isCheckRemainder
checkExcludeCategoryIds
banFractions
branchTitle
departmentTitle
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-pos-ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type IProductGroup = {

export type IScreenConfig = {
isActive: boolean;
isPrint?: boolean;
type: string;
value: number;
contentUrl?: string;
Expand Down Expand Up @@ -70,6 +71,7 @@ export type IPos = {
allowTypes?: string[];
isCheckRemainder: boolean;
checkExcludeCategoryIds: string[];
banFractions: boolean;

branchTitle?: string;
departmentTitle?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const types = `
allowTypes: [String]
isCheckRemainder: Boolean
checkExcludeCategoryIds: [String]
banFractions: Boolean
}
`;

Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-posclient-api/src/graphql/utils/syncUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ export const extractConfig = async (subdomain, doc) => {
permissionConfig: doc.permissionConfig,
allowTypes: doc.allowTypes,
isCheckRemainder: doc.isCheckRemainder,
checkExcludeCategoryIds: doc.checkExcludeCategoryIds
checkExcludeCategoryIds: doc.checkExcludeCategoryIds,
banFractions: doc.banFractions
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface IConfig {
allowTypes: string[];
isCheckRemainder: boolean;
checkExcludeCategoryIds: string[];
banFractions: boolean;
}

export interface IConfigDocument extends Document, IConfig {
Expand Down Expand Up @@ -164,6 +165,7 @@ export const configSchema = new Schema({
allowTypes: field({ type: [String], label: 'Allow Types' }),
isCheckRemainder: field({ type: Boolean, optional: true }),
checkExcludeCategoryIds: field({ type: [String] }),
banFractions: field({ type: Boolean, optional: true }),
status: field({ type: String, optional: true })
});

Expand Down

0 comments on commit 4d35cca

Please sign in to comment.