mailing UI tweaks and bugs fixed

This commit is contained in:
Dobromir Popov
2024-04-06 12:38:02 +03:00
parent fdbf2642cc
commit 7f4ba3545c
3 changed files with 16 additions and 15 deletions

View File

@ -131,7 +131,10 @@ export default async function handler(req, res) {
const shiftStr = `${CON.weekdaysBG[assignment.shift.startTime.getDay()]} ${CON.GetDateFormat(assignment.shift.startTime)} at ${assignment.shift.cartEvent.location.name} from ${CON.GetTimeFormat(assignment.shift.startTime)} to ${CON.GetTimeFormat(assignment.shift.endTime)}`; const shiftStr = `${CON.weekdaysBG[assignment.shift.startTime.getDay()]} ${CON.GetDateFormat(assignment.shift.startTime)} at ${assignment.shift.cartEvent.location.name} from ${CON.GetTimeFormat(assignment.shift.startTime)} to ${CON.GetTimeFormat(assignment.shift.endTime)}`;
const allNewPubNames = newAssignment.shift.assignments.map(a => a.publisher.firstName + " " + a.publisher.lastName + "\t\t" + a.publisher.phone + "").join("</br>"); const newPubs = newAssignment.shift.assignments.map(a => ({
name: `${a.publisher.firstName} ${a.publisher.lastName}`,
phone: a.publisher.phone
}));
let model = { let model = {
user: publisher, user: publisher,
@ -141,7 +144,7 @@ export default async function handler(req, res) {
oldPubName: assignment.publisher.firstName + " " + assignment.publisher.lastName, oldPubName: assignment.publisher.firstName + " " + assignment.publisher.lastName,
firstName: publisher.firstName, firstName: publisher.firstName,
lastName: publisher.lastName, lastName: publisher.lastName,
newPubNames: allNewPubNames, newPubs: newPubs,
placeName: assignment.shift.cartEvent.location.name, placeName: assignment.shift.cartEvent.location.name,
dateStr: common.getDateFormated(assignment.shift.startTime), dateStr: common.getDateFormated(assignment.shift.startTime),
time: common.formatTimeHHmm(assignment.shift.startTime), time: common.formatTimeHHmm(assignment.shift.startTime),
@ -150,15 +153,9 @@ export default async function handler(req, res) {
emailHelper.SendEmailHandlebars(to, "coverMeAccepted", model); emailHelper.SendEmailHandlebars(to, "coverMeAccepted", model);
// await prisma.user.update({ const messagePageUrl = `/message?message=${encodeURIComponent('Вашата заявка за замстване е обработена успешно')}&type=info&caption=${encodeURIComponent('Благодарим ви!')}`;
// where: { res.redirect(messagePageUrl);
// id: parseInt(userId)
// },
// data: {
// status: "accepted",
// acceptedAt: date
// }
// });
break; break;
//POST //POST

View File

@ -1,7 +1,7 @@
{{!--Subject: ССС: Нужен е заместник --}} {{!--Subject: ССС: Нужен е заместник --}}
<section> <section>
<h3>Търси се зместник <h3>Търси се зместник:
{{!-- за смяна на {{placeName}} за {{dateStr}}! --}} {{!-- за смяна на {{placeName}} за {{dateStr}}! --}}
</h3> </h3>
<p>Здравей {{firstName}},</p> <p>Здравей {{firstName}},</p>

View File

@ -1,11 +1,15 @@
{{!-- Subject: ССС: Нови назначени смени--}} {{!-- Subject: ССС: Промени в твоята смяна --}}
<section> <section>
<h2>Промяна твоята смяна на {{placeName}} {{dateStr}} </h2> <h2>Промяна твоята смяна на {{placeName}} {{dateStr}} </h2>
<p>Здравейте {{firstName}}, </p> <p>Здравейте {{firstName}}, </p>
<p>{{firstName}} {{lastName}} ще замести {{oldPubName}} на смяната ви на {{dateStr}}</p> <p>{{firstName}} {{lastName}} ще замести {{oldPubName}} на смяната ви на {{dateStr}} от {{time}}</p>
<p>Новаия списък с участници за тази смяна е:</p> <p>Новаия списък с участници за тази смяна е:</p>
<p>{{{newPubNames}}}</p> <ul>
{{#each newPubs}}
<li>{{this.name}} - {{this.phone}}</li>
{{/each}}
</ul>
<div> <div>
</div> </div>
</section> </section>