text: sap.ui.define(["sap/ui/model/json/JSONModel","com/wir/vs/virus/timeslots/ShopOwner/data/Goods","com/wir/vs/virus/timeslots/ShopOwner/utils/Connection"],function(s,t,i){"use strict";return s.extend("com.wir.vs.virus.timeslots.ShopOwner.model.GoodsModel",{shopId:undefined,load:function(s){if(s===this.shopId){this.updateBindings();return Promise.resolve()}this.shopId=s;this.loadData("/api/v1/shops/"+this.shopId+"/goods/").then(function(){var s=this.getData();var i=t.slice();s.forEach(function(s){var t=i.find(function(t){return t.name===s.name});if(t){t.status=s.status;t.id=s.id}});this.setData(i)}.bind(this))},changeGood:function(s,t){var o=this.getProperty(s);var e=o.status;o.status=t;var n="/api/v1/shops/"+this.shopId+"/goods/";var r;if(e==="unknown"){r=i.post(n,o)}else{n+=o.id;if(t==="unknown"){r=i.remove(n)}else{r=i.put(n,o)}}return r.then(function(i){if(i){this.setProperty(s+"/id",i.id)}this.setProperty(s+"/status",t)}.bind(this))}})});