text changes to registration mail content
[namibia] / public / js / app / portal-workspace / disputeview.js
1 ;(function(){
2
3         window._w.disputeview = {
4
5                 itemId : null,
6                 itemData : null,
7                 formMeta : null,
8                 ti : null,
9
10                 onViewTemplateReady : function( template, event, eventData )
11                 {
12                         _w.disputeview.ti = _t[template];
13                         _w.disputeview.itemData = null;
14                         _w.disputeview.setDisputeViewFormMeta();
15                         _w.disputeview.ti.hydrate(_w.disputeview.formMeta);
16
17                         // Retrieve initial view data.
18                         _w.disputeview.itemId = App.Util.getUrlParam('id');
19                         App.API.getTask(
20                                 'viewDispute:' + _w.disputeview.itemId, 'Dispute', 'Dispute.View', _w.disputeview.itemId,
21                                 {'id':_w.disputeview.itemId}, _w.disputeview._onDisputeViewDataReceived, _w.taskContractError
22                         );
23                 },
24
25                 setDisputeViewFormMeta : function( data )
26                 {
27                         if (!data)
28                         {
29                                 data = {};
30                         }
31                         _w.disputeview.formMeta = {
32                                         'jobState' : {
33                                                 title       : 'Status',
34                                                 value       : data.jobState
35                                         },
36                                         'created' : {
37                                                 title       : 'Created',
38                                                 value       : data.created ? ((data.created).split(' '))[0] : ''
39                                         },
40                                         'vehicle' : {
41                                                 title       : 'Vehicle',
42                                                 value       : data.auction ? data.auction.stock.type.model.make.name
43                                                                                         + ', ' + data.auction.stock.type.model.name
44                                                                                         + ', ' + data.auction.stock.type.name
45                                                                                         + ' (' + data.auction.stock.vehicleYear.name + ')'
46                                                                                 : ''
47                                         },
48                                         'complaint' : {
49                                                 title       : 'Complaint',
50                                                 value       : data.complaint
51                                         },
52                                         'resolution' : {
53                                                 title       : 'Resolution',
54                                                 value       : data.resolution
55                                         },
56                                         'plaintive' : {
57                                                 title       : 'Plaintiff',
58                                                 value       : data.fromCompany ? data.fromCompany.name : ''
59                                         },
60                                         'contact' : {
61                                                 title       : 'Contact person',
62                                                 value       : data.fromCompany
63                                                                                 ? data.fromCompany.contact.firstName
64                                                                                                 + ' ' + data.fromCompany.contact.familyName
65                                                                                 : ''
66                                         },
67                                         'office' : {
68                                                 title       : 'Office',
69                                                 value       : data.fromCompany ? data.fromCompany.contact.office : ''
70                                         },
71                                         'mobile' : {
72                                                 title       : 'Mobile',
73                                                 value       : data.fromCompany ? data.fromCompany.contact.mobile : ''
74                                         },
75                                         'email' : {
76                                                 title       : 'Email',
77                                                 value       : data.fromCompany ? data.fromCompany.contact.email : ''
78                                         }
79                         };
80                 },
81
82                 _onDisputeViewDataReceived : function( response )
83                 {
84                         _w.disputeview.itemId = response.Data.id;
85                         _w.disputeview.itemData = response.Data;
86                         console.log(response.Data);
87                         _w.disputeview.setDisputeViewFormMeta(response.Data);
88                         _w.disputeview.ti.hydrate(_w.disputeview.formMeta);
89                 }
90
91         };
92
93 })();