Skip to content

Instantly share code, notes, and snippets.

@shackbarth
Created November 26, 2013 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shackbarth/7665832 to your computer and use it in GitHub Desktop.
Save shackbarth/7665832 to your computer and use it in GitHub Desktop.
XM.SalesOrder.prototype.augment({
handlers: {
'change:packDate': 'packDateDidChange'
},
holdTypeDidChange: function () {
this.updateWorkflowItemPackDate();
},
packDateDidChange: function () {
this.updateWorkflowItemPackDate();
},
saleTypeDidChange: function () {
this.updateWorkflowItemPackDate();
this.updateWorkflowItemShipDate();
},
updateWorkflowItemPackDate: function () {
var that = this;
_.each(this.get("workflow").where(
{workflowType: XM.SalesOrderWorkflow.TYPE_PACK}),
function (workflow) {
workflow.set({dueDate: that.get("packDate")});
});
},
updateWorkflowItemShipDate: function () {
var that = this;
_.each(this.get("workflow").where(
{workflowType: XM.SalesOrderWorkflow.TYPE_SHIP}),
function (workflow) {
workflow.set({dueDate: that.get("scheduleDate")});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment