diff --git a/packages/client/src/components/Modals/SearchPanel.vue b/packages/client/src/components/Modals/SearchPanel.vue index 5654ba8ba..d5d28b2b6 100644 --- a/packages/client/src/components/Modals/SearchPanel.vue +++ b/packages/client/src/components/Modals/SearchPanel.vue @@ -26,11 +26,16 @@ label="Search Title" label-for="search-title" description="ex. Infrastructure" + :invalid-feedback="invalidTitleFeedback" + :state="searchTitleState" > value !== null - && !(Array.isArray(value) && value.length === 0)) - && this.formData.searchTitle !== null; - }, isEditMode() { return this.searchId !== null && this.searchId !== undefined && this.searchId !== 0; }, + saveEnabled() { + return this.searchTitleIsValid() && this.formIsDirty(); + }, panelTitle() { return this.isEditMode ? 'Edit Search' : 'New Search'; }, + searchTitleState() { + return this.searchTitleIsValid(); + }, + invalidTitleFeedback() { + return 'Search Title is required'; + }, }, methods: { ...mapActions({ @@ -322,6 +335,12 @@ export default { eligibilityLabel({ label }) { return label; }, + searchTitleIsValid() { + return !!this.formData.searchTitle; + }, + formIsDirty() { + return !(JSON.stringify(this.formData.criteria) === JSON.stringify(defaultCriteria)); + }, apply() { const formDataCopy = { ...this.formData.criteria }; this.applyFilters(formDataCopy); diff --git a/packages/client/src/store/modules/grants.js b/packages/client/src/store/modules/grants.js index 1b2f38e82..42cb94118 100644 --- a/packages/client/src/store/modules/grants.js +++ b/packages/client/src/store/modules/grants.js @@ -60,6 +60,7 @@ function buildGrantsNextQuery({ filters, ordering, pagination }) { criteria.excludeKeywords = criteria.excludeKeywords && criteria.excludeKeywords.length > 0 ? criteria.excludeKeywords.split(',').map((k) => k.trim()) : null; criteria.eligibility = criteria.eligibility?.map((e) => e.code); criteria.fundingTypes = criteria.fundingTypes?.map((f) => f.code); + criteria.bill = criteria.bill === 'All Bills' ? null : criteria.bill; const paginationQuery = Object.entries(pagination) // filter out undefined and nulls since api expects parameters not present as undefined