Testing...

This commit is contained in:
Martin Kamerbeek 2009-10-23 12:24:35 +00:00
parent de46eb5986
commit 22d2ab34cc
2 changed files with 46 additions and 16 deletions

View file

@ -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'});

View file

@ -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' ) } );
}