Skip to content

Commit

Permalink
Merge pull request #742 from turbo124/add_blank_option_for_subscripti…
Browse files Browse the repository at this point in the history
…ons_frequency

Add blank option for subscriptions frequency
  • Loading branch information
beganovich authored Jun 13, 2023
2 parents 2aa9d66 + 1f803b9 commit 2b816cf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/layouts/common/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function useSettingsRoutes() {
enabled: isAdmin || isOwner || false,
},
{
name: t('subscriptions'),
name: t('payment_links'),
href: '/settings/subscriptions',
current: location.pathname.startsWith('/settings/subscriptions'),
enabled: isAdmin || isOwner || false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ export function Settings(props: SubscriptionProps) {
<Element leftSide={t('frequency')}>
<SelectField
value={subscription.frequency_id}
errorMessage={errors?.errors.frequency_id}
onValueChange={(value) => handleChange('frequency_id', value)}
>
<option value="">{t('once')}</option>
{Object.keys(frequencies).map((frequency, index) => (
<option key={index} value={frequency}>
{t(frequencies[frequency as keyof typeof frequencies])}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/settings/subscriptions/create/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export function Create() {

const pages = [
{ name: t('settings'), href: '/settings' },
{ name: t('subscriptions'), href: '/settings/subscriptions' },
{ name: t('new_subscription'), href: '/settings/subscriptions/create' },
{ name: t('payment_links'), href: '/settings/subscriptions' },
{ name: t('new_payment_link'), href: '/settings/subscriptions/create' },
];

const tabs = [t('overview'), t('settings'), t('webhook')];
Expand Down Expand Up @@ -120,7 +120,7 @@ export function Create() {

return (
<Settings
title={t('new_subscription')}
title={t('new_payment_link')}
breadcrumbs={pages}
onSaveClick={handleSave}
disableSaveButton={!subscription || showPlanAlert}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/settings/subscriptions/edit/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function Edit() {

const pages = [
{ name: t('settings'), href: '/settings' },
{ name: t('subscriptions'), href: '/settings/subscriptions' },
{ name: t('payment_links'), href: '/settings/subscriptions' },
{
name: t('edit_subscription'),
name: t('edit_payment_link'),
href: route('/settings/subscriptions/:id/edit', { id }),
},
];
Expand Down Expand Up @@ -123,6 +123,7 @@ export function Edit() {
if (error.response?.status === 422) {
setErrors(error.response.data);
toast.dismiss();
toast.error('error_title');
} else {
console.error(error);
toast.error();
Expand Down
4 changes: 2 additions & 2 deletions src/pages/settings/subscriptions/index/Subscriptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function Subscriptions() {

const pages = [
{ name: t('settings'), href: '/settings' },
{ name: t('subscriptions'), href: '/settings/subscriptions' },
{ name: t('payment_links'), href: '/settings/subscriptions' },
];

return (
Expand All @@ -34,7 +34,7 @@ export function Subscriptions() {
withoutBackButton
>
<DataTable
resource="subscription"
resource="payment_link"
endpoint="/api/v1/subscriptions?sort=id|desc"
bulkRoute="/api/v1/subscriptions/bulk"
columns={columns}
Expand Down

0 comments on commit 2b816cf

Please sign in to comment.