79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
/*jslint browser : true, continue : true,
|
|
devel : true, indent : 2, maxerr : 50,
|
|
newcap : true, nomen : true, plusplus : true,
|
|
regexp : true, sloppy : true, vars : false,
|
|
white : true
|
|
*/
|
|
|
|
/*global $, app */
|
|
|
|
app.reportDataExpires = (function () {
|
|
|
|
'use strict';
|
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
|
var
|
|
stateMap = {},
|
|
configModule,
|
|
initModule;
|
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
|
|
|
//------------------- BEGIN UTILITY METHODS ------------------
|
|
//-------------------- END UTILITY METHODS -------------------
|
|
|
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
|
|
|
|
|
|
|
|
|
//-------------------- END EVENT HANDLERS --------------------
|
|
|
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
|
//CONFIGMODULE
|
|
//
|
|
configModule = function (context) {
|
|
stateMap.context = context.context;
|
|
};
|
|
|
|
//INITMODULE
|
|
//
|
|
initModule = function ($container) {
|
|
if (typeof $container === 'undefined') {
|
|
$container = $('#app-shell-main-content');
|
|
}
|
|
|
|
$container.html(Handlebars.templates['app.reportDataExpires']({}));
|
|
|
|
//fetch data
|
|
app.api.get('report/expires', 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) {
|
|
$appList.append("<li><a href=\"#!/purchaseEdit/" + obj.id + "/" + obj.site_id + "\">" +
|
|
app.utilB.genListColumn(app.utilB.epochToShortDate(obj.expireDate)) +
|
|
app.utilB.genListColumn(obj.customer) +
|
|
app.utilB.genListColumn(obj.name) +
|
|
"</a></li>")
|
|
});
|
|
|
|
}
|
|
});
|
|
|
|
//Context menu
|
|
app.nav.contextClear();
|
|
app.nav.contextAddLink("reportData/", "Reports", "book-open-variant");//url title icon
|
|
|
|
};
|
|
|
|
|
|
// return public methods
|
|
return {
|
|
configModule: configModule,
|
|
initModule: initModule
|
|
};
|
|
//------------------- END PUBLIC METHODS ---------------------
|
|
}()); |