Skip to content

Commit

Permalink
Merge pull request #2106 from Civolilah/cleanup/1202-payments-quotes
Browse files Browse the repository at this point in the history
[Cleanup] Changing Selectors For Payments And Quotes
  • Loading branch information
beganovich authored Oct 21, 2024
2 parents 1652443 + 6a7171f commit 3cf422c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
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 @@ -520,11 +520,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

0 comments on commit 3cf422c

Please sign in to comment.