Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup] Changing Selectors For Payments And Quotes #2106

Merged
Merged
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
4 changes: 2 additions & 2 deletions src/components/forms/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ export function SelectField(props: SelectProps) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
styles={customStyles}
isSearchable={false}
isClearable={dismissable}
isSearchable
isClearable={Boolean(dismissable && selectedEntry?.value)}
data-cy={cypressRef}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/payments/create/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ export default function Create() {

<Element leftSide={t('payment_type')}>
<SelectField
id="type_id"
value={payment?.type_id}
onValueChange={(value) => handleChange('type_id', value)}
errorMessage={errors?.errors.type_id}
withBlank
customSelector
>
{paymentTypes.map(([key, value], index) => (
<option value={key} key={index}>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/payments/edit/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ export default function Edit() {

<Element leftSide={t('payment_type')}>
<SelectField
style={{ color: colors.$3, colorScheme: colors.$0 }}
id="type_id"
value={payment?.type_id}
onValueChange={(value) => handleChange('type_id', value)}
errorMessage={errors?.errors.type_id}
withBlank
customSelector
style={{ color: colors.$3, colorScheme: colors.$0 }}
>
{paymentTypes.map(([key, value], index) => (
<option value={key} key={index}>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/quotes/common/components/QuoteDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ export function QuoteDetails(props: Props) {

<div className="w-full lg:w-1/2">
<SelectField
value={quote?.is_amount_discount.toString()}
onValueChange={(value) =>
handleChange('is_amount_discount', JSON.parse(value))
}
value={quote?.is_amount_discount.toString()}
errorMessage={errors?.errors.is_amount_discount}
customSelector
dismissable={false}
>
<option value="false">{t('percent')}</option>
<option value="true">{t('amount')}</option>
Expand Down
Loading