partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

Controller.js (1115B)


      1 Ext.define("PartKeepr.Components.Part.Details.Controller", {
      2     extend: 'Ext.app.ViewController',
      3 
      4     alias: 'controller.PartDetailsController',
      5 
      6     closePanel: function () {
      7         this.getView().hide();
      8     },
      9     reloadPart: function () {
     10         this.getView().getPart().load({
     11             success: Ext.bind(this.getView().updatePart, this.getView())
     12         });
     13     },
     14     promptAddStock: function () {
     15         Ext.Msg.prompt(i18n("Add Stock"), i18n("Amount"), this.addStock, this);
     16     },
     17     addStock: function (button, value) {
     18         if (button === "ok") {
     19             this.getView().getPart().callPutAction("addStock",{
     20                 quantity: value
     21             },Ext.bind(this.reloadPart, this),false);
     22         }
     23     },
     24     promptRemoveStock: function () {
     25         Ext.Msg.prompt(i18n("Remove Stock"), i18n("Amount"), this.removeStock, this);
     26     },
     27     removeStock: function (button, value) {
     28         if (button === "ok") {
     29             this.getView().getPart().callPutAction("removeStock",{
     30                 quantity: value
     31             },Ext.bind(this.reloadPart, this),false);
     32         }
     33     }
     34 });