/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

define(["angular"],function(a){"use strict";var b=a.module("grafana.controllers");b.controller("AdminEditOrgCtrl",["$scope","$routeParams","backendSrv","$location","navModelSrv",function(a,b,c,d,e){a.init=function(){a.navModel=e.getAdminNav(),b.id&&(a.getOrg(b.id),a.getOrgUsers(b.id))},a.getOrg=function(b){c.get("/api/orgs/"+b).then(function(b){a.org=b})},a.getOrgUsers=function(b){c.get("/api/orgs/"+b+"/users").then(function(b){a.orgUsers=b})},a.update=function(){a.orgDetailsForm.$valid&&c.put("/api/orgs/"+a.org.id,a.org).then(function(){d.path("/admin/orgs")})},a.updateOrgUser=function(a){c.patch("/api/orgs/"+a.orgId+"/users/"+a.userId,a)},a.removeOrgUser=function(b){c.delete("/api/orgs/"+b.orgId+"/users/"+b.userId).then(function(){a.getOrgUsers(a.org.id)})},a.init()}])});