--- /dev/null
+/*
+Copyright (c) Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
+For licensing, see README.txt or http://www.pentilanero.com (Cecill-C or AGPL or LGPL)
+*/
+Ext.ns("EntSavoie.Cartable");
+EntSavoie.Cartable.CommentWindow = function (config) {
+ Ext.apply(this, config);
+
+ // Ajoute le texte des erreurs
+ Ext.QuickTips.init();
+ // turn on validation errors beside the field globally
+ Ext.form.Field.prototype.msgTarget = 'side';
+
+ this.messageField = this.messageField || new Ext.form.DisplayField();
+
+ this.recordCasier = null;
+
+ EntSavoie.Cartable.CommentWindow.superclass.constructor.call(this, {
+ cls: "cartable-portlet",
+ title: this.i18n.Cartable.CommentWindow.title,
+ modal: true,
+ width: 400,
+ height: 300,
+ layout: 'fit',
+ closable: true,
+ closeAction: 'hide',
+ autoScroll: true,
+ items: [this.messageField],
+ buttons: [/*{
+ text: 'RĂ©pondre',
+ handler: this.onReply,
+ scope: this
+ },*/
+ {
+ text: this.i18n.Cartable.CommentWindow.buttons[0],
+ handler: this.onClose,
+ scope: this
+ }]
+ });
+
+ this.on("hide", this.onHideWindow, this);
+
+};
+
+Ext.extend(EntSavoie.Cartable.CommentWindow, Ext.Window, {
+ initComponent: function () {
+ EntSavoie.Cartable.CommentWindow.superclass.initComponent.call(this);
+ },
+
+ refreshWindow: function(record) {
+ this.recordCasier = record;
+ this.messageField.setValue(record.get("comment"));
+ this.show();
+ },
+
+ onReply: function() {
+ this.hide();
+ this.mainContainer.replyCasierEntry(this.recordCasier);
+ },
+
+ onClose: function(btn) {
+ this.hide();
+ },
+
+ onHideWindow: function(wdn) {
+ if(this.mainContainer.gridEntity.isVisible()){
+ this.mainContainer.gridEntity.setFocusOnGrid();
+ }
+ }
+
+});