X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Dialog.CoreCompanies.js;h=e44744a9efd4f9171c7ff785a46617cc789b3eba;hp=aea8598936bbb914774dc54a025efc2af0451dc9;hb=1524f8b36295809a3eedd6da3c6494f8aa0d86f5;hpb=287e7705a1dddcf15b20f3dc6b45c77c9e070e6a
diff --git a/Pman.Dialog.CoreCompanies.js b/Pman.Dialog.CoreCompanies.js
index aea85989..e44744a9 100644
--- a/Pman.Dialog.CoreCompanies.js
+++ b/Pman.Dialog.CoreCompanies.js
@@ -2,306 +2,453 @@
// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+Roo.namespace('Pman.Dialog');
+
Pman.Dialog.CoreCompanies = {
- dialog : false,
- callback: false,
+ _strings : {
+ 'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
+ '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
+ 'b33457e7e1cd5dbf1db34a0c60fcb75f' :"Company ID (for filing Ref.)",
+ '023a5dfa857c4aa0156e6685231a1dbd' :"Select Type",
+ '8535bcc0f05358a583bb432bbadf7e0d' :"Select type",
+ '733640ec0c9367df1b4d85eb286ed9ae' :"Enter code",
+ '8c04eb09879a05470fae436ba76e3bb9' :"Enter Url",
+ '4ef6052d74436756f08e95fd63949653' :"Enter Company Name",
+ 'c54b90756cfbeff9217293b567cb2eb0' :"Enter remarks",
+ '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+ 'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
+ 'cf3a5d25d39613ad5bbc2f5eb0f9b675' :"Enter Fax Number",
+ '9f86c00615b1a210935ac28ff8ebbb22' :"Enter Email Address",
+ 'e7b47c58815acf1d3afa59a84b5db7fb' :"Company Name",
+ 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+ '32c4e9483403d60115b21519178e5384' :"Enter Address",
+ 'b9c49611cfda3259a2b837b39489e650' :"Add Image",
+ '72b9d3d2e231f1de7a2bd70737f644aa' :"Add / Edit Organization",
+ 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
+ '02a3a357710cc2a5dfdfb74ed012fb59' :"Url",
+ 'dd7bf230fde8d4836917806aff6a6b27' :"Address",
+ 'c9cc8cce247e49bae79f15173ce97354' :"Save",
+ 'bc3a4c40d007b8d610a16312970e5cb3' :"Enter Phone Number",
+ '9810aa2b9f44401be4bf73188ef2b67d' :"Fax",
+ '35cb9e66ff801a819684ee0fbeabaeeb' :"Background Colour",
+ 'bc87ef2144ae15ef4f78211e73948051' :"Logo Image"
+ },
+ _named_strings : {
+ 'name_qtip' : '4ef6052d74436756f08e95fd63949653' /* Enter Company Name */ ,
+ 'tel_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
+ 'address_qtip' : '32c4e9483403d60115b21519178e5384' /* Enter Address */ ,
+ 'background_color_fieldLabel' : '35cb9e66ff801a819684ee0fbeabaeeb' /* Background Colour */ ,
+ 'comptype_id_display_name_emptyText' : '023a5dfa857c4aa0156e6685231a1dbd' /* Select Type */ ,
+ 'comptype_id_display_name_fieldLabel' : 'a1fa27779242b4902f7ae3bdd5c6d508' /* Type */ ,
+ 'comptype_id_display_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+ 'code_fieldLabel' : 'b33457e7e1cd5dbf1db34a0c60fcb75f' /* Company ID (for filing Ref.) */ ,
+ 'fax_fieldLabel' : '9810aa2b9f44401be4bf73188ef2b67d' /* Fax */ ,
+ 'name_fieldLabel' : 'e7b47c58815acf1d3afa59a84b5db7fb' /* Company Name */ ,
+ 'fax_qtip' : 'cf3a5d25d39613ad5bbc2f5eb0f9b675' /* Enter Fax Number */ ,
+ 'url_qtip' : '8c04eb09879a05470fae436ba76e3bb9' /* Enter Url */ ,
+ 'remarks_fieldLabel' : '231bc72756b5e6de492aaaa1577f61b1' /* Remarks */ ,
+ 'code_qtip' : '733640ec0c9367df1b4d85eb286ed9ae' /* Enter code */ ,
+ 'tel_qtip' : 'bc3a4c40d007b8d610a16312970e5cb3' /* Enter Phone Number */ ,
+ 'email_qtip' : '9f86c00615b1a210935ac28ff8ebbb22' /* Enter Email Address */ ,
+ 'url_fieldLabel' : '02a3a357710cc2a5dfdfb74ed012fb59' /* Url */ ,
+ 'remarks_qtip' : 'c54b90756cfbeff9217293b567cb2eb0' /* Enter remarks */ ,
+ 'comptype_id_display_name_qtip' : '8535bcc0f05358a583bb432bbadf7e0d' /* Select type */ ,
+ 'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
+ 'address_fieldLabel' : 'dd7bf230fde8d4836917806aff6a6b27' /* Address */ ,
+ 'logo_id_fieldLabel' : 'bc87ef2144ae15ef4f78211e73948051' /* Logo Image */
+ },
- show : function(data, cb)
- {
- if (!this.dialog) {
- this.create();
- }
+ dialog : false,
+ callback: false,
- this.callback = cb;
- this.data = data;
- this.dialog.show(this.data._el);
- if (this.form) {
- this.form.reset();
- this.form.setValues(data);
- this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
- }
+ show : function(data, cb)
+ {
+ if (!this.dialog) {
+ this.create();
+ }
- },
+ this.callback = cb;
+ this.data = data;
+ this.dialog.show(this.data._el);
+ if (this.form) {
+ this.form.reset();
+ this.form.setValues(data);
+ this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
+ }
- create : function()
- {
- var _this = this;
- this.dialog = Roo.factory({
- xtype: 'LayoutDialog',
- xns: Roo,
- autoCreate : 'true',
- closable : false,
- collapsible : false,
- draggable : false,
- height : 400,
- modal : true,
- shadow : 'true',
- title : "Edit Companies",
- width : 750,
- items : [
- {
- xtype: 'ContentPanel',
- xns: Roo,
- autoCreate : 'true',
- fitToFrame : true,
- region : 'center',
- items : [
- {
- xtype: 'Form',
- xns: Roo.form,
- listeners : {
- actionfailed : function(f, act) {
- _this.dialog.el.unmask();
- // error msg???
- Pman.standardActionFailed(f,act);
-
- },
- actioncomplete : function(f, act) {
- _this.dialog.el.unmask();
- //console.log('load completed');
- // error messages?????
- if(act.type == 'setdata'){
- this.load({ method: 'GET', params: { '_id' : _this.data.id }});
- return;
- }
-
- if (act.type == 'load') {
- _this.data = act.result.data;
- var meth = _this.data.isOwner || !Pman.Login.isOwner() ? 'disable' : 'enable';
-
-
- if (_this.form.findField('comptype')) {
- _this.form.findField('comptype')[meth]();
- }
-
- // _this.loaded();
- return;
- }
-
-
- if (act.type == 'submit') { // only submitted here if we are
- _this.dialog.hide();
-
- if (_this.callback) {
- _this.callback.call(this, act.result.data);
- }
- return;
- }
- // unmask??
- },
- rendered : function (form)
- {
- _this.form = form;
- }
- },
- fileUpload : true,
- labelWidth : 160,
- url : baseURL + '/Roo/Person.php',
- items : [
- {
- xtype: 'Column',
- xns: Roo.form,
- width : 500,
- items : [
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : false,
- fieldLabel : 'Company ID (for filing Ref.)',
- name : 'code',
- qtip : "Enter code",
- width : 100
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- displayField : 'desc',
- editable : false,
- emptyText : "Select Type",
- fieldLabel : 'Type',
- hiddenName : 'comptype',
- listWidth : 250,
- name : 'comptype_name',
- qtip : "Select Company type",
- selectOnFocus : true,
- triggerAction : 'all',
- typeAhead : false,
- valueField : 'val',
- width : 200,
- store : {
- xtype: 'SimpleStore',
- xns: Roo.data,
- data : '[ \'CONSULTANT\', "Consultant" ],[ \'CLIENT\' , "Client" ],[ \'CONTRACTOR\' , "Contractor" ]',
- fields : '[\'val\', \'desc\']'
- }
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Company Name',
- name : 'name',
- qtip : "Enter Company Name",
- width : 300
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Phone',
- name : 'tel',
- qtip : "Enter Phone Number",
- width : 300
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Fax',
- name : 'fax',
- qtip : "Enter Fax Number",
- width : 300
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Email',
- name : 'email',
- qtip : "Enter Email Address",
- width : 300
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Address',
- name : 'address',
- qtip : "Enter Address",
- width : 300
- },
- {
- xtype: 'TextArea',
- xns: Roo.form,
- allowBlank : true,
- fieldLabel : 'Remarks',
- height : 40,
- name : 'remarks',
- qtip : "Enter remarks",
- width : 300
- }
- ]
- },
- {
- xtype: 'Column',
- xns: Roo.form,
- labelAlign : 'top',
- width : 200,
- items : [
- {
- xtype: 'TextField',
- xns: Roo.form,
- fieldLabel : 'Background Colour',
- name : 'background_color'
- },
- {
- xtype: 'DisplayField',
- xns: Roo.form,
- fieldLabel : 'Logo Image',
- height : 170,
- icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
- name : 'logo_id',
- style : 'border: 1px solid #ccc;',
- width : 170,
- valueRenderer : function(v) {
- //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
- if (!v) {
- return "No Image Available" + '
';
- }
- return String.format('',
- baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
- );
- }
- },
- {
- xtype: 'Button',
- xns: Roo,
- listeners : {
- click : function (_self, e)
- {
- var _t = _this.form.findField('logo_id');
-
- Pman.Dialog.Image.show({
- onid :_this.data.id,
- ontable : 'Companies',
- imgtype : 'LOGO'
- }, function(data) {
- if (data) {
- _t.setValue(data.id);
- }
-
- });
- }
- },
- text : "Add Image"
- }
- ]
- },
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'isOwner'
- },
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'id'
- }
- ]
- }
- ]
- }
- ],
- center : {
- xtype: 'LayoutRegion',
- xns: Roo,
- alwaysShowTabs : false,
- autoScroll : false,
- closeOnTab : true,
- hideTabs : true,
- titlebar : false
- },
- buttons : [
- {
- xtype: 'Button',
- xns: Roo,
- listeners : {
- click : function (_self, e)
- {
- _this.dialog.hide();
- }
- },
- text : "Cancel"
+ },
+
+ create : function()
+ {
+ var _this = this;
+ this.dialog = Roo.factory({
+ xtype : 'LayoutDialog',
+ autoCreate : true,
+ closable : false,
+ collapsible : false,
+ draggable : false,
+ height : 400,
+ modal : true,
+ shadow : true,
+ title : _this._strings['72b9d3d2e231f1de7a2bd70737f644aa'] /* Add / Edit Organization */,
+ width : 750,
+ xns : Roo,
+ '|xns' : 'Roo',
+ center : {
+ xtype : 'LayoutRegion',
+ alwaysShowTabs : false,
+ autoScroll : false,
+ closeOnTab : true,
+ hideTabs : true,
+ titlebar : false,
+ xns : Roo,
+ '|xns' : 'Roo'
+ },
+ buttons : [
+ {
+ xtype : 'Button',
+ text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.dialog.hide();
+ }
+ },
+ xns : Roo,
+ '|xns' : 'Roo'
+ },
+ {
+ xtype : 'Button',
+ text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
+ listeners : {
+ click : function (_self, e)
+ {
+ if(!_this.form.isValid()){
+ Roo.MessageBox.alert('Error', 'Please Correct all the errors in red');
+ return;
+ }
+
+ new Pman.Request({
+ url : baseURL + '/Roo/Core_company.php',
+ method : 'POST',
+ params : {
+ id : _this.form.findField('id').getValue() * 1,
+ name : _this.form.findField('name').getValue(),
+ _check_name : 1
+ },
+ success : function(res) {
+ _this.dialog.el.mask("Saving");
+ _this.form.doAction("submit");
},
- {
- xtype: 'Button',
- xns: Roo,
- listeners : {
- click : function (_self, e)
- {
- // do some checks?
-
+ failure : function(res) {
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "The company name has been used. Save it anyway?",
+ function(res) {
+ if(res != 'yes') {
+ return;
+ }
_this.dialog.el.mask("Saving");
_this.form.doAction("submit");
-
}
- },
- text : "Save"
+ );
+ }
+ });
+
+ return;
+
+ }
+ },
+ xns : Roo,
+ '|xns' : 'Roo'
+ }
+ ],
+ items : [
+ {
+ xtype : 'ContentPanel',
+ autoCreate : true,
+ fitToFrame : true,
+ region : 'center',
+ xns : Roo,
+ '|xns' : 'Roo',
+ items : [
+ {
+ xtype : 'Form',
+ fileUpload : true,
+ labelWidth : 160,
+ url : baseURL + '/Roo/core_company.php',
+ listeners : {
+ actioncomplete : function(f, act) {
+ _this.dialog.el.unmask();
+ //console.log('load completed');
+ // error messages?????
+ if(act.type == 'setdata'){
+ this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+ return;
+ }
+
+ if (act.type == 'load') {
+ _this.data = act.result.data;
+ var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';
+
+
+ if (_this.form.findField('comptype')) {
+ _this.form.findField('comptype')[meth]();
+ }
+
+ // _this.loaded();
+ return;
+ }
+
+
+ if (act.type == 'submit') { // only submitted here if we are
+ _this.dialog.hide();
+
+ if (_this.callback) {
+ _this.callback.call(this, act.result.data);
+ }
+ return;
+ }
+ // unmask??
+ },
+ actionfailed : function(f, act) {
+ _this.dialog.el.unmask();
+ // error msg???
+ Pman.standardActionFailed(f,act);
+
+ },
+ rendered : function (form)
+ {
+ _this.form = form;
+ }
+ },
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ items : [
+ {
+ xtype : 'Column',
+ width : 500,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ items : [
+ {
+ xtype : 'TextField',
+ allowBlank : true,
+ fieldLabel : _this._strings['b33457e7e1cd5dbf1db34a0c60fcb75f'] /* Company ID (for filing Ref.) */,
+ name : 'code',
+ qtip : _this._strings['733640ec0c9367df1b4d85eb286ed9ae'] /* Enter code */,
+ width : 100,
+ xns : Roo.form,
+ '|xns' : 'Roo.form'
+ },
+ {
+ xtype : 'ComboBox',
+ allowBlank : false,
+ alwaysQuery : true,
+ displayField : 'display_name',
+ emptyText : _this._strings['023a5dfa857c4aa0156e6685231a1dbd'] /* Select Type */,
+ fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
+ forceSelection : true,
+ hiddenName : 'comptype_id',
+ listWidth : 250,
+ loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+ minChars : 2,
+ name : 'comptype_id_display_name',
+ pageSize : 20,
+ qtip : _this._strings['8535bcc0f05358a583bb432bbadf7e0d'] /* Select type */,
+ queryParam : 'query[name]',
+ selectOnFocus : true,
+ tpl : '