This commit is contained in:
@@ -93,6 +93,8 @@ namespace rockfishCore.Controllers
|
||||
public IEnumerable<dtoNameIdChildrenItem> GetActiveSubsForSites([FromRoute] long id)
|
||||
{
|
||||
|
||||
long EpochNow = DateUtil.NowAsEpoch();
|
||||
|
||||
var res = from c in _context.Site
|
||||
.Where(c => c.CustomerId.Equals(id)).OrderBy(c => c.Name)
|
||||
select new dtoNameIdChildrenItem
|
||||
@@ -108,7 +110,7 @@ namespace rockfishCore.Controllers
|
||||
{
|
||||
var subs = from c in _context.Purchase
|
||||
.Where(c => c.SiteId.Equals(child.id))
|
||||
.Where(c => c.CancelDate == null)
|
||||
.Where(c => c.CancelDate == null || c.CancelDate > EpochNow)
|
||||
.OrderByDescending(c => c.PurchaseDate)
|
||||
select new dtoNameIdItem
|
||||
{
|
||||
|
||||
@@ -328,45 +328,48 @@ namespace rockfishCore.Util
|
||||
|
||||
quoted.WriteLine("On {0}, {1} wrote:", message.Date.ToString("f"), name);
|
||||
|
||||
//TODO: get text message just like in reader here for html only message
|
||||
//sometimes body text is empty.
|
||||
/*
|
||||
var theBody = m.GetTextBody(MimeKit.Text.TextFormat.Plain);
|
||||
//Try to get the original message text and format it as > quoted
|
||||
|
||||
var theBody = message.GetTextBody(MimeKit.Text.TextFormat.Plain);
|
||||
if (theBody == null)
|
||||
{
|
||||
//might be an html email, try to get the text anyway
|
||||
var ht = m.HtmlBody;
|
||||
//No text body so go with the new method to extract the text part
|
||||
// might be an html email, try to get the text anyway
|
||||
var ht = message.HtmlBody;
|
||||
if (!string.IsNullOrWhiteSpace(ht))
|
||||
{
|
||||
theBody = "**** HTML-ONLY MESSAGE ****";
|
||||
theBody += "\r\n=-=-=-=- TEXT CONVERSION =-=-=-=-\r\n";
|
||||
theBody += StripHTML(ht, true);
|
||||
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
|
||||
theBody += "\r\n=-=-=-=- SOURCE HTML =-=-=-=-\r\n";
|
||||
theBody += ht;
|
||||
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
|
||||
theBody += "\r\n******* END MESSAGE *******";
|
||||
|
||||
theBody = StripHTML(ht, true);
|
||||
theBody += "> ";
|
||||
theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>');
|
||||
theBody ="\r\n"+theBody;//descend the first line under the On you wrote bit
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
theBody = "NO MESSAGE BODY WAS FOUND NEITHER HTML NOR TEXT";
|
||||
theBody = "> Source Message Empty";
|
||||
}
|
||||
|
||||
quoted.WriteLine(theBody);
|
||||
}
|
||||
sb.AppendLine(theBody);
|
||||
*/
|
||||
|
||||
|
||||
using (var reader = new StringReader(message.TextBody))
|
||||
else
|
||||
{
|
||||
string line;
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
//has a text body so go with old method
|
||||
using (var reader = new StringReader(message.TextBody))
|
||||
{
|
||||
quoted.Write("> ");
|
||||
quoted.WriteLine(line);
|
||||
string line;
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
quoted.Write("> ");
|
||||
quoted.WriteLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
reply.Body = new TextPart("plain")
|
||||
{
|
||||
Text = replyBody + "\r\n\r\n\r\n" + quoted.ToString()
|
||||
|
||||
@@ -7,139 +7,155 @@
|
||||
|
||||
/*global $, app */
|
||||
|
||||
app.purchases = (function () {
|
||||
'use strict';
|
||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||
var
|
||||
app.purchases = (function() {
|
||||
"use strict";
|
||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||
var configMap = {
|
||||
//main_html: '',
|
||||
|
||||
configMap = {
|
||||
//main_html: '',
|
||||
settable_map: {}
|
||||
},
|
||||
stateMap = {
|
||||
$append_target: null
|
||||
},
|
||||
onSubmit,
|
||||
loadList,
|
||||
configModule,
|
||||
initModule;
|
||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||
|
||||
settable_map: {}
|
||||
},
|
||||
stateMap = {
|
||||
$append_target: null
|
||||
},
|
||||
onSubmit, loadList, configModule, initModule;
|
||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||
//------------------- BEGIN UTILITY METHODS ------------------
|
||||
loadList = function() {
|
||||
var epochNow = Math.round(new Date().getTime() / 1000);
|
||||
|
||||
//------------------- BEGIN UTILITY METHODS ------------------
|
||||
loadList = function () {
|
||||
//----
|
||||
//fetch
|
||||
app.api.get('site/' + stateMap.id + '/purchases', function (res) {
|
||||
if (res.error) {
|
||||
$.gevent.publish('app-show-error',res.msg);
|
||||
} else {
|
||||
//get the list ul
|
||||
var $appList = $('#rf-list');
|
||||
$appList.empty();
|
||||
$.each(res, function (i, obj) {
|
||||
//----
|
||||
//fetch
|
||||
app.api.get("site/" + stateMap.id + "/purchases", function(res) {
|
||||
if (res.error) {
|
||||
$.gevent.publish("app-show-error", res.msg);
|
||||
} else {
|
||||
//get the list ul
|
||||
var $appList = $("#rf-list");
|
||||
$appList.empty();
|
||||
$.each(res, function(i, obj) {
|
||||
//bugbug: don't just check for the presence of a cancel date but also is it in the past otherwise it's not cancelled
|
||||
if (obj.cancelDate && obj.cancelDate < epochNow) {
|
||||
$appList.append(
|
||||
"<li class='rfc-list-item-inactive'><a href=\"#!/purchaseEdit/" +
|
||||
obj.id +
|
||||
"/" +
|
||||
stateMap.id +
|
||||
'">' +
|
||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||
// ' ' +
|
||||
"<span class='text-muted'>" +
|
||||
app.utilB.genListColumn(obj.name) +
|
||||
" cancelled " +
|
||||
app.utilB.genListColumn(
|
||||
app.utilB.epochToShortDate(obj.cancelDate)
|
||||
) +
|
||||
"</span>" +
|
||||
"</a></li>"
|
||||
);
|
||||
} else {
|
||||
$appList.append(
|
||||
'<li><a href="#!/purchaseEdit/' +
|
||||
obj.id +
|
||||
"/" +
|
||||
stateMap.id +
|
||||
'">' +
|
||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||
// ' ' +
|
||||
app.utilB.genListColumn(obj.name) +
|
||||
" expires " +
|
||||
app.utilB.genListColumn(
|
||||
app.utilB.epochToShortDate(obj.expireDate)
|
||||
) +
|
||||
"</a></li>"
|
||||
);
|
||||
|
||||
if (obj.cancelDate) {
|
||||
$appList.append("<li class='rfc-list-item-inactive'><a href=\"#!/purchaseEdit/" + obj.id + "/" + stateMap.id + "\">" +
|
||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||
// ' ' +
|
||||
"<span class='text-muted'>"+
|
||||
app.utilB.genListColumn(obj.name) +
|
||||
" cancelled " +
|
||||
app.utilB.genListColumn(app.utilB.epochToShortDate(obj.cancelDate)) +
|
||||
"</span>"+
|
||||
"</a></li>");
|
||||
} else {
|
||||
$appList.append("<li><a href=\"#!/purchaseEdit/" + obj.id + "/" + stateMap.id + "\">" +
|
||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||
// ' ' +
|
||||
app.utilB.genListColumn(obj.name) +
|
||||
" expires " +
|
||||
app.utilB.genListColumn(app.utilB.epochToShortDate(obj.expireDate)) +
|
||||
"</a></li>");
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
//
|
||||
}
|
||||
});
|
||||
//------
|
||||
}
|
||||
});
|
||||
//------
|
||||
};
|
||||
//-------------------- END UTILITY METHODS -------------------
|
||||
|
||||
//--------------------- BEGIN DOM METHODS --------------------
|
||||
|
||||
// Begin private DOM methods
|
||||
|
||||
// End private DOM methods
|
||||
//---------------------- END DOM METHODS ---------------------
|
||||
|
||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||
|
||||
//-------------------- END EVENT HANDLERS --------------------
|
||||
|
||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||
//CONFIGMODULE
|
||||
//
|
||||
configModule = function(context) {
|
||||
stateMap.context = context.context;
|
||||
if (stateMap.context.params.id) {
|
||||
stateMap.id = stateMap.context.params.id;
|
||||
}
|
||||
//-------------------- END UTILITY METHODS -------------------
|
||||
};
|
||||
|
||||
//--------------------- BEGIN DOM METHODS --------------------
|
||||
// Begin public method /initModule/
|
||||
// Example : app.customer.initModule( $('#div_id') );
|
||||
// Purpose : directs the module to being offering features
|
||||
// Arguments : $container - container to use
|
||||
// Action : Provides interface
|
||||
// Returns : none
|
||||
// Throws : none
|
||||
//
|
||||
initModule = function($container) {
|
||||
if (typeof $container === "undefined") {
|
||||
$container = $("#app-shell-main-content");
|
||||
}
|
||||
stateMap.sortOrder = "d";
|
||||
$container.html(Handlebars.templates["app.purchases"]({}));
|
||||
|
||||
if (!stateMap.id) {
|
||||
throw "app.purchases.js::initModule - There is no stateMap.id!";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Begin private DOM methods
|
||||
|
||||
|
||||
|
||||
// End private DOM methods
|
||||
//---------------------- END DOM METHODS ---------------------
|
||||
|
||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------- END EVENT HANDLERS --------------------
|
||||
|
||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||
//CONFIGMODULE
|
||||
//
|
||||
configModule = function (context) {
|
||||
stateMap.context = context.context;
|
||||
if (stateMap.context.params.id) {
|
||||
stateMap.id = stateMap.context.params.id;
|
||||
app.api.get("site/" + stateMap.id, function(res) {
|
||||
if (res.error) {
|
||||
$.gevent.publish("app-show-error", res.msg);
|
||||
} else {
|
||||
//Context menu
|
||||
app.nav.contextClear();
|
||||
app.nav.contextAddLink(
|
||||
"purchaseEdit/new/" + stateMap.id,
|
||||
"New",
|
||||
"plus"
|
||||
);
|
||||
app.nav.contextAddLink(
|
||||
"customerEdit/" + res.customerId,
|
||||
"Customer",
|
||||
"account"
|
||||
);
|
||||
app.nav.contextAddLink(
|
||||
"customerSiteEdit/" + stateMap.id + "/" + res.customerId,
|
||||
"Site",
|
||||
"city"
|
||||
);
|
||||
if (stateMap.id) {
|
||||
loadList();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
// End public method /initModule/
|
||||
|
||||
// Begin public method /initModule/
|
||||
// Example : app.customer.initModule( $('#div_id') );
|
||||
// Purpose : directs the module to being offering features
|
||||
// Arguments : $container - container to use
|
||||
// Action : Provides interface
|
||||
// Returns : none
|
||||
// Throws : none
|
||||
//
|
||||
initModule = function ($container) {
|
||||
if (typeof $container === 'undefined') {
|
||||
$container = $('#app-shell-main-content');
|
||||
}
|
||||
stateMap.sortOrder = 'd';
|
||||
$container.html(Handlebars.templates['app.purchases']({}));
|
||||
|
||||
if (!stateMap.id) {
|
||||
throw ('app.purchases.js::initModule - There is no stateMap.id!');
|
||||
}
|
||||
|
||||
app.api.get('site/' + stateMap.id, function (res) {
|
||||
if (res.error) {
|
||||
$.gevent.publish('app-show-error',res.msg);
|
||||
} else {
|
||||
|
||||
//Context menu
|
||||
app.nav.contextClear();
|
||||
app.nav.contextAddLink('purchaseEdit/new/' + stateMap.id, "New", "plus");
|
||||
app.nav.contextAddLink("customerEdit/" + res.customerId, "Customer", "account");
|
||||
app.nav.contextAddLink("customerSiteEdit/" + stateMap.id + '/' + res.customerId, "Site", "city");
|
||||
if (stateMap.id) {
|
||||
loadList();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// End public method /initModule/
|
||||
|
||||
|
||||
|
||||
// return public methods
|
||||
return {
|
||||
configModule: configModule,
|
||||
initModule: initModule
|
||||
};
|
||||
//------------------- END PUBLIC METHODS ---------------------
|
||||
}());
|
||||
// return public methods
|
||||
return {
|
||||
configModule: configModule,
|
||||
initModule: initModule
|
||||
};
|
||||
//------------------- END PUBLIC METHODS ---------------------
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user