Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend fixes for #1113 #1200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,32 @@ Ext.define('PartKeepr.PartStockWindow', {
price = this.priceField.getValue() / this.quantityField.getValue();
}

Ext.callback(this.callbackFn,
//Warn the user if they want to remove more than the current available
var current_stock = this.callbackScope.record.data.stockLevel;
if ((this.title == this.removePartText) & (this.quantityField.getValue() > current_stock)){

Ext.Msg.confirm(i18n("Not enough stock"),
i18n("You are removing more parts than are in stock. \
If you continue a negative stock will be tracked. <br><br> \
Are you sure you want to remove these parts?"),
function(buttonid){
// if yes, submit data as normal
if (buttonid == "yes") {
Ext.callback(this.callbackFn,
this.callbackScope,
[this.quantityField.getValue(), price, this.commentField.getValue()]);
this.close();
}
return; //otherwise, return without doing anything
}, this);
}
else { // add or remove stock normally
Ext.callback(this.callbackFn,
this.callbackScope,
[this.quantityField.getValue(), price, this.commentField.getValue()]);
this.close();
}
this.close();
}
}
},
/**
* Opens the window in "add stock" mode. The target callback receives three parameters: the value of the quantity
Expand Down Expand Up @@ -201,7 +222,6 @@ Ext.define('PartKeepr.PartStockWindow', {
this.priceField.hide();
this.priceCheckbox.hide();
this.okButton.setIconCls("web-icon brick_delete");
this.quantityField.maxValue = this.callbackScope.record.data.stockLevel;
this.show();
}
});