From 22d2ab34cc418fd90ffd5c2df500dfac8add140b Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Fri, 23 Oct 2009 12:24:35 +0000 Subject: [PATCH] Testing... --- lib/WebGUI/Shop/Vendor.pm | 4 +- www/extras/VendorPayout/vendorPayout.js | 58 +++++++++++++++++++------ 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lib/WebGUI/Shop/Vendor.pm b/lib/WebGUI/Shop/Vendor.pm index d2d806bf2..fdaa8f3fc 100644 --- a/lib/WebGUI/Shop/Vendor.pm +++ b/lib/WebGUI/Shop/Vendor.pm @@ -496,8 +496,8 @@ sub www_managePayouts { $style->setScript($url->extras('yui/build/connection/connection-min.js'), {type=>'text/javascript'}); $style->setScript($url->extras('yui/build/json/json-min.js'), {type=>'text/javascript'}); $style->setScript($url->extras('yui/build/paginator/paginator-min.js'), {type=>'text/javascript'}); - $style->setScript($url->extras('yui/build/datasource/datasource-min.js'), {type=>'text/javascript'}); - $style->setScript($url->extras('yui/build/datatable/datatable-min.js'), {type=>'text/javascript'}); + $style->setScript($url->extras('yui/build/datasource/datasource.js'), {type=>'text/javascript'}); + $style->setScript($url->extras('yui/build/datatable/datatable.js'), {type=>'text/javascript'}); $style->setScript($url->extras('yui/build/button/button-min.js'), {type=>'text/javascript'}); $style->setScript($url->extras('yui-webgui/build/i18n/i18n.js'), {type=>'text/javascript'}); $style->setScript($url->extras('VendorPayout/vendorPayout.js'), {type=>'text/javascript'}); diff --git a/www/extras/VendorPayout/vendorPayout.js b/www/extras/VendorPayout/vendorPayout.js index 048c03cfa..3af58f861 100644 --- a/www/extras/VendorPayout/vendorPayout.js +++ b/www/extras/VendorPayout/vendorPayout.js @@ -12,7 +12,7 @@ WebGUI.VendorPayout = function ( containerId ) { 'schedule all button', 'deschedule all button', 'submit scheduled payouts button', 'vendor id', 'vendor name', 'scheduled payout amount', 'not scheduled payout amount', 'vp item id', 'vp item title', 'vp item price', 'vp item quantity', 'vp item payout amount', - 'vp item payout status' + 'vp item payout status', 'vp select vendor' ] }, onpreload : { @@ -30,15 +30,41 @@ WebGUI.VendorPayout = function ( containerId ) { //---------------------------------------------------------------------------- WebGUI.VendorPayout.prototype.initialize = function (aaa, bbb,ccc,ddd) { - // Vendors data table - this.vendorList = document.createElement('div'); - this.container.appendChild( this.vendorList ); + // Vendor data table + this.vendorTable = document.createElement( 'div' ); + this.vendorButtons = document.createElement( 'div' ); + + var vendor = document.createElement( 'fieldset' ); + var vendorLegend = document.createElement( 'legend' ); + vendor.appendChild( vendorLegend ).innerHTML = 'Vendors'; + vendor.appendChild( this.vendorTable ); + vendor.appendChild( this.vendorButtons ); + + this.container.appendChild( vendor ); + // Payout data table + this.payoutTable = document.createElement( 'div' ); + this.payoutButtons = document.createElement( 'div' ); + + var payout = document.createElement( 'fieldset' ); + var payoutLegend = document.createElement( 'legend' ); + payout.appendChild( payoutLegend ).innerHTML = 'Payouts'; + payout.appendChild( this.payoutTable ); + payout.appendChild( this.payoutButtons ); + + this.container.appendChild( payout ); + // (De)schedule buttons - this.buttonDiv = document.createElement('div'); - this.container.appendChild( this.buttonDiv ); - this.scheduleAllButton = new YAHOO.widget.Button({ label: this.i18n( 'schedule all button' ), container: this.buttonDiv }); - this.descheduleAllButton = new YAHOO.widget.Button({ label: this.i18n( 'deschedule all button' ), container: this.buttonDiv }); + this.scheduleAllPayoutsButton = new YAHOO.widget.Button( { + label : this.i18n( 'schedule all button' ), + container : this.payoutButtons, + disabled : true + } ); + this.descheduleAllPayoutsButton = new YAHOO.widget.Button( { + label: this.i18n( 'deschedule all button' ), + container: this.payoutButtons, + disabled : true + } ); // Submit button this.submitPayoutsButton = new YAHOO.widget.Button({ label: this.i18n( 'submit scheduled payouts button' ), container: this.buttonDiv }); @@ -80,7 +106,7 @@ WebGUI.VendorPayout.prototype.initVendorList = function () { }; // initialize data table - this.vendorDataTable = new YAHOO.widget.DataTable( this.vendorList, this.vendorSchema, this.vendorDataSource, { + this.vendorDataTable = new YAHOO.widget.DataTable( this.vendorTable, this.vendorSchema, this.vendorDataSource, { selectionMode : 'single' } ); @@ -96,6 +122,9 @@ WebGUI.VendorPayout.prototype.initVendorList = function () { obj.currentVendorRow = record; obj.refreshItemDataTable(); + + obj.scheduleAllPayoutsButton.set( 'disabled', false ); + obj.descheduleAllPayoutsButton.set( 'disabled', false ); } ); } @@ -156,11 +185,12 @@ WebGUI.VendorPayout.prototype.initPayoutDetails = function () { }; // Instanciate the DataTable. - this.itemDataTable = new YAHOO.widget.DataTable( this.payoutDetails, this.itemSchema, this.itemDataSource, { + this.itemDataTable = new YAHOO.widget.DataTable( this.payoutTable, this.itemSchema, this.itemDataSource, { dynamicData : true, formatRow : rowFormatter, - paginator : new YAHOO.widget.Paginator({ rowsPerPage:10 } ) //, updateOnChange: true }) - }); + paginator : new YAHOO.widget.Paginator({ rowsPerPage:10 } ), + MSG_EMPTY : this.i18n( 'vp select vendor' ) //, updateOnChange: true }) + } ); this.itemDataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { // For some reason oPayload is undefined when we're switch vendors. This is a hack to // still set the paginator correctly. @@ -231,8 +261,8 @@ WebGUI.VendorPayout.prototype.initButtons = function () { YAHOO.util.Connect.asyncRequest( 'POST', url, callback, postdata ); } - this.scheduleAllButton.on( 'click', function () { updateAll( 'Scheduled' ) } ); - this.descheduleAllButton.on( 'click', function () { updateAll( 'NotPaid' ) } ); + this.scheduleAllPayoutsButton.on( 'click', function () { updateAll( 'Scheduled' ) } ); + this.descheduleAllPayoutsButton.on( 'click', function () { updateAll( 'NotPaid' ) } ); }