10 onTemplateReady : function( template, event, eventData )
12 _w.override.ti = _t[template];
14 _w.override.setPermissionsViewFormMeta();
15 _w.override.ti.hydrate(_w.override.formMeta);
17 // Retrieve initial view data.
18 _w.override.itemId = App.Util.getUrlParam('id');
20 'overridePermissions:' + _w.override.itemId, 'User', 'Override.Update', null,
21 {'id':_w.override.itemId},
22 $.proxy( _w.override._onPermissionsViewDataReceived, this ),
27 onTemplatePublished : function( template, event, eventData )
29 _w.override.ti = _t[template];
32 _routeToActive : function()
35 'routePermissionsActive:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToActive',
36 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
40 _routeToSuspended : function()
43 'routePermissionsSuspended:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToSuspended',
44 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
48 _routeToArchived : function()
51 'routePermissionsArchive:' + _w.override.itemId, 'Permissions', 'Workflow.MoveToArchive',
52 _w.override.itemId, {}, _w.override._onPermissionsUpdated, _w.taskExecError
56 setPermissionsViewFormMeta : function( data )
62 _w.override.formMeta = {
63 'accessPortalModule' : {
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'))
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();
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'));
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'));
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'))
128 $('#valuationView').change();
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'))
142 $('#pgView').change();
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'))
156 $('#stockView').change();
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'));
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'));
183 title : 'Group filtering',
184 value : data.suGroupFull ? true : false
188 id : 'suDivisionFull',
189 title : 'Division filtering',
190 value : data.suDivisionFull ? true : false
194 id : 'suCompanyFull',
195 title : 'Company filtering',
196 value : data.suCompanyFull ? true : false
201 title : 'User management',
202 value : data.settingsUser ? true : false
207 title : 'Club management',
208 value : data.settingsClub ? true : false
210 'settingsMembership' : {
212 id : 'settingsMembership',
213 title : 'Membership management',
214 value : data.settingsMembership ? true : false
218 id : 'settingsRetail',
219 title : 'Retail management',
220 value : data.settingsRetail ? true : false
224 id : 'settingsReport',
226 value : data.settingsReport ? true : false
228 'settingsHpiReport' : {
230 id : 'settingsHpiReport',
231 title : 'HPI Reports',
232 value : data.settingsHpiReport ? true : false
234 'settingsGridExport' : null,
235 'settingsDealership' : {
237 id : 'settingsDealership',
238 title : 'Update dealership details',
239 value : data.settingsDealership ? true : false
241 'settingsPersonal' : {
243 id : 'settingsPersonal',
244 title : 'Update personal details',
245 value : data.settingsPersonal ? true : false
247 'settingsResetPin' : {
249 id : 'settingsResetPin',
251 value : data.settingsResetPin ? true : false
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'));
263 'valuationGridExport' : {
265 id : 'valuationGridExport',
266 title : 'Export valuation data',
267 value : data.valuationGridExport ? true : false
269 'valuationIsSales' : {
271 id : 'valuationIsSales',
272 title : 'Is a sales person',
273 value : data.valuationIsSales ? true : false
275 'valuationIsValuator' : {
277 id : 'valuationIsValuator',
278 title : 'Is a valuator',
279 value : data.valuationIsValuator ? true : false
281 'valuationCreateNew' : {
283 id : 'valuationCreateNew',
284 title : 'Create valuation and save as New',
285 value : data.valuationCreateNew ? true : false
287 'valuationCreateSales' : {
289 id : 'valuationCreateSales',
290 title : 'Create valuation and send to Valuator(s)',
291 value : data.valuationCreateSales ? true : false
293 'valuationCreatePending' : {
295 id : 'valuationCreatePending',
296 title : 'Create valuation and save as Pending',
297 value : data.valuationCreatePending ? true : false
299 'valuationCreatePriceguide' : {
301 id : 'valuationCreatePriceguide',
302 title : 'Create valuation and send to Price Guide',
303 value : data.valuationCreatePriceguide ? true : false
305 'valuationCreateComplete' : {
307 id : 'valuationCreateComplete',
308 title : 'Create valuation and send to Sales',
309 value : data.valuationCreateComplete ? true : false
311 'valuationCreateStock' : {
313 id : 'valuationCreateStock',
314 title : 'Create valuation and send to Stock',
315 value : data.valuationCreateStock ? true : false
317 'valuationUpdate' : {
319 id : 'valuationUpdate',
320 title : 'Update a valuation',
321 value : data.valuationUpdate ? true : false
323 'valuationUpdateDamages' : {
325 id : 'valuationUpdateDamages',
326 title : 'Update damages',
327 value : data.valuationUpdateDamages ? true : false
329 'valuationUpdateCoverReceived' : {
331 id : 'valuationUpdateCoverReceived',
332 title : 'Update cover received',
333 value : data.valuationUpdateCoverReceived ? true : false
335 'valuationUploadPhotos' : {
337 id : 'valuationUploadPhotos',
338 title : 'Upload photos',
339 value : data.valuationUploadPhotos ? true : false
341 'valuationPricingDetails' : {
343 id : 'valuationPricingDetails',
344 title : 'Full pricing details',
345 value : data.valuationPricingDetails ? true : false
347 'valuationCalendar' : {
349 id : 'valuationCalendar',
350 title : 'Enable Valuation Calendar',
351 value : data.valuationCalendar ? true : false
353 'valuationRoutePending' : {
355 id : 'valuationRoutePending',
356 title : 'Update and send to Pending',
357 value : data.valuationRoutePending ? true : false
359 'valuationRouteComplete' : {
361 id : 'valuationRouteComplete',
362 title : 'Update and send to Sales',
363 value : data.valuationRouteComplete ? true : false
365 'valuationRouteStock' : {
367 id : 'valuationRouteStock',
368 title : 'Update and send to Stock',
369 value : data.valuationRouteStock ? true : false
371 'valuationRoutePriceguide' : {
373 id : 'valuationRoutePriceguide',
374 title : 'Update and send to Price Guide',
375 value : data.valuationRoutePriceguide ? true : false
377 'valuationRouteDealDone' : {
379 id : 'valuationRouteDealDone',
380 title : 'Update and send to Deal Done',
381 value : data.valuationRouteDealDone ? true : false
383 'valuationRouteDealNotDone' : {
385 id : 'valuationRouteDealNotDone',
386 title : 'Update and send to Deal Not Done',
387 value : data.valuationRouteDealNotDone ? true : false
389 'valuationArchive' : {
391 id : 'valuationArchive',
392 title : 'Archive valuation',
393 value : data.valuationArchive ? true : false
395 'valuationUnarchive' : {
397 id : 'valuationUnarchive',
398 title : 'Unarchive valuation',
399 value : data.valuationUnarchive ? true : false
403 id : 'valuationPrint',
404 title : 'Print valuation',
405 value : data.valuationPrint ? true : false
407 'valuationB4cReport' : {
409 id : 'valuationB4cReport',
410 title : 'Request B4C Report',
411 value : data.valuationB4cReport ? true : false
416 title : 'Request BMW Report',
417 value : data.valuationBmw ? true : false
422 title : 'Export price guide data',
423 value : data.pgGridExport ? true : false
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'));
438 title : 'Request B4C Report',
439 value : data.pgB4cReport ? true : false
444 title : 'Make an offer',
445 value : data.pgMakeOffer ? true : false
449 id : 'pgUpdateOffer',
450 title : 'Update an offer',
451 value : data.pgUpdateOffer ? true : false
457 value : data.pgPrint ? true : false
463 value : data.pgArchive ? true : false
469 value : data.pgUnArchive ? true : false
471 'stockGridExport' : {
473 id : 'stockGridExport',
474 title : 'Export stock data',
475 value : data.stockGridExport ? true : false
477 'stockAuctionReportGridExport' : {
479 id : 'stockAuctionReportGridExport',
480 title : 'Stock auction report data',
481 value : data.stockAuctionReportGridExport ? true : false
483 'stockBulkImportDrive' : {
485 id : 'stockBulkImportDrive',
486 title : 'Stock bulk import Drive',
487 value : data.stockBulkImportDrive ? true : false
489 'stockBulkImportPinnacle' : {
491 id : 'stockBulkImportPinnacle',
492 title : 'Stock bulk import Pinnacle',
493 value : data.stockBulkImportPinnacle ? true : false
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'));
508 title : 'Update stock',
509 value : data.stockUpdate ? true : false
511 'stockUpdateDamages' : {
513 id : 'stockUpdateDamages',
514 title : 'Update damages',
515 value : data.stockUpdateDamages ? true : false
517 'stockUpdateCoverReceived' : {
519 id : 'stockUpdateCoverReceived',
520 title : 'Update cover received',
521 value : data.stockUpdateCoverReceived ? true : false
523 'stockUploadPhotos' : {
525 id : 'stockUploadPhotos',
526 title : 'Upload photos',
527 value : data.stockUploadPhotos ? true : false
529 'stockRouteAuction' : {
531 id : 'stockRouteAuction',
532 title : 'Update and send to Auction',
533 value : data.stockRouteAuction ? true : false
535 'stockRouteRetail' : {
537 id : 'stockRouteRetail',
538 title : 'Update and send to Retail',
539 value : data.stockRouteRetail ? true : false
541 'stockReclaimRetail' : {
543 id : 'stockReclaimRetail',
544 title : 'Reclaim from Retail',
545 value : data.stockReclaimRetail ? true : false
547 'stockRoutePriceguide' : {
549 id : 'stockRoutePriceguide',
550 title : 'Update and send to Price Guide',
551 value : data.stockRoutePriceguide ? true : false
553 'stockRouteValuation' : {
555 id : 'stockRouteValuation',
556 title : 'Update and send to Valuation',
557 value : data.stockRouteValuation ? true : false
563 value : data.stockPrint ? true : false
569 value : data.stockArchive ? true : false
573 id : 'stockUnarchive',
575 value : data.stockUnarchive ? true : false
577 'auctionGridExport' : {
579 id : 'auctionGridExport',
580 title : 'Export auction data',
581 value : data.auctionGridExport ? true : false
586 title : 'Bid on auction',
587 value : data.auctionBid ? true : false
592 title : 'Export trade center data',
593 value : data.tcGridExport ? true : false
595 'appCreateValuation' : {
597 id : 'appCreateValuation',
598 title : 'Create valuation',
599 value : data.appCreateValuation ? true : false
601 'appCompleteValuation' : {
603 id : 'appCompleteValuation',
604 title : 'Complete portal valuation',
605 value : data.appCompleteValuation ? true : false
607 'accessAdminModule' : {
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'));
620 title : 'Manage permissions',
621 value : data.adminPage ? true : false
623 'adminRegistration' : {
625 id : 'adminRegistration',
626 title : 'Manage registrations',
627 value : data.adminRegistration ? true : false
633 value : data.adminReport ? true : false
635 'adminCommunication' : {
637 id : 'adminCommunication',
638 title : 'Manage communications',
639 value : data.adminCommunication ? true : false
643 id : 'adminSettings',
644 title : 'Manage system settings',
645 value : data.adminSettings ? true : false
650 title : 'Manage system users',
651 value : data.adminUser ? true : false
656 title : 'Manage dealerships',
657 value : data.adminDealer ? true : false
662 title : 'Manage auctions',
663 value : data.adminAuction ? true : false
667 id : 'historicalPage',
668 title : 'Historical Auction Data',
669 value : data.historicalPage ? true : false
675 value : data.etpGemDmd ? true : false
680 _onPermissionsViewDataReceived : function( response )
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();
700 _setupValidation : function ()
702 $('#frmPermissionsView').validate({
703 submitHandler: function( form ) {
704 $('#btnUpdate').prop('disabled', true);
705 var data = _w.override._prepPermissionsUpdateData();
707 'overridePermissions:' + _w.override.itemId, data, {},
708 _w.override._onPermissionsUpdated, _w.taskExecError
712 $('#btnUpdate').prop('disabled', false);
715 _prepPermissionsUpdateData : function()
717 return {Override:_w.override.ti.harvest()};
720 _onPermissionsUpdated : function( response )
722 window.location.hash = '/systemusers';