18 onBidViewTemplateReady : function( template, event, eventData )
20 _w.bidview.ti = _t[template];
21 _w.bidview.limited = ('limitedbidview' == template)
25 _w.bidview.setStockViewFormMeta();
26 _w.bidview.ti.hydrate(_w.bidview.formMeta);
28 // Retrieve initial view data.
29 _w.bidview.basketId = App.Util.getUrlParam('basketId');
30 _w.bidview.itemId = App.Util.getUrlParam('id');
31 _w.bidview.bidId = null;
32 if ('false' == _w.bidview.basketId)
34 _w.bidview.basketId = false;
36 if (_w.bidview.basketId)
39 'updateBasket:' + _w.bidview.itemId, 'Auction', 'Basket.SetStatus',
40 _w.bidview.itemId, {id:_w.bidview.basketId}, _w.bidview._onBasketDataReceived, function(){}
46 'createBasket:' + _w.bidview.itemId, 'Auction', 'Basket.Create',
47 _w.bidview.itemId, {}, function(){}, function(){}
52 var task = 'Auction.View';
54 'viewAuction:' + _w.bidview.itemId, 'Auction', task, _w.bidview.itemId,
55 {}, $.proxy( _w.bidview._onStockViewDataReceived, this ), _w.taskContractError
59 onBidViewPublished : function( template, event, eventData )
61 if (!_w.bidview.basketId)
63 $('#btnAddToBasket').prop('disabled', false);
64 $('#btnAddToBasket').removeClass('addtobasketbtntrue');
65 $('#btnAddToBasket').addClass('addtobasketbtn');
69 $('#btnRequestHPI').click(function () {
71 if ('' == $('#HPIusername').val() || '' == $('#HPIpin').val())
73 alert('Please enter a valid username and password.');
77 $('#HPIdropConfirm').slideToggle();
78 $('#HPIresponse').html('');
82 App.Util.updateCheckboxStyle($('#acceptHPIdisclaimer'));
83 $('#HPIbtnConfirm').click(function () {
84 if ( $('#engineNumber').html() == '' || $('#vinNumber').html() == '' ) {
85 alert('Cannot request report without Vehicle Engine Number and VIN Number.');
88 if (!$('#acceptHPIdisclaimer').is(':checked'))
90 alert('Please accept the conditions before sending.');
94 var user = $('#HPIusername').val();
95 var pass = $('#HPIpin').val();
98 'TransUnionForHPI', 'Stock', 'Utility.TransUnionForHPI', null,
99 {'Filter' : {'username' : user ,'pass' : pass , 'stock' : _w.stock.Id}},
102 'TransUnionForHPI',{}, {},
105 $('#HPIdropConfirm').hide();
106 if ('Success' == data.Status)
108 $('#HPIresponse').html('Success on HPI Report');
109 alert('Success on HPI Report');
110 App.DataStore.loadSelectListData(
111 'tuhpi', false, 'Stock', 'Tuhpi.List', null,{"Filter":
113 "stock" : _w.bidview.itemData.stock.id,
114 "company" : App.companyData.id
117 var tuHpiData = App.DataStore.getData('tuhpi');
118 for (var i = 0; i < tuHpiData.length; i++)
120 var tuHpiId = tuHpiData[i].id
121 var tuHpiCreated = tuHpiData[i].created
124 $('#tuhpiDate').html(tuHpiCreated);
125 $('#downloadTuhpi').show();
126 $('#HPIbtnConfirm').prop('disabled', true);
131 $('#tuhpiDate').html('Not Requested Yet');
132 $('#downloadTuhpi').hide();
133 $('#HPIbtnConfirm').prop('disabled', false);
140 $('#HPIresponse').html('API call to remote host failed. No data could be retrieved from remote service.');
142 }, function(response)
144 $('#HPIbtnConfirm').prop('disabled', false);
146 undefined != response.StatusReason
147 ? response.StatusReason
148 : 'API call to remote host failed. No data could be retrieved from remote service.'
155 , _w.taskContractError
160 $('#downloadTuhpi').click(function () {
161 //console.log("stock id", _w.stock.Id);
163 'printTuhpi:' + _w.stock.Id, 'Stock', 'Tuhpi.Print', _w.stock.Id,
166 'printTuhpi:' + _w.stock.Id, {}, {},
167 function () {}, _w.taskExecError,
170 }, _w.taskContractError
175 $('#btnAddToBasket').click(function () {
176 $('#btnAddToBasket').prop('disabled', true);
177 if (_w.bidview.basketId)
180 'updateBasket:' + _w.bidview.itemId, {Basket:{archived: false}}, {},
182 alert('Item added to basket.');
183 $('#btnAddToBasket').removeClass('addtobasketbtn');
184 $('#btnAddToBasket').addClass('addtobasketbtntrue');
191 'createBasket:' + _w.bidview.itemId, {Basket:{auction:_w.bidview.itemId}}, {},
193 alert('Item added to basket.');
194 $('#btnAddToBasket').removeClass('addtobasketbtn');
195 $('#btnAddToBasket').addClass('addtobasketbtntrue');
200 $('#btnMakeBid').click(function () {
201 $('#confirm_dynamic').show();
202 $('#confirmation_msg').hide();
203 _w.bidview.ti.hydrateParam('infAmount', _w.bidview.nextBid);
204 $('#dropCmp').hide();
205 $('#dropConfirm').show();
206 _w.bidview.bidType = 'bid';
208 $('#btnAskQuestion').click(function () {
209 if ('' == $('#question').val())
211 alert('Please specify your question.');
215 'askQuestion:' + _w.bidview.itemId, 'Auction', 'Question.Create', _w.bidview.itemId,
219 "auction": _w.bidview.itemId,
220 "question": $('#question').val()
224 'askQuestion:' + _w.bidview.itemId, data, {},
225 _w.bidview._onBidUpdated, function () {
226 alert('Your question have been submitted.');
227 $('#dropCmp3').slideToggle();
230 }, _w.taskContractError
233 $('#btnMakeAutoBid').click(function () {
234 $('#confirm_dynamic').show();
235 $('#confirmation_msg').hide();
236 var amount = $('#autoamount').val();
237 if ('' != amount && isNaN(amount))
239 alert('Please enter a numeric value.');
244 _w.bidview.ti.hydrateParam('infAmount', _w.bidview.nextBid);
245 $('#dropCmp').hide();
246 $('#dropConfirm').show();
247 _w.bidview.bidType = 'bid';
251 var parts = amount.split('.');
252 if (parts.length > 1)
255 $('#autoamount').val(amount);
257 if (amount < _w.bidview.nextBid)
259 $('#dropConfirm').show();
260 $('#confirm_dynamic').hide();
261 $('#confirmation_msg').show();
262 $('#confirmation_msg').html('Autobid amount must be more than R ' + _w.bidview.nextBid);
265 _w.bidview.ti.hydrateParam('infAmount', amount);
267 $('#dropConfirm').show();
268 _w.bidview.bidType = 'autobid';
272 $('#btnConfirm').click(function () {
274 $('#btnConfirm').prop('disabled', true);
276 if ('bid' == _w.bidview.bidType)
280 "amount": _w.bidview.nextBid
284 'createBid', data, {},
285 _w.bidview._onBidUpdated, function (response) {
286 $('#bidSection').hide();
287 console.log(response);
288 if (response.StatusReason && 'Your' == response.StatusReason.substring(0,4))
290 alert(response.StatusReason);
294 alert('Your bid was placed but you were just outbid. You can make another bid.');
297 'viewAuction:' + _w.bidview.itemId, 'Auction', 'Auction.View', _w.bidview.itemId,
298 {}, $.proxy( _w.bidview._onStockViewDataReceived, this ), _w.taskContractError
300 $('#btnConfirm').prop('disabled', false);
308 "amount": $('#autoamount').val()
312 'createAutoBid', data, {},
313 _w.bidview._onBidUpdated, function (response) {
314 console.log(response);
315 if (response.StatusReason && 'Your' == response.StatusReason.substring(0,4))
317 alert(response.StatusReason);
321 alert('Your bid was placed but you were just outbid. You can make another bid.');
324 'viewAuction:' + _w.bidview.itemId, 'Auction', 'Auction.View', _w.bidview.itemId,
325 {}, $.proxy( _w.bidview._onStockViewDataReceived, this ), _w.taskContractError
327 $('#btnConfirm').prop('disabled', false);
333 App.Util.updateCheckboxStyle($('#terms_accepted'));
334 App.Util.updateCheckboxStyle($('#terms_accepted2'));
335 $('.showTerms').hover(
337 $('.moreTerms').show();
340 $('.moreTerms').hide();
343 $('#terms_accepted').click(function() {
344 $('#btnMakeBid').prop('disabled', $(this).prop('checked') ? false : true);
346 $('#terms_accepted2').click(function() {
347 $('#btnMakeAutoBid').prop('disabled', $(this).prop('checked') ? false : true);
350 $('.mobile-header-bottom .bottom-heading').text('BID DETAILS');
352 if (null != _w.bidview.itemData)
354 _w.bidview._onStockDataAndTemplate();
356 if (null != _w.bidview.basketData)
358 _w.bidview._onBasketDataAndTemplate();
364 setStockViewFormMeta : function( data )
366 data = (undefined == data)
372 _w.stock.Id = data.stock.id;
374 var damagesHtml = '';
375 var accessoriesHtml = '';
376 if (undefined != data && undefined != data.stock && undefined != data.stock.damages)
378 for (var i = 0; i < data.stock.damages.length; i++)
380 damagesHtml += '<div class="control-group row' + i + '">';
381 damagesHtml += '<label class="control-label bid-information-label">' + data.stock.damages[i].damage.name + ':</label>';
382 damagesHtml += '<div class="controls">';
383 damagesHtml += '<p class="bid-information">R ' + data.stock.damages[i].amount + '</p>';
384 damagesHtml += '</div>';
385 damagesHtml += '</div>';
389 if (undefined != data && undefined != data.stock && undefined != data.stock.accessories)
391 for (var i = 0; i < data.stock.accessories.length; i+=2)
393 var acc1 = data.stock.accessories[i]
394 ? data.stock.accessories[i].accessory.name
396 var acc2 = data.stock.accessories[i+1]
397 ? data.stock.accessories[i+1].accessory.name
399 accessoriesHtml += '<div class="row-fluid">';
400 accessoriesHtml += '<div class="span6 textshow-black">' + acc1 + '</div>';
401 accessoriesHtml += '<div class="span6 textshow-black">' + acc2 + '</div>';
402 accessoriesHtml += '</div>';
409 if (data.currentBidPrice)
411 _w.bidview.nextBid = 0.0 == data.currentBidPrice
412 ? parseFloat(data.reservePrice) + parseFloat(data.bidIncrement)
413 : parseFloat(data.currentBidPrice) + parseFloat(data.bidIncrement);
417 _w.bidview.nextBid = 0.0;
419 _w.bidview.formMeta = {
420 'auctionId' : data.id ? '<div class="row-fluid"><div class="span12"><b>Auction ID: </b> ' + data.id + '</div></div>' : '',
421 'b4cRefNo' : data.stock.referenceNumber ? '<div class="row-fluid"><div class="span12"><b>B4C reference no. ref# </b> ' + data.stock.referenceNumber + '</div></div>' : '',
422 'mmCode' : data.stock.type ? '<div class="row-fluid"><div class="span12"><b>M & M Code: </b> ' + data.stock.type.mmCode + '</div></div>' : '',
423 'vehicle' : data.stock.type
424 ? '<div class="row-fluid"><div class="span3"><h5><b>Vehicle Details:</b></h5></div><div class="span9"><h5>'
425 + data.stock.vehicleYear.name + ', '
426 + data.stock.type.category.name + ', '
427 + data.stock.type.model.make.name + ', '
428 + data.stock.type.model.name + ', '
429 + data.stock.type.name + '</h5></div>'
432 //'seller' : data.stock.type
433 //? '<div class="row-fluid"><div class="span4"><h5><b>Seller Details:</b></h5></div><div class="span8"><h5>'
434 // + data.company.contact.firstName + ' ' + data.company.contact.familyName + ', '
435 // + data.company.contact.mobile + ', ' + data.company.name + '<br/>'
436 // + data.company.street + ', '
437 // + data.company.city.name + ', ' + data.company.region.name + ', '
438 // + data.company.postalCode + '</h5></div>'
442 style : 'bid-information',
443 labelStyle : 'bid-information-label',
444 value : data.stock.vehicleYear ? data.stock.vehicleYear.name : ''
448 style : 'bid-information',
449 labelStyle : 'bid-information-label',
450 value : data.stock.type ? data.stock.type.category.name : ''
453 title : 'Vehicle Make',
454 style : 'bid-information',
455 labelStyle : 'bid-information-label',
456 value : data.stock.type ? data.stock.type.model.make.name : ''
460 title : 'Vehicle Model',
461 style : 'bid-information',
462 labelStyle : 'bid-information-label',
463 value : data.stock.type ? data.stock.type.model.name : ''
466 title : 'Vehicle Type',
467 style : 'bid-information',
468 labelStyle : 'bid-information-label',
469 value : data.stock.type ? data.stock.type.name : ''
473 value : data.stock.fuelType ? data.stock.fuelType.name : '',
474 style : 'bid-information',
475 labelStyle : 'bid-information-label'
478 'transmissionType' : {
479 title : 'Transmission Type',
480 style : 'bid-information',
481 labelStyle : 'bid-information-label',
482 value : data.stock.transmissionType ? data.stock.transmissionType.name : ''
486 style : 'bid-information',
487 labelStyle : 'bid-information-label',
488 value : data.stock.condition ? data.stock.condition.name : ''
491 title : 'Main ext. colour',
492 style : 'bid-information',
493 labelStyle : 'bid-information-label',
494 value : data.stock.exteriorColour ? data.stock.exteriorColour.name : ''
497 title : 'Main int. colour',
498 style : 'bid-information',
499 labelStyle : 'bid-information-label',
500 value : data.stock.interiorColour ? data.stock.interiorColour.name : ''
503 title : 'Upholstery',
504 style : 'bid-information',
505 labelStyle : 'bid-information-label',
506 value : data.stock.upholstery ? data.stock.upholstery.name : ''
510 style : 'bid-information',
511 labelStyle : 'bid-information-label',
512 value : data.stock.papers ? data.stock.papers.name : ''
516 value : data.stock.natis ? data.stock.natis.name : '',
517 style : 'bid-information',
518 labelStyle : 'bid-information-label'
521 title : 'Spare keys',
522 value : undefined == data.stock.spareKeys
524 : (data.stock.spareKeys ? 'Yes' : 'No'),
525 style : 'bid-information',
526 labelStyle : 'bid-information-label'
528 'fullServiceHistory' : {
529 title : 'Full service history',
530 value : undefined == data.stock.fullServiceHistory
532 : data.stock.fullServiceHistory.name,
533 style : 'bid-information',
534 labelStyle : 'bid-information-label'
536 'registrationNumber' : {
537 title : 'Registration no',
538 value : data.stock.registrationNumber ? data.stock.registrationNumber : '',
539 style : 'bid-information',
540 labelStyle : 'bid-information-label'
544 value : data.stock.vinNumber ? data.stock.vinNumber : '',
545 style : 'bid-information',
546 labelStyle : 'bid-information-label'
550 value : data.stock.engineNumber ? data.stock.engineNumber : '',
551 style : 'bid-information',
552 labelStyle : 'bid-information-label'
556 value : data.stock.km ? data.stock.km : '',
557 style : 'bid-information',
558 labelStyle : 'bid-information-label'
562 value : data.stock.fshNotes ? data.stock.fshNotes : ''
566 style : 'bid-information',
567 labelStyle : 'bid-information-label'
570 style : 'bid-information',
571 labelStyle : 'bid-information-label',
572 value : data.stock.fshNotes ? data.stock.fshNotes : ''
574 'damages' : damagesHtml,
576 title : 'Estimated repair price',
577 value : 'R ' + (data.stock ? data.stock.damageTotal : '0.00'),
578 style : 'bid-information',
579 labelStyle : 'bid-information-label'
582 title : 'Damages comments',
583 value : data.stock.damageNotes ? data.stock.damageNotes : '',
584 style : 'bid-information',
585 labelStyle : 'bid-information-label'
587 'damageNotes_title' : {
588 style : 'bid-information',
589 labelStyle : 'bid-information-label',
590 title : 'Damages comments',
593 'damageNotes_data' : {
594 style : 'bid-information',
595 labelStyle : 'bid-information-label',
596 value : data.stock.damageNotes ? data.stock.damageNotes : ''
598 'previousRepairsNoted' : {
599 title : 'Previous repairs noted',
600 value : data.stock.previousRepairsNoted ? 'Yes' : 'No',
601 style : 'bid-information',
602 labelStyle : 'bid-information-label'
604 'previousRepairsNotes' : {
605 title : 'Previous repairs comments',
606 value : data.stock.previousRepairsNotes ? data.stock.previousRepairsNotes : '',
607 style : 'bid-information',
608 labelStyle : 'bid-information-label'
610 'previousRepairsNotes_title' : {
611 style : 'bid-information',
612 labelStyle : 'bid-information-label',
613 title : 'Previous repairs comments'
615 'previousRepairsNotes_data' : {
616 style : 'bid-information',
617 labelStyle : 'bid-information-label',
618 value : data.stock.previousRepairsNotes ? data.stock.previousRepairsNotes : ''
621 'accessories' : accessoriesHtml,
625 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : '',
626 style : 'bid-information',
627 labelStyle : 'bid-information-label hidden'
633 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : '',
634 style : 'bid-information',
635 labelStyle : 'bid-information-label'
637 'accessoryNotes_title' : {
638 style : 'bid-information',
639 labelStyle : 'bid-information-label',
640 title : 'Accessories Comments',
643 'accessoryNotes_data' : {
644 style : 'bid-information',
645 labelStyle : 'bid-information-label',
646 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : ''
651 'accessoriesMobi' : accessoriesHtml,
652 'accessoryNotesMobi' : {
654 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : '',
655 style : 'bid-information',
656 labelStyle : 'bid-information-label'
658 'accessoryNotes_titleMobi' : {
659 style : 'bid-information',
660 labelStyle : 'bid-information-label',
661 title : 'Accessories Comments',
664 'accessoryNotes_dataMobi' : {
665 style : 'bid-information',
666 labelStyle : 'bid-information-label',
667 title : 'Accessories Notes',
668 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : ''
671 'accessoryNewMobi' : {
672 value : data.stock.accessoryNotes ? data.stock.accessoryNotes : '',
673 style : 'bid-information',
674 labelStyle : 'bid-information-label'
680 type : 'bidMainImage',
683 baseImage : 'main_img_car.jpg',
684 value : data.stock.mainImage ? data.stock.mainImage : ''
690 baseImage : 'main_img_car.jpg',
691 value : data.stock.mainImage ? data.stock.mainImage : ''
697 baseImage : 'front_car.jpg',
698 value : data.stock.frontImage ? data.stock.frontImage : ''
704 baseImage : 'left_car.jpg',
705 value : data.stock.leftImage ? data.stock.leftImage : ''
711 baseImage : 'right_car.jpg',
712 value : data.stock.rightImage ? data.stock.rightImage : ''
718 baseImage : 'back_car.jpg',
719 value : data.stock.backImage ? data.stock.backImage : ''
724 id : 'interiorImage',
725 baseImage : 'interior_car.jpg',
726 value : data.stock.interiorImage ? data.stock.interiorImage : ''
732 baseImage : 'engine_car.jpg',
733 value : data.stock.engineImage ? data.stock.engineImage : ''
739 baseImage : 'copy_of_natis_car.jpg',
740 value : data.stock.natisImage ? data.stock.natisImage : ''
743 'infCreated': data.created ? ((data.created).split(' '))[0] : '',
744 'infLoadedOnAuction': data.stock.loadedOnAuction
745 ? ((data.stock.loadedOnAuction).split(' '))[0] : '',
747 title : '<b>Trade</b>',
748 value : data.stock.tradePrice ? ' R ' + data.stock.tradePrice : ' R 0.00',
749 style : 'bid-information',
750 labelStyle : 'bid-information-label'
753 title : '<b>Retail</b>',
754 value : data.stock.retailPrice ? ' R ' + data.stock.retailPrice : ' 0.00',
755 style : 'bid-information',
756 labelStyle : 'bid-information-label'
759 title : '<b>New list price</b>',
760 value : data.stock.listPrice ? ' R ' + data.stock.listPrice : ' R 0.00',
761 style : 'bid-information',
762 labelStyle : 'bid-information-label'
766 title : 'Dealership name',
767 value : data.company ? data.company.name : '',
768 style : 'bid-information',
769 labelStyle : 'bid-information-label'
772 title : 'Name and surname',
773 value : data.company && data.company.contact
774 ? data.company.contact.firstName + ' ' + data.company.contact.familyName
776 style : 'bid-information',
777 labelStyle : 'bid-information-label'
781 value : data.company && data.company.contact
782 ? data.company.contact.mobile
784 style : 'bid-information',
785 labelStyle : 'bid-information-label'
789 value : data.company && data.company.contact
790 ? data.company.contact.email
792 style : 'bid-information',
793 labelStyle : 'bid-information-label'
799 value : _w.bidview.nextBid,
803 type : 'amountAuction',
806 value : '' //parseFloat(_w.bidview.nextBid) + parseFloat(data.bidIncrement)
809 type : 'textarea-styled',
816 'infAmount' : _w.bidview.nextBid,
817 'myAutoBid' : data.currentBid && data.currentBid.autoBid
818 && App.companyData.id == data.currentBid.autoBid.company
819 ? '<b>My auto-bid:<br/>R ' + data.currentBid.autoBid.amount + '</b>'
820 : '<b>No current auto-bid.</b>',
823 value : '<b>R ' + _w.bidview.nextBid + '</b>'
829 value : '<b>R ' + _w.bidview.nextBid + '</b>',
830 style : 'text-large-auction'
833 title : 'Winning bid',
834 value : data.currentBid ? '<b>R ' + data.currentBid.amount + '</b>' : '<b>R 0.00</b>'
837 type : 'textarea-styled',
841 areaStyle : 'span12',
845 constructor: 'Button',
849 id: 'printAuctionPdf',
850 handler: _w.bidview.printAuctionPdf
857 printAuctionPdf : function()
860 'printAuctionPdf:' + _w.bidview.itemId, 'Auction', 'Pdf.Print', _w.bidview.itemId,
863 'printAuctionPdf:' + _w.bidview.itemId, {}, {},
864 function() {}, function() {},
867 }, _w.taskContractError
871 _onBidDataAndTemplate : function ()
875 if ('Archived' == _w.bidview.bidData.status)
877 true == App.permissions.pgUnArchive ? $('#btnUnarchive').show() : $('#btnUnarchive').hide();
878 $('#btnArchive').hide();
879 $('#optMakeBid').hide();
883 true == App.permissions.pgArchive ? $('#btnArchive').show() : $('#btnArchive').hide();
884 $('#btnUnarchive').hide();
888 _onBasketDataAndTemplate : function ()
890 if (true == _w.bidview.basketData.archived)
892 $('#btnAddToBasket').prop('disabled', false);
893 $('#btnAddToBasket').removeClass('addtobasketbtntrue');
894 $('#btnAddToBasket').addClass('addtobasketbtn');
898 $('#btnAddToBasket').prop('disabled', true);
899 $('#btnAddToBasket').removeClass('addtobasketbtn');
900 $('#btnAddToBasket').addClass('addtobasketbtntrue');
904 _onStockDataAndTemplate : function ()
906 App.DataStore.loadSelectListData(
907 'tuhpi', false, 'Stock', 'Tuhpi.List', null,{"Filter":
909 "stock" : _w.bidview.itemData.stock.id,
910 "company" : App.companyData.id
913 var tuHpiData = App.DataStore.getData('tuhpi');
914 for (var i = 0; i < tuHpiData.length; i++)
916 var tuHpiId = tuHpiData[i].id
917 var tuHpiCreated = tuHpiData[i].created
919 console.log("tuhpi data Created", tuHpiCreated);
920 console.log("tuhpi data id", tuHpiId);
923 console.log("tuhpi data Created", tuHpiCreated);
924 console.log("tuhpi data id", tuHpiId);
925 $('#tuhpiDate').html(tuHpiCreated);
926 $('#downloadTuhpi').show();
930 console.log("tuhpi no data id");
931 $('#tuhpiDate').html('Not Requested Yet');
932 $('#downloadTuhpi').hide();
936 $('#disputeSection').hide();
938 //if ('Sold' == _w.bidview.itemData.jobState && _w.bidview.itemData.soldToCompany.id == App.companyData.id)
939 if ('Sold' == _w.bidview.itemData.jobState)
941 $('#bidSection').hide();
942 $('#disputeSection').show();
943 $('#btnLogDispute').click(function() {
944 var comp = $('#complaint').val();
947 alert('Please specify the complaint.');
952 againstCompany : _w.bidview.itemData.company.id,
953 auction : _w.bidview.itemId,
958 'createDispute', 'Dispute', 'Dispute.Create',
959 null, {}, function(){
961 'createDispute', data, {},
963 alert('Dispute logged.');
964 _w.bidview._onBidUpdated();
967 }, _w.taskContractError
971 else if ('Active' != _w.bidview.itemData.jobState)
973 $('#optMakeBid').hide();
977 $('#autoamount').focus(function() {
978 $('#dropConfirm').hide();
981 'createBid', 'Auction', 'Bid.Create',
982 _w.bidview.itemId, {}, function(){}, function(){}
985 'createAutoBid', 'Auction', 'AutoBid.Create',
986 _w.bidview.itemId, {}, function(){}, function(){}
990 $("#tS1").thumbnailScroller({
991 /* scroller type based on mouse interaction
992 values: "hoverPrecise", "hoverAccelerate", "clickButtons"
993 default: "hoverPrecise" */
994 scrollerType:"hoverAccelerate",
995 /* scroller orientation
996 values: "horizontal", "vertical"
997 default: "horizontal" */
998 scrollerOrientation:"horizontal",
999 /* scroll easing type only for "hoverPrecise" scrollers
1000 available values here: http://jqueryui.com/demos/effect/easing.html
1001 default: "easeOutCirc" */
1002 scrollEasing:"easeOutCirc",
1003 /* scroll easing amount only for "hoverPrecise" and "clickButtons" scrollers (0 for no easing)
1004 values: milliseconds
1006 scrollEasingAmount:300,
1007 /* acceleration value only for "hoverAccelerate" scrollers
1011 /* scrolling speed only for "clickButtons" scrollers
1012 values: milliseconds
1015 /* scroller null scrolling area only for "hoverAccelerate" scrollers
1016 0 being the absolute center of the scroller
1019 noScrollCenterSpace:0,
1020 /* initial auto-scrolling
1021 0 equals no auto-scrolling
1022 values: amount of auto-scrolling loops (integer)
1025 /* initial auto-scrolling speed
1026 values: milliseconds
1028 autoScrollingSpeed:100,
1029 /* initial auto-scrolling easing type
1030 available values here: http://jqueryui.com/demos/effect/easing.html
1031 default: "easeInOutQuad" */
1032 autoScrollingEasing:"easeInOutQuad",
1033 /* initial auto-scrolling delay for each loop
1034 values: milliseconds
1036 autoScrollingDelay:250
1043 if (false == App.permissions.auctionBid)
1045 $('#bidSection').hide();
1048 if (App.permissions.settingsHpiReport == false)
1050 $('#requestHPIreport').hide();
1054 if (App.permissions.settingsHpiReport)
1056 $('#requestHPIreport').show();
1061 _onBasketDataReceived : function( response )
1063 _w.bidview.basketData = response.Data;
1064 if (_w.bidview.ti.published)
1066 _w.bidview._onBasketDataAndTemplate();
1070 _onStockViewDataReceived : function( response )
1074 _w.bidview.itemId = response.Data.id;
1075 _w.bidview.itemData = response.Data;
1076 _w.bidview.setStockViewFormMeta(response.Data);
1077 _w.bidview.ti.hydrate(_w.bidview.formMeta);
1078 if (response.Data.currentBid)
1080 _w.bidview.bidId = response.Data.currentBid.id;
1081 _w.bidview.bidData = response.Data.currentBid;
1082 if (_w.bidview.bidData.company.id != App.companyData.id)
1084 $('#bidSection').show();
1085 $('#winningBid').hide();
1089 $('#bidSection').hide();
1090 $('#winningBid').show();
1095 $('#bidSection').show();
1096 _w.bidview.newItem = true;
1097 _w.bidview.bidData = {};
1099 if (_w.bidview.itemData.company.id == App.companyData.id || _w.bidview.itemData.stock.company.id == App.companyData.id)
1101 $('#bidSection').hide();
1103 if (_w.bidview.ti.published)
1105 _w.bidview._onStockDataAndTemplate();
1109 _onBidUpdated : function( response )
1111 window.location.hash = '/auction';