initial commit
[namibia] / public / js / app / brochure-workspace / dealerhome.js
1 ;(function(){
2
3         window._w.home = {
4
5                 itemId     : null,
6                 itemData   : null,
7                 formMeta   : null,
8                 ti         : null,
9                 counter    : 0,
10
11                 onTemplateReady : function( template, event, eventData )
12                 {
13                         _w.home.ti = _t[template];
14                         _w.home.limited = ('limitedregister' == template)
15                                 ? true
16                                 : false;
17
18                         _w.home.setHomeViewFormMeta();
19                         _w.home.ti.hydrate(_w.home.formMeta);
20                         App.API.getTask(
21                                         'auctionCount', 'Auction', 'Auction.Count', null,
22                                         {}, function() {
23                                                 App.API.execTask(
24                                                         'auctionCount', {}, {},
25                                                         function(response) {
26                                                                 _w.home.itemData = response.Data;
27                                                                 if (_w.home.ti.published)
28                                                                 {
29                                                                         _w.home._onHomeDataAndTemplate();
30                                                                 }
31                                                         }, _w.taskExecError
32                                                 );
33                                         }, _w.taskContractError
34                         );
35                 },
36
37                 onTemplatePublished : function( template, event, eventData )
38                 {
39                         _w.home.ti = _t[template];
40                         if (_w.home.ti.published)
41                         {
42                                 _w.home._onHomeDataAndTemplate();
43                         }
44                 },
45
46                 setHomeViewFormMeta : function()
47                 {
48                         data = null != _w.home.itemData
49                                 ? _w.home.itemData
50                                 : {};
51                         _w.home.formMeta = {
52                                         'auctionCount' : data ? data.Items : '0',
53                                         'auctionCountMobi' : data ? data.Items : '0',
54                         };
55                 },
56
57                 _onHomeDataAndTemplate : function ()
58                 {
59                         _w.home.setHomeViewFormMeta();
60                         _w.home.ti.hydrate(_w.home.formMeta);
61                 }
62
63         };
64 })();