<%= _.isUndefined(i18n['Create contact']) ? 'Create contact':i18n['Create contact'] %>

<%= _.isUndefined(i18n['Last contacted'])?'Last contacted':i18n['Last contacted'] %> <% var lastContacted = (_.isEmpty(leadOrganizationModel.get('lastContacted'))) ? '': moment(leadOrganizationModel.get('lastContacted').created_at, 'YYYY-MM-DD HH:mm:ss').format('DD MMMM YYYY') %> <%= (lastContacted !== 'Invalid date') ? lastContacted: '' %>

<%= _.isUndefined(i18n['Added on'])?'Added on':i18n['Added on'] %> <%= _.isEmpty(leadOrganizationModel.get('created_at')) ? '': moment(leadOrganizationModel.get('created_at'), 'YYYY-MM-DD HH:mm:ss').format('DD MMMM YYYY') %>

<%= _.isUndefined(i18n['First contact created on'])?'First contact created on':i18n['First contact created on'] %> <%= _.isEmpty(leadOrganizationModel.get('first_contact_creation_date')) ? '': moment(leadOrganizationModel.get('first_contact_creation_date'), 'YYYY-MM-DD HH:mm:ss').format('DD MMMM YYYY') %>

<% countryClass = 'grid_12' %> <% if(!_.isEmpty(leadOrganizationModel.get('states'))) { %> <% countryClass = 'grid_6' %> <% } %>

<% if(_.isEmpty(leadOrganizationModel.get('states'))) { %> <% var statesHidden = 'hidden' %> <% } else { %> <% var statesHidden = '' %> <% } %>

<%= _.isUndefined(i18n['View notes'])?'View notes':i18n['View notes'] %>
<% opportunitiesStatClasses = 'grid_4 text-center omega total-opportunity'; %> <% if(_.isUndefined(leadOrganizationModel.get('firstPurchaseDate').created_at)) { %> <% opportunitiesStatClasses = 'grid_6 text-center total-opportunity'; %> <% } %>

<%= _.isUndefined(i18n['Total Opportunities'])?'Total Opportunities':i18n['Total Opportunities'] %>

<% var leadOpportunityStatNewCount = 0; %> <% var leadOpportunityStatNewAmount = 0; %> <% var leadOpportunityStatLostCount = 0;%> <% var leadOpportunityStatLostAmount = 0;%> <% var leadOpportunityStatWonCount = 0;%> <% var leadOpportunityStatWonAmount = 0;%> <% var leadOpportunityRatio = 0 %> <% if(!_.isEmpty(leadOrganizationModel.get('leadOpportunityStats'))) { %> <% _.each(leadOrganizationModel.get('leadOpportunityStats'), function(statsData, stageId) { %> <% if (parseInt(stageId) === 1) { %> <% leadOpportunityStatLostCount += parseInt(statsData.count) %> <% leadOpportunityStatLostAmount += parseFloat(statsData.total) %> <% } else if (parseInt(stageId) === 100) { %> <% leadOpportunityStatWonCount += parseInt(statsData.count) %> <% leadOpportunityStatWonAmount += parseFloat(statsData.total) %> <% } else { %> <% leadOpportunityStatNewCount += parseInt(statsData.count) %> <% leadOpportunityStatNewAmount += parseFloat(statsData.total) %> <% } %> <% }) %> <% leadOpportunityRatio = (((leadOpportunityStatWonCount)/(leadOpportunityStatNewCount+leadOpportunityStatLostCount+leadOpportunityStatWonCount))*100).toFixed(2) %> <% } %>

<%= leadOpportunityStatNewCount %>

<%= _.isUndefined(i18n['for'])?'for':i18n['for'] %>

<%= accounting.formatMoney(Math.round(leadOpportunityStatNewAmount.toFixed(2)), JSON.parse(leadOrganizationModel.get('moneyFormat'))) %>

<%= _.isUndefined(i18n['Open'])?'Open':i18n['Open'] %>

<%= leadOpportunityStatLostCount %>

<%= _.isUndefined(i18n['for'])?'for':i18n['for'] %>

<%= accounting.formatMoney(Math.round(leadOpportunityStatLostAmount.toFixed(2)), JSON.parse(leadOrganizationModel.get('moneyFormat'))) %>

<%= _.isUndefined(i18n['Lost'])?'Lost':i18n['Lost'] %>

<%= leadOpportunityStatWonCount %>

<%= _.isUndefined(i18n['for'])?'for':i18n['for'] %>

<%= accounting.formatMoney(Math.round(leadOpportunityStatWonAmount.toFixed(2)), JSON.parse(leadOrganizationModel.get('moneyFormat'))) %>

<%= _.isUndefined(i18n['Won'])?'Won':i18n['Won'] %>

<%= (!_.isUndefined(leadOpportunityRatio)) ? Math.round(leadOpportunityRatio) : 0 %>%

<%= _.isUndefined(i18n['Win ratio'])?'Win ratio':i18n['Win ratio'] %>

<% if(!_.isUndefined(leadOrganizationModel.get('firstPurchaseDate').created_at)) { %>

<%= _.isUndefined(i18n['Total Sales'])?'Total Sales':i18n['Total Sales'] %>

<% totalSalesInfo = leadOrganizationModel.get('totalSales') %> <% totalSalesCount = (!_.isUndefined(totalSalesInfo.count))? parseInt(totalSalesInfo.count) : 0 %> <% totalSalesAmount = (!_.isUndefined(totalSalesInfo.total))? parseFloat(totalSalesInfo.total) : 0 %>

<%= totalSalesCount %>

<%= _.isUndefined(i18n['for'])?'for':i18n['for'] %>

<%= accounting.formatMoney(Math.round(totalSalesAmount.toFixed(2)), JSON.parse(leadOrganizationModel.get('moneyFormat'))) %>

<%= _.isUndefined(i18n['Customer since'])?'Customer since':i18n['Customer since'] %>: <%= (!_.isUndefined(leadOrganizationModel.get('firstPurchaseDate').created_at)) ? moment(leadOrganizationModel.get('firstPurchaseDate').created_at, 'YYYY-MM-DD HH:mm:ss').format('DD MMMM YYYY') :'' %>

<% } %>
<% if(!_.isEmpty(leadOrganizationModel.get('organizationLeads'))) { %>

<%= _.isUndefined(i18n['Filter by contacts'])?'Filter by contacts':i18n['Filter by contacts'] %>

<% } %>
<%= _.isUndefined(i18n['Upcoming events'])?'Upcoming events':i18n['Upcoming events'] %>
<%= _.isUndefined(i18n['Today'])?'Today':i18n['Today'] %>