Skip to content

Commit

Permalink
feat: add button to erase all settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharmyn28 committed Oct 10, 2023
1 parent 608814c commit 16ca72e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
20 changes: 18 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-04-25T10:52:53.056Z\n"
"PO-Revision-Date: 2023-04-25T10:52:53.056Z\n"
"POT-Creation-Date: 2023-10-10T12:26:40.540Z\n"
"PO-Revision-Date: 2023-10-10T12:26:40.540Z\n"

msgid "Access denied"
msgstr "Access denied"
Expand Down Expand Up @@ -46,6 +46,19 @@ msgstr "Cancel"
msgid "Delete"
msgstr "Delete"

msgid "Erase all settings"
msgstr "Erase all settings"

msgid ""
"This action will remove all settings. Are you sure you want to erase all "
"content and settings?"
msgstr ""
"This action will remove all settings. Are you sure you want to erase all "
"content and settings?"

msgid "Erase"
msgstr "Erase"

msgid "First time setup"
msgstr "First time setup"

Expand Down Expand Up @@ -79,6 +92,9 @@ msgstr "Set defaults and save"
msgid "Configuration"
msgstr "Configuration"

msgid "Reset all values to default"
msgstr "Reset all values to default"

msgid "Something went wrong while saving the default configuration"
msgstr "Something went wrong while saving the default configuration"

Expand Down
8 changes: 7 additions & 1 deletion src/pages/StockConfiguration/StockConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from '@dhis2/d2-i18n'
import isEqual from 'lodash/isEqual'
import isNil from 'lodash/isNil'
import React, { useState, useEffect } from 'react'
import { Page } from '../../components'
import { Page, EraseValues } from '../../components'
import { useGetDataStore, useUpdateUseCases } from '../../hooks'
import AddConfiguration from './AddConfiguration'
import { UseCaseTable } from './UseCaseList'
Expand Down Expand Up @@ -43,6 +43,10 @@ export const StockConfiguration = () => {
setInitialList(useCasesList)
}

const resetSettings = () => {
setCurrentList([])
}

return (
<Page
title={TITLE}
Expand All @@ -53,13 +57,15 @@ export const StockConfiguration = () => {
disabled={disable}
error={error}
success={data}
handleReset={resetSettings}
>
<>
<AddConfiguration
useCases={useCasesList}
handleUseCases={setCurrentList}
/>
<UseCaseTable list={useCasesList} handleList={setCurrentList} />
<EraseValues />
</>
</Page>
)
Expand Down

0 comments on commit 16ca72e

Please sign in to comment.