//>>built
require({cache:{"url:app/ui/managers/templates/NoteManager.html":'\x3cdiv\x3e\n  \x3cdiv class\x3d"row relation-row" style\x3d"margin-bottom: 5px;"\x3e\n    \x3cdiv class\x3d"large-offset-10 large-2 columns"\x3e\n      \x3ca style\x3d"float: right;" href\x3d"#" class\x3d"button tiny" data-dojo-attach-event\x3d"onClick: _addNote" title\x3d"Add note"\x3eAdd Note\x26nbsp;\x26nbsp;\x3ci class\x3d"fa fa-plus"\x3e\x3c/i\x3e\x3c/a\x3e\n    \x3c/div\x3e\n  \x3c/div\x3e\n  \x3cdiv class\x3d"row"\x3e\n    \x3cdiv class\x3d"large-12 columns" style\x3d"padding: 0;"\x3e\n      \x3cdiv data-dojo-attach-point\x3d"noteGridNode" style\x3d"max-height: 350px;"\x3e\x3c/div\x3e\n    \x3c/div\x3e\n  \x3c/div\x3e\n\x3c/div\x3e'}});
define("app/ui/managers/NoteManager","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom-construct dojo/dom-class dojo/dom-style dojo/json dojo/on dojo/topic dijit/_WidgetBase dijit/_TemplatedMixin dojo/text!./templates/NoteManager.html dstore/Memory dstore/Trackable dgrid/OnDemandGrid dgrid/extensions/DijitRegistry dgrid/extensions/ColumnResizer ../../utils/DomUtils ../dialogs/NotesDialog".split(" "),function(c,d,b,e,v,w,x,g,y,l,m,n,h,k,p,q,r,z,t){return c([l,m],{templateString:n,baseClass:"note-manager",
languageController:null,listController:null,concept:null,languageList:null,_noteStore:null,_noteGrid:null,_index:0,postCreate:function(){this.inherited(arguments);this.trackableMemory=c([h,k]);this._noteStore=new this.trackableMemory({data:[]});this.concept&&d.forEach(this.concept.notes,b.hitch(this,function(a){a.id=this._index++;this._noteStore.put(a)}));this._createGrid({collection:this._noteStore},this.noteGridNode);this._notesDialog=new t({parentNode:this,langList:this.languageList,typeList:this.listController.getNoteTypes()});
g(this._notesDialog,"add.note",b.hitch(this,function(a){this._doAddNote(a)}));g(this._notesDialog,"edit.note",b.hitch(this,function(a){this._doEditNote(a)}))},startup:function(){this.inherited(arguments);this._notesDialog.startup();this._noteGrid.startup();this._noteGrid.resize()},reset:function(){this._notesDialog&&this._notesDialog.reset();this._noteStore=new (c([h,k]))({data:[]});this._noteGrid.set("collection",this._noteStore)},_createGrid:function(a,u){var f={note:{label:"Note",field:"note",
renderCell:function(a){if(a)return e.create("div",{innerHTML:a.note})}},language:{label:"Language",field:"language",formatter:b.hitch(this,function(a){var b=d.filter(this.languageList,function(b){return b.id===a})[0];return b?b.name:"-"})},type:{label:"Type",field:"type",formatter:b.hitch(this,function(a){return d.filter(this.listController.getNoteTypes(),function(b){return b.value===a})[0].label})},actions:{label:"",renderCell:b.hitch(this,function(a){if(void 0===a.id)return null;var c=e.create("div",
{"class":"dGridHyperlink"});e.create("a",{href:"#",title:"Edit note",className:"fa fa-pencil",innerHTML:"",style:"margin-right: 12px;",onclick:b.hitch(this,function(b){b.preventDefault();this._editNote(a)})},c);e.create("a",{href:"#",title:"Remove note",className:"fa fa-trash",innerHTML:"",onclick:b.hitch(this,function(b){b.preventDefault();this._removeRow(a.id)})},c);return c})}};this._noteGrid=f=new (c([p,q,r]))({collection:a.collection,columns:f,showHeader:!1,noDataMessage:"No notes found",loadingMessage:"Fetching data.."},
u);f.on("dgrid-error",function(a){})},getData:function(){return{notes:this._noteStore.data}},setConcept:function(a){a&&(this.concept=a,this._noteStore=new this.trackableMemory({data:[]}),d.forEach(this.concept.notes,b.hitch(this,function(a){a.id=this._index++;this._noteStore.put(a)})),this._noteGrid.set("collection",this._noteStore))},updateLanguages:function(a){a&&(this.languageList=a,this._notesDialog.updateLanguages(a))},_addNote:function(a){a?a.preventDefault():null;this._notesDialog.show()},
_editNote:function(a){this._notesDialog.show(a)},_doAddNote:function(a){this._noteStore.add({language:a.lang,type:a.noteType,note:a.note})},_doEditNote:function(a){this._noteStore.put({language:a.lang,type:a.noteType,note:a.note,id:a.id})},_removeRow:function(a){this._noteStore.remove(a)}})});
//# sourceMappingURL=NoteManager.js.map