diff --git a/apps/backend/src/emails/emailTemplates.ts b/apps/backend/src/emails/emailTemplates.ts index b9ce3bf19..38cb7ab05 100644 --- a/apps/backend/src/emails/emailTemplates.ts +++ b/apps/backend/src/emails/emailTemplates.ts @@ -9,7 +9,10 @@ export const EMAIL_REDIRECT_URL = 'http://localhost:4200'; export const SSF_PARTNER_EMAIL = 'example@gmail.com'; export const emailTemplates = { - pantryFmApplicationApproved: (params: { name: string }): EmailTemplate => ({ + pantryFmApplicationApproved: (params: { + name: string; + applicantType: 'company' | 'pantry'; + }): EmailTemplate => ({ subject: 'Your Securing Safe Food Account Has Been Created', bodyHTML: `

Hi ${params.name},

@@ -18,7 +21,11 @@ export const emailTemplates = {

You can log in using the credentials created during registration - to begin submitting requests, managing donations, and coordinating with our network. + ${ + params.applicantType === 'company' + ? 'to begin managing donations and coordinating with our network' + : 'to begin submitting requests, and coordinating with our network' + }.

If you have any questions as you get started or need help navigating the @@ -66,14 +73,17 @@ export const emailTemplates = { pantryFmApplicationSubmittedToUser: (params: { name: string; + applicantType: 'company' | 'pantry'; }): EmailTemplate => ({ subject: 'Your SSF Application Has Been Submitted', bodyHTML: `

Hi ${params.name},

- Thank you for your interest in partnering with Securing Safe Food! - Your application has been successfully submitted and is currently under review. - If we determine that your food pantry aligns with our mission and available resources, our team will reach out. + Thank you for your interest in partnering with Securing Safe Food! + Your application has been successfully submitted and is currently under review. + If we determine that your ${ + params.applicantType === 'company' ? 'company' : 'food pantry' + } aligns with our mission and available resources, our team will reach out.

While we are unable to respond to every application, submissions are reviewed on a rolling basis. diff --git a/apps/backend/src/foodManufacturers/manufacturers.service.spec.ts b/apps/backend/src/foodManufacturers/manufacturers.service.spec.ts index e067e5b6c..e49e5ec45 100644 --- a/apps/backend/src/foodManufacturers/manufacturers.service.spec.ts +++ b/apps/backend/src/foodManufacturers/manufacturers.service.spec.ts @@ -210,6 +210,7 @@ describe('FoodManufacturersService', () => { const id = manufacturer.foodManufacturerId; const message = emailTemplates.pantryFmApplicationApproved({ name: manufacturer.foodManufacturerRepresentative.firstName, + applicantType: 'company', }); await service.approve(id); @@ -380,6 +381,7 @@ describe('FoodManufacturersService', () => { const userMessage = emailTemplates.pantryFmApplicationSubmittedToUser({ name: dto.contactFirstName, + applicantType: 'company', }); const adminMessage = emailTemplates.pantryFmApplicationSubmittedToAdmin(); diff --git a/apps/backend/src/foodManufacturers/manufacturers.service.ts b/apps/backend/src/foodManufacturers/manufacturers.service.ts index 8f405d048..88e5934b7 100644 --- a/apps/backend/src/foodManufacturers/manufacturers.service.ts +++ b/apps/backend/src/foodManufacturers/manufacturers.service.ts @@ -333,6 +333,7 @@ export class FoodManufacturersService { const manufacturerMessage = emailTemplates.pantryFmApplicationSubmittedToUser({ name: foodManufacturerContact.firstName, + applicantType: 'company', }); await this.emailsService.sendEmails({ @@ -432,6 +433,7 @@ export class FoodManufacturersService { try { const message = emailTemplates.pantryFmApplicationApproved({ name: newFoodManufacturer.firstName, + applicantType: 'company', }); await this.emailsService.sendEmails({ diff --git a/apps/backend/src/pantries/pantries.service.spec.ts b/apps/backend/src/pantries/pantries.service.spec.ts index 69d8ab565..a777c06b7 100644 --- a/apps/backend/src/pantries/pantries.service.spec.ts +++ b/apps/backend/src/pantries/pantries.service.spec.ts @@ -223,6 +223,7 @@ describe('PantriesService', () => { const pantry = await service.findOne(5); const message = emailTemplates.pantryFmApplicationApproved({ name: pantry.pantryUser.firstName, + applicantType: 'pantry', }); await service.approve(5); @@ -387,6 +388,7 @@ describe('PantriesService', () => { const userMessage = emailTemplates.pantryFmApplicationSubmittedToUser({ name: dto.contactFirstName, + applicantType: 'pantry', }); const adminMessage = emailTemplates.pantryFmApplicationSubmittedToAdmin(); diff --git a/apps/backend/src/pantries/pantries.service.ts b/apps/backend/src/pantries/pantries.service.ts index 1dbbb8b68..a97fccff9 100644 --- a/apps/backend/src/pantries/pantries.service.ts +++ b/apps/backend/src/pantries/pantries.service.ts @@ -419,6 +419,7 @@ export class PantriesService { try { const pantryMessage = emailTemplates.pantryFmApplicationSubmittedToUser({ name: pantryContact.firstName, + applicantType: 'pantry', }); await this.emailsService.sendEmails({ @@ -516,6 +517,7 @@ export class PantriesService { try { const message = emailTemplates.pantryFmApplicationApproved({ name: newPantryUser.firstName, + applicantType: 'pantry', }); await this.emailsService.sendEmails({ diff --git a/apps/frontend/src/components/forms/donationDetailsModal.tsx b/apps/frontend/src/components/forms/donationDetailsModal.tsx index 2561db55a..ad6ea2b72 100644 --- a/apps/frontend/src/components/forms/donationDetailsModal.tsx +++ b/apps/frontend/src/components/forms/donationDetailsModal.tsx @@ -137,7 +137,7 @@ const DonationDetailsModal: React.FC = ({ Donation #{donationId} Stock - {donation.status === DonationStatus.AVAILABLE && ( + {donation.status === DonationStatus.AVAILABLE && !isEditing && ( <> setIsEditing(true)}> diff --git a/apps/frontend/src/components/forms/resubmitDonationModal.tsx b/apps/frontend/src/components/forms/resubmitDonationModal.tsx index ef3409292..1fc49e2c8 100644 --- a/apps/frontend/src/components/forms/resubmitDonationModal.tsx +++ b/apps/frontend/src/components/forms/resubmitDonationModal.tsx @@ -353,10 +353,11 @@ const ResubmitDonationModal: React.FC = ({ mx={3} /> {item.quantity} diff --git a/apps/frontend/src/containers/foodManufacturerDashboard.tsx b/apps/frontend/src/containers/foodManufacturerDashboard.tsx index 519935b44..c18b0905f 100644 --- a/apps/frontend/src/containers/foodManufacturerDashboard.tsx +++ b/apps/frontend/src/containers/foodManufacturerDashboard.tsx @@ -112,7 +112,7 @@ const FoodManufacturerDashboard: React.FC = () => { diff --git a/apps/frontend/src/containers/foodManufacturerDonationManagement.tsx b/apps/frontend/src/containers/foodManufacturerDonationManagement.tsx index a1c16a044..03b29c255 100644 --- a/apps/frontend/src/containers/foodManufacturerDonationManagement.tsx +++ b/apps/frontend/src/containers/foodManufacturerDonationManagement.tsx @@ -40,7 +40,9 @@ const FoodManufacturerDonationManagement: React.FC = () => { const [isResubmitOpen, setIsResubmitOpen] = useState(false); const [loading, setLoading] = useState(true); const [alertState, setAlertMessage] = useAlert(); - const [isLogDonationOpen, setIsLogDonationOpen] = useState(false); + const [isLogDonationOpen, setIsLogDonationOpen] = useState( + searchParams.get('logDonation') === 'true', + ); const [manufacturerId, setManufacturerId] = useState(null); const [selectedActionDonation, setSelectedActionDonation] = useState(null); @@ -260,7 +262,12 @@ const FoodManufacturerDonationManagement: React.FC = () => { foodManufacturerId={mostRecentDonationFmId ?? manufacturerId} onDonationSuccess={() => fetchDonations()} isOpen={isLogDonationOpen} - onClose={() => setIsLogDonationOpen(false)} + onClose={() => { + setIsLogDonationOpen(false); + if (searchParams.get('logDonation')) { + navigate(ROUTES.FM_DONATION_MANAGEMENT, { replace: true }); + } + }} /> )}