initial commit
[namibia] / public / js / app / admin-workspace / override.js
1 ;(function(){
2
3         window._w.override = {
4
5                 itemId : null,
6                 itemData : null,
7                 formMeta : null,
8                 ti : null,
9
10                 onTemplateReady : function( template, event, eventData )
11                 {
12                         _w.override.ti = _t[template];
13
14                         _w.override.setPermissionsViewFormMeta();
15                         _w.override.ti.hydrate(_w.override.formMeta);
16
17                         // Retrieve initial view data.
18                         _w.override.itemId = App.Util.getUrlParam('id');
19                         App.API.getTask(
20                                 'overridePermissions:' + _w.override.itemId, 'User', 'Override.Update', null,
21                                 {'id':_w.override.itemId},
22                                 $.proxy( _w.override._onPermissionsViewDataReceived, this ),
23                                 _w.taskContractError
24                         );
25                 },
26
27                 onTemplatePublished : function( template, event, eventData )
28                 {
29                         _w.override.ti = _t[template];
30                 },
31
32                 _routeToActive : function()
33                 {
34                         App.API.directRoute(
35                                 'routePermissionsActive:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToActive',
36                                 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
37                         );
38                 },
39
40                 _routeToSuspended : function()
41                 {
42                         App.API.directRoute(
43                                 'routePermissionsSuspended:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToSuspended',
44                                 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
45                         );
46                 },
47
48                 _routeToArchived : function()
49                 {
50                         App.API.directRoute(
51                                 'routePermissionsArchive:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToArchive',
52                                 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
53                         );
54                 },
55
56                 setPermissionsViewFormMeta : function( data )
57                 {
58                         if (!data)
59                         {
60                                 data = {};
61                         }
62                         _w.override.formMeta = {
63                                 'accessPortalModule' : {
64                                         type  : 'checkbox',
65                                         id    : 'accessPortalModule',
66                                         title : 'Portal access',
67                                         value : data.accessPortalModule ? true : false,
68                                         onChange : function() {
69                                                 $('#portalPagesSection input').prop('disabled', !$(this).prop('checked'));
70                                                 $('#portalPagesSection .control-group').toggleClass('warning', !$(this).prop('checked'));
71                                                 $('#suAccessSection input').prop('disabled', !$(this).prop('checked'));
72                                                 $('#suAccessSection .control-group').toggleClass('warning', !$(this).prop('checked'));
73                                                 $('#settingsPageSection input').prop('disabled', !$(this).prop('checked'));
74                                                 $('#settingsPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
75                                                 $('#valuationPageSection input').prop('disabled', !$(this).prop('checked'));
76                                                 $('#valuationPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
77                                                 $('#pgPageSection input').prop('disabled', !$(this).prop('checked'));
78                                                 $('#pgPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
79                                                 $('#auctionPageSection input').prop('disabled', !$(this).prop('checked'));
80                                                 $('#tcPageSection input').prop('disabled', !$(this).prop('checked'));
81                                                 $('#stockPageSection input').prop('disabled', !$(this).prop('checked'));
82                                                 $('#stockPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
83                                                 if ($(this).prop('checked'))
84                                                 {
85                                                         $('#valuationView').change();
86                                                         $('#pgView').change();
87                                                         $('#stockView').change();
88                                                         $('#settingsPage').change();
89                                                         $('#valuationPage').change();
90                                                         $('#pgPage').change();
91                                                         $('#auctionPage').change();
92                                                         $('#tcPage').change();
93                                                         $('#stockPage').change();
94                                                         $('#suAccess').change();
95                                                 }
96                                         }
97                                 },
98                                 'suAccess' : {
99                                         type  : 'checkbox',
100                                         id    : 'suAccess',
101                                         title : 'Super user access',
102                                         value : data.suAccess ? true : false,
103                                         onChange : function() {
104                                                 $('#suAccessSection input').prop('disabled', !$(this).prop('checked'));
105                                                 $('#suAccessSection .control-group').toggleClass('warning', !$(this).prop('checked'));
106                                         }
107                                 },
108                                 'settingsPage' : {
109                                         type  : 'checkbox',
110                                         id    : 'settingsPage',
111                                         title : 'Settings page',
112                                         value : data.settingsPage ? true : false,
113                                         onChange : function() {
114                                                 $('#settingsPageSection input').prop('disabled', !$(this).prop('checked'));
115                                                 $('#settingsPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
116                                         }
117                                 },
118                                 'valuationPage' : {
119                                         type  : 'checkbox',
120                                         id    : 'valuationPage',
121                                         title : 'Valuation page',
122                                         value : data.valuationPage ? true : false,
123                                         onChange : function() {
124                                                 $('#valuationPageSection input').prop('disabled', !$(this).prop('checked'));
125                                                 $('#valuationPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
126                                                 if ($(this).prop('checked'))
127                                                 {
128                                                         $('#valuationView').change();
129                                                 }
130                                         }
131                                 },
132                                 'pgPage' : {
133                                         type  : 'checkbox',
134                                         id    : 'pgPage',
135                                         title : 'Price guide page',
136                                         value : data.pgPage ? true : false,
137                                         onChange : function() {
138                                                 $('#pgPageSection input').prop('disabled', !$(this).prop('checked'));
139                                                 $('#pgPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
140                                                 if ($(this).prop('checked'))
141                                                 {
142                                                         $('#pgView').change();
143                                                 }
144                                         }
145                                 },
146                                 'stockPage' : {
147                                         type  : 'checkbox',
148                                         id    : 'stockPage',
149                                         title : 'Stock page',
150                                         value : data.stockPage ? true : false,
151                                         onChange : function() {
152                                                 $('#stockPageSection input').prop('disabled', !$(this).prop('checked'));
153                                                 $('#stockPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
154                                                 if ($(this).prop('checked'))
155                                                 {
156                                                         $('#stockView').change();
157                                                 }
158                                         }
159                                 },
160                                 'auctionPage' : {
161                                         type  : 'checkbox',
162                                         id    : 'auctionPage',
163                                         title : 'Auction page',
164                                         value : data.auctionPage ? true : false,
165                                                         onChange : function() {
166                                                                 $('#auctionPageSection input').prop('disabled', !$(this).prop('checked'));
167                                                                 $('#auctionPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
168                                                         }
169                                 },
170                                 'tcPage' : {
171                                         type  : 'checkbox',
172                                         id    : 'tcPage',
173                                         title : 'Trade Center page',
174                                         value : data.tcPage ? true : false,
175                                                         onChange : function() {
176                                                                 $('#tcPageSection input').prop('disabled', !$(this).prop('checked'));
177                                                                 $('#tcPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
178                                                         }
179                                 },
180                                 'suGroupFull' : {
181                                         type  : 'checkbox',
182                                         id    : 'suGroupFull',
183                                         title : 'Group filtering',
184                                         value : data.suGroupFull ? true : false
185                                 },
186                                 'suDivisionFull' : {
187                                         type  : 'checkbox',
188                                         id    : 'suDivisionFull',
189                                         title : 'Division filtering',
190                                         value : data.suDivisionFull ? true : false
191                                 },
192                                 'suCompanyFull' : {
193                                         type  : 'checkbox',
194                                         id    : 'suCompanyFull',
195                                         title : 'Company filtering',
196                                         value : data.suCompanyFull ? true : false
197                                 },
198                                 'settingsUser' : {
199                                         type  : 'checkbox',
200                                         id    : 'settingsUser',
201                                         title : 'User management',
202                                         value : data.settingsUser ? true : false
203                                 },
204                                 'settingsClub' : {
205                                         type  : 'checkbox',
206                                         id    : 'settingsClub',
207                                         title : 'Club management',
208                                         value : data.settingsClub ? true : false
209                                 },
210                                 'settingsMembership' : {
211                                         type  : 'checkbox',
212                                         id    : 'settingsMembership',
213                                         title : 'Membership management',
214                                         value : data.settingsMembership ? true : false
215                                 },
216                                 'settingsRetail' : {
217                                         type  : 'checkbox',
218                                         id    : 'settingsRetail',
219                                         title : 'Retail management',
220                                         value : data.settingsRetail ? true : false
221                                 },
222                                 'settingsReport' : {
223                                         type  : 'checkbox',
224                                         id    : 'settingsReport',
225                                         title : 'Reports',
226                                         value : data.settingsReport ? true : false
227                                 },
228                                 'settingsHpiReport' : {
229                                         type  : 'checkbox',
230                                         id    : 'settingsHpiReport',
231                                         title : 'HPI Reports',
232                                         value : data.settingsHpiReport ? true : false
233                                 },
234                                 'settingsGridExport' : null,
235                                 'settingsDealership' : {
236                                         type  : 'checkbox',
237                                         id    : 'settingsDealership',
238                                         title : 'Update dealership details',
239                                         value : data.settingsDealership ? true : false
240                                 },
241                                 'settingsPersonal' : {
242                                         type  : 'checkbox',
243                                         id    : 'settingsPersonal',
244                                         title : 'Update personal details',
245                                         value : data.settingsPersonal ? true : false
246                                 },
247                                 'settingsResetPin' : {
248                                         type  : 'checkbox',
249                                         id    : 'settingsResetPin',
250                                         title : 'Reset pin',
251                                         value : data.settingsResetPin ? true : false
252                                 },
253                                 'valuationView' : {
254                                         type  : 'checkbox',
255                                         id    : 'valuationView',
256                                         title : 'View valuation',
257                                         value : data.valuationView ? true : false,
258                                         onChange : function() {
259                                                 $('#valuationViewSection input').prop('disabled', !$(this).prop('checked'));
260                                                 $('#valuationViewSection .control-group').toggleClass('warning', !$(this).prop('checked'));
261                                         }
262                                 },
263                                 'valuationGridExport' : {
264                                         type  : 'checkbox',
265                                         id    : 'valuationGridExport',
266                                         title : 'Export valuation data',
267                                         value : data.valuationGridExport ? true : false
268                                 },
269                                 'valuationIsSales' : {
270                                         type  : 'checkbox',
271                                         id    : 'valuationIsSales',
272                                         title : 'Is a sales person',
273                                         value : data.valuationIsSales ? true : false
274                                 },
275                                 'valuationIsValuator' : {
276                                         type  : 'checkbox',
277                                         id    : 'valuationIsValuator',
278                                         title : 'Is a valuator',
279                                         value : data.valuationIsValuator ? true : false
280                                 },
281                                 'valuationCreateNew' : {
282                                         type  : 'checkbox',
283                                         id    : 'valuationCreateNew',
284                                         title : 'Create valuation and save as New',
285                                         value : data.valuationCreateNew ? true : false
286                                 },
287                                 'valuationCreateSales' : {
288                                         type  : 'checkbox',
289                                         id    : 'valuationCreateSales',
290                                         title : 'Create valuation and send to Valuator(s)',
291                                         value : data.valuationCreateSales ? true : false
292                                 },
293                                 'valuationCreatePending' : {
294                                         type  : 'checkbox',
295                                         id    : 'valuationCreatePending',
296                                         title : 'Create valuation and save as Pending',
297                                         value : data.valuationCreatePending ? true : false
298                                 },
299                                 'valuationCreatePriceguide' : {
300                                         type  : 'checkbox',
301                                         id    : 'valuationCreatePriceguide',
302                                         title : 'Create valuation and send to Price Guide',
303                                         value : data.valuationCreatePriceguide ? true : false
304                                 },
305                                 'valuationCreateComplete' : {
306                                         type  : 'checkbox',
307                                         id    : 'valuationCreateComplete',
308                                         title : 'Create valuation and send to Sales',
309                                         value : data.valuationCreateComplete ? true : false
310                                 },
311                                 'valuationCreateStock' : {
312                                         type  : 'checkbox',
313                                         id    : 'valuationCreateStock',
314                                         title : 'Create valuation and send to Stock',
315                                         value : data.valuationCreateStock ? true : false
316                                 },
317                                 'valuationUpdate' : {
318                                         type  : 'checkbox',
319                                         id    : 'valuationUpdate',
320                                         title : 'Update a valuation',
321                                         value : data.valuationUpdate ? true : false
322                                 },
323                                 'valuationUpdateDamages' : {
324                                         type  : 'checkbox',
325                                         id    : 'valuationUpdateDamages',
326                                         title : 'Update damages',
327                                         value : data.valuationUpdateDamages ? true : false
328                                 },
329                                 'valuationUpdateCoverReceived' : {
330                                         type  : 'checkbox',
331                                         id    : 'valuationUpdateCoverReceived',
332                                         title : 'Update cover received',
333                                         value : data.valuationUpdateCoverReceived ? true : false
334                                 },
335                                 'valuationUploadPhotos' : {
336                                         type  : 'checkbox',
337                                         id    : 'valuationUploadPhotos',
338                                         title : 'Upload photos',
339                                         value : data.valuationUploadPhotos ? true : false
340                                 },
341                                 'valuationPricingDetails' : {
342                                         type  : 'checkbox',
343                                         id    : 'valuationPricingDetails',
344                                         title : 'Full pricing details',
345                                         value : data.valuationPricingDetails ? true : false
346                                 },
347                 'valuationCalendar' : {
348                     type  : 'checkbox',
349                     id    : 'valuationCalendar',
350                     title : 'Enable Valuation Calendar',
351                     value : data.valuationCalendar ? true : false
352                 },
353                                 'valuationRoutePending' : {
354                                         type  : 'checkbox',
355                                         id    : 'valuationRoutePending',
356                                         title : 'Update and send to Pending',
357                                         value : data.valuationRoutePending ? true : false
358                                 },
359                                 'valuationRouteComplete' : {
360                                         type  : 'checkbox',
361                                         id    : 'valuationRouteComplete',
362                                         title : 'Update and send to Sales',
363                                         value : data.valuationRouteComplete ? true : false
364                                 },
365                                 'valuationRouteStock' : {
366                                         type  : 'checkbox',
367                                         id    : 'valuationRouteStock',
368                                         title : 'Update and send to Stock',
369                                         value : data.valuationRouteStock ? true : false
370                                 },
371                                 'valuationRoutePriceguide' : {
372                                         type  : 'checkbox',
373                                         id    : 'valuationRoutePriceguide',
374                                         title : 'Update and send to Price Guide',
375                                         value : data.valuationRoutePriceguide ? true : false
376                                 },
377                                 'valuationRouteDealDone' : {
378                                         type  : 'checkbox',
379                                         id    : 'valuationRouteDealDone',
380                                         title : 'Update and send to Deal Done',
381                                         value : data.valuationRouteDealDone ? true : false
382                                 },
383                                 'valuationRouteDealNotDone' : {
384                                         type  : 'checkbox',
385                                         id    : 'valuationRouteDealNotDone',
386                                         title : 'Update and send to Deal Not Done',
387                                         value : data.valuationRouteDealNotDone ? true : false
388                                 },
389                                 'valuationArchive' : {
390                                         type  : 'checkbox',
391                                         id    : 'valuationArchive',
392                                         title : 'Archive valuation',
393                                         value : data.valuationArchive ? true : false
394                                 },
395                                 'valuationUnarchive' : {
396                                         type  : 'checkbox',
397                                         id    : 'valuationUnarchive',
398                                         title : 'Unarchive valuation',
399                                         value : data.valuationUnarchive ? true : false
400                                 },
401                                 'valuationPrint' : {
402                                         type  : 'checkbox',
403                                         id    : 'valuationPrint',
404                                         title : 'Print valuation',
405                                         value : data.valuationPrint ? true : false
406                                 },
407                                 'valuationB4cReport' : {
408                                         type  : 'checkbox',
409                                         id    : 'valuationB4cReport',
410                                         title : 'Request B4C Report',
411                                         value : data.valuationB4cReport ? true : false
412                                 },
413                                 'valuationBmw' : {
414                                         type  : 'checkbox',
415                                         id    : 'valuationBmw',
416                                         title : 'Request BMW Report',
417                                         value : data.valuationBmw ? true : false
418                                 },
419                                 'pgGridExport' : {
420                                         type  : 'checkbox',
421                                         id    : 'pgGridExport',
422                                         title : 'Export price guide data',
423                                         value : data.pgGridExport ? true : false
424                                 },
425                                 'pgView' : {
426                                         type  : 'checkbox',
427                                         id    : 'pgView',
428                                         title : 'View price guide entry',
429                                         value : data.pgView ? true : false,
430                                         onChange : function() {
431                                                 $('#pgViewSection input').prop('disabled', !$(this).prop('checked'));
432                                                 $('#pgViewSection .control-group').toggleClass('warning', !$(this).prop('checked'));
433                                         }
434                                 },
435                                 'pgB4cReport' : {
436                                         type  : 'checkbox',
437                                         id    : 'pgB4cReport',
438                                         title : 'Request B4C Report',
439                                         value : data.pgB4cReport ? true : false
440                                 },
441                                 'pgMakeOffer' : {
442                                         type  : 'checkbox',
443                                         id    : 'pgMakeOffer',
444                                         title : 'Make an offer',
445                                         value : data.pgMakeOffer ? true : false
446                                 },
447                                 'pgUpdateOffer' : {
448                                         type  : 'checkbox',
449                                         id    : 'pgUpdateOffer',
450                                         title : 'Update an offer',
451                                         value : data.pgUpdateOffer ? true : false
452                                 },
453                                 'pgPrint' : {
454                                         type  : 'checkbox',
455                                         id    : 'pgPrint',
456                                         title : 'Print',
457                                         value : data.pgPrint ? true : false
458                                 },
459                                 'pgArchive' : {
460                                         type  : 'checkbox',
461                                         id    : 'pgArchive',
462                                         title : 'Archive',
463                                         value : data.pgArchive ? true : false
464                                 },
465                                 'pgUnArchive' : {
466                                         type  : 'checkbox',
467                                         id    : 'pgUnArchive',
468                                         title : 'Unarchive',
469                                         value : data.pgUnArchive ? true : false
470                                 },
471                                 'stockGridExport' : {
472                                         type  : 'checkbox',
473                                         id    : 'stockGridExport',
474                                         title : 'Export stock data',
475                                         value : data.stockGridExport ? true : false
476                                 },
477                 'stockAuctionReportGridExport' : {
478                     type  : 'checkbox',
479                     id    : 'stockAuctionReportGridExport',
480                     title : 'Stock auction report data',
481                     value : data.stockAuctionReportGridExport ? true : false
482                 },
483                 'stockBulkImportDrive' : {
484                     type  : 'checkbox',
485                     id    : 'stockBulkImportDrive',
486                     title : 'Stock bulk import Drive',
487                     value : data.stockBulkImportDrive ? true : false
488                 },
489                 'stockBulkImportPinnacle' : {
490                     type  : 'checkbox',
491                     id    : 'stockBulkImportPinnacle',
492                     title : 'Stock bulk import Pinnacle',
493                     value : data.stockBulkImportPinnacle ? true : false
494                 },
495                                 'stockView' : {
496                                         type  : 'checkbox',
497                                         id    : 'stockView',
498                                         title : 'View stock',
499                                         value : data.stockView ? true : false,
500                                         onChange : function() {
501                                                 $('#stockViewSection input').prop('disabled', !$(this).prop('checked'));
502                                                 $('#stockViewSection .control-group').toggleClass('warning', !$(this).prop('checked'));
503                                         }
504                                 },
505                                 'stockUpdate' : {
506                                         type  : 'checkbox',
507                                         id    : 'stockUpdate',
508                                         title : 'Update stock',
509                                         value : data.stockUpdate ? true : false
510                                 },
511                                 'stockUpdateDamages' : {
512                                         type  : 'checkbox',
513                                         id    : 'stockUpdateDamages',
514                                         title : 'Update damages',
515                                         value : data.stockUpdateDamages ? true : false
516                                 },
517                                 'stockUpdateCoverReceived' : {
518                                         type  : 'checkbox',
519                                         id    : 'stockUpdateCoverReceived',
520                                         title : 'Update cover received',
521                                         value : data.stockUpdateCoverReceived ? true : false
522                                 },
523                                 'stockUploadPhotos' : {
524                                         type  : 'checkbox',
525                                         id    : 'stockUploadPhotos',
526                                         title : 'Upload photos',
527                                         value : data.stockUploadPhotos ? true : false
528                                 },
529                                 'stockRouteAuction' : {
530                                         type  : 'checkbox',
531                                         id    : 'stockRouteAuction',
532                                         title : 'Update and send to Auction',
533                                         value : data.stockRouteAuction ? true : false
534                                 },
535                                 'stockRouteRetail' : {
536                                         type  : 'checkbox',
537                                         id    : 'stockRouteRetail',
538                                         title : 'Update and send to Retail',
539                                         value : data.stockRouteRetail ? true : false
540                                 },
541                                 'stockReclaimRetail' : {
542                                         type  : 'checkbox',
543                                         id    : 'stockReclaimRetail',
544                                         title : 'Reclaim from Retail',
545                                         value : data.stockReclaimRetail ? true : false
546                                 },
547                                 'stockRoutePriceguide' : {
548                                         type  : 'checkbox',
549                                         id    : 'stockRoutePriceguide',
550                                         title : 'Update and send to Price Guide',
551                                         value : data.stockRoutePriceguide ? true : false
552                                 },
553                                 'stockRouteValuation' : {
554                                         type  : 'checkbox',
555                                         id    : 'stockRouteValuation',
556                                         title : 'Update and send to Valuation',
557                                         value : data.stockRouteValuation ? true : false
558                                 },
559                                 'stockPrint' : {
560                                         type  : 'checkbox',
561                                         id    : 'stockPrint',
562                                         title : 'Print',
563                                         value : data.stockPrint ? true : false
564                                 },
565                                 'stockArchive' : {
566                                         type  : 'checkbox',
567                                         id    : 'stockArchive',
568                                         title : 'Archive',
569                                         value : data.stockArchive ? true : false
570                                 },
571                                 'stockUnarchive' : {
572                                         type  : 'checkbox',
573                                         id    : 'stockUnarchive',
574                                         title : 'Unarchive',
575                                         value : data.stockUnarchive ? true : false
576                                 },
577                                 'auctionGridExport' : {
578                                         type  : 'checkbox',
579                                         id    : 'auctionGridExport',
580                                         title : 'Export auction data',
581                                         value : data.auctionGridExport ? true : false
582                                 },
583                                 'auctionBid' : {
584                                         type  : 'checkbox',
585                                         id    : 'auctionBid',
586                                         title : 'Bid on auction',
587                                         value : data.auctionBid ? true : false
588                                 },
589                                 'tcGridExport' : {
590                                         type  : 'checkbox',
591                                         id    : 'tcGridExport',
592                                         title : 'Export trade center data',
593                                         value : data.tcGridExport ? true : false
594                                 },
595                                 'appCreateValuation' : {
596                                         type  : 'checkbox',
597                                         id    : 'appCreateValuation',
598                                         title : 'Create valuation',
599                                         value : data.appCreateValuation ? true : false
600                                 },
601                                 'appCompleteValuation' : {
602                                         type  : 'checkbox',
603                                         id    : 'appCompleteValuation',
604                                         title : 'Complete portal valuation',
605                                         value : data.appCompleteValuation ? true : false
606                                 },
607                                 'accessAdminModule' : {
608                                         type  : 'checkbox',
609                                         id    : 'accessAdminModule',
610                                         title : 'Admin access',
611                                         value : data.accessAdminModule ? true : false,
612                                         onChange : function() {
613                                                 $('#adminPageSection input').prop('disabled', !$(this).prop('checked'));
614                                                 $('#adminPageSection .control-group').toggleClass('warning', !$(this).prop('checked'));
615                                         }
616                                 },
617                                 'adminPage' : {
618                                         type  : 'checkbox',
619                                         id    : 'adminPage',
620                                         title : 'Manage permissions',
621                                         value : data.adminPage ? true : false
622                                 },
623                                 'adminRegistration' : {
624                                         type  : 'checkbox',
625                                         id    : 'adminRegistration',
626                                         title : 'Manage registrations',
627                                         value : data.adminRegistration ? true : false
628                                 },
629                                 'adminReport' : {
630                                         type  : 'checkbox',
631                                         id    : 'adminReport',
632                                         title : 'Reports',
633                                         value : data.adminReport ? true : false
634                                 },
635                                 'adminCommunication' : {
636                                         type  : 'checkbox',
637                                         id    : 'adminCommunication',
638                                         title : 'Manage communications',
639                                         value : data.adminCommunication ? true : false
640                                 },
641                                 'adminSettings' : {
642                                         type  : 'checkbox',
643                                         id    : 'adminSettings',
644                                         title : 'Manage system settings',
645                                         value : data.adminSettings ? true : false
646                                 },
647                                 'adminUser' : {
648                                         type  : 'checkbox',
649                                         id    : 'adminUser',
650                                         title : 'Manage system users',
651                                         value : data.adminUser ? true : false
652                                 },
653                                 'adminDealer' : {
654                                         type  : 'checkbox',
655                                         id    : 'adminDealer',
656                                         title : 'Manage dealerships',
657                                         value : data.adminDealer ? true : false
658                                 },
659                                 'adminAuction' : {
660                                         type  : 'checkbox',
661                                         id    : 'adminAuction',
662                                         title : 'Manage auctions',
663                                         value : data.adminAuction ? true : false
664                                 },
665                 'historicalPage' : {
666                                         type  : 'checkbox',
667                                         id    : 'historicalPage',
668                                         title : 'Historical Auction Data',
669                                         value : data.historicalPage ? true : false
670                                 },
671                 'etpGemDmd' : {
672                     type  : 'checkbox',
673                     id    : 'etpGemDmd',
674                     title : 'GEM DMD',
675                     value : data.etpGemDmd ? true : false
676                 }
677                         };
678                 },
679
680                 _onPermissionsViewDataReceived : function( response )
681                 {
682                         _w.override.itemId = response.Data.id;
683                         _w.override.itemData = response.Data;
684                         _w.override.setPermissionsViewFormMeta(response.Data);
685                         _w.override.ti.hydrate(_w.override.formMeta);
686                         _w.override._setupValidation();
687                         $('#valuationView').change();
688                         $('#pgView').change();
689                         $('#stockView').change();
690                         $('#settingsPage').change();
691                         $('#valuationPage').change();
692                         $('#pgPage').change();
693                         $('#stockPage').change();
694                         $('#auctionPage').change();
695                         $('#suAccess').change();
696                         $('#accessPortalModule').change();
697                         $('#accessAdminModule').change();
698                 },
699
700                 _setupValidation : function ()
701                 {
702                         $('#frmPermissionsView').validate({
703                                 submitHandler: function( form ) {
704                                         $('#btnUpdate').prop('disabled', true);
705                                         var data = _w.override._prepPermissionsUpdateData();
706                                         App.API.execTask(
707                                                         'overridePermissions:' + _w.override.itemId, data, {},
708                                                         _w.override._onPermissionsUpdated, _w.taskExecError
709                                                 );
710                                 }
711                         });
712                         $('#btnUpdate').prop('disabled', false);
713                 },
714
715                 _prepPermissionsUpdateData : function()
716                 {
717                         return {Override:_w.override.ti.harvest()};
718                 },
719
720                 _onPermissionsUpdated : function( response )
721                 {
722                         window.location.hash = '/systemusers';
723                 }
724
725         };
726
727 })();