Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

(#119-3)To make it look a bit more receipt like, table with EIN #250

Merged
merged 1 commit into from
Oct 4, 2017

Conversation

ronaldblanco
Copy link
Contributor

#119 -3 To make it look a bit more receipt like, there could be another table as part of the donation receipt with the organization details and EIN number from general settings.
Solution tested locally and checked with lint command.

@jspaine
Copy link
Contributor

jspaine commented Sep 28, 2017

I meant it should be part of the receipt placeholder. You can't edit tables with Quill and I'm not sure what'll happen if you insert one into the editor like that. What does it look like!?

@ronaldblanco
Copy link
Contributor Author

ronaldblanco commented Sep 28, 2017

In the console.log looks well (the same way that the other).
Or, Are you thinking in a new placeholder for the recipe?

@jspaine
Copy link
Contributor

jspaine commented Sep 28, 2017

I mean what does it look like in the email editor?

I think it should be in the same placeholder as the receipt.

@ronaldblanco
Copy link
Contributor Author

I will be checking.

@ronaldblanco
Copy link
Contributor Author

Hey @jspaine check now, I did create a new placeholder I think it is a better solution (as I understand)
Let me know.

Thanks.

@@ -10,6 +10,7 @@ const placeholders = [
{id: 'url', label: 'Foodbank Website'},
{id: 'clientIntakeNumber', label: 'Client Intake Number'},
{id: 'supportNumber', label: 'Support Number'},
{id: 'EIN', label: 'EIN Number'},

This comment was marked as off-topic.

@@ -51,7 +51,7 @@ const SettingsSchema = new Schema({
EIN: {
type: String,
trim: true,
default: ''
default: '0'

This comment was marked as off-topic.

let head = ['Foodbank Name','Foodbank Address','Foodbank Website','Client Intake Number', 'Support Number','EIN Number']
let tableFinal = `<table>`
for (let i = 0; i < 6; i++) {
tableFinal += `<tr><td><p>"${head[i]}":</p></td><td><p>"${placeholders[i]}"</p></td></tr>`

This comment was marked as off-topic.

@@ -51,7 +51,7 @@ const SettingsSchema = new Schema({
EIN: {

This comment was marked as off-topic.

@ronaldblanco
Copy link
Contributor Author

Hello @jspaine; check now, I did left the ein default: '0' because the ein placeholder have problems with an empty string.

Copy link
Contributor

@jspaine jspaine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

const id = getAttr(node, 'data-id')
const placeholder = placeholders.find(pl => pl.id === id)

//Receipt Placeholder only
if (id === 'receipt') {

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -40,6 +41,13 @@ const placeholders = [
required: true,

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@ronaldblanco
Copy link
Contributor Author

Check now and let me know!!

const id = getAttr(node, 'data-id')
const placeholder = placeholders.find(pl => pl.id === id)

//Receipt Placeholder only
if (id === 'receipt') {

This comment was marked as off-topic.

tableFinal += `<tr><td><p>"${value[i].name}"</p></td><td><p>"${value[i].value}"</p></td></tr>`
total += value[i].value
for (let i = 0; i < items.length; i++) {
table += `<tr><td><p>"${items[i].name}"</p></td><td><p>"${items[i].value}"</p></td></tr>`

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -40,6 +41,13 @@ const placeholders = [
required: true,

This comment was marked as off-topic.

@jspaine
Copy link
Contributor

jspaine commented Oct 3, 2017

What was the problem with the ein field being an empty string by default?

@ronaldblanco
Copy link
Contributor Author

When ein = "" the placeholder ein does not return, it give a problem of "No placeholder with that id" or something like that.
I thing that have to be with the mail-generator.js, some validation missing.

@ronaldblanco
Copy link
Contributor Author

OK, I will be checking the rest you told me.

@jspaine
Copy link
Contributor

jspaine commented Oct 3, 2017

Ah I think it's line 89 in the mail generator:

if (!bindings[id] && placeholder.type !== placeholderTypes.ATTACHMENT)

should probably be:

// import {isUndefined} from 'lodash'
if (isUndefined(bindings[id]) && placeholder.type !== placeholderTypes.ATTACHMENT)

@ronaldblanco
Copy link
Contributor Author

You were right with the correction on line 89.
Check now and let me know.

Copy link
Contributor

@jspaine jspaine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it looks good!

tableFinal += `<tr><td><p>"${value[i].name}"</p></td><td><p>"${value[i].value}"</p></td></tr>`
total += value[i].value
for (let i = 0; i < items.length; i++) {
table += `<tr><td><p>"${items[i].name}"</p></td><td><p>"${items[i].value}"</p></td></tr>`

This comment was marked as off-topic.

@ronaldblanco
Copy link
Contributor Author

Ready.

@jspaine
Copy link
Contributor

jspaine commented Oct 4, 2017

Thanks!

@jspaine jspaine merged commit 0cc56e5 into freeCodeCamp:staging Oct 4, 2017
@ronaldblanco ronaldblanco deleted the fix/119#3 branch December 6, 2017 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants